Query Basic Pairing Data

Last Updated on : 2023-10-11 02:49:46download

This topic describes how to get the basic data for device pairing, helping you customize the app UI and adjust the basic parameters for pairing.

Get level-1 category

ThingActivatorCoreKit.getCommonBizOpt()
    .getDeafultDeviceListData(object : IResultResponse<CategoryResultBean?> {
        override fun onError(errorCode: String?, errorMessage: String?) {
            TODO("Not yet implemented")
        }

        override fun onSuccess(result: CategoryResultBean?) {
            TODO("Not yet implemented")
        }

    })

Sample response

{
    "result":{
        "defaultLevel2List":[
            {
                "tagCode":"cz_tag",
                "name":"Socket",
                "level3Items":[
                    {
                        "capability":1,
                        "icon":",
                        "name":"Socket",
                        "attribute":5,
                        "category":"wf_cz",
                        "activatorDes":"Wi-Fi"
                    }
                ]
            },
            {
                "tagCode":"gj_tag",
                "name":"Tool",
                "level3Items":[
                    {
                        "capability":1024,
                        "icon":"",
                        "name":"Battery pack",
                        "attribute":5,
                        "category":"dcb_2b_4",
                        "activatorDes":"BLE"
                    }
                ]
            }
        ],
        "level1List":[
            {
                "level1Code":"dgzm",
                "name":"Electrical",
                "type":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, confirm that the light is on.",
                    "wifiIconUrl":"",
                    "wcHelpUrl":"",
                    "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":""
                },
                "icon":"",
                "name":"Gateway",
                "linkModes":[
                    {
                        "leadList":[
                            {
                                "iconUrl":"",
                                "title":"Please plug in the gateway and connect it to the router."
                            },
                            {
                                "iconUrl":"",
                                "title":"Hold the RESET button for 5s."
                            },
                            {
                                "iconUrl":"",
                                "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"
}

Get level-2 category

ThingActivatorCoreKit.getCommonBizOpt()
            .getDeviceLevelSecondData("level",0,object :IResultResponse<List<CategoryLevelTwoBean>?>{
                override fun onError(errorCode: String?, errorMessage: String?) {
                    TODO("Not yet implemented")
                }

                override fun onSuccess(result: List<CategoryLevelTwoBean>?) {
                    TODO("Not yet implemented")
                }

            })

Request parameters

Name Parameter type Description
levelCode String The levelCode of the level-1 category.
type Int The type of the level-1 category.

Sample response

{
    "result":[
        {
            "tagCode":"zm_dj_tag",
            "name":"",
            "level3Items":[
                {
                    "capability":1025,
                    "icon":"",
                    "name":"",
                    "attribute":4,
                    "category":"wf_ble_dj",
                    "activatorDes":""
                }
            ]
        },
        {
            "tagCode":"zm_dd_tag",
            "name":"",
            "level3Items":[
                {
                    "capability":1025,
                    "sale":"",
                    "icon":"",
                    "name":"",
                    "sort":0,
                    "attribute":4,
                    "category":"wf_ble_dd",
                    "activatorDes":""
                }
            ]
        }
    ],
    "t":1622688701083,
    "success":true,
    "status":"ok"
}

Get level-3 category

ThingActivatorCoreKit.getCommonBizOpt()
    .getDeviceLevelThirdDetailData(0,"bizValue",object :IResultResponse<CategoryLevelThirdBean?>{
        override fun onError(errorCode: String?, errorMessage: String?) {
            TODO("Not yet implemented")
        }

        override fun onSuccess(result: CategoryLevelThirdBean?) {
            TODO("Not yet implemented")
        }

    })

Request parameters

Name Parameter 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.
{
    "result":{
        "display":{
            "ezAddBtText":"",
            "wifiIconUrl":"",
            "ezHelpUrl":"",
            "ezTipIconUrl":"",
            "apTip":"",
            "wifiTitle":"",
            "apTipIconUrl":"",
            "apAddBtText":"",
            "wifiContent":"",
            "ezTip":"",
            "apHelpUrl":""
        },
        "linkModes":[
            {
                "leadList":[
                    {
                        "iconUrl":"",
                        "title":""
                    },
                    {
                        "iconUrl":"",
                        "title":""
                    },
                    {
                        "iconUrl":"",
                        "title":""
                    }
                ],
                "linkMode":1,
                "desText":"",
                "title":""
            },
            {
                "leadList":[
                    {
                        "iconUrl":"",
                        "title":""
                    },
                    {
                        "iconUrl":"",
                        "title":""
                    },
                    {
                        "iconUrl":"",
                        "title":""
                    },
                    {
                        "iconUrl":"",
                        "title":""
                    }
                ],
                "linkMode":2,
                "title":""
            }
        ],
        "enableLead":false
    },
    "t":1622689764143,
    "success":true,
    "status":"ok"
}