Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JL_jiancetai
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
梁百峰
JL_jiancetai
Commits
f40121f0
Commit
f40121f0
authored
Jan 13, 2026
by
梁百峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:wifi投屏与蓝牙音乐工程
parent
fadd406c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
201 additions
and
27 deletions
+201
-27
app_main.c
...2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/app_main.c
+20
-12
app_uart.c
...2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/app_uart.c
+82
-0
app_uart.h
...2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/app_uart.h
+3
-0
a2dp_play.c
...3/fw-AC792_SDK/sdk/apps/wifi_soundbox/mode/bt/a2dp_play.c
+3
-0
bt.c
...25-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/mode/bt/bt.c
+3
-1
bt_emitter.c
.../fw-AC792_SDK/sdk/apps/wifi_soundbox/mode/bt/bt_emitter.c
+17
-10
wifi_demo.c
...025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/wifi_demo.c
+73
-4
No files found.
AC792N_SDK_BETA_V3.0.11_2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/app_main.c
View file @
f40121f0
...
...
@@ -20,7 +20,7 @@
#if (THIRD_PARTY_PROTOCOLS_SEL & MULTI_BOX_ADV_EN)
#include "multi_box_adv/multi_box_adv.h"
#endif
#include "app_uart.h"
/*中断列表 */
const
struct
irq_info
irq_info_table
[]
=
{
//中断号 //优先级0-7 //注册的cpu(0或1)
...
...
@@ -348,12 +348,12 @@ void jiancetai_main_task(void)
if
(
main_task_10ms
%
100
==
0
)
{
if
(
testflag
==
1
)
if
(
testflag
==
1
&&
Switch_indicator
==
1
)
{
printf
(
"jiancetai_main_task testflag = 1"
);
testflag
=
2
;
//
bt_search_device();
bt_search_device
();
}
// wifi_demo_example();
// printf("Hello World!!!\n");
...
...
@@ -367,7 +367,7 @@ void jiancetai_main_task(void)
app_mode_change_next
();
app_default_volume_change_handler
(
1
);
os_time_dly
(
20
);
//
wifi_demo_init();
wifi_demo_init
();
}
// if(click1111 == 0)
// {
...
...
@@ -391,8 +391,8 @@ void app_main(void)
puts
(
"------------- wifi_soundbox app main-------------
\n
"
);
// extern void bt_search_device(void);
#ifdef USE_LVGL_V8_UI_DEMO
int
lvgl_main_task_init
(
void
);
lvgl_main_task_init
();
//
int lvgl_main_task_init(void);
//
lvgl_main_task_init();
#endif
int
ret
=
play_tone_file_callback
(
get_tone_files
()
->
power_on
,
NULL
,
poweron_tone_play_end_callback
);
...
...
@@ -400,5 +400,13 @@ void app_main(void)
poweron_tone_play_end_callback
(
NULL
,
STREAM_EVENT_STOP
);
}
thread_fork
(
"jiancetai_main_task"
,
18
,
8
*
1024
,
1024
,
&
jiancetai_main_task_pid
,
jiancetai_main_task
,
NULL
);
ret
=
thread_fork
(
"uart_app_task"
,
20
,
2048
*
2
,
0
,
0
,
app_uart_task
,
NULL
);
if
(
ret
<
0
)
{
printf
(
"uart_app_task create err: %d
\n
"
,
ret
);
}
else
{
printf
(
"uart_app_task create success
\n
"
);
}
}
AC792N_SDK_BETA_V3.0.11_2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/app_uart.c
View file @
f40121f0
...
...
@@ -15,7 +15,21 @@ static void *uart_hdl = NULL;
/* 任务相关变量 */
static
u8
uart_task_running
=
0
;
uint8_t
Yadea_Mac_Addr
[
6
]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
uint8_t
Switch_indicator
=
0
;
int
Uart_Data_Analysis
(
u8
*
data
)
{
if
(
data
[
0
]
==
0x59
&&
data
[
1
]
==
0x44
&&
data
[
15
]
==
0x4B
&&
data
[
16
]
==
0x4A
)
{
memcpy
(
Yadea_Mac_Addr
,
&
data
[
9
],
6
);
Switch_indicator
=
data
[
8
];
printf
(
"Yadea_Mac_Addr:%02x:%02x:%02x:%02x:%02x:%02x, Switch_indicator:%d
\n
"
,
Yadea_Mac_Addr
[
0
],
Yadea_Mac_Addr
[
1
],
Yadea_Mac_Addr
[
2
],
Yadea_Mac_Addr
[
3
],
Yadea_Mac_Addr
[
4
],
Yadea_Mac_Addr
[
5
],
Switch_indicator
);
}
}
static
int
uart_read_timeout_cb
(
void
)
{
// printf("UART read timeout callback\n");
...
...
@@ -59,3 +73,71 @@ static int uart_device_init(void)
printf
(
"---> uart1 init success
\n
"
);
return
0
;
}
void
app_uart_task
(
void
*
param
)
{
int
len
;
u8
recv_buf
[
64
];
u32
cbuf_data_cnt
=
0
;
printf
(
"---> uart_app_task running
\n
"
);
// 初始化UART设备
if
(
uart_device_init
()
!=
0
)
{
printf
(
"uart device init failed!
\n
"
);
return
;
}
uart_task_running
=
1
;
// 主循环
while
(
uart_task_running
)
{
// 获取串口循环buf中已接收到未被取走的数据的累计值
dev_ioctl
(
uart_hdl
,
IOCTL_UART_GET_RECV_CNT
,
(
u32
)
&
cbuf_data_cnt
);
// 接收数据
len
=
dev_read
(
uart_hdl
,
recv_buf
,
sizeof
(
recv_buf
));
if
(
len
>
0
)
{
// printf("uart recv len = %d\n", len);
// 打印接收到的数据(十六进制格式,便于调试)
// printf("recv data: ");
// for (int i = 0; i < len && i < 16; i++) { // 只打印前16个字节
// printf("%02X ", recv_buf[i]);
// }
// if (len > 16) printf("...");
// printf("\n");
// 将接收到的数据添加到接收缓冲区
Uart_Data_Analysis
(
recv_buf
);
}
else
if
(
len
==
0
)
{
// 没有数据,短暂延时
os_time_dly
(
1
);
}
else
{
// 处理错误情况
if
(
len
==
UART_CIRCULAR_BUFFER_WRITE_OVERLAY
)
{
printf
(
"UART_CIRCULAR_BUFFER_WRITE_OVERLAY...
\n
"
);
// 如果循环buf接收到的数据未来得及取走,出现回卷覆盖,则冲掉循环buf所有数据重新接收
dev_ioctl
(
uart_hdl
,
IOCTL_UART_FLUSH
,
0
);
}
else
if
(
len
==
UART_RECV_TIMEOUT
)
{
// printf("UART_RECV_TIMEOUT...\n"); // 不打印超时,避免日志过多
}
else
if
(
len
==
UART_RECV_EXIT
)
{
// printf("UART_RECV_EXIT...\n");
// 收到退出信号,可能是因为超时回调返回0,尝试继续接收
}
else
{
printf
(
"uart recv error: %d
\n
"
,
len
);
}
// 短暂延时后继续
os_time_dly
(
1
);
}
}
// 关闭UART设备
if
(
uart_hdl
)
{
dev_close
(
uart_hdl
);
uart_hdl
=
NULL
;
}
printf
(
"uart_app_task exit
\n
"
);
}
\ No newline at end of file
AC792N_SDK_BETA_V3.0.11_2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/app_uart.h
View file @
f40121f0
...
...
@@ -11,4 +11,7 @@
#define TX_BUFFER_SIZE 600 // 发送缓冲区大小
#define PROTOCOL_BUF_SIZE 4096 // 协议缓冲区大小
extern
uint8_t
Yadea_Mac_Addr
[
6
];
extern
uint8_t
Switch_indicator
;
void
app_uart_task
(
void
*
param
);
#endif
AC792N_SDK_BETA_V3.0.11_2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/mode/bt/a2dp_play.c
View file @
f40121f0
...
...
@@ -57,6 +57,8 @@ static void a2dp_play_close(u8 *bt_addr)
{
log_info
(
"a2dp_play_close"
);
/* put_buf(bt_addr, 6); */
put_buf
(
bt_addr
,
6
);
printf
(
"IN here close a2dp_play_close"
);
rf_coexistence_scene_exit
(
RF_COEXISTENCE_SCENE_A2DP_PLAY
);
a2dp_player_close
(
bt_addr
);
bt_stop_a2dp_slience_detect
(
bt_addr
);
...
...
@@ -507,6 +509,7 @@ static int a2dp_bt_hci_event_handler(void *evt)
switch
(
event
->
event
)
{
case
HCI_EVENT_DISCONNECTION_COMPLETE
:
a2dp_play_close
(
event
->
args
);
system_soft_reset
();
break
;
}
...
...
AC792N_SDK_BETA_V3.0.11_2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/mode/bt/bt.c
View file @
f40121f0
...
...
@@ -201,6 +201,7 @@ static void bt_connect_vol_sync(void *p)
/*
* 对应原来的状态处理函数,连接,电话状态等
*/
extern
uint8_t
click1111
;
static
int
bt_connction_status_event_handler
(
void
*
evt
)
{
struct
bt_event
*
bt
=
(
struct
bt_event
*
)
evt
;
...
...
@@ -216,6 +217,7 @@ static int bt_connction_status_event_handler(void *evt)
bt_clear_current_poweron_memory_search_index
(
0
);
case
BT_STATUS_FIRST_CONNECTED
:
log_info
(
"BT_STATUS_CONNECTED"
);
click1111
=
1
;
#if TCFG_USER_TWS_ENABLE
bt_tws_phone_connected
();
#endif
...
...
@@ -989,7 +991,7 @@ static int bt_key_event_handler(struct key_event *key)
{
int
ret
=
FALSE
;
printf
(
"
\n
=============%s==========%d,key->action:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
key
->
action
);
//
printf("\n =============%s==========%d,key->action:%d\n",__FUNCTION__,__LINE__,key->action);
switch
(
key
->
action
)
{
case
KEY_EVENT_CLICK
:
ret
=
bt_key_click
(
key
);
...
...
AC792N_SDK_BETA_V3.0.11_2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/mode/bt/bt_emitter.c
View file @
f40121f0
...
...
@@ -16,7 +16,7 @@
#define LOG_INFO_ENABLE
#define LOG_CLI_ENABLE
#include "debug.h"
#include "app_uart.h"
// #if TCFG_USER_EMITTER_ENABLE
#define BT_EMITTER_TEST 0
...
...
@@ -132,14 +132,14 @@ void emitter_bt_connect(u8 *mac)
#if (SEARCH_LIMITED_MODE == SEARCH_BD_ADDR_LIMITED)
static
const
u8
bd_addr_filt
[][
6
]
=
{
{
0x0
1
,
0x02
,
0x03
,
0x04
,
0x85
,
0x06
},
/*S10_H*/
{
0xA7
,
0xDD
,
0x05
,
0xDD
,
0x1F
,
0x00
},
/*ST-001*/
{
0xE9
,
0x73
,
0x13
,
0xC0
,
0x1F
,
0x00
},
/*HBS 730*/
{
0x38
,
0x7C
,
0x78
,
0x1C
,
0xFC
,
0x02
},
/*Bluetooth*/
{
0xF4
,
0xF6
,
0x7E
,
0x1B
,
0x1B
,
0xBE
},
/*792*/
{
0x3B
,
0x6E
,
0x37
,
0xEB
,
0x66
,
0x89
},
/*7106*/
{
0x24
,
0xE8
,
0xCC
,
0xB7
,
0x16
,
0xCE
},
/*7106 customer*/
static
u8
bd_addr_filt
[][
6
]
=
{
{
0x0
0
,
0x00
,
0x20
,
0x59
,
0xA8
,
0xC1
},
/*S10_H*/
//
{0xA7, 0xDD, 0x05, 0xDD, 0x1F, 0x00}, /*ST-001*/
//
{0xE9, 0x73, 0x13, 0xC0, 0x1F, 0x00}, /*HBS 730*/
//
{0x38, 0x7C, 0x78, 0x1C, 0xFC, 0x02}, /*Bluetooth*/
//
{0xF4, 0xF6, 0x7E, 0x1B, 0x1B, 0xBE}, /*792*/
//
{0x3B, 0x6E, 0x37, 0xEB, 0x66, 0x89}, /*7106*/
//
{0x24, 0xE8, 0xCC, 0xB7, 0x16, 0xCE}, /*7106 customer*/
};
/*----------------------------------------------------------------------------*/
...
...
@@ -153,7 +153,14 @@ static u8 search_bd_addr_filt(const u8 *addr)
{
log_info
(
"bd_addr:"
);
log_info_hexdump
(
addr
,
6
);
bd_addr_filt
[
0
][
0
]
=
Yadea_Mac_Addr
[
5
];
bd_addr_filt
[
0
][
1
]
=
Yadea_Mac_Addr
[
4
];
bd_addr_filt
[
0
][
2
]
=
Yadea_Mac_Addr
[
3
];
bd_addr_filt
[
0
][
3
]
=
Yadea_Mac_Addr
[
2
];
bd_addr_filt
[
0
][
4
]
=
Yadea_Mac_Addr
[
1
];
bd_addr_filt
[
0
][
5
]
=
Yadea_Mac_Addr
[
0
];
printf
(
"bd_addr_filt:"
);
printf
(
"%02x %02x %02x %02x %02x %02x"
,
bd_addr_filt
[
0
][
0
],
bd_addr_filt
[
0
][
1
],
bd_addr_filt
[
0
][
2
],
bd_addr_filt
[
0
][
3
],
bd_addr_filt
[
0
][
4
],
bd_addr_filt
[
0
][
5
]);
for
(
u8
i
=
0
;
i
<
(
sizeof
(
bd_addr_filt
)
/
sizeof
(
bd_addr_filt
[
0
]));
i
++
)
{
if
(
memcmp
(
addr
,
bd_addr_filt
[
i
],
6
)
==
0
)
{
log_info
(
"bd_addr match: %d"
,
i
);
...
...
AC792N_SDK_BETA_V3.0.11_2025-12-23/fw-AC792_SDK/sdk/apps/wifi_soundbox/wifi_demo.c
View file @
f40121f0
...
...
@@ -22,7 +22,7 @@
#define LOG_CLI_ENABLE
#include "debug.h"
#include "fs/fs.h"
#include "app_uart.h"
// 全局图片数据缓存区
#define MAX_IMAGE_SIZE 1024*120 // 最大图片大小1MB
static
uint8_t
image_cache
[
MAX_IMAGE_SIZE
];
...
...
@@ -104,7 +104,9 @@ uint16_t crc16(uint8_t *puchMsg, uint32_t usDataLen)
#define UDP_SEND_INTERVAL 1000 // 发送间隔1秒
#define UDP_DATA_SIZE 1000 // UDP数据长度1000字节
#define UDP_PACKET_SIZE 1024 // UDP单包发送大小4K字节
uint8_t
sta_ssid
[
14
];
uint8_t
sta_password
[
24
];
uint8_t
wifi_mac
[
6
];
// WiFi状态标志
static
u8
wifi_initialized
=
0
;
static
u8
wifi_connected
=
0
;
...
...
@@ -147,7 +149,73 @@ static void tcp_send_task(void *arg);
// TCP接收任务函数声明
static
void
tcp_recv_task
(
void
*
arg
);
/**
* @brief 从蓝牙MAC地址计算WiFi MAC地址
* @param bt_mac 蓝牙MAC地址 (6字节数组)
* @param wifi_mac 输出的WiFi MAC地址 (6字节数组)
*/
static
void
bt_mac_to_wifi_mac_internal
(
const
u8
*
bt_mac
,
u8
*
wifi_mac
)
{
if
(
!
bt_mac
||
!
wifi_mac
)
{
return
;
}
// 复制蓝牙MAC地址
memcpy
(
wifi_mac
,
bt_mac
,
6
);
// 第1字节(索引1)加0x82
wifi_mac
[
1
]
=
bt_mac
[
1
]
+
0x82
;
// 根据第5字节(索引5)的最低位决定第0字节
if
((
bt_mac
[
5
]
&
0x01
)
==
0x01
)
{
wifi_mac
[
0
]
=
0xC4
;
}
else
{
wifi_mac
[
0
]
=
0xC0
;
}
}
/**
* @brief 根据蓝牙MAC地址生成WiFi参数
* @param bt_mac 蓝牙MAC地址 (6字节数组)
*/
static
void
generate_wifi_params_from_bt_mac
(
const
u8
*
bt_mac
)
{
if
(
!
bt_mac
)
{
log_error
(
"E01:BT_MAC_NULL"
);
// 蓝牙MAC地址为空
return
;
}
// 保存蓝牙MAC地址
memcpy
(
wifi_mac
,
bt_mac
,
6
);
// 从蓝牙MAC计算WiFi MAC
bt_mac_to_wifi_mac_internal
(
bt_mac
,
wifi_mac
);
// 生成WiFi SSID: YD + 后4字节MAC + ICM(使用WiFi MAC的后4字节)
snprintf
(
sta_ssid
,
sizeof
(
sta_ssid
),
"YD%02X%02X%02X%02XICM"
,
wifi_mac
[
2
],
wifi_mac
[
3
],
wifi_mac
[
4
],
wifi_mac
[
5
]);
// 生成WiFi密码: Yadea@ + 蓝牙MAC地址(第1字节加0x82)
snprintf
(
sta_password
,
sizeof
(
sta_password
),
"Yadea@%02X:%02X:%02X:%02X:%02X:%02X"
,
bt_mac
[
0
],
((
bt_mac
[
1
]
+
0x82
)
&
0xFF
),
bt_mac
[
2
],
bt_mac
[
3
],
bt_mac
[
4
],
bt_mac
[
5
]);
// // 生成P2P设备名: YD- + 后4字节MAC + ICM(使用WiFi MAC的后4字节)
// snprintf(wifi_state.generated_p2p_name, sizeof(wifi_state.generated_p2p_name),
// "YD-%02X%02X%02X%02XICM", wifi_mac[2], wifi_mac[3],
// wifi_mac[4], wifi_mac[5]);
// wifi_state.params_generated = true;
log_info
(
"I01:PARAM_GEN:SSID=%s,PWD=%s"
,
sta_ssid
,
sta_password
);
// WiFi参数生成完成
}
void
Generate_WiFi_parameters
(
uint8_t
*
Mac_Addr
)
{
uint8_t
Wifi_Mac
[
6
]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
memcpy
(
Wifi_Mac
,
Mac_Addr
,
6
);
Wifi_Mac
[
1
]
-=
0x80
;
generate_wifi_params_from_bt_mac
(
Wifi_Mac
);
}
// 扫描控制结构体
static
OS_SEM
scan_sem
;
static
u8
scan_sem_flag
=
0
;
...
...
@@ -334,7 +402,8 @@ int wifi_demo_init(void)
wifi_initialized
=
1
;
log_info
(
"WiFi初始化成功"
);
wifi_demo_connect_sta
(
DEFAULT_STA_SSID
,
DEFAULT_STA_PASSWORD
);
Generate_WiFi_parameters
(
Yadea_Mac_Addr
);
wifi_demo_connect_sta
(
sta_ssid
,
sta_password
);
return
0
;
}
...
...
@@ -557,7 +626,7 @@ void wifi_demo_example(void)
// 3. 连接默认WiFi
log_info
(
"尝试连接默认WiFi网络..."
);
if
(
wifi_demo_connect_sta
(
DEFAULT_STA_SSID
,
DEFAULT_STA_PASSWORD
)
==
0
)
{
if
(
wifi_demo_connect_sta
(
sta_ssid
,
sta_password
)
==
0
)
{
log_info
(
"WiFi连接请求已发送"
);
// 等待连接结果(实际应用中应该使用事件回调)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment