简体中文
简体中文
English
联系我们
注册
登录
layout空间导航

通用配网业务包安卓版

更新时间:2021-12-27 09:51:23下载pdf

安卓版通用配网业务包提供配网列表数据查询能力,提供了查询数据列表自定义展示的方法。您可以结合涂鸦 IoT 平台支持的配网列表页数据,来配置列表页。

功能说明

  • 您需要通过 TyActivatorExtraBusinessKit 提供的对应方法查询对应的数据类目信息。

  • 请在 build.gradle 文件依赖声明中,配置相关依赖:

    dependencies {
    	...
    	implementation 'com.tuya.smart:tuyasmart-TuyaSmartActivatorExtraBizBundle:1.0.0'
    	...
    	}
    

查询配网列表一级品类数据

接口说明

getDeviceLevelFirstData(callback)

请求参数

请求示例

		TyActivatorExtraBusinessKit.INSTANCE.getDeviceLevelFirstData(new Business.ResultListener<CategoryResultBean>() {
			@Override
			public void onFailure(BusinessResponse businessResponse, CategoryResultBean categoryResultBean, String s) {

			}

			@Override
			public void onSuccess(BusinessResponse businessResponse, CategoryResultBean categoryResultBean, String s) {

			}
		});

返回示例

{
	"result":{
		"defaultLevel2List":[//默认二级品类列表
			{
				"tagCode":"cz_tag",//二级标签
				"name":"Socket",//二级标签名称
				"level3Items":[//三级类目信息
					{
						"capability":1,//能力值
						"icon":"https://images.tuyaus.com/smart/product_icon2/cz_1.png",//图标
						"name":"Socket",//品类名称
						"attribute":5,//标位
						"category":"wf_cz",//品类 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":[//一级类目列表
			{
				"level1Code":"dgzm",//一级类目 code
				"name":"Electrical",//一级类目名称
				"type":0//配网列表类型:0-标准
			},
			{
				"level1Code":"zm",
				"name":"Lighting",
				"type":0
			}
		],
		"defaultWglist":[//默认网关列表
			{
				"capability":4097,//能力值
				"display":{//配网引导描述
					"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"
}

查询配网列表二级品类数据

接口说明

getDeviceLevelSecondData(levelCode,type,callback)

请求参数

名称 参数类型 说明
levelCode String 一级类目的 levelCode
type Int 一级类目的 type

请求示例

TyActivatorExtraBusinessKit.INSTANCE.getDeviceLevelSecondData(
				level1Bean.getLevel1Code(),
				level1Bean.getType(),
				new Business.ResultListener<ArrayList<CategoryLevelTwoBean>>() {
					@Override
					public void onFailure(BusinessResponse businessResponse, ArrayList<CategoryLevelTwoBean> categoryLevelTwoBeans, String s) {

					}

					@Override
					public void onSuccess(BusinessResponse businessResponse, ArrayList<CategoryLevelTwoBean> categoryLevelTwoBeans, String s) {

					}
				});

返回示例

{
	"result":[
		{
			"tagCode":"zm_dj_tag",//二级标签
			"name":"光源",//二级标签名称
			"level3Items":[
				{
					"capability":1025,//能力值
					"icon":"https://images.tuyacn.com/smart/program_category_icon/wf_ble_dj.png",//图标
					"name":"光源",//品类名称
					"attribute":4,
					"category":"wf_ble_dj",//品类 code
					"activatorDes":"蓝牙+Wi-Fi"
				}
			]
		},
		{
			"tagCode":"zm_dd_tag",
			"name":"灯带",
			"level3Items":[
				{
					"capability":1025,
					"sale":"",
					"icon":"https://images.tuyacn.com/smart/app_category/wf_ble_dd_1598683823026.png",
					"name":"灯带",
					"sort":0,
					"attribute":4,
					"category":"wf_ble_dd",
					"activatorDes":"蓝牙+Wi-Fi"
				}
			]
		}
	],
	"t":1622688701083,
	"success":true,
	"status":"ok"
}

查询配网列表三级品类详情数据

接口说明

getDeviceLevelThirdDetailData(bizType,bizValue,callback)

请求参数

名称 参数类型 说明
bizType Int
  • 0:表示产品品类
  • 1:表示产品
bizValue String
  • 如果 bizType=0,则 bizValue=category
  • 如果 bizType=1,则 bizValue=pid

请求示例

TyActivatorExtraBusinessKit.INSTANCE.getDeviceLevelThirdDetailData(
				0,
				thirdBean.getCategory(),
				new Business.ResultListener<CategoryLevelThirdBean>() {
					@Override
					public void onFailure(BusinessResponse businessResponse, CategoryLevelThirdBean categoryLevelThirdBean, String s) {

					}

					@Override
					public void onSuccess(BusinessResponse businessResponse, CategoryLevelThirdBean categoryLevelThirdBean, String s) {

					}
				});

返回示例

{
	"result":{
		"display":{
			"ezAddBtText":"确认指示灯快闪",
			"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":"接通电源, 确认指示灯在慢闪。注意:重置设备后,请在三分钟内完成配网操作",
			"wifiTitle":"选择 2.4GHz Wi-Fi 网络并输入密码",
			"apTipIconUrl":"https://images.tuyacn.com/smart/connect-scheme-v3/tip-icon/ty_common_slow%402x.gif",
			"apAddBtText":"确认指示灯慢闪",
			"wifiContent":"如果你的 Wi-Fi 是 5GHz 的,请先设置为 2.4GHz",
			"ezTip":"接通电源, 确认指示灯在快闪。注意:重置设备后,请在三分钟内完成配网操作",
			"apHelpUrl":"https://images.tuyacn.com/smart/connect-scheme-v3/help/template/ap_default_default/common_network/ap_default_default_ap_zh.html"
		},
		"linkModes":[//配网方式
			{
				"leadList":[//配网引导
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step1ty.png",
						"title":"将设备接通电源,10 秒后断电再接通电源"
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step2ty.png",
						"title":"长按复位键 5 秒"
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step3tykuai.gif",
						"title":"确认指示灯快闪"
					}
				],
				"linkMode":1,
				"desText":"默认",
				"title":"Wi_Fi 快连"
			},
			{
				"leadList":[
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step1ty.png",
						"title":"将设备接通电源,10 秒后断电再接通电源"
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step2ty.png",
						"title":"长按复位键 5 秒"
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step3tykuai.gif",
						"title":"确认指示灯快闪后,再进行下一步骤"
					},
					{
						"iconUrl":"https://images.tuyacn.com/smart_res/iot_os/step4tyman.gif",
						"title":"再次长按复位键 5 秒,直至指示灯慢闪"
					}
				],
				"linkMode":2,
				"title":"热点配网(兼容模式)"
			}
		],
		"enableLead":false
	},
	"t":1622689764143,
	"success":true,
	"status":"ok"
}