Generic Pairing BizBundle

Last Updated on : 2024-06-26 09:56:59download

Announcement

This component is no longer maintained. Its functionality is migrated to the device pairing service. For more information, see Query Basic Pairing Data.

Generic Pairing BizBundle for Android is used to query a list of pairing data. It provides the capabilities to customize the pattern to display the returned list. You can customize the list page based on the pairing lists supported by the Tuya Developer Platform.

Functional description

  • You must call API methods in TyActivatorExtraBusinessKit to get information about the list views.

  • Configure the following dependencies in build.gradle:

    dependencies {
    	...
    	implementation 'com.thingclips.smart:ThingSmartActivatorExtraBizBundle:5.0.0'
    	...
    	}
    

Query level-1 category for pairing

API description

getDeviceLevelFirstData(callback)

Request parameters

None

Sample request

	val extraKit = ThingActivatorExtraBusinessKit()
        extraKit.getDeviceLevelFirstData(object :ResultListener<CategoryResultBean>{
            override fun onFailure(
                bizResponse: BusinessResponse?,
                bizResult: CategoryResultBean?,
                apiName: String?
            ) {

            }

            override fun onSuccess(
                bizResponse: BusinessResponse?,
                bizResult: CategoryResultBean?,
                apiName: String?
            ) {

            }

        })

Sample response

{
	"result":{
		"defaultLevel2List":[// The default level-2 category list.
			{
				"tagCode":"cz_tag",// The level-2 category tag.
				"name":"Socket",// The name of the level-2 category.
				"level3Items":[// The level-3 category information.
					{
						"capability":1,// The capability value.
						"icon":"https://images.tuyaus.com/smart/product_icon2/cz_1.png",// The icon of the product.
						"name":"Socket",// The name of the category.
						"attribute":5,// The attribute.
						"category":"wf_cz",// The category code.
						"activatorDes":"Wi-Fi"
					}
				]
			},
			{
				"tagCode":"gj_tag",
				"name":"Tool",
				"level3Items":[
					{
						"capability":1024,
						"icon":"https://images.tuyaus.com/smart/app_category/dcb_2b_4_1618543239196.png",
						"name":"Battery pack",
						"attribute":5,
						"category":"dcb_2b_4",
						"activatorDes":"BLE"
					}
				]
			}
		],
		"level1List":[// The list of the level-1 category.
			{
				"level1Code":"dgzm",// The code of the level-1 category.
				"name":"Electrical",// The name of the level-1 category.
				"type":0// The type of pairing list: `0` represent the standard view.
			},
			{
				"level1Code":"zm",
				"name":"Lighting",
				"type":0
			}
		],
		"defaultWglist":[// The default list of gateways.
			{
				"capability":4097,// The capability value.
				"display":{// The pairing guidelines.
					"wcAddBtText":"Confirm the two green lights are on.",
					"wcTip":"Please plug in the gateway and connect it to the router, making sure your phone and the gateway are under the same network. Then, comfirm that the light is on.",
					"wifiIconUrl":"https://images.tuyaus.com/smart_res/Group_8@2x.png",
					"wcHelpUrl":"https://images.tuyaus.com/smart/connect-scheme-v3/help/template/wc_wgzk_zigbee/common_network/wc_wgzk_zigbee_ez_en.html",
					"wifiTitle":"Select 2.4 GHz Wi-Fi Network and enter password.",
					"wifiContent":"If your Wi-Fi is 5GHz, please set it to be 2.4GHz.",
					"wcTipIconUrl":"https://images.tuyaus.com/smart_res/iot_os/wgzk_wc_2green@2x.png"
				},
				"icon":"https://images.tuyaus.com/smart/product_icon2/zigbee_4097.png",
				"name":"Gateway",
				"linkModes":[
					{
						"leadList":[
							{
								"iconUrl":"https://images.tuyaus.com/smart_res/iot_os/wgzk_doublelink_power_network.png",
								"title":"Please plug in the gateway and connect it to the router."
							},
							{
								"iconUrl":"https://images.tuyaus.com/smart_res/iot_os/wgzk_reset@2x.png",
								"title":"Hold the RESET button for 5s."
							},
							{
								"iconUrl":"https://images.tuyaus.com/smart_res/iot_os/wgzk_wc_2green@2x.png",
								"title":"Confirm the two green lights are on."
							}
						],
						"linkMode":8,
						"title":"Cable"
					}
				],
				"enableLead":false,
				"attribute":0,
				"category":"wf_zig_zigbee"
			}
		]
	},
	"t":1622190464866,
	"success":true,
	"status":"ok"
}

Query level-2 category for pairing

API description

getDeviceLevelSecondData(levelCode,type,callback)

Request parameters

Name Type Description
levelCode String The value of levelCode for the level-1 category.
type Int The type of the level-1 category.

Sample request

        val extraKit = ThingActivatorExtraBusinessKit()
        extraKit.getDeviceLevelSecondData(level1Bean.getLevel1Code(),level1Bean.getType(),object :Business.ResultListener<ArrayList<CategoryLevelTwoBean>>{
            override fun onFailure(
                bizResponse: BusinessResponse?,
                bizResult: ArrayList<CategoryLevelTwoBean>?,
                apiName: String?
            ) {

            }

            override fun onSuccess(
                bizResponse: BusinessResponse?,
                bizResult: ArrayList<CategoryLevelTwoBean>?,
                apiName: String?
            ) {

            }

        })

Sample response

{
	"result":[
		{
			"tagCode":"zm_dj_tag",// The tag of the level-2 category.
			"name":"Lighting",// The name of the level-2 category.
			"level3Items":[
				{
					"capability":1025,// The capability value.
					"icon":"https://images.tuyacn.com/smart/program_category_icon/wf_ble_dj.png",// The icon of the category.
					"name":"Lighting",// The name of the category.
					"attribute":4,
					"category":"wf_ble_dj",// The category code.
					"activatorDes":"Bluetooth+Wi-Fi"
				}
			]
		},
		{
			"tagCode":"zm_dd_tag",
			"name":"Strip light",
			"level3Items":[
				{
					"capability":1025,
					"sale":"",
					"icon":"https://images.tuyacn.com/smart/app_category/wf_ble_dd_1598683823026.png",
					"name":"Strip light",
					"sort":0,
					"attribute":4,
					"category":"wf_ble_dd",
					"activatorDes":"Bluetooth+Wi-Fi"
				}
			]
		}
	],
	"t":1622688701083,
	"success":true,
	"status":"ok"
}

Query level-3 category for pairing

API description

getDeviceLevelThirdDetailData(bizType,bizValue,callback)

Request parameters

Name Type Description
bizType Int
  • 0: product category
  • 1: product
bizValue String
  • If bizType is 0, bizValue is category.
  • If bizType is 1, bizValue is pid.

Sample request

         val extraKit = ThingActivatorExtraBusinessKit()
        extraKit.getDeviceLevelThirdDetailData(0,thirdBean.getCategory(),object :ResultListener<CategoryLevelThirdBean>{
            override fun onFailure(
                bizResponse: BusinessResponse?,
                bizResult: CategoryLevelThirdBean?,
                apiName: String?
            ) {

            }

            override fun onSuccess(
                bizResponse: BusinessResponse?,
                bizResult: CategoryLevelThirdBean?,
                apiName: String?
            ) {

            }

        })

Sample response

{
	"result":{
		"display":{
			"ezAddBtText":"Confirm that the indicator is blinking quickly.",
			"wifiIconUrl":"https://images.tuyacn.com/smart_res/Group_8@2x.png",
			"ezHelpUrl":"https://images.tuyacn.com/smart/connect-scheme-v3/help/template/ez_default_default/common_network/ez_default_default_ez_zh.html",
			"ezTipIconUrl":"https://images.tuyacn.com/smart/connect-scheme-v3/tip-icon/ty_common_fast%402x.gif",
			"apTip":"After power on, confirm that the indicator is blinking slowly. Note that the pairing operation must be finished within three minutes after the device is reset.",
			"wifiTitle":"Select 2.4 GHz Wi-Fi Network and Enter Password",
			"apTipIconUrl":"https://images.tuyacn.com/smart/connect-scheme-v3/tip-icon/ty_common_slow%402x.gif",
			"apAddBtText":"Confirm that the indicator is blinking slowly.",
			"wifiContent":"If your Wi-Fi band is 5 GHz, select 2.4 GHz.",
			"ezTip":"After power on, confirm that the indicator is blinking quickly. Note that the pairing operation must be finished within three minutes after the device is reset.",
			"apHelpUrl":"https://images.tuyacn.com/smart/connect-scheme-v3/help/template/ap_default_default/common_network/ap_default_default_ap_zh.html"
		},
		"linkModes":[// The pairing mode.
			{
				"leadList":[// The pairing guidelines.
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step1ty.png",
						"title":"Power the device off and on again 10 seconds later it is powered on."
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step2ty.png",
						"title":"Tap and hold the Reset button five seconds."
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step3tykuai.gif",
						"title":"Confirm Indicator Blinking Quickly"
					}
				],
				"linkMode":1,
				"desText":"Default",
				"title":"Wi_Fi EZ"
			},
			{
				"leadList":[
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step1ty.png",
						"title":"Power the device off and on again 10 seconds later it is powered on."
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step2ty.png",
						"title":"Tap and hold the Reset button five seconds."
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step3tykuai.gif",
						"title":"Confirm Indicator Blinking Quickly and Proceed"
					},
					{
						"iconUrl":"https://images.tuyacn.com/sm****art_res/iot_os/step4tyman.gif",
						"title":"Tap and hold the Reset button five seconds again until the indicator is blinking slowly."
					}
				],
				"linkMode":2,
				"title":"AP Mode (Compatible Mode)"
			}
		],
		"enableLead":false
	},
	"t":1622689764143,
	"success":true,
	"status":"ok"
}