瀏覽代碼

实现除OTA之外的所有指令

Hansome 1 月之前
父節點
當前提交
efd32fce41

+ 4 - 0
src/hlw2025141/app/projects/earphone/app.cbp

@@ -722,6 +722,10 @@
 			<Option compilerVar="CC" />
 		</Unit>
 		<Unit filename="com/com_ble.h" />
+		<Unit filename="com/com_dec.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="com/com_dec.h" />
 		<Unit filename="config.c">
 			<Option compilerVar="CC" />
 		</Unit>

+ 13 - 13
src/hlw2025141/app/projects/earphone/app.depend

@@ -5914,7 +5914,7 @@
 
 1731923638 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\xcfg.h
 
-1744099298 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\config.h
+1744255226 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\config.h
 	"config_define.h"
 	"config_extra.h"
 
@@ -6064,7 +6064,7 @@
 
 1697613588 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\3rd-party\sensor\sc7a20.h
 
-1744099298 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\system\system.h
+1744255226 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\system\system.h
 	"mute.h"
 	"param.h"
 	"device.h"
@@ -6181,7 +6181,7 @@
 	"dueros_dma/dueros_dma_app.h"
 	"app_fota/app_fota.h"
 
-1733207270 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\app\ab_mate\ab_mate_app.h
+1744255226 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\app\ab_mate\ab_mate_app.h
 	"ab_mate_timer.h"
 	"ab_mate_profile.h"
 
@@ -6384,7 +6384,7 @@
 	"func.h"
 	"func_aux.h"
 
-1744099298 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\functions\func_bt.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\functions\func_bt.c
 	"include.h"
 	"func.h"
 	"func_bt.h"
@@ -6399,7 +6399,7 @@
 	"func.h"
 	"func_bt_hid.h"
 
-1727407343 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\functions\func_charge.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\functions\func_charge.c
 	"include.h"
 	"func.h"
 
@@ -7015,7 +7015,7 @@
 1706002176 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\ble\priv_ble.c
 	"include.h"
 
-1744099298 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\bsp_bt.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\bsp_bt.c
 	"include.h"
 	"api.h"
 
@@ -7090,7 +7090,7 @@
 1697613588 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\tws\tws_util.c
 	"include.h"
 
-1744099298 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\charge\charge.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\charge\charge.c
 	"include.h"
 
 1733207270 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\charge\charge_box.c
@@ -7212,7 +7212,7 @@
 1724071741 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\system\param.c
 	"include.h"
 
-1744099298 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\system\system.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\system\system.c
 	"include.h"
 
 1702027377 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\system\vbat.c
@@ -7255,7 +7255,7 @@
 	"include.h"
 	"func.h"
 
-1744099298 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\message\msg_bt.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\message\msg_bt.c
 	"include.h"
 	"func.h"
 	"func_bt.h"
@@ -7340,13 +7340,13 @@
 1733475627 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\ram.ld
 	"config.h"
 
-1744099298 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\com\com_adv.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\com\com_adv.c
 	"com_adv.h"
 
 1744099298 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\com\com_adv.h
 	"include.h"
 
-1744099298 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\app\ab_mate\ab_mate_profile.c
+1744255226 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\modules\bluetooth\app\ab_mate\ab_mate_profile.c
 	"include.h"
 	"ab_mate_profile.h"
 	"com_adv.h"
@@ -7359,9 +7359,9 @@
 	"com_ble.h"
 	"com_dec.h"
 
-1744011017 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\com\com_dec.c
+1744278055 source:e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\com\com_dec.c
 	"com_dec.h"
 
-1744180168 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\com\com_dec.h
+1744334802 e:\hlwei\projects\hlw2025141\src\hlw2025141\app\projects\earphone\com\com_dec.h
 	"include.h"
 

+ 342 - 0
src/hlw2025141/app/projects/earphone/com/com_dec.c

@@ -653,6 +653,54 @@ void com_dec_on_recv(uint8_t* datas, uint16_t len)
             com_dec_send_ios_disc_ack(1);
             break;
 
+        case COM_DEC_CMD_SET_NOISE_RDMODE:
+            break;
+
+        case COM_DEC_CMD_GET_NOISE_RDMODE:
+            break;
+
+        case COM_DEC_CMD_SET_FIND_FUNC:
+            break;
+
+        case COM_DEC_CMD_SET_SLEEP_MODE:
+            break;
+
+        case COM_DEC_CMD_GET_SLEEP_MODE:
+            break;
+
+        case COM_DEC_CMD_SET_SLEEP_TIMER:
+            break;
+
+        case COM_DEC_CMD_SET_SPAUDIO_MODE:
+            break;
+
+        case COM_DEC_CMD_SET_IMAUDIO_MODE:
+            break;
+
+        case COM_DEC_CMD_SET_FOCUS_MODE:
+            break;
+
+        case COM_DEC_CMD_SET_TRANS_MODE:
+            break;
+
+        case COM_DEC_CMD_SET_REC_MODE:
+            break;
+
+        case COM_DEC_CMD_CTRL_ASVOICE:
+            break;
+
+        case COM_DEC_CMD_QUERY_PAIR_DEVS:
+            break;
+
+        case COM_DEC_CMD_DEL_PAIR_DEV:
+            break;
+
+        case COM_DEC_CMD_CH_PAIR_DEV:
+            break;
+
+        case COM_DEC_CMD_CH_BT_NAME:
+            break;
+
         default:
             break;
 
@@ -1097,4 +1145,298 @@ void com_dec_send_ios_disc_ack(uint8_t ret)
 }
 
 
+void com_dec_send_set_noise_rdmode_ack(uint8_t ret)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_NOISE_RDMODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = ret;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_get_noise_rdmode_ack(uint16_t mode)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_GET_NOISE_RDMODE;
+    _tx_buf[i++] = 2;
+    _tx_buf[i++] = mode & 0xff;
+    _tx_buf[i++] = mode >> 8;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_find_func_ack(uint8_t ret)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_FIND_FUNC;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = ret;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_sleep_mode_ack(uint8_t ret)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_SLEEP_MODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = ret;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_get_sleep_mode_ack(uint8_t mode)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_GET_SLEEP_MODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = mode;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_sleep_timer_ack(uint8_t ret)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_SLEEP_TIMER;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = ret;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_spaudio_mode_ack(uint8_t mode)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_SPAUDIO_MODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = mode;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_imaudio_mode_ack(uint8_t mode)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_IMAUDIO_MODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = mode;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_focus_mode_ack(uint8_t mode)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_FOCUS_MODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = mode;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_trans_mode_ack(uint8_t mode)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_TRANS_MODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = mode;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_ear_side(uint8_t is_right)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = 0xff;
+    _tx_buf[i++] = 0xff;
+    _tx_buf[i++] = is_right;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_set_rec_mode_ack(uint8_t mode)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_SET_REC_MODE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = mode;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_ctrl_asvoice_ack(uint8_t op)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_CTRL_ASVOICE;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = op;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_asvoice_datas(uint8_t* datas, uint8_t len)
+{
+
+    uint8_t i = 0;
+    uint8_t j;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_CTRL_ASVOICE;
+    _tx_buf[i++] = len;
+    for(j = 0; j < len; j++){
+        _tx_buf[i++] = datas[j];
+    }
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_query_pair_devs_ack(uint8_t* datas, uint8_t len)
+{
+
+    uint8_t i = 0;
+    uint8_t j;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_QUERY_PAIR_DEVS;
+    _tx_buf[i++] = len;
+    for(j = 0; j < len; j++){
+        _tx_buf[i++] = datas[j];
+    }
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_del_pair_dev_ack(uint8_t ret)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_DEL_PAIR_DEV;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = ret;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_ch_pair_dev_ack(uint8_t ret)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_CH_PAIR_DEV;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = ret;
+
+    _tx_len = i;
+    _send();
+
+}
+
+
+void com_dec_send_ch_bt_name_ack(uint8_t ret)
+{
+
+    uint8_t i = 0;
+
+    _tx_buf[i++] = COM_DEC_DEV_TO_APP;
+    _tx_buf[i++] = COM_DEC_CMD_CH_BT_NAME;
+    _tx_buf[i++] = 1;
+    _tx_buf[i++] = ret;
+
+    _tx_len = i;
+    _send();
+
+}
+
 

+ 50 - 0
src/hlw2025141/app/projects/earphone/com/com_dec.h

@@ -49,6 +49,31 @@
 
 #define COM_DEC_CMD_IOS_DISC                (0x47)
 
+#define COM_DEC_CMD_SET_NOISE_RDMODE        (0x60)
+#define COM_DEC_CMD_GET_NOISE_RDMODE        (0x61)
+
+#define COM_DEC_CMD_SET_FIND_FUNC           (0x62)
+
+#define COM_DEC_CMD_SET_SLEEP_MODE          (0x63)
+#define COM_DEC_CMD_GET_SLEEP_MODE          (0x64)
+#define COM_DEC_CMD_SET_SLEEP_TIMER         (0x65)
+
+#define COM_DEC_CMD_SET_SPAUDIO_MODE        (0x80)
+#define COM_DEC_CMD_SET_IMAUDIO_MODE        (0x81)
+
+#define COM_DEC_CMD_SET_FOCUS_MODE          (0x86)
+
+#define COM_DEC_CMD_SET_TRANS_MODE          (0x51)
+#define COM_DEC_CMD_SET_REC_MODE            (0x52)
+
+#define COM_DEC_CMD_CTRL_ASVOICE            (0x87)
+
+#define COM_DEC_CMD_QUERY_PAIR_DEVS         (0x89)
+#define COM_DEC_CMD_DEL_PAIR_DEV            (0x8a)
+#define COM_DEC_CMD_CH_PAIR_DEV             (0x8b)
+
+#define COM_DEC_CMD_CH_BT_NAME              (0x8c)
+
 
 void com_dec_on_recv(uint8_t* datas, uint16_t len);
 
@@ -91,5 +116,30 @@ void com_dec_send_set_eq_ack(uint8_t id);
 
 void com_dec_send_ios_disc_ack(uint8_t ret);
 
+void com_dec_send_set_noise_rdmode_ack(uint8_t ret);
+void com_dec_send_get_noise_rdmode_ack(uint16_t mode);
+
+void com_dec_send_set_sleep_mode_ack(uint8_t ret);
+void com_dec_send_get_sleep_mode_ack(uint8_t mode);
+void com_dec_send_set_sleep_timer_ack(uint8_t ret);
+
+void com_dec_send_set_spaudio_mode_ack(uint8_t mode);
+void com_dec_send_set_imaudio_mode_ack(uint8_t mode);
+
+void com_dec_send_set_focus_mode_ack(uint8_t mode);
+
+void com_dec_send_set_trans_mode_ack(uint8_t mode);
+void com_dec_send_ear_side(uint8_t is_right);
+void com_dec_send_set_rec_mode_ack(uint8_t mode);
+
+void com_dec_send_ctrl_asvoice_ack(uint8_t op);
+void com_dec_send_asvoice_datas(uint8_t* datas, uint8_t len);
+
+void com_dec_send_query_pair_devs_ack(uint8_t* datas, uint8_t len);
+void com_dec_send_del_pair_dev_ack(uint8_t ret);
+void com_dec_send_ch_pair_dev_ack(uint8_t ret);
+
+void com_dec_send_ch_bt_name_ack(uint8_t ret);
+
 
 #endif