cun
This commit is contained in:
@ -44,7 +44,7 @@
|
||||
#define SUPPORT_TEST_BOX_BLE_MASTER_TEST_EN 0 // 是否支持测试盒BLE主设备测试
|
||||
#define SHOW_RX_DATA_RATE 1 // 是否显示接收数据速率
|
||||
#define SHOW_TX_DATA_RATE 1 // 是否显示发送数据速率
|
||||
#define XTELL_DEBUG 0
|
||||
#define XTELL_DEBUG 1
|
||||
|
||||
// 日志打印宏
|
||||
#if XTELL_DEBUG == 1
|
||||
@ -500,6 +500,25 @@ void rcsp_adv_fill_mac_addr(u8 *mac_addr_buf)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 发送数据给server
|
||||
*
|
||||
* @param data
|
||||
* @param length
|
||||
*/
|
||||
void g_send_data_to_ble_server(const u8* data, u16 length){
|
||||
// 检查数据长度是否有效
|
||||
if (length == 0 || length > 512) {
|
||||
printf("Error: Data length %d is out of range (1-512)\n", length);
|
||||
return;
|
||||
}
|
||||
int ret = client_operation_send(default_client_write_handle, data, length, ATT_OP_WRITE_WITHOUT_RESPOND);
|
||||
if(ret == 0){
|
||||
printf("success: send data to server\n");
|
||||
return;
|
||||
}
|
||||
printf("error: send data to server\n");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static u8 new_device_name[MAIN_BOARD_MAC_ADDR_LENGTH] = {0};
|
||||
@ -1022,7 +1041,7 @@ opt_end:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 协议栈上报搜索结果的回调
|
||||
* @brief 协议栈上报搜索结果的回调,内部调用
|
||||
* @param result_info 搜索结果,为-1时表示搜索完成
|
||||
*/
|
||||
void user_client_report_search_result(search_result_t *result_info)
|
||||
@ -1641,13 +1660,16 @@ static void default_event_callback(le_client_event_e event, u8 *packet, int size
|
||||
log_info("CLI_EVENT_SEARCH_PROFILE_COMPLETE\n");
|
||||
if ((!test_client_timer) && default_client_write_handle) {
|
||||
log_info("test timer_add\n");
|
||||
test_client_timer = sys_hi_timer_add(0, default_test_write, 500);
|
||||
// test_client_timer = sys_hi_timer_add(0, default_test_write, 500); //xtell
|
||||
extern void test_func_main(void);
|
||||
test_func_main();
|
||||
}
|
||||
break;
|
||||
|
||||
case CLI_EVENT_CONNECTED:
|
||||
connect_state = 1;
|
||||
log_info("<<<<<<<<<< BLE Connection Successful! >>>>>>>>>>\n");
|
||||
|
||||
break;
|
||||
|
||||
case CLI_EVENT_DISCONNECT:
|
||||
@ -1665,7 +1687,7 @@ static void default_event_callback(le_client_event_e event, u8 *packet, int size
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
@ -49,4 +49,12 @@ extern void g_ble_connect_new_device(char* name);
|
||||
* @return //0:连接断开; 1:连接成功
|
||||
*/
|
||||
extern u8 g_ble_get_state(void);
|
||||
|
||||
/**
|
||||
* @brief 发送数据给server
|
||||
*
|
||||
* @param data
|
||||
* @param length
|
||||
*/
|
||||
void g_send_data_to_ble_server(const u8* data, u16 length);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user