TuyaSmartBleMesh Class Reference

Inherits from NSObject
Declared in TuyaSmartBleMesh.h

Other Methods

  bleMeshModel

@property (nonatomic, strong, readonly) TuyaSmartBleMeshModel *bleMeshModel

  delegate

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

+ bleMeshWithMeshId:homeId:

获取设备对象

+ (instancetype)bleMeshWithMeshId:(NSString *)meshId homeId:(long long)homeId

Parameters

meshId

meshId

Discussion

获取设备对象

Declared In

TuyaSmartBleMesh.h

– initWithMeshId:homeId:

获取设备对象

- (instancetype)initWithMeshId:(NSString *)meshId homeId:(long long)homeId

Parameters

meshId

meshId

Discussion

获取设备对象

Declared In

TuyaSmartBleMesh.h

– init

- (instancetype)init

+ createBleMeshWithMeshName:homeId:success:failure:

创建mesh

+ (void)createBleMeshWithMeshName:(NSString *)meshName homeId:(long long)homeId success:(void ( ^ ) ( TuyaSmartBleMeshModel *meshModel ))success failure:(TYFailureError)failure

Parameters

meshName

mesh名字

success

操作成功回调 meshId

failure

操作失败回调

Discussion

创建mesh

Declared In

TuyaSmartBleMesh.h

– getSubDeviceListFromCloudWithSuccess:failure:

获取mesh的子设备信息

- (void)getSubDeviceListFromCloudWithSuccess:(void ( ^ ) ( NSArray<TuyaSmartDeviceModel*> *subDeviceList ))success failure:(TYFailureError)failure

Parameters

success

操作成功回调

failure

操作失败回调

Discussion

获取mesh的子设备信息

Declared In

TuyaSmartBleMesh.h

– getSubDeviceFromCloudWithDeviceId:success:failure:

获取单个子设备信息

- (void)getSubDeviceFromCloudWithDeviceId:(NSString *)deviceId success:(void ( ^ ) ( TuyaSmartDeviceModel *subDeviceModel ))success failure:(TYFailureError)failure

Parameters

deviceId

子设备id

success

操作成功回调

failure

操作失败回调

Discussion

获取单个子设备信息

Declared In

TuyaSmartBleMesh.h

– publishNodeId:pcc:dps:success:failure:

单个子设备dps命令下发

- (void)publishNodeId:(NSString *)nodeId pcc:(NSString *)pcc dps:(NSDictionary *)dps success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

nodeId

蓝牙子设备短地址标识

pcc

大小类标示

dps

命令字典

success

操作成功回调

failure

操作失败回调

Discussion

单个子设备dps命令下发

Declared In

TuyaSmartBleMesh.h

– multiPublishWithLocalId:pcc:dps:success:failure:

群控设备

- (void)multiPublishWithLocalId:(NSString *)localId pcc:(NSString *)pcc dps:(NSDictionary *)dps success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

localId

localId

pcc

大小类标示

dps

命令字典

success

操作成功的回调

failure

操作失败的回调

Discussion

群控设备

Declared In

TuyaSmartBleMesh.h

– broadcastDps:pcc:success:failure:

广播dps命令下发

- (void)broadcastDps:(NSDictionary *)dps pcc:(NSString *)pcc success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

dps

命令字典

pcc

大小类标示

success

操作成功回调

failure

操作失败回调

Discussion

广播dps命令下发

Declared In

TuyaSmartBleMesh.h

– getSubDeviceDpsWithNodeId:pcc:dpIdList:success:failure:

获取子设备的最新dps信息

- (void)getSubDeviceDpsWithNodeId:(NSString *)nodeId pcc:(NSString *)pcc dpIdList:(NSArray<NSNumber*> *)dpIdList success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

nodeId

蓝牙子设备短地址标识

dpIdList

dps 中 key 的 list

success

操作成功回调

failure

操作失败回调

Discussion

获取子设备的最新dps信息

Declared In

TuyaSmartBleMesh.h

– publishRawDataWithRaw:pcc:success:failure:

给设备发送透传指令

- (void)publishRawDataWithRaw:(NSString *)raw pcc:(NSString *)pcc success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

raw

透传值

success

操作成功的回调

failure

操作失败的回调

Discussion

给设备发送透传指令

Declared In

TuyaSmartBleMesh.h

– updateMeshName:success:failure:

修改mesh名称

- (void)updateMeshName:(NSString *)meshName success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

meshName

mesh名称

success

操作成功回调

failure

操作失败回调

Discussion

修改mesh名称

Declared In

TuyaSmartBleMesh.h

– removeMeshWithSuccess:failure:

删除mesh,如果mesh组下有设备,子设备也移除掉。wifi连接器也一并移除掉。

- (void)removeMeshWithSuccess:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

success

操作成功回调

failure

操作失败回调

Discussion

删除mesh,如果mesh组下有设备,子设备也移除掉。wifi连接器也一并移除掉。

Declared In

TuyaSmartBleMesh.h

– addSubDeviceWithUuid:homeId:authKey:nodeId:productKey:ver:success:failure:

蓝牙设备入网 2.0

- (void)addSubDeviceWithUuid:(NSString *)uuid homeId:(long long)homeId authKey:(NSString *)authKey nodeId:(NSString *)nodeId productKey:(NSString *)productKey ver:(NSString *)ver success:(void ( ^ ) ( NSString *devId , NSString *name ))success failure:(TYFailureError)failure

Parameters

uuid

蓝牙子设备短地址标识

authKey

授权

nodeId

mesh节点id(短地址)

productKey

产品ID

ver

版本号

success

操作成功回调

failure

操作失败回调

Discussion

蓝牙设备入网 2.0

Declared In

TuyaSmartBleMesh.h

– renameMeshSubDeviceWithDeviceId:name:success:failure:

重命名mesh子设备

- (void)renameMeshSubDeviceWithDeviceId:(NSString *)deviceId name:(NSString *)name success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

deviceId

设备ID

name

新的名字

success

操作成功回调

failure

操作失败回调

Discussion

重命名mesh子设备

Declared In

TuyaSmartBleMesh.h

– removeMeshSubDeviceWithDeviceId:success:failure:

移除mesh子设备

- (void)removeMeshSubDeviceWithDeviceId:(NSString *)deviceId success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

deviceId

设备ID

success

操作成功回调

failure

操作失败回调

Discussion

移除mesh子设备

Declared In

TuyaSmartBleMesh.h

SIGMesh Methods

+ createSIGMeshWithHomeId:success:failure:

+ (void)createSIGMeshWithHomeId:(long long)homeId success:(void ( ^ ) ( TuyaSmartBleMeshModel *meshModel ))success failure:(TYFailureError)failure

– addSIGMeshSubDeviceWithUuid:devKey:nodeId:productKey:ver:mac:success:failure:

蓝牙设备入网 后绑定 productKey + mac = pid

- (void)addSIGMeshSubDeviceWithUuid:(NSString *)uuid devKey:(NSString *)devKey nodeId:(NSString *)nodeId productKey:(NSString *)productKey ver:(NSString *)ver mac:(NSString *)mac success:(void ( ^ ) ( NSString *devId , NSString *name ))success failure:(TYFailureError)failure

Parameters

uuid

蓝牙子设备短地址标识

devKey

设备 key

nodeId

mesh节点id(短地址)

productKey

产品 Key

ver

版本号

mac

设备 mac

success

操作成功回调

failure

操作失败回调

Discussion

蓝牙设备入网 后绑定 productKey + mac = pid

Declared In

TuyaSmartBleMesh+SIGMesh.h

– addSIGMeshSubDeviceWithUuid:devKey:nodeId:productKey:ver:mac:companyId:venderId:success:failure:

蓝牙设备入网 后绑定 productKey + mac = pid,可兼容配网第三方设备

- (void)addSIGMeshSubDeviceWithUuid:(NSString *)uuid devKey:(NSString *)devKey nodeId:(NSString *)nodeId productKey:(NSString *)productKey ver:(NSString *)ver mac:(NSString *)mac companyId:(nonnull NSString *)companyId venderId:(nonnull NSString *)venderId success:(void ( ^ ) ( NSString *devId , NSString *name ))success failure:(TYFailureError)failure

Parameters

uuid

蓝牙子设备短地址标识

devKey

设备 key

nodeId

mesh节点id(短地址)

productKey

产品 Key

ver

版本号

mac

设备 mac

companyId

SIG Mesh设备对应的公司ID

venderId

第三方设备需要传入,目前支持灯组与开关,如果存在lightless操作,默认传入 “01” ,没有则传入 “02”

success

操作成功回调

failure

操作失败回调

Discussion

蓝牙设备入网 后绑定 productKey + mac = pid,可兼容配网第三方设备

Declared In

TuyaSmartBleMesh+SIGMesh.h

– addSIGMeshSubDeviceWithUuid:devKey:nodeId:productId:ver:mac:success:failure:

蓝牙设备入网 前绑定 pid

- (void)addSIGMeshSubDeviceWithUuid:(NSString *)uuid devKey:(NSString *)devKey nodeId:(NSString *)nodeId productId:(NSString *)productId ver:(NSString *)ver mac:(NSString *)mac success:(void ( ^ ) ( NSString *devId , NSString *name ))success failure:(TYFailureError)failure

Parameters

uuid

蓝牙子设备短地址标识

devKey

设备 key

nodeId

mesh节点id(短地址)

productId

产品 ID

ver

版本号

mac

设备 mac

success

操作成功回调

failure

操作失败回调

Discussion

蓝牙设备入网 前绑定 pid

Declared In

TuyaSmartBleMesh+SIGMesh.h

– addSIGMeshSubDeviceWithUuid:devKey:nodeId:productId:ver:mac:companyId:venderId:success:failure:

蓝牙设备入网 前绑定 pid,可兼容配网第三方设备

- (void)addSIGMeshSubDeviceWithUuid:(NSString *)uuid devKey:(NSString *)devKey nodeId:(NSString *)nodeId productId:(NSString *)productId ver:(NSString *)ver mac:(NSString *)mac companyId:(nonnull NSString *)companyId venderId:(nonnull NSString *)venderId success:(void ( ^ ) ( NSString *devId , NSString *name ))success failure:(TYFailureError)failure

Parameters

uuid

蓝牙子设备短地址标识

devKey

设备 key

nodeId

mesh节点id(短地址)

productId

产品 ID

ver

版本号

mac

设备 mac

companyId

SIG Mesh设备对应的公司ID

venderId

第三方设备需要传入,目前支持灯组与开关,如果存在lightless操作,默认传入 “01” ,没有则传入 “02”

success

操作成功回调

failure

操作失败回调

Discussion

蓝牙设备入网 前绑定 pid,可兼容配网第三方设备

Declared In

TuyaSmartBleMesh+SIGMesh.h

– getSIGMeshNodeAddressFromServerWithSuccess:failure:

向云端分配 sig mesh 的 node id, 每次分配 + 0000 0111 = 8

- (void)getSIGMeshNodeAddressFromServerWithSuccess:(TYSuccessInt)success failure:(TYFailureError)failure

Parameters

success

操作成功回调

failure

操作失败回调

Discussion

向云端分配 sig mesh 的 node id, 每次分配 + 0000 0111 = 8

Declared In

TuyaSmartBleMesh+SIGMesh.h

– getMultiNodeAddressFromServerWithNumber:success:failure:

向批量获取sig mesh的node id

- (void)getMultiNodeAddressFromServerWithNumber:(NSInteger)number success:(TYSuccessList)success failure:(TYFailureError)failure

Parameters

number

分配的数量

success

操作成功回调

failure

操作失败回调

Discussion

向批量获取sig mesh的node id

Declared In

TuyaSmartBleMesh+SIGMesh.h

– removeMeshSubDeviceWithGatewayId:subDeviceId:success:failure:

在网关连接下通过网关移除 sig mesh 子设备

- (void)removeMeshSubDeviceWithGatewayId:(NSString *)gatewayId subDeviceId:(NSString *)subDeviceId success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

gatewayId

网关 id

subDeviceId

子设备 id

success

操作成功回调

failure

操作失败回调

Discussion

在网关连接下通过网关移除 sig mesh 子设备

Declared In

TuyaSmartBleMesh+SIGMesh.h

– getSIGMeshSourceAddressFromServerWithSuccess:failure:

向云端分配 sig mesh 的终端 source id

- (void)getSIGMeshSourceAddressFromServerWithSuccess:(TYSuccessInt)success failure:(TYFailureError)failure

Parameters

success

操作成功回调

failure

操作失败回调

Discussion

向云端分配 sig mesh 的终端 source id

Declared In

TuyaSmartBleMesh+SIGMesh.h