串口接收数据处理位置:
//src\app\rtk_mesh\provisioner\provisioner_app.c
/**
* @brief All the application messages are pre-handled in this function
* @note All the IO MSGs are sent to this function, then the event handling
* function shall be called according to the MSG type.
* @param[in] io_msg IO message data
* @return void
*/
void app_handle_io_msg(T_IO_MSG io_msg)
{
uint16_t msg_type = io_msg.type;
switch (msg_type)
{
case IO_MSG_TYPE_BT_STATUS:
app_handle_gap_msg(&io_msg);
break;
case IO_MSG_TYPE_UART:
{//*******************该位置处理串口接收的数据
/* We handle user command informations from Data UART in this branch. */
uint8_t data = io_msg.subtype;
user_cmd_collect(&data, sizeof(data), provisioner_cmd_table);
}
break;
case DFU_SERVER_TIMEOUT_MSG:
dfu_server_adv_send();
default:
break;
}
}
串口打印函数:
APP_PRINT_INFO0("GAP stack ready");
APP_PRINT_INFO5("GAP_CONN_STATE_CONNECTED:remote_bd %s, remote_addr_type %d, conn_interval 0x%x, conn_latency 0x%x, conn_supervision_timeout 0x%x", TRACE_BDADDR(app_link_table[conn_id].bd_addr), app_link_table[conn_id].bd_type, conn_interval, conn_latency, conn_supervision_timeout);
data_uart_debug("bt addr: 0x%02x%02x%02x%02x%02x%02x\r\n>",
bt_addr[5], bt_addr[4], bt_addr[3],
bt_addr[2], bt_addr[1], bt_addr[0]);
data_uart_debug("Disconnect conn_id %d\r\n", conn_id);
data_uart_debug("udb=");
data_uart_dump(pinfo_data->provision->dev_uuid, 16);
mesh网络发送数据:
typedef enum
{
MESH_BEARER_ADV = BIT0,
MESH_BEARER_GATT = BIT1,
MESH_BEARER_ALL = BIT0 | BIT1,
} mesh_bearer_t;
/**
* @brief send network message
* @param[in] bearer: message bearer
* @param[in] dst: destination address
* @param[in] pmesh_msg: network message
* @return send result
*/
bool net_send(mesh_bearer_t bearer, uint16_t dst, uint8_t *pdata, uint16_t data_len);