TuyaSmartActivator Class Reference

Inherits from NSObject
Declared in TuyaSmartActivator.h

Other Methods

+ sharedInstance

Singleton 单例

+ (instancetype)sharedInstance

Return Value

instance

Discussion

Singleton 单例

Declared In

TuyaSmartActivator.h

+ currentWifiSSID

Get the SSID of the current Wi-Fi 获取当前 Wi-Fi 的 SSID

+ (NSString *)currentWifiSSID

Return Value

Wi-Fi SSID

Discussion

Get the SSID of the current Wi-Fi 获取当前 Wi-Fi 的 SSID

To use this function in iOS 12 and later, enable the Access WiFi Information capability for your app in Xcode. To use this function in iOS 13 and later, must also meet at least one of criteria below: - Apps with permission to access location - Currently enabled VPN app - NEHotspotConfiguration (only Wi-Fi networks that the app configured)

从 iOS 12 开始,调用该函数将默认返回 nil,需要在 Xcode 项目中开启「Access WiFi Information」后才会返回正确的值。这个功能需要在开发者页面的 App IDs 中激活才能使用。 从 iOS 13 开始,还需要符合下列三项条件中的至少一项: - 获得了定位服务权限的应用; - 目前正处于启用状态的 VPN 应用; - 使用 NEHotspotConfiguration(仅支援通过应用配置的 Wi-Fi 网路)。

Declared In

TuyaSmartActivator.h

+ currentWifiBSSID

Get the BSSID of the current Wi-Fi 获取当前 Wi-Fi 的 BSSID

+ (NSString *)currentWifiBSSID

Return Value

Wi-Fi BSSID

Discussion

Get the BSSID of the current Wi-Fi 获取当前 Wi-Fi 的 BSSID

See [TuyaSmartActivator currentWifiSSID];

Declared In

TuyaSmartActivator.h

+ getSSID:failure:

Get the SSID of the current Wi-Fi asynchronous 异步获取当前 Wi-Fi 的 SSID

+ (void)getSSID:(TYSuccessString)success failure:(TYFailureError)failure

Parameters

success

Success block

failure

Failure block

Discussion

Get the SSID of the current Wi-Fi asynchronous 异步获取当前 Wi-Fi 的 SSID

See [TuyaSmartActivator currentWifiSSID];

Declared In

TuyaSmartActivator.h

+ getBSSID:failure:

Get the BSSID of the current Wi-Fi asynchronous 异步获取当前 Wi-Fi 的 BSSID

+ (void)getBSSID:(TYSuccessString)success failure:(TYFailureError)failure

Parameters

success

Success block

failure

Failure block

Discussion

Get the BSSID of the current Wi-Fi asynchronous 异步获取当前 Wi-Fi 的 BSSID

See [TuyaSmartActivator currentWifiBSSID];

Declared In

TuyaSmartActivator.h

  delegate

@property (nonatomic, weak) id<TuyaSmartActivatorDelegate> delegate

– getTokenWithHomeId:success:failure:

To obtain token (valid for 10 minutes) 获取配网Token(有效期10分钟)

- (void)getTokenWithHomeId:(long long)homeId success:(TYSuccessString)success failure:(TYFailureError)failure

Parameters

homeId

Home Id

success

Success block

failure

Failure block

Discussion

To obtain token (valid for 10 minutes) 获取配网Token(有效期10分钟)

Declared In

TuyaSmartActivator.h

– getTokenWithProductKey:homeId:success:failure:

To obtain token with productId (valid for 10 minutes) 获取配网Token(有效期10分钟)

- (void)getTokenWithProductKey:(NSString *)productKey homeId:(long long)homeId success:(TYSuccessString)success failure:(TYFailureError)failure

Parameters

productKey

Product Id

homeId

Home Id

success

Success block

failure

Failure block

Discussion

To obtain token with productId (valid for 10 minutes) 获取配网Token(有效期10分钟)

Declared In

TuyaSmartActivator.h

– getTokenWithUUID:homeId:success:failure:

To obtain token with uuid (valid for 10 minutes) 获取配网Token(有效期10分钟)

- (void)getTokenWithUUID:(NSString *)uuid homeId:(long long)homeId success:(TYSuccessString)success failure:(TYFailureError)failure

Parameters

uuid

Device uuid

homeId

Home Id

success

Success block

failure

Failure block

Discussion

To obtain token with uuid (valid for 10 minutes) 获取配网Token(有效期10分钟)

Declared In

TuyaSmartActivator.h

– startConfigWiFi:ssid:password:token:timeout:

start config (Wireless config) 开始配网 (无线配网)

- (void)startConfigWiFi:(TYActivatorMode)mode ssid:(NSString *)ssid password:(NSString *)password token:(NSString *)token timeout:(NSTimeInterval)timeout

Parameters

mode

Config mode, EZ or AP

ssid

Name of route

password

Password of route

token

Config Token

timeout

Timeout, default 100 seconds

Discussion

start config (Wireless config) 开始配网 (无线配网)

Declared In

TuyaSmartActivator.h

– startConfigWiFiWithToken:timeout:

start config (Wired config) 开始配网(有线配网)

- (void)startConfigWiFiWithToken:(NSString *)token timeout:(NSTimeInterval)timeout

Parameters

token

Token

timeout

Timeout, default 100 seconds

Discussion

start config (Wired config) 开始配网(有线配网)

Declared In

TuyaSmartActivator.h

– startConfigWiFiWithToken:productId:timeout:

start config with productId (Wired config) 开始配网(有线配网)只去激活一个品类的设备

- (void)startConfigWiFiWithToken:(NSString *)token productId:(NSString *)productId timeout:(NSTimeInterval)timeout

Parameters

token

配网Token

productId

productId 设备的产品Id

timeout

Timeout, default 100 seconds

Discussion

start config with productId (Wired config) 开始配网(有线配网)只去激活一个品类的设备

Declared In

TuyaSmartActivator.h

– startEZMultiConfigWiFiWithSsid:password:token:timeout:

start EZ mode multi-device config 开始EZ模式多设备配网

- (void)startEZMultiConfigWiFiWithSsid:(NSString *)ssid password:(NSString *)password token:(NSString *)token timeout:(NSTimeInterval)timeout

Parameters

ssid

Name of route 路由器热点名称

password

Password of route 路由器热点密码

token

配网 Token

timeout

Timeout, default 100 seconds

Discussion

start EZ mode multi-device config 开始EZ模式多设备配网

Declared In

TuyaSmartActivator.h

– stopConfigWiFi

停止配网 stop config

- (void)stopConfigWiFi

Discussion

停止配网 stop config

Declared In

TuyaSmartActivator.h

– activeSubDeviceWithGwId:timeout:

激活子设备 如 zigbee、Wi-Fi 子设备 … active sub device

- (void)activeSubDeviceWithGwId:(NSString *)gwId timeout:(NSTimeInterval)timeout

Parameters

gwId

gateway Id

timeout

Timeout, default 100 seconds

Discussion

激活子设备 如 zigbee、Wi-Fi 子设备 … active sub device

Declared In

TuyaSmartActivator.h

– stopActiveSubDeviceWithGwId:

stop active sub device 停止激活子设备

- (void)stopActiveSubDeviceWithGwId:(NSString *)gwId

Parameters

gwId

gateway Id

Discussion

stop active sub device 停止激活子设备

Declared In

TuyaSmartActivator.h

BleMesh Methods

– getTokenWithMeshId:nodeId:productId:uuid:authKey:version:success:failure:

wifi连接器加入mesh 获取配网Token(有效期10分钟)

- (void)getTokenWithMeshId:(NSString *)meshId nodeId:(NSString *)nodeId productId:(NSString *)productId uuid:(NSString *)uuid authKey:(NSString *)authKey version:(NSString *)version success:(TYSuccessString)success failure:(TYFailureError)failure

Parameters

meshId

meshId

nodeId

nodeId

productId

产品Id

uuid

设备唯一值

authKey

权限key

version

version

success

操作成功回调,返回配网Token

failure

操作失败回调

Discussion

wifi连接器加入mesh 获取配网Token(有效期10分钟)

Declared In

TuyaSmartActivator+BleMesh.h

– startBleMeshConfigWiFiWithSsid:password:token:timeout:

mesh 配网

- (void)startBleMeshConfigWiFiWithSsid:(NSString *)ssid password:(NSString *)password token:(NSString *)token timeout:(NSTimeInterval)timeout

Parameters

ssid

路由器热点名称

password

路由器热点密码

token

配网Token

timeout

超时时间, 默认为100秒

Discussion

mesh 配网

Declared In

TuyaSmartActivator+BleMesh.h