forked from xuos/xiuos
xiuos\APP_Framework\Framework\connection\bluetooth:
1.add code like setting Tuuid and Suuid
This commit is contained in:
parent
1293577e93
commit
b5783ca4c5
|
@ -189,6 +189,30 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
|
|||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, cmd_str);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_GET_SUUID:
|
||||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_SUUID_CMD);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_SET_SUUID:
|
||||
luuid = *(unsigned int *)param;
|
||||
sprintf(cmd_str, HC08_SET_SUUID_CMD, luuid);
|
||||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, cmd_str);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_GET_TUUID:
|
||||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_TUUID_CMD);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_SET_TUUID:
|
||||
luuid = *(unsigned int *)param;
|
||||
sprintf(cmd_str, HC08_SET_TUUID_CMD, luuid);
|
||||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, cmd_str);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
default:
|
||||
printf("hc08 do not support no.%d cmd\n", hc08_at_cmd);
|
||||
|
@ -309,7 +333,8 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
#else
|
||||
static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
||||
{
|
||||
if (OPE_INT != cmd) {
|
||||
|
@ -360,15 +385,19 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
|||
}
|
||||
|
||||
PrivTaskDelay(500);
|
||||
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
//Step3 : show hc08 device info, hc08_get send "AT+RX" response device info
|
||||
// char device_info[HC08_RESP_DEFAULT_SIZE * 2] = {0};
|
||||
// if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_DEVICE_INFO, NULL, device_info) < 0) {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
char device_info[HC08_RESP_DEFAULT_SIZE * 2] = {0};
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_DEVICE_INFO, NULL, device_info) < 0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
//Step4 : set LUUID、SUUID、TUUID, slave and master need to have same uuid param
|
||||
luuid = 1234;
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
luuid = 1233;
|
||||
#else
|
||||
luuid = 1234;
|
||||
#endif
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_LUUID, &luuid, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -376,11 +405,29 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
|||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_LUUID, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
uint32_t suuid=1233;
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_SUUID, &luuid, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_SUUID, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
uint32_t tuuid=1233;
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_TUUID, &tuuid, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_TUUID, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
ADAPTER_DEBUG("Hc08 ioctl done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int Hc08SetAddr(struct Adapter *adapter, const char *ip, const char *gateway, const char *netmask)
|
||||
|
|
Loading…
Reference in New Issue