Skip to content

ThreadNetwork macOS xcode14.1 b3

Israel Soto edited this page Sep 28, 2022 · 3 revisions

#ThreadNetwork.framework https://github.com/xamarin/xamarin-macios/pull/16196

diff -ruN /Applications/Xcode_14.1.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h
--- /Applications/Xcode_14.1.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h	1969-12-31 18:00:00.000000000 -0600
+++ /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h	2022-09-22 09:17:21.000000000 -0500
@@ -0,0 +1,127 @@
+//
+//  THClient.h
+//  ThreadNetwork
+//
+//  Copyright © 2020 Apple. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ThreadNetwork/THCredentials.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+API_AVAILABLE(ios(15.0))
+
+@interface THClient : NSObject
+
+/*
+ * @function init
+ *
+ * @discussion
+ * Initialize instance of THClient
+ *
+ * @parameter
+ * no parameters
+ */
+
+- (instancetype)init API_AVAILABLE(ios(15.0));
+
+/*
+ * @function retrieveAllCredentials
+ *
+ * @discussion
+ * Retrieve All Credentials, stored by the client
+ *
+ * @parameter
+ * completion : Callback function to receive all credentials
+ *
+ */
+- (void)retrieveAllCredentials:(void (^)(NSSet<THCredentials*>* _Nullable credentials, NSError* _Nullable error))completion API_AVAILABLE(ios(15.0)) NS_SWIFT_ASYNC_NAME(allCredentials());
+
+/*
+ * @function deleteActiveDataSetRecordForBorderAgent
+ *
+ * @discussion
+ * Delete Credentials For The given Border Agent identifier, stored by the client
+ *
+ * @parameter
+ * borderAgentID : Thread Network Border Agent Identifier
+ * @parameter
+ * completion : Callback function to return the status of the delete operation
+ *
+ */
+- (void)deleteCredentialsForBorderAgent:(NSData *)borderAgentID completion:(void (^)(NSError* _Nullable error))completion API_AVAILABLE(ios(15.0));
+
+/*
+ * @function retrieveCredentialsForBorderAgent
+ *
+ * @discussion
+ * Retrieve Credentials For The given Thread Border Agent identifier, stored by the client
+ *
+ * @parameter
+ * completion : Callback function to receive the matching active dataset record
+ *
+ */
+- (void)retrieveCredentialsForBorderAgent:(NSData *)borderAgentID completion:( void (^)(THCredentials* _Nullable credentials, NSError* _Nullable error))completion API_AVAILABLE(ios(15.0)) NS_SWIFT_ASYNC_NAME(credentials(forBorderAgentID:));
+
+/*
+ * @function storeCredentialsForBorderAgent
+ *
+ * @discussion
+ * Store the Credentials Record
+ *
+ * @parameters
+ * borderAgent              : Border Agent Identifier
+ * activeOperationalDataSet : byte array of active operational dataset
+ * completion               : Callback function to return the status of the store operation
+ *
+ */
+
+- (void)storeCredentialsForBorderAgent:(NSData *)borderAgentID
+              activeOperationalDataSet:(NSData *)activeOperationalDataSet
+                            completion:(void (^)(NSError* _Nullable error))completion API_AVAILABLE(ios(15.0));
+
+/*
+ * @function retrievePreferredCredentials
+ *
+ * @discussion
+ * Retrieve Preferred Thread Network Credentials.
+ * Invoking this API will result into UI Alert prompt seeking user's permission to access the credentials
+ *
+ * @parameter
+ * completion : Callback function to receive preferred network active dataset record
+ *
+ */
+- (void)retrievePreferredCredentials:(void (^)(THCredentials* _Nullable credentials, NSError* _Nullable error))completion API_AVAILABLE(ios(15.0)) NS_SWIFT_ASYNC_NAME(preferredCredentials());
+
+/*
+ * @function retrieveActiveDataSetRecordForExtendedPANID
+ *
+ * @discussion
+ * Retrieve Credentials For The given Extended-PAN Id
+ * Invoking this API will result into UI Alert prompt seeking user's permission to access the credentials
+ *
+ * @parameter
+ * extendedPANID    : Extended PAN Id identifying the thread network
+ * completion       : Callback function to receive the matching active dataset record
+ *
+ */
+- (void)retrieveCredentialsForExtendedPANID:(NSData *)extendedPANID completion:( void (^)(THCredentials* _Nullable credentials, NSError* _Nullable error))completion API_AVAILABLE(ios(15.0)) NS_SWIFT_ASYNC_NAME(credentials(forExtendedPANID:));
+
+/*
+ * @function checkPreferredNetworkForActiveOperationalDataset
+ *
+ * @discussion
+ * Returns true if the dataset matches to the preferred network
+ *
+ * @parameters
+ * activeOperationalDataSet : byte array of active operational dataset
+ * completion               : Callback function gives true if dataset matches to preferred network, else false
+ *
+ */
+
+- (void)checkPreferredNetworkForActiveOperationalDataset:(NSData *)activeOperationalDataSet
+                                           completion:(void (^)(BOOL isPreferred))completion API_AVAILABLE(ios(15.0))   NS_SWIFT_ASYNC_NAME(isPreferred(forActiveOperationalDataset:));
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.1.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h
--- /Applications/Xcode_14.1.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h	1969-12-31 18:00:00.000000000 -0600
+++ /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h	2022-09-22 09:17:21.000000000 -0500
@@ -0,0 +1,52 @@
+//
+//  THCredentials.h
+//  ThreadNetwork
+//
+//  Copyright © 2021 Apple. All rights reserved.
+//
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+extern __attribute__((visibility ("default")))
+
+API_AVAILABLE(ios(15.0)) @interface THCredentials : NSObject<NSSecureCoding>
+
+/*
+ * @description:
+ *
+ * All the fields represents Credentials field.
+ *
+ * Note :
+ * If activeOperationalDataSet is nil after retrieving the credentials,
+ * use rest of the parameter to join the Thread Network
+ */
+
+/// networkName : Thread Network name
+@property (nonatomic, nullable, readonly) NSString *networkName;
+/// extendedPANID : Thread Network extended PAN ID
+@property (nonatomic, nullable, readonly) NSData *extendedPANID;
+/// extendedPANID : Active Thread Network Border Agent Identifier
+@property (nonatomic, nullable, readonly) NSData *borderAgentID;
+/// Active Operational Data Set in Bytes.
+@property (nonatomic, nullable, readonly) NSData *activeOperationalDataSet;
+/// networkKey : A 16 byte value. e.g. 7dd5b9bffe1285f27e78898658aa88f4
+@property (nonatomic, nullable, readonly) NSData *networkKey;
+/// PSKc : A 16 byte value. e.g. 0eec92e950c4cbc6966d32613f08efe0
+@property (nonatomic, nullable, readonly) NSData *PSKC;
+/// channel : Thread network channel
+@property (nonatomic) uint8_t channel;
+/// PANID : A 2 byte value. e.g. 308f
+@property (nonatomic, nullable, readonly) NSData *panID;
+
+/// Metadata
+@property (nonatomic, nullable, readonly) NSDate *creationDate;
+@property (nonatomic, nullable, readonly) NSDate *lastModificationDate;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
diff -ruN /Applications/Xcode_14.1.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/ThreadNetwork.h /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/ThreadNetwork.h
--- /Applications/Xcode_14.1.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/ThreadNetwork.h	1969-12-31 18:00:00.000000000 -0600
+++ /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/ThreadNetwork.h	2022-09-19 04:40:26.000000000 -0500
@@ -0,0 +1,9 @@
+//
+//  ThreadNetwork.h
+//  ThreadNetwork
+//
+//  Copyright © 2021 Apple. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ThreadNetwork/THClient.h>
Clone this wiki locally