TUYA mesh Скачать руководство пользователя страница 33

8 Control devices and groups

1

mTuyaBlueMeshDevice

.

registerMeshDevListener

(

new

IMeshDevListener

() {

2

/**

3

* Data is updated .

4

* @param nodeId

The value of `nodeId ` for the device .

5

* @param dps

DP data.

6

* @param isFromLocal

The data source . Valid values : `true ` to indi

7

cate the local Bluetooth mesh network , and `false ` to indicate the c

8

loud.

9

*/

10

@Override

11

public

void

onDpUpdate

(

String

nodeId

,

String

dps

,

boolean

isFromLocal

12

) {

13

// Returns `DeviceBean ` by using `node `.

14

DeviceBean deviceBean

=

mTuyaBlueMeshDevice

.

getMeshSubDevBeanByNodeI

15

d

(

nodeId

);

16

}

17

/**

18

* Reports the device status .

19

* @param online

The list of online devices .

20

* @param offline

The list of offline devices .

21

* @param gwId

The source of the status . If `gwId ` is not empty ,

22

the cloud returns the status . `gwId ` indicates the ID of the gatewa

23

y that reports the data. If `gwId ` is empty , the local Bluetooth mes

24

h network returns the status .

25

*/

26

@Override

27

public

void

onStatusChanged

(

List

<

String

>

online

,

List

<

String

>

offlin

28

e

,

String

gwId

) {

29

}

30

/**

31

* The changed network status .

32

* @param devId

33

* @param status

34

*/

35

@Override

36

public

void

onNetworkStatusChanged

(

String

devId

,

boolean

status

) {

37

}

38

/**

39

* Reports the Raw type of data.

40

* @param bytes

41

*/

42

@Override

43

public

void

onRawDataUpdate

(

byte

[]

bytes

) {

44

}

45

/**

46

* The changes of device information , such as the device name.

47

* @param bytes

48

*/

49

@Override

50

public

void

onDevInfoUpdate

(

String

devId

) {

51

}

52

/**

53

* The device is removed .

54

* @param devId

55

*/

56

@Override

57

public

void

onRemoved

(

String

devId

) {

58

}

59

});

30 / 31

Содержание mesh

Страница 1: ...Tuya mesh Version 20211129 Online Version...

Страница 2: ...and disconnect from a mesh sub device 8 5 Pair devices 10 5 1 Reset devices 10 5 2 Scan for sub devices pending pairing 11 5 3 Pair mesh sub devices 11 5 4 Pair a mesh gateway 13 5 5 Pairing error co...

Страница 3: ...Contents 7 5 Delete a group 25 7 6 Rename a group 25 8 Control devices and groups 27 8 1 Control devices 27 8 2 Control groups 28 8 3 Listen for mesh device status 29 9 Update firmware 31 II...

Страница 4: ...Energy Bluetooth LE Tuya s proprietary Bluetooth mesh connections Tuya mesh and Bluetooth mesh networking Bluetooth mesh provided by Blue tooth Special Interest Group Bluetooth SIG This topic describ...

Страница 5: ...tooth mesh but with Tuya mesh Combo devices Bluetooth mesh gateways IP cameras IPCs and new devices that support Bluetooth and Wi Fi combo The devices that support Bluetooth and Wi Fi combo can be pai...

Страница 6: ...I 4 ON 5 uses permission android name android permission BLUETOOTH 6 uses permission android name android permission BLUETOOTH_ADMIN 7 Precheck of Bluetooth permissions Check whether the location perm...

Страница 7: ...adapters with Bluetooth mesh and other communi cation nodes Product types of a category Smart lights ranging from cool white lights C to white and colored lights RG BCW 01 05 One to six outlet power...

Страница 8: ...s are added deleted or managed in a group these operations are implemented with local Bluetooth commands and synchronously recorded in the cloud Therefore device information is synchronized to the loc...

Страница 9: ...ription meshName String The name of a mesh network with up to 16 bytes callback ITuyaResultCallback The callback Example 1 TuyaHomeSdk newHomeInstance siteId createBlueMesh meshName new 2 ITuyaResultC...

Страница 10: ...t 2 Callback 3 Override 4 public void onError String errorCode String errorMsg 5 6 Override 7 public void onSuccess 8 9 4 3 Query a list of mesh networks in a site API description 1 List BlueMeshBean...

Страница 11: ...roy the current mesh instance and initialize the mesh instance for the target site when you switch between sites API method 1 Initializes the mesh network 2 TuyaHomeSdk getTuyaBlueMeshClient initMesh...

Страница 12: ...tTuyaBlueMeshClient stopSearch important After a connection is started available devices are scanned for in the back ground until a device is connected The background scanning will consume resources Y...

Страница 13: ...lists multiple common reset methods Product type Reset method State pending pairing Smart light Turns on and off the light consecutively three times in a row The indicator is flickering quickly Smart...

Страница 14: ...verride 7 public void onSearchFinish 8 9 10 SearchBuilder searchBuilder new SearchBuilder 11 The name of the device to be scanned for Default value out_of_ 12 mesh to represent the name of the device...

Страница 15: ...t value 100 Unit seconds ssid String The name of the home Wi Fi network to which a paired device is connected password String The password of the site Wi Fi network to which a paired device is connect...

Страница 16: ...lic void onSuccess DeviceBean deviceBean 12 13 Override 14 public void onError String errorCode String errorMsg 15 16 Override 17 public void onFinish 18 19 ITuyaBlueMeshActivator iTuyaBlueMeshActivat...

Страница 17: ...e of the site Wi Fi network to which a paired device is connected password String The password of the site Wi Fi network to which a paired device is connected mMeshBean MeshBean MeshBean homeId Long T...

Страница 18: ...ing errorMsg 19 The callback that is used when a single device failed to be paire 20 d 21 The error code See the list of pairing error codes 22 L d TAG errorCode errorCode errorMsg errorMsg 23 24 Over...

Страница 19: ...5 Pair devices Error code Description 13011 The pairing task timed out 16 31...

Страница 20: ...6 L d TAG This device is blue mesh device 7 8 Checks whether a Bluetooth mesh gateway is used 9 if deviceBean isBlueMeshWifi 10 L d TAG This device is blue mesh wifi device 11 6 2 Rename a sub device...

Страница 21: ...n getParentId 5 The online status including the status of connections to the loc 6 al mesh network and gateway 7 boolean online deviceBean getIsOnline 8 The device online status of connections to the...

Страница 22: ...6 Manage devices Parameters 19 31...

Страница 23: ...sg 6 Toast LENGTH_LONG show 7 8 Override 9 public void onSuccess 10 Toast makeText mContext Sub device removed successfully Toast LE 11 NGTH_LONG show 12 13 6 5 Query sub device status The data point...

Страница 24: ...ring The value of nodeId for the device callback IResultCallback The callback Example 1 mTuyaBlueMeshDevice querySubDevStatusByLocal devBean getCategory 2 devBean getNodeId new IResultCallback 3 Overr...

Страница 25: ...MeshId 4 L d TAG This group is a Bluetooth mesh group 5 7 2 Create a group Each mesh network supports up to 28 672 groups In the response to group creation the group ID ranges from 8000 to EFFF in hex...

Страница 26: ...Category and type 8001 ne 2 w IAddGroupCallback 3 Override 4 public void onError String errorCode String errorMsg 5 6 Override 7 public void onSuccess long groupId 8 9 7 3 Add sub devices to a group...

Страница 27: ...ove sub devices from a group API description 1 void removeDevice String devId IResultCallback callback Parameters Parameter Type Description devId String The device ID callback IResultCallback The cal...

Страница 28: ...allback The callback Example 1 ITuyaGroup mGroup TuyaHomeSdk newBlueMeshGroupInstance groupId 2 mGroup dismissGroup new IResultCallback 3 Override 4 public void onError String code String errorMsg 5 6...

Страница 29: ...e group callback IResultCallback The callback Example 1 ITuyaGroup mGroup TuyaHomeSdk newBlueMeshGroupInstance groupId 2 mGroup renameGroup Group name new IResultCallback 3 Override 4 public void onEr...

Страница 30: ...ices Send a control command in the following format 1 dpId dpValue API description 1 void publishDps String nodeId String pcc String dps IResultCallba 2 ck callback Parameters Parameter Description no...

Страница 31: ...lic void onError String s String s1 8 9 Override 10 public void onSuccess 11 12 8 2 Control groups To control a group send a control command in the following format 1 2 dpId dpValue 3 API description...

Страница 32: ...tDps groupBean getLocalId devBean get 5 Category dps new IResultCallback 6 Override 7 public void onError String errorCode String errorMsg 8 9 Override 10 public void onSuccess 11 12 8 3 Listen for me...

Страница 33: ...evices 21 param gwId The source of the status If gwId is not empty 22 the cloud returns the status gwId indicates the ID of the gatewa 23 y that reports the data If gwId is empty the local Bluetooth m...

Страница 34: ...9 Update firmware 9 Update firmware Tuya mesh shares the same logic of device firmware updates as Bluetooth mesh For more information see Firmware updates 31 31...

Отзывы: