Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ThreadNetwork] Add new framework Xcode 13 beta 5. #12533

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,7 @@ IOS_FRAMEWORKS = \
Social \
Speech \
SystemConfiguration \
ThreadNetwork \
Twitter \
UIKit XKit \
UserNotifications \
Expand Down
74 changes: 74 additions & 0 deletions src/threadnetwork.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using CoreFoundation;
using ObjCRuntime;
using Foundation;

using System;

namespace ThreadNetwork {

[iOS (15,0)]
[BaseType (typeof (NSObject))]
interface THClient
{
[Async]
[Export ("retrieveAllCredentials:")]
void RetrieveAllCredentials (Action<NSSet<THCredentials>, NSError> completion);

[Async]
[Export ("deleteCredentialsForBorderAgent:completion:")]
void DeleteCredentialsForBorderAgent (NSData borderAgentId, Action<NSError> completion);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ForBorderAgent since it's the first parameter, not the action

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, there is a reason for the 'ForBorderAgent'. We have another method called 'RetrieveCredentialsForExtendedPanId' which takes a NsData too, I fear that people will either confuse the NSData between a PanId and a BorderId, so I prefer to be explicit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense

I'd usually check the swift names - but it looks like they are not (yet?) on the web doc


[Async]
[Export ("retrieveCredentialsForBorderAgent:completion:")]
void RetrieveCredentialsForBorderAgent (NSData borderAgentId, Action<THCredentials, NSError> completion);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ForBorderAgent since it's the first parameter, not the action


[Async]
[Export ("storeCredentialsForBorderAgent:activeOperationalDataSet:completion:")]
void StoreCredentialsForBorderAgent (NSData borderAgentId, NSData activeOperationalDataSet, Action<NSError> completion);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ForBorderAgent since it's the first parameter, not the action

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same.


[Async]
[Export ("retrievePreferredCredentials:")]
void RetrievePreferredCredentials (Action<THCredentials, NSError> completion);

[Async]
[Export ("retrieveCredentialsForExtendedPANID:completion:")]
void RetrieveCredentialsForExtendedPanId (NSData extendedPanId, Action<THCredentials, NSError> completion);
}

[iOS (15,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface THCredentials : NSSecureCoding
{
[NullAllowed, Export ("networkName")]
string NetworkName { get; }

[NullAllowed, Export ("extendedPANID")]
NSData ExtendedPanId { get; }

[NullAllowed, Export ("borderAgentID")]
NSData BorderAgentId { get; }

[NullAllowed, Export ("activeOperationalDataSet")]
NSData ActiveOperationalDataSet { get; }

[NullAllowed, Export ("networkKey")]
NSData NetworkKey { get; }

[NullAllowed, Export ("PSKC")]
NSData Pskc { get; }

[Export ("channel")]
byte Channel { get; set; }

[NullAllowed, Export ("panID")]
NSData PanId { get; }

[NullAllowed, Export ("creationDate")]
NSDate CreationDate { get; }

[NullAllowed, Export ("lastModificationDate")]
NSDate LastModificationDate { get; }
}

}
1 change: 1 addition & 0 deletions tests/introspection/ApiTypoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ public void ConstantsCheck ()
#endif
#if !__MACOS__
case "ChipLibrary":
case "ThreadNetworkLibrary":
case "MediaSetupLibrary":
case "MLComputeLibrary":
// Xcode 12 beta 2 does not ship these framework/headers for the simulators
Expand Down
4 changes: 1 addition & 3 deletions tests/introspection/iOS/iOSApiClassPtrTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ protected override bool Skip (Type type)
{
switch (type.Namespace) {
case "Phase": // missing in the sim
if (Runtime.Arch == Arch.SIMULATOR)
return true;
break;
case "ShazamKit": // missing in the sim
case "ThreadNetwork": // missing in the sim
if (Runtime.Arch == Arch.SIMULATOR)
return true;
break;
Expand Down
2 changes: 2 additions & 0 deletions tests/introspection/iOS/iOSApiCtorInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ protected override bool Skip (Type type)
return TestRuntime.CheckXcodeVersion (11, 2);
case "UIMenuController": // Stopped working with Xcode 11.3 beta 1
return TestRuntime.CheckXcodeVersion (11, 3);
case "THClient":
return Runtime.Arch == Arch.SIMULATOR;
#if __TVOS__
case "MPSPredicate":
// the device .ctor ends up calling `initWithBuffer:offset:` and crash on older (non 4k AppleTV devices)
Expand Down
1 change: 1 addition & 0 deletions tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ protected override bool Skip (Type type)
case "MLCompute":
case "MediaSetup":
case "Phase":
case "ThreadNetwork":
if (Runtime.Arch == Arch.SIMULATOR)
return true;
break;
Expand Down
1 change: 1 addition & 0 deletions tests/introspection/iOS/iOSApiSelectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ protected override bool Skip (Type type)
case "MetalPerformanceShaders":
case "MonoTouch.MetalPerformanceShaders":
case "Phase":
case "ThreadNetwork":
if (Runtime.Arch == Arch.SIMULATOR)
return true;
break;
Expand Down
1 change: 1 addition & 0 deletions tests/mtouch/RegistrarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public void MT4134 ()
new { Framework = "AutomaticAssessmentConfiguration", Version = "13.4" },
new { Framework = "CoreLocationUI", Version = "15.0" },
new { Framework = "Chip", Version = "15.0" },
new { Framework = "ThreadNetwork", Version = "15.0" },
};
foreach (var framework in invalidFrameworks)
mtouch.AssertError (4134, $"Your application is using the '{framework.Framework}' framework, which isn't included in the iOS SDK you're using to build your app (this framework was introduced in iOS {framework.Version}, while you're building with the iOS {mtouch.Sdk} SDK.) Please select a newer SDK in your app's iOS Build options.");
Expand Down
20 changes: 0 additions & 20 deletions tests/xtro-sharpie/iOS-ThreadNetwork.todo

This file was deleted.

1 change: 1 addition & 0 deletions tools/common/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ public static Frameworks CreateiOSFrameworks (bool is_simulator_build)
{ "Phase", "PHASE", new Version (15,0), NotAvailableInSimulator /* no headers in beta 2 */ },
{ "OSLog", "OSLog", 15,0 },
{ "ShazamKit", "ShazamKit", new Version (15,0), NotAvailableInSimulator},
{ "ThreadNetwork", "ThreadNetwork", new Version (15,0), NotAvailableInSimulator},

// the above MUST be kept in sync with simlauncher
// see tools/mtouch/Makefile
Expand Down
3 changes: 3 additions & 0 deletions tools/common/StaticRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,9 @@ void CheckNamespace (string ns, List<Exception> exceptions)
return;
}
goto default;
case "ThreadNetwork":
h = "<ThreadNetwork/THClient.h>";
break;
default:
h = string.Format ("<{0}/{0}.h>", ns);
break;
Expand Down
1 change: 1 addition & 0 deletions tools/common/Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public void GatherFrameworks ()
case "MetalPerformanceShaders":
case "CHIP":
case "PHASE":
case "ThreadNetwork":
// some frameworks do not exists on simulators and will result in linker errors if we include them
if (App.IsSimulatorBuild)
continue;
Expand Down
1 change: 1 addition & 0 deletions tools/linker/ObjCExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static class Namespaces {
public const string Social = nameof (Social);
public const string SpriteKit = nameof (SpriteKit);
public const string StoreKit = nameof (StoreKit);
public const string ThreadNetwork = nameof (ThreadNetwork);
public const string UIKit = nameof (UIKit);
public const string VideoSubscriberAccount = nameof (VideoSubscriberAccount);
public const string VideoToolbox = nameof (VideoToolbox);
Expand Down