1.连接设备 -- online :
URL Example: http://127.0.0.1:6969/ctrl?cmd=online
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "Method": "online", "Status": "Success" }, "send": "Success" } |
{ "recv": { "Method": "online", "Status": "Fail" }, "send": "Success" } |
2.断开设备 -- offline :
URL Example: http://127.0.0.1:6969/ctrl?cmd=offline
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "Method": "offline", "Status": "Success" }, "send": "Success" } |
{ "recv": { "Method": "offline", "Status": "Fail" }, "send": "Success" } |
3.获取版本信息和指令地址 -- getFirmwareVersion :
URL Example: http://127.0.0.1:6969/uhf?cmd=getFirmwareVersion
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "HexExCmdAddr": "01", "Major": "8", "Method": "getfirmwareversion", "Minor": "2" }, "send": "Success" } |
{ "recv": { "Method": "getfirmwareversion", "Status": "Fail" }, "send": "Fail" } |
recv说明 |
Major |
固件主版本号。 |
Minor |
固件次版本号。 |
|
HexExCmdAddr |
读写器通讯指令的地址 |
4.获取功率设置 -- getOutputPower4 :
URL Example: http://127.0.0.1:6969/uhf?cmd=getOutputPower4
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "Method": "getoutputpower4", "OutputPower1": "30", "OutputPower2": "30", "OutputPower3": "30", "OutputPower4": "30" }, "send": "Success" } |
{ "recv": { "Method": "getoutputpower4", "Status": "Fail" }, "send": "Fail" } |
recv说明 |
OutputPower1 |
天线 1 的功率值 |
OutputPower2 |
天线 2 的功率值 |
|
OutputPower3 |
天线 3 的功率值 |
|
OutputPower4 |
天线 4 的功率值 |
5.设置功率大小 -- setOutputPowerAll :
action参数说明:
allpower |
需要设置的功率值大小,单位:dbm |
URL Example:
http://127.0.0.1:6969/uhf?cmd=setOutputPowerAll&action={allpower:28}
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "Method": "setoutputpowerall", "Status": "Success" }, "send": "Success" } |
{ "recv": { "Method": "setoutputpowerall", "Status": "Fail" }, "send": "Fail" } |
6.盘点标签 -- SessionInventory :
action参数说明:
Session |
指定盘存的session。其值可以为S0 / S1 / S2 / S3 |
Target |
指定盘存的Inventoried Flag,其值可以为target_A / target_B |
Repeat |
盘存过程重复的次数,其值可以为[1-255] |
URL Example :
http://127.0.0.1:6969/uhf?cmd=SessionInventory&action={session:s0,target:target_A,repeat:1}
Success Return:
{
"recv": {
"AntID": "Ant_01",
"Info": {
"TagList": [
{
"AntID": "Ant_01",
"FreQ": "924.00",
"HexEPC": "",
"HexPC": "0400",
"RSSI": "-83"
},
{
"AntID": "Ant_01",
"FreQ": "924.00",
"HexEPC": "000000000000000000361975",
"HexPC": "3400",
"RSSI": "-76"
}
]
},
"Method": "sessioninventory",
"ReadRate": "95",
"TagHits": "2",
"TotalRead": "2"
},
"send": "Success"
}
Note:
1.最真实的标签数量是解析 TagList 数组的大小,TagList 数组的大小<= TagHits <= TotalRead ,某种意义上可以认为TotalRead 和 TagHits 是不能代表盘点到的标签数量的;
2.若对象recv中包含有Status对象, 则Status 的值仅仅代表最后一次repeat盘点的结果。当repeat 值 大于1 的时候,最后一轮盘点若返回天线未连接的状态,则会出现 既有TagList数据,但 Status 值却又是Fail的状态。此时是没有TotalRead这个字段的。
TagList说明 |
AntID |
读到标签的天线号。 |
FreQ |
标签的实时频点。 |
|
HexEPC |
标签的EPC号,长度可变化。 |
|
HexPC |
标签的PC ,固定两个字节 |
|
RSSI |
标签的实时RSSI。 |
7.存取读标签 -- readTag :
action参数说明:
Membank |
指定读取的区域。其值可以为reserved/ epc / tid / user |
Wordadd |
读取数据首地址 |
Wordcnt |
读取数据字长度,单位为 word |
Hexpassword |
标签访问密码,4字节,标签默认值是 00 00 00 00 |
Read Tid URL Example :
http://127.0.0.1:6969/uhf?cmd=ReadTag&action={membank:tid,wordadd:00,wordcnt:06,hexpassword:00 00 00 00}
Success Return:
{
"recv": {
"Counter": "2",
"Info": {
"TagList": [
{
"AntID": "Ant_01",
"DataLen": "28",
"FreQ": "903.00",
"HexCRC": "87B9",
"HexEPC": "778E106ABB3D106ABB3DD0C6",
"HexPC": "3000",
"HexReadTargetData": "E28068942000400826935456",
"ReadCount": "1",
"ReadLen": "12"
},
{
"AntID": "Ant_01",
"DataLen": "28",
"FreQ": "903.00",
"HexCRC": "8FC2",
"HexEPC": "010101010506020A0F6A0C48",
"HexPC": "3400",
"HexReadTargetData": "E280117020001448ED410941",
"ReadCount": "1",
"ReadLen": "12"
}
]
},
"Method": "readtag"
},
"send": "Success"
}
Note:
TagList说明 |
AntID |
读到标签的天线号。 |
FreQ |
标签的实时频点。 |
|
HexEPC |
标签的EPC号,长度可变化。 |
|
HexPC |
标签的PC ,固定两个字节 |
|
HexReadTargetData |
读取的目标数据 |
|
ReadCount |
该标签被读操作的次数。 |
|
ReadLen |
读取的目标数据的长度,单位是字节。 |
|
DataLen |
所操作标签的有效数据长度。(PC+CRC+EPC+读取的标签数据)。 单位是字节。 |
8.存取写标签 -- writeTag :
action参数说明:
Membank |
指定读取的区域。其值可以为reserved/ epc / user |
Wordadd |
写入数据首地址 |
Wordcnt |
写入数据的字长度,单位为 word,需要对应Hexdata |
Hexpassword |
标签访问密码,4字节,标签默认值是 00 00 00 00 |
Hexdata |
写入标签的数据标签数据 |
URL:
Write EPC data Example :01 02 03 04 05 06 , write data count 3 words
http://127.0.0.1:6969/uhf?cmd=WriteTag&action={membank:epc,wordadd:02,wordcnt:03,hexpassword:00 00 00 00,hexdata:01 02 03 04 05 06}
Success Return:
{
"recv": {
"Counter": "2",
"Info": {
"TagList": [
{
"AntID": "Ant_01",
"DataLen": "16",
"FreQ": "911.50",
"HexCRC": "9A46",
"HexEPC": "E28011606000020497CA6951",
"HexPC": "3000",
"Status": "Success",
"WriteCount": "1"
},
{
"AntID": "Ant_01",
"DataLen": "16",
"FreQ": "911.50",
"HexCRC": "6CB2",
"HexEPC": "332211606000020497CA6961",
"HexPC": "3000",
"Status": "Fail : Error occurred when write",
"WriteCount": "1"
}
]
},
"Method": "writetag"
},
"send": "Success"
}
Note:
TagList说明 |
AntID |
读到标签的天线号。 |
FreQ |
标签的实时频点。 |
|
HexEPC |
标签的EPC号,长度可变化。 |
|
HexPC |
标签的PC ,固定两个字节 |
|
WriteCount |
该标签被操作的次数。 |
|
Status |
所操作标签的操作结果,即错误代码。 |
|
DataLen |
所操作标签的有效数据长度。(PC+CRC+EPC+读取的标签数据)。 单位是字节。 |
1.获取蓝牙读写器电池电压 -- getbtvolt :
URL Example: http://172.16.10.128:6969/ctrl?cmd=getbtvolt
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "Info": "3788", "Method": "getbtvolt", "Status": "Success" }, "send": "Success" } |
{ "recv": { "Info": "Fail", "Method": "getbtvolt", "Status": "Fail" }, "send": "Fail" } |
recv说明 |
Info |
读写器的电池电压值,单位是mV |
2.启动二维码扫描 -- getbtbarcode :
URL Example: http://127.0.0.1:6969/ctrl?cmd=getbtbarcode
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "Info": "123456789", "Method": "getbtbarcode", "Status": "Success" }, "send": "Success" } |
{ "recv": { "Info": "Fail", "Method": "getbtbarcode", "Status": "Fail" }, "send": "Fail" } |
recv说明 |
Info |
条码的内容,如果扫描失败,则为"Fail" |
Note:
使用该API之前首先需要确认读写器的条码头功能是否已经开启;
3.关闭蓝牙读写器电源 -- setbtshutdown:
URL Example: http://172.16.10.128:6969/ctrl?cmd=setbtshutdown
Recv Success Return: |
Recv Fail Return: |
{ "recv": { "Method": "setbtshutdown", "Status": "Success" }, "send": "Success" } |
{ "recv": { "Method": "setbtshutdown", "Status": "Fail" }, "send": "Fail" } |
Note:
该API执行成功之后,读写器会发出滴的一声响,然后完全断电。因此,APP也会断开蓝牙的连接。