Skip to content

ThreadNetwork iOS xcode13.0 beta1

Manuel de la Pena edited this page Aug 24, 2021 · 5 revisions

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

diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THClient.h	2021-06-02 12:45:53.000000000 -0400
@@ -0,0 +1,113 @@
+//
+//  THClient.h
+//  CoreThreadRadio
+//
+//  Created by Venkat Manepalli on 10/26/20.
+//  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;
+
+/*
+ * @function retrieveAllCredentials
+ *
+ * @discussion
+ * Retrieve All Credentials, stored by the client
+ *
+ * @parameter
+ * completion : Callback function to recieve 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 recieve the matching active dataset record
+ *
+ */
+- (void)retrieveCredentialsForBorderAgent:(NSData *)borderAgentID completion:( void (^)(THCredentials* _Nullable credetials, NSError* _Nullable error))completion API_AVAILABLE(ios(15.0)) NS_SWIFT_ASYNC_NAME(credentials(forBorderAgentID:));
+
+/*
+ * @function storeActiveDataSetRecordForBorderAgent
+ *
+ * @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 recieve 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 Extedend-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 recieve 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:));
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/ThreadNetwork.framework/Headers/THCredentials.h	2021-06-02 12:45:53.000000000 -0400
@@ -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 fileds represents Credetials 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 extendended 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
+
Clone this wiki locally