GATT MESH笔记

串口接收数据处理位置:

//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);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值