新增COM离线时对控制/读取/OTA相关JB命令的本地自动应答,经BLE回传网关
This commit is contained in:
@@ -360,24 +360,12 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
printf("E_BLEPROTO_SERVICE_ID_RUNCMD_V2 cmd=%d bytes_len=%d\n",
|
||||
pkt->cmd, pkt->device_bytes_len);
|
||||
|
||||
#if TCFG_USB_SLAVE_CDC_ENABLE
|
||||
/* 透传 device bytes 到 USB CDC(串口助手可见) */
|
||||
if (pkt->bytes_data && pkt->device_bytes_len > 0)
|
||||
{
|
||||
u32 wlen = cdc_write_data(0, (u8 *)pkt->bytes_data, pkt->device_bytes_len);
|
||||
printf("cdc_write_data %u/%u\n", wlen, (u32)pkt->device_bytes_len);
|
||||
if (wlen == 0)
|
||||
{
|
||||
printf("cdc write fail: USB not ready(DTR) or CDC not started\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* COM 打开→透传 CDC;COM 关闭→对指定 JB 命令本地自动应答回 BLE */
|
||||
if (pkt->bytes_data && pkt->device_bytes_len > 0) {
|
||||
usr_jb_on_runcmd_bytes(pkt->bytes_data, pkt->device_bytes_len);
|
||||
} else {
|
||||
printf("runcmd_v2 no bytes payload\n");
|
||||
}
|
||||
#else
|
||||
printf("TCFG_USB_SLAVE_CDC_ENABLE not enable\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user