适配了逗猫棒的配网指令
This commit is contained in:
+8
-8
@@ -132164,7 +132164,7 @@
|
||||
"app_main.h"
|
||||
"tone_player.h"
|
||||
|
||||
1784803197 d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\include\app_main.h
|
||||
1785135433 d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\include\app_main.h
|
||||
"bleproto.h"
|
||||
"bleproto_api.h"
|
||||
|
||||
@@ -134230,7 +134230,7 @@
|
||||
"rcsp_adv_bluetooth.h"
|
||||
"bt_tws.h"
|
||||
|
||||
1784867308 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\common\third_party_profile\jieli\jl_rcsp\bt_trans_data\le_rcsp_adv_module.c
|
||||
1785142510 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\common\third_party_profile\jieli\jl_rcsp\bt_trans_data\le_rcsp_adv_module.c
|
||||
"system/app_core.h"
|
||||
"system/includes.h"
|
||||
"app_config.h"
|
||||
@@ -134919,7 +134919,7 @@
|
||||
"bt_tws.h"
|
||||
"icsd_adt_app.h"
|
||||
|
||||
1784878086 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\app_main.c
|
||||
1785135433 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\app_main.c
|
||||
"system/includes.h"
|
||||
"btstack/btstack_task.h"
|
||||
"app_config.h"
|
||||
@@ -135271,7 +135271,7 @@
|
||||
"icsd_adt_app.h"
|
||||
"debug.h"
|
||||
|
||||
1784804410 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\default_event_handler.c
|
||||
1785135433 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\default_event_handler.c
|
||||
"default_event_handler.h"
|
||||
"app_action.h"
|
||||
"bt_background.h"
|
||||
@@ -135308,7 +135308,7 @@
|
||||
"debug.h"
|
||||
"update_tws_new.h"
|
||||
|
||||
1784804410 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\earphone.c
|
||||
1785135433 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\earphone\earphone.c
|
||||
"system/includes.h"
|
||||
"media/includes.h"
|
||||
"tone_player.h"
|
||||
@@ -136062,7 +136062,7 @@
|
||||
<math.h>
|
||||
"mjson.h"
|
||||
|
||||
1784878066 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\usr_le_code\usr_le_adv.c
|
||||
1785135433 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\usr_le_code\usr_le_adv.c
|
||||
"system/includes.h"
|
||||
"app_config.h"
|
||||
"app_main.h"
|
||||
@@ -136074,7 +136074,7 @@
|
||||
"usr_usb_jb.h"
|
||||
"debug.h"
|
||||
|
||||
1784867441 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\usr_le_code\usr_le_recieve.c
|
||||
1785142543 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\usr_le_code\usr_le_recieve.c
|
||||
"app_config.h"
|
||||
"asm/pwm_led.h"
|
||||
"tone_player.h"
|
||||
@@ -137193,7 +137193,7 @@
|
||||
1784880583 d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\usr_le_code\usr_usb_jb.h
|
||||
<stdint.h>
|
||||
|
||||
1784882217 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\usr_le_code\usr_usb_jb.c
|
||||
1785135673 source:d:\jianbao\project\À¶ÑÀת½Ó°å-¶ºÃ¨°ô\sdk\apps\usr_le_code\usr_usb_jb.c
|
||||
"system/includes.h"
|
||||
"app_config.h"
|
||||
"vm.h"
|
||||
|
||||
@@ -36,7 +36,6 @@ static u8 txbuf[384]={0};
|
||||
static u8 rxbuf[FIRM_PACK_LEN + 1024] = {0};
|
||||
static u8 ota_source_data[FIRM_PACK_LEN * 2] = {0};
|
||||
|
||||
|
||||
extern u16 usr_get_conn_service();
|
||||
extern void ble_multi_trans_disconnect(void);
|
||||
extern void usr_ble_adv_updata_OTA();
|
||||
@@ -52,6 +51,7 @@ void usr_data_ana(bleproto_appdata_desc_t *desc);
|
||||
void usr_do_action_code(int flag);
|
||||
void usr_app_ota_init();
|
||||
void usr_test_protocol(void);
|
||||
void usr_run_cmd_code(bleproto_runcmd_req_t *runcmd_par, u8 usr_msg_id);
|
||||
|
||||
bleproto_authsetup_req_t usr_auth_data;
|
||||
usr_module_cfg _usr_module_cfg;
|
||||
@@ -60,7 +60,8 @@ usr_module_cfg_cache _usr_module_cfg_cache;
|
||||
void usr_read_device_sta()
|
||||
{
|
||||
int ret = syscfg_read(CFG_USER_DEVICE_STA, (u8 *)&_usr_module_cfg, sizeof(_usr_module_cfg));
|
||||
if (ret <= 0) {
|
||||
if (ret <= 0)
|
||||
{
|
||||
memset(&_usr_module_cfg, 0, sizeof(_usr_module_cfg));
|
||||
_usr_module_cfg.power_on_flag = 1;
|
||||
syscfg_write(CFG_USER_DEVICE_STA, (u8 *)&_usr_module_cfg, sizeof(_usr_module_cfg));
|
||||
@@ -128,8 +129,10 @@ void usr_set_device_default()
|
||||
void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
{
|
||||
bleproto_appdata_desc_t encode_desc = {0};
|
||||
if(desc->header.msgtype/*desc.header.msgtype*/ == BLEPROTO_APPDATA_MSGTYPE_REQ) {
|
||||
switch(desc->header.serviceid){
|
||||
if (desc->header.msgtype /*desc.header.msgtype*/ == BLEPROTO_APPDATA_MSGTYPE_REQ)
|
||||
{
|
||||
switch (desc->header.serviceid)
|
||||
{
|
||||
|
||||
case E_BLEPROTO_SERVICE_ID_DEVICEINFO:
|
||||
|
||||
@@ -154,7 +157,8 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
rsp->prototype = 4;
|
||||
}
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if(encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
printf("encode_len = %d\n", encode_len);
|
||||
// 调用蓝牙协议栈发送数据接口,将数据一包一包的发送出去
|
||||
// 第一包:packetlen
|
||||
@@ -194,7 +198,8 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
}
|
||||
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if(encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
printf("encode_len = %d\n", encode_len);
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
}
|
||||
@@ -227,7 +232,8 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
}
|
||||
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if(encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
printf("encode_len = %d\n", encode_len);
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
}
|
||||
@@ -236,6 +242,13 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
printf("2encode_len = %d\n", encode_len);
|
||||
}
|
||||
break;
|
||||
case E_BLEPROTO_SERVICE_ID_RUNCMD:
|
||||
printf("E_BLEPROTO_SERVICE_ID_RUNCMD\n");
|
||||
usr_run_cmd_code(&desc->datast.runcmd_req, desc->header.msgid);
|
||||
break;
|
||||
case E_BLEPROTO_SERVICE_ID_REPORTCMD:
|
||||
printf("E_BLEPROTO_SERVICE_ID_REPORTCMD\n");
|
||||
break;
|
||||
case E_BLEPROTO_SERVICE_ID_DOACTION:
|
||||
printf("E_BLEPROTO_SERVICE_ID_DOACTION\n");
|
||||
encode_desc.header.version = 0;
|
||||
@@ -252,7 +265,8 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
}
|
||||
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if (encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
usr_do_action_code(desc->datast.doaction_req.action);
|
||||
}
|
||||
@@ -282,7 +296,8 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
usr_var.usr_ota_data_id = in_ota_data2->id; // int
|
||||
usr_var.usr_ota_data_size = in_ota_data2->size;
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if(encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
printf("encode_len = %d\n", encode_len);
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
}
|
||||
@@ -313,7 +328,8 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
encode_desc.datast.otadata_req.offset = usr_var.usr_data_index;
|
||||
encode_desc.datast.otadata_req.maxsize = FIRM_PACK_LEN;
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if(encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
}
|
||||
else
|
||||
@@ -341,13 +357,17 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
|
||||
#if TCFG_USB_SLAVE_CDC_ENABLE
|
||||
/* 透传 device bytes 到 USB CDC(串口助手可见) */
|
||||
if (pkt->bytes_data && pkt->device_bytes_len > 0) {
|
||||
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) {
|
||||
if (wlen == 0)
|
||||
{
|
||||
printf("cdc write fail: USB not ready(DTR) or CDC not started\n");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("runcmd_v2 no bytes payload\n");
|
||||
}
|
||||
#else
|
||||
@@ -358,8 +378,11 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}else if(desc->header.msgtype == BLEPROTO_APPDATA_MSGTYPE_RSP) {
|
||||
switch(desc->header.serviceid) {
|
||||
}
|
||||
else if (desc->header.msgtype == BLEPROTO_APPDATA_MSGTYPE_RSP)
|
||||
{
|
||||
switch (desc->header.serviceid)
|
||||
{
|
||||
case E_BLEPROTO_SERVICE_ID_REPORTCMD:
|
||||
// 主控回复的响应,设备处理
|
||||
printf("E_BLEPROTO_SERVICE_ID_REPORTCMD\n");
|
||||
@@ -401,37 +424,73 @@ void usr_data_ana(bleproto_appdata_desc_t *desc)
|
||||
encode_desc.datast.otadata_req.offset = usr_var.usr_data_index;
|
||||
encode_desc.datast.otadata_req.maxsize = FIRM_PACK_LEN;
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if(encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("2encode_len err = %d\n", encode_len);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void usr_run_cmd_code(bleproto_runcmd_req_t *runcmd_par, u8 usr_msg_id)
|
||||
{
|
||||
printf("runcmd_par id = %d\n", runcmd_par->ycmd.cmd_id);
|
||||
|
||||
bleproto_appdata_desc_t encode_desc = {0};
|
||||
encode_desc.header.version = 0;
|
||||
encode_desc.header.datafmt = BLEPROTO_APPDATA_DATAFMT_JSON;
|
||||
encode_desc.header.msgtype = BLEPROTO_APPDATA_MSGTYPE_RSP;
|
||||
encode_desc.header.msgid = usr_msg_id;
|
||||
encode_desc.header.encrypt = 0;
|
||||
encode_desc.header.serviceid = E_BLEPROTO_SERVICE_ID_RUNCMD;
|
||||
|
||||
bleproto_runcmd_rsp_t *rsp = &encode_desc.datast.runcmd_rsp;
|
||||
|
||||
switch (runcmd_par->ycmd.cmd_id)
|
||||
{
|
||||
case 600:
|
||||
/*
|
||||
| 索引 | 类型 | 描述 | 取值 |
|
||||
| ---- | ----- | ---------------- | ------------------------------------------------- |
|
||||
| 0 | int32 | cmdid | 600 |
|
||||
| 1 | int32 | 返回值 | 0: 设备接受命令成功; 非零: 参见具体的命令错误代码 |
|
||||
*/
|
||||
rsp->ycmd.cmd_id = 110;
|
||||
rsp->ycmd.arg_int32_count = 9;
|
||||
rsp->ycmd.arg_string_count = 0;
|
||||
rsp->ycmd.arg_bytes_count = 0;
|
||||
rsp->ycmd.arg_int32[0] = 600;
|
||||
rsp->ycmd.arg_int32[1] = 0; // 0:命令接收成功
|
||||
memcpy(rsp->ycmd.arg_int32 + 2, 0, 7);
|
||||
rsp->ycmd.t = usr_var.usr_cureent_utc; // UTC时间戳;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int encode_len = bleproto_appdata_encode(
|
||||
/* txbuf */ txbuf,
|
||||
/* size */ sizeof(txbuf),
|
||||
/* packetlen */ sizeof(txbuf),
|
||||
/* desc */ &encode_desc);
|
||||
printf("encode_len = %d\n", encode_len);
|
||||
if (encode_len > 0)
|
||||
{
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
}
|
||||
}
|
||||
|
||||
extern void nvram_set_boot_state(u32 state);
|
||||
extern void hw_mmu_disable(void);
|
||||
extern void ram_protect_close(void);
|
||||
AT(.volatile_ram_code)
|
||||
void usr_update_init()
|
||||
{
|
||||
//local_irq_disable();
|
||||
ram_protect_close();
|
||||
//hw_mmu_disable();
|
||||
//nvram_set_boot_state(2);
|
||||
|
||||
//JL_CLOCK->PWR_CON |= (1 << 4);
|
||||
/* chip_reset(); */
|
||||
/* cpu_reset(); */
|
||||
//while (1);
|
||||
}
|
||||
void usr_ota_deal_task()
|
||||
{
|
||||
@@ -465,7 +524,8 @@ void usr_ota_deal_task()
|
||||
encode_desc.datast.otadata_req.offset = usr_var.usr_data_index;
|
||||
encode_desc.datast.otadata_req.maxsize = FIRM_PACK_LEN;
|
||||
encode_len = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
if(encode_len > 0) {
|
||||
if (encode_len > 0)
|
||||
{
|
||||
usr_ble_send_data(txbuf, encode_len);
|
||||
}
|
||||
else
|
||||
@@ -493,31 +553,37 @@ void usr_ota_deal_task()
|
||||
|
||||
#endif // 0
|
||||
|
||||
|
||||
void usr_ota_process()
|
||||
{
|
||||
static u8 cnt = 0;
|
||||
if (cnt == 0) {
|
||||
if (cnt == 0)
|
||||
{
|
||||
ble_multi_trans_disconnect();
|
||||
}
|
||||
|
||||
if (usr_get_conn_service() == 0) {
|
||||
if (usr_get_conn_service() == 0)
|
||||
{
|
||||
cnt++;
|
||||
if (cnt == 2) {
|
||||
if (cnt == 2)
|
||||
{
|
||||
usr_ble_adv_updata_OTA();
|
||||
}
|
||||
if (cnt >= 60) {
|
||||
if (cnt >= 60)
|
||||
{
|
||||
cnt = 0;
|
||||
cpu_reset();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void usr_do_action_code(int flag)
|
||||
{
|
||||
switch (flag) {
|
||||
switch (flag)
|
||||
{
|
||||
case 0: /* reboot */
|
||||
cpu_reset();
|
||||
break;
|
||||
@@ -539,7 +605,8 @@ void usr_do_action_code(int flag)
|
||||
void usr_app_ota_init()
|
||||
{
|
||||
usr_var.usr_goto_updata = 1;
|
||||
if (usr_var.ota_timer == 0) {
|
||||
if (usr_var.ota_timer == 0)
|
||||
{
|
||||
usr_var.ota_timer = sys_timer_add(NULL, usr_ota_process, 1000);
|
||||
}
|
||||
}
|
||||
@@ -566,7 +633,8 @@ void usr_test_protocol(void)
|
||||
|
||||
int elen = bleproto_appdata_encode(txbuf, sizeof(txbuf), sizeof(txbuf), &encode_desc);
|
||||
printf("encode_len = %d\n", elen);
|
||||
if (elen > 0) {
|
||||
if (elen > 0)
|
||||
{
|
||||
usr_ble_send_data(txbuf, elen);
|
||||
printf_buf(txbuf, elen);
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3338,6 +3338,7 @@ obj/Release/apps/usr_le_code/usr_le_recieve.o
|
||||
-r=obj/Release/apps/usr_le_code/usr_le_recieve.o,usr_write_pair_info,l
|
||||
-r=obj/Release/apps/usr_le_code/usr_le_recieve.o,memcmp,l
|
||||
-r=obj/Release/apps/usr_le_code/usr_le_recieve.o,usr_clear_pair_info,l
|
||||
-r=obj/Release/apps/usr_le_code/usr_le_recieve.o,usr_run_cmd_code,pl
|
||||
-r=obj/Release/apps/usr_le_code/usr_le_recieve.o,usr_do_action_code,pl
|
||||
-r=obj/Release/apps/usr_le_code/usr_le_recieve.o,dual_ota_app_data_deal,l
|
||||
-r=obj/Release/apps/usr_le_code/usr_le_recieve.o,clk_set,l
|
||||
|
||||
+474
-475
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Reference in New Issue
Block a user