TYBLEMeshManager Class Reference

Inherits from NSObject
Declared in TYBLEMeshManager.h

Other Methods

+ sharedInstance

+ (instancetype)sharedInstance

  isPoweredOn

@property (nonatomic, assign) BOOL isPoweredOn

  isLogin

@property (nonatomic, assign) BOOL isLogin

  isWifiDevice

@property (nonatomic, assign) BOOL isWifiDevice

  wifiAddress

@property (nonatomic, assign) uint32_t wifiAddress

  otaAddress

@property (nonatomic, assign) uint32_t otaAddress

  ssid

@property (nonatomic, strong) NSString *ssid

  password

@property (nonatomic, strong) NSString *password

  token

@property (nonatomic, strong) NSString *token

  authKey

@property (nonatomic, strong) NSString *authKey

  uuid

@property (nonatomic, strong) NSString *uuid

  productId

@property (nonatomic, strong) NSString *productId

  version

@property (nonatomic, strong) NSString *version

  wifiMac

@property (nonatomic, assign) uint32_t wifiMac

  delegate

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

– startScanWithName:pwd:active:wifiAddress:otaAddress:

mesh 入口

- (void)startScanWithName:(NSString *)name pwd:(NSString *)pwd active:(BOOL)active wifiAddress:(uint32_t)wifiAddress otaAddress:(uint32_t)otaAddress

Parameters

name

mesh 名称

pwd

mesh 密码

active

是否为配网激活

wifiAddress

Wi-Fi 地址,网关配网需要,其余情况传 0

otaAddress

ota 设备地址,ota 升级时需要,其余情况传 0

Discussion

mesh 入口

若操作为配网,填入默认 mesh name 和 password,此时只会通过 TYBLEMeshManagerDelegate 中的 - (void)bleMeshManager:(TYBLEMeshManager *)manager didScanedDevice:(TYBleMeshDeviceModel *)device; 返回扫描结果

若操作为入网,填入已创建的 mesh name 和 password,此信息来自云端接口返回,可以自动进行连接、入网,并自动获取一次 mesh 网中的各个设备在线情况

Declared In

TYBLEMeshManager.h

– activeMeshDeviceIncludeGateway:

激活设备

- (void)activeMeshDeviceIncludeGateway:(BOOL)includeGateway

Parameters

includeGateway

是否激活网关,若为 yes, 则会激活已记录扫描到设备中的网关设备,其余子设备不激活 反之激活所有的已扫描的普通的 mesh 子设备,不激活网关

Discussion

激活设备

Declared In

TYBLEMeshManager.h

– activeMeshDevice:

激活特定的设备

- (void)activeMeshDevice:(TYBleMeshDeviceModel *)deviceModel

Parameters

deviceModel

设备 model

Discussion

激活特定的设备

Declared In

TYBLEMeshManager.h

– stopActiveDevice

停止激活设备

- (void)stopActiveDevice

Discussion

停止激活设备

Declared In

TYBLEMeshManager.h

– getLightAllStatus

- (void)getLightAllStatus

– isConnected

- (BOOL)isConnected

– stopScan

- (void)stopScan

– clearScanData

- (void)clearScanData

– sendCommand:

发送命令

- (void)sendCommand:(TYBLEMeshCommand *)command

Parameters

command

command

Discussion

发送命令

Declared In

TYBLEMeshManager.h

– startConfigWiFiWithSsid:pwd:token:

向网关写入 Wi-Fi 信息,使用 sdk 激活后,此方法会自动调用

- (void)startConfigWiFiWithSsid:(NSString *)ssid pwd:(NSString *)pwd token:(NSString *)token

Parameters

ssid

路由器热点名称

pwd

路由器热点密码

token

配网Token

Discussion

向网关写入 Wi-Fi 信息,使用 sdk 激活后,此方法会自动调用

Declared In

TYBLEMeshManager.h

– readFirmwareFeature

读取固件版本号

- (void)readFirmwareFeature

Discussion

读取固件版本号

Declared In

TYBLEMeshManager.h

– sendOTAPackWithAddress:version:otaData:success:failure:

发送升级包

- (void)sendOTAPackWithAddress:(NSInteger)address version:(NSString *)version otaData:(NSData *)otaData success:(TYSuccessHandler)success failure:(TYFailureHandler)failure

Parameters

address

设备地址

version

版本号

otaData

升级数据

success

成功回调

failure

失败回调

Discussion

发送升级包

Declared In

TYBLEMeshManager.h

– getProductNameByProductId:completion:

获取 mesh 产品名称,需要事先将产品与 app 关联,否则返回为空

- (void)getProductNameByProductId:(NSString *)productId completion:(void ( ^ ) ( NSString *))completion

Parameters

productId

产品 id

completion

完成回调

Discussion

获取 mesh 产品名称,需要事先将产品与 app 关联,否则返回为空

Declared In

TYBLEMeshManager.h

Raw Methods

– rawDataDeleteGroupAddress:type:

从 mesh 中删除某个群组

- (NSString *)rawDataDeleteGroupAddress:(uint32_t)groupAddress type:(NSString *)type

Parameters

groupAddress

群组地址

type

群组大小类

Return Value

raw 数据

Discussion

从 mesh 中删除某个群组

Declared In

TYBLEMeshManager.h

– rawDataDeleteDeviceAddress:groupAddress:type:

从群组内删除某个设备

- (NSString *)rawDataDeleteDeviceAddress:(uint32_t)deviceAddress groupAddress:(uint32_t)groupAddress type:(NSString *)type

Parameters

deviceAddress

设备地址

groupAddress

群组地址

type

设备大小类

Return Value

raw 数据

Discussion

从群组内删除某个设备

Declared In

TYBLEMeshManager.h

– rawDataAddDeviceAddress:groupAddress:type:

添加某个设备到群组

- (NSString *)rawDataAddDeviceAddress:(uint32_t)deviceAddress groupAddress:(uint32_t)groupAddress type:(NSString *)type

Parameters

deviceAddress

设备地址

groupAddress

群组地址

type

群组大小类

Return Value

raw 数据

Discussion

添加某个设备到群组

Declared In

TYBLEMeshManager.h

– rawDataGetDevicesAddressWithGroupAddress:type:

获取指定群组下的所有设备

- (NSString *)rawDataGetDevicesAddressWithGroupAddress:(uint32_t)groupAddress type:(NSString *)type

Parameters

groupAddress

群组地址

type

群组大小类

Return Value

raw 数据

Discussion

获取指定群组下的所有设备

Declared In

TYBLEMeshManager.h

– rawDataKickoutLightWithAddress:type:

从 mesh 中踢掉某个设备

- (NSString *)rawDataKickoutLightWithAddress:(uint32_t)address type:(NSString *)type

Parameters

address

设备地址

type

设备大小类

Return Value

raw 数据

Discussion

从 mesh 中踢掉某个设备

Declared In

TYBLEMeshManager.h

– rawDataGetStatusAllWithAddress:type:

获取对应设备状态

- (NSString *)rawDataGetStatusAllWithAddress:(uint32_t)address type:(NSString *)type

Parameters

address

设备地址

type

设备大小类

Return Value

raw 数据

Discussion

获取对应设备状态

Declared In

TYBLEMeshManager.h

– rawDataCountDownWithAddress:type:

获取设备倒计时(电工类专属)

- (NSString *)rawDataCountDownWithAddress:(uint32_t)address type:(NSString *)type

Parameters

address

设备地址

type

设备大小类

Return Value

raw 数据

Discussion

获取设备倒计时(电工类专属)

Declared In

TYBLEMeshManager.h

Command Methods

– setLightModelWithAddress:type:isGroup:param:

设置灯的模式(照明类专属) 模式数据在 param 中,具体参考协议

- (void)setLightModelWithAddress:(uint32_t)address type:(NSString *)type isGroup:(BOOL)isGroup param:(NSArray<NSString*> *)param

Parameters

address

地址

type

设备大小类

isGroup

是否为群组

param

参数

Discussion

设置灯的模式(照明类专属) 模式数据在 param 中,具体参考协议

Declared In

TYBLEMeshManager.h

– getLightSceneModelWithAddress:type:

读取灯的场景模式(照明类专属)

- (void)getLightSceneModelWithAddress:(uint32_t)address type:(NSString *)type

Parameters

address

设备地址

type

设备大小类

Discussion

读取灯的场景模式(照明类专属)

Declared In

TYBLEMeshManager.h

– getSensorStateWithAddress:dps:type:

获取低功耗(门磁)状态

- (void)getSensorStateWithAddress:(uint32_t)deviceAddress dps:(NSArray *)dps type:(NSString *)type

Parameters

deviceAddress

设备地址

dps

数据 dp

type

大小类

Discussion

获取低功耗(门磁)状态

Declared In

TYBLEMeshManager.h

– addDeviceAddress:type:groupAddress:

把设备加入到群组

- (void)addDeviceAddress:(uint32_t)deviceAddress type:(NSString *)type groupAddress:(uint32_t)groupAddress

Parameters

deviceAddress

设备地址

type

设备大小类

groupAddress

群组地址

Discussion

把设备加入到群组

Declared In

TYBLEMeshManager.h

– deleteDeviceAddress:type:groupAddress:

把设备从群组内移除

- (void)deleteDeviceAddress:(uint32_t)deviceAddress type:(NSString *)type groupAddress:(uint32_t)groupAddress

Parameters

deviceAddress

设备地址

type

设备大小类

groupAddress

群组地址

Discussion

把设备从群组内移除

Declared In

TYBLEMeshManager.h

– deleteGroupAddress:type:

从 mesh 中删除某个群组

- (void)deleteGroupAddress:(uint32_t)groupAddress type:(NSString *)type

Parameters

groupAddress

群组地址

type

群组大小类

Discussion

从 mesh 中删除某个群组

Declared In

TYBLEMeshManager.h

– getGroupAddressWithDeviceAddress:type:

获取设备对应的群组地址

- (void)getGroupAddressWithDeviceAddress:(uint32_t)deviceAddress type:(NSString *)type

Parameters

deviceAddress

设备地址

type

设备大小类

Discussion

获取设备对应的群组地址

Declared In

TYBLEMeshManager.h

– getDevicesAddressWithGroupAddress:type:

获取群组下的所有设备

- (void)getDevicesAddressWithGroupAddress:(uint32_t)groupAddress type:(NSString *)type

Parameters

groupAddress

群组地址

type

群组大小类

Discussion

获取群组下的所有设备

Declared In

TYBLEMeshManager.h

– kickoutLightWithAddress:type:

将某个设备从 mesh 网中剔除

- (void)kickoutLightWithAddress:(uint32_t)address type:(NSString *)type

Parameters

address

设备地址

type

设备大小类

Discussion

将某个设备从 mesh 网中剔除

Declared In

TYBLEMeshManager.h

– getDeviceStatusAllWithAddress:type:

获取某个设备状态,例如灯的 rgb 等。。。

- (void)getDeviceStatusAllWithAddress:(uint32_t)address type:(NSString *)type

Parameters

address

设备地址

type

设备大小类

Discussion

获取某个设备状态,例如灯的 rgb 等。。。

Declared In

TYBLEMeshManager.h

– getDeviceCountdownWithAddress:type:

获取设备倒计时数据(电工类专属)

- (void)getDeviceCountdownWithAddress:(uint32_t)address type:(NSString *)type

Parameters

address

设备地址

type

设备大小类

Discussion

获取设备倒计时数据(电工类专属)

Declared In

TYBLEMeshManager.h