Skip to content

红外

流程

红外识别流程

接口设计

1.获取设备类型

获取所有支持识别的红外类型

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/devType"

返回

< 200
< [
    {
      "id": "5",
      "enName": "AC",
      "cnName": "空凋",
    },
    {
      "id": "1",
      "enName": "STB",
      "cnName": "机顶盒",
    },
    ...
  ]

2.获取品牌信息

根据设备类型获取该类型支持的品牌信息

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/brand?devTypeId=5"

参数

参数名 是否可选 参数类型 取值范围 说明
devTypeId 可选 String 设备类型id(为接口1返回信息中的id字段)

返回

< 200
< [
    {
        "id": "10",
        "cnName": "索爱",
        "enName": "Soaiy"
    },
    {
        "id": "1002",
        "cnName": "格尔",
        "enName": "Geer"
    },
    {
        "id": "1005",
        "cnName": "清华紫光",
        "enName": "UNIS"
    },
    ...
]

3.获取设备列表

根据设备类型获取该类型支持的品牌信息

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/irBrandDevice?devTypeId=5&brandId=12&remoteKeys=WIND_SPEED,TEMP-&page=0&size=10"

参数

  • devTypeId、brandId 分别为接口1、接口2返回数据中的id字段
参数名 是否可选 参数类型 取值范围 说明
devTypeId 必选 String 设备类型id
brandId 必选 String 设备品牌id
remoteKeys 可选 List 返回遥控器中指定按键的红外码
page 可选 int 分页参数
size 可选 int 分页参数

返回

< 200
<[
    {
        "id": "1002",         //遥控器ID
        "frequency": "37910", //载波频
        "type": "1",
        "exts": {},
        "keyMap": {           // 遥控器所有按键集合
            "0": {
                "kid": "56",  // 按键Id
                "name": "0",  // 按键名称(英文)
                "display_name": "0", // 按键名称(中文)
                "pulse": "8216,4023,488,514,488,514,488,1543,488,514,488,514,488,514,488,515,488,514,488,3891,488,1543,488,514,488,514,488,514,488,1543,488,1543,488,514,488,514,488,20534,8216,4022,488,514,488,514,488,1543,488,514,488,514,488,514,488,514,488,514,488,3890,488,1543,488,515,488,514,488,514,488,1543,488,1543,488,514,488,514,488,20530",  // 按键红外码
                "exts": {}
            },
            "OK": {
                "kid": "42",
                "name": "OK",
                "display_name": "确认",
                "pulse": "8216,4022,488,514,488,514,488,1543,488,514,488,514,488,514,488,514,489,514,488,3890,488,1543,488,1543,488,1543,488,1543,488,1543,488,1543,488,1543,488,1543,488,20534,8216,4022,488,514,489,514,488,1543,488,514,488,514,488,514,488,514,488,514,488,3891,488,1543,488,1543,488,1543,488,1543,488,1543,489,1542,488,1543,488,1543,488,20530",
                "exts": {}
            },
            "CH+": {
                "kid": "43",
                "name": "CH+",
                "display_name": "频道+",
                "pulse": "8216,4022,488,514,488,514,488,1543,488,514,488,514,488,514,488,515,488,514,488,3890,488,514,488,1543,488,514,488,514,488,1543,488,1543,488,514,488,514,488,20534,8216,4022,488,514,488,514,488,1543,488,514,488,514,488,514,488,514,488,514,488,3890,488,514,488,1543,488,514,488,514,488,1543,488,1543,488,514,488,514,488,20530",
                "exts": {}
            },
           ...
  ]

4.获取地域信息

获取区域信息

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/area"

返回

< 200
< [
    {
        "cityId": "430700", // 城市行政编码
        "name": "常德市",    
        "province": "湖南省",
        "province_id": "430000" // 省行政编码
    },
    {
        "cityId": "450100",
        "name": "南宁市",
        "province": "广西壮族自治区",
        "province_id": "450000"
    },
    {
        "cityId": "510800",
        "name": "广元市",
        "province": "四川省",
        "province_id": "510000"
    },
    ...
]

5.获取地域运营商信息

根据区域信息(cityId)或者该区域所有的运营商信息

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/areaSp?cityId=110000"

参数

参数名 是否可选 参数类型 取值范围 说明
cityId 必选 String 行政区域码(接口4中返回的城市行政编码)

返回

< 200
< [
    {
        "id": "302",
        "provider_name": "天津广电",
        "type": "0"
    },
    {
        "id": "3070",
        "provider_name": "石化科电网络",
    },
    {
        "id": "312",
        "provider_name": "大港油田有线",
        "type": "0"
    }
    ...
]

6.根据地域运营商信息获取设备信息

机顶盒类型的根据地域信息和运营商获取设备

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/irSTBDevice?provinceId=1&spId=12"

参数

参数名 是否可选 参数类型 取值范围 说明
cityId 必选 String 城市行政编码
spId 必选 String 运营商id(接口5返回的Id信息)

返回

< 200
<  [
    {
        "id": "10687",
        "frequency": "37820",
        "type": "1",
        "exts": {},
        "keyMap": {
            "0": {
                "kid": "56",
                "name": "0",
                "display_name": "0",
                "pulse": "9022,4514,562,1707,540,575,562,571,562,576,539,575,562,571,562,575,540,575,562,1707,540,575,562,1708,540,1707,562,1690,562,1707,540,1707,562,1690,562,1707,540,1707,562,1690,562,571,562,575,540,576,561,571,562,1690,562,571,562,575,540,575,562,1707,540,1707,562,1690,562,1707,540,575,562,40045,9022,2263,562,95260",
                "exts": {}
            },
            "CH-": {
                "kid": "44",
                "name": "CH-",
                "display_name": "频道-",
                "pulse": "9022,4514,562,1690,562,571,562,575,540,574,562,571,562,575,540,575,562,571,562,1690,562,571,562,1690,562,1707,540,1707,562,1690,562,1707,540,1707,562,575,540,1707,562,575,540,575,562,1707,540,575,561,1707,540,1707,562,1690,562,571,562,1690,562,1707,540,575,562,1707,540,575,562,571,562,40045,9022,2267,540,95280",
                "exts": {}
            },
            "MENU": {
                "kid": "45",
                "name": "MENU",
                "display_name": "菜单",
                "pulse": "9022,4514,562,1707,540,575,562,571,562,576,539,575,562,571,562,575,540,575,562,1707,540,575,562,1707,540,1707,562,1690,562,1707,540,1707,562,1690,562,570,562,575,540,575,562,571,562,575,540,575,562,571,562,1690,561,1708,540,1708,562,1690,562,1707,540,1707,562,1690,562,1707,540,575,562,40045,9022,2263,562,95261",
                "exts": {}
            },
           ...
  ]

7.获取IPTV品牌信息

获取所有IPTV品牌信息及对应的遥控器Id信息

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/IPTVBrand"

返回

< 200
< [
    {
        "id": "1017",
        "cnName": "中兴",
        "enName": "ZTE",
        "remoteIds": [ // 遥控器ID集合
            "5262",
            "6027",
            "5129",
            "5850",
            "6492"
        ]
    },
    {
        "id": "1022",
        "cnName": "UT斯达康",
        "enName": "UT STARCOM",
        "remoteIds": [
            "5272",
            "6002",
            "6206"
        ]
    },
    {
        "id": "1147",
        "cnName": "神州",
        "enName": "Shenzhou",
        "remoteIds": [
            "6352"
        ]
    },
    ...
]

8. 获取遥控器信息

根据遥控器Id获取,遥控器信息

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/irDevice?remoteIds=112,123"

参数

参数名 是否可选 参数类型 取值范围 说明
remoteIds 可选 Set 遥控器Id集合
remoteKeys 可选 Set 遥控器Id集合
isSatellite 必选 Boolean 是否为卫星电视
page 可选 int 分页参数
size 可选 int 分页参数

返回

< 200
<  [
    {
        "id": "10687",
        "frequency": "37820",
        "type": "1",
        "exts": {},
        "keyMap": {
            "0": {
                "kid": "56",
                "name": "0",
                "display_name": "0",
                "pulse": "9022,4514,562,1707,540,575,562,571,562,576,539,575,562,571,562,575,540,575,562,1707,540,575,562,1708,540,1707,562,1690,562,1707,540,1707,562,1690,562,1707,540,1707,562,1690,562,571,562,575,540,576,561,571,562,1690,562,571,562,575,540,575,562,1707,540,1707,562,1690,562,1707,540,575,562,40045,9022,2263,562,95260",
                "exts": {}
            },
            "CH-": {
                "kid": "44",
                "name": "CH-",
                "display_name": "频道-",
                "pulse": "9022,4514,562,1690,562,571,562,575,540,574,562,571,562,575,540,575,562,571,562,1690,562,571,562,1690,562,1707,540,1707,562,1690,562,1707,540,1707,562,575,540,1707,562,575,540,575,562,1707,540,575,561,1707,540,1707,562,1690,562,571,562,1690,562,1707,540,575,562,1707,540,575,562,571,562,40045,9022,2267,540,95280",
                "exts": {}
            },
            "MENU": {
                "kid": "45",
                "name": "MENU",
                "display_name": "菜单",
                "pulse": "9022,4514,562,1707,540,575,562,571,562,576,539,575,562,571,562,575,540,575,562,1707,540,575,562,1707,540,1707,562,1690,562,1707,540,1707,562,1690,562,570,562,575,540,575,562,571,562,575,540,575,562,571,562,1690,561,1708,540,1708,562,1690,562,1707,540,1707,562,1690,562,1707,540,575,562,40045,9022,2263,562,95261",
                "exts": {}
            },
           ...
  ]

9. 保存红外设备和遥控器的对应关系

保存红外设备和遥控器的对应关系

curl -X POST \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/irDevRemote"
    -d : {
            "ctrlKey" : "5d41402abc4b2a76b9719d911017c592",                    
            "devTypeId" : "1",
            "brandId" : "12341",                           
            "remoteId" : "32134" 
            "name":"空凋"
        }

参数

参数名 是否可选 参数类型 取值范围 说明
devTypeId 必选 String 遥控器类型id
brandId 可选 String 遥控器品牌id
remoteId 必选 String 遥控器id
ctrlKey 必选 String 设备主键
type 必选 IrDaType STB,BRAND,SATELLITE, IPTV 添加的设备类型 机顶盒类,品牌类,卫 星电视机顶盒
name 可选 String 用户自定义名称
cityId 可选 String 遥控器类型id
spId 可选 String 遥控器品牌id

返回

< 200
< {
    "ctrlKey": "6f243308cd044a468074237e0db28977",
    "devType": "机顶盒",
    "brand": "中兴",
    "typeId": "5129",
    "frequency": "38000",
    "name": "中兴机顶盒"
    "instructions": [
        {
            "name": "POWER",
            "desc": "电源",
            "data": {
                "cmdId": 10,
                "irFreq": 38000,
                "irCode": "9016,4501,574,556,574,1679,574,556,573,556,574,556,574,1679,574,556,573,556,573,1679,574,556,573,1679,574,1679,574,1679,573,556,573,1679,574,1679,574,556,573,556,573,1679,574,1679,574,1679,574,556,573,1679,574,1679,574,1679,574,1680,573,557,573,556,573,556,573,1679,574,556,573,551,573,39807,9017,2242,573,96160",
                "irType": "LE"
            }
        },
        ...
    ]
}

10. 列举红外设备识别的遥控器列表

curl -X GET \
    -H "Authorization: Bearer {JWT_TOKEN}" \
    -H "Accept: application/json" \
    "https://user-openapi.hekr.me/irDa/irDevRemote?ctrlKey = 5d41402abc4b2a76b9719d911017c592"

参数

参数名 是否可选 参数类型 取值范围 说明
ctrlKey 必选 String 设备主键

返回

< 200
<[ 
    {
        "ctrlKey": "6f243308cd044a468074237e0db28977",
        "devType": "机顶盒",
        "brand": "中兴",
        "typeId": "5129",
        "frequency": "38000",
        "name": "中兴机顶盒"
        "instructions": [
            {
                "name": "POWER",
                "desc": "电源",
                "data": {
                    "cmdId": 10,
                    "irFreq": 38000,
                    "irCode": "9016,4501,574,556,574,1679,574,556,573,556,574,556,574,1679,574,556,573,556,573,1679,574,556,573,1679,574,1679,574,1679,573,556,573,1679,574,1679,574,556,573,556,573,1679,574,1679,574,1679,574,556,573,1679,574,1679,574,1679,574,1680,573,557,573,556,573,556,573,1679,574,556,573,551,573,39807,9017,2242,573,96160",
                    "irType": "LE"
                }
            },
            ...
        ]
    }
]