BES客户ble_APP调试

\bthost\service\ble_app\app_main\app_task.c
/**
 ****************************************************************************************
 * @brief Handles reception of all messages sent from the lower layers to the application
 * @param[in] msgid     Id of the message received.
 * @param[in] param     Pointer to the parameters of the message.
 * @param[in] dest_id   ID of the receiving task instance
 * @param[in] src_id    ID of the sending task instance.
 *
 * @return If the message was consumed or not.
 ****************************************************************************************
 */
static int appm_msg_handler(ke_msg_id_t const msgid,
                            void *param,
                            ke_task_id_t const dest_id,
                            ke_task_id_t const src_id)
{
    // Retrieve identifier of the task from received message
    ke_task_id_t src_task_id = MSG_T(msgid);
    // Message policy
    uint8_t msg_pol = KE_MSG_CONSUMED;

    switch (src_task_id)
    {
........
        #if (BLE_APP_DATAPATH_SERVER)
        case (TASK_ID_DATAPATHPS):
        {
            // Call the Data Path Module
            msg_pol = app_get_handler(&app_datapath_server_table_handler, msgid, param, src_id); //--------------------------------------<
        } break;
        #endif //(BLE_APP_DATAPATH_SERVER)
........

    }

    return (msg_pol);
}


/*
 * GLOBAL VARIABLES DEFINITION
 ****************************************************************************************
 */

/* Default State handlers definition. */
KE_MSG_HANDLER_TAB(appm)
{
    /// please add in order of gapm_msg size
    // GAPM messages
    {GAPM_CMP_EVT,                 (ke_msg_func_t)gapm_cmp_evt_handler},
    {GAPM_DEV_BDADDR_IND,          (ke_msg_func_t)gapm_dev_addr_ind_handler},
    {GAPM_ADDR_SOLVED_IND,         (ke_msg_func_t)gapm_addr_solved_ind_handler},
    {GAPM_GEN_RAND_NB_IND,         (ke_msg_func_t)gapm_gen_rand_nb_ind_handler},
    {GAPM_ACTIVITY_CREATED_IND,    (ke_msg_func_t)gapm_activity_created_ind_handler},
    {GAPM_ACTIVITY_STOPPED_IND,    (ke_msg_func_t)gapm_activity_stopped_ind_handler},
    {GAPM_EXT_ADV_REPORT_IND,      (ke_msg_func_t)gapm_adv_report_ind_handler},
    {GAPM_PROFILE_ADDED_IND,       (ke_msg_func_t)gapm_profile_added_ind_handler},

    /// please add in order of gapc_msg size
    // GAPC messages
    {GAPC_CMP_EVT,                 (ke_msg_func_t)gapc_cmp_evt_handler},
    {GAPC_LE_CONNECTION_REQ_IND,   (ke_msg_func_t)gapc_le_connection_req_ind_handler},
    {GAPC_DISCONNECT_IND,          (ke_msg_func_t)gapc_disconnect_ind_handler},
    {GAPC_BT_CONNECTION_REQ_IND,   (ke_msg_func_t)gapc_bt_connection_req_ind_handler},
    {GAPC_MTU_CHANGED_IND,         (ke_msg_func_t)gapc_mtu_changed_ind_handler},
    {GAPC_PEER_ATT_INFO_IND,       (ke_msg_func_t)gapc_peer_att_info_ind_handler},
    {GAPC_PEER_FEATURES_IND,       (ke_msg_func_t)gapc_peer_features_ind_handler},
    {GAPC_GET_DEV_INFO_REQ_IND,    (ke_msg_func_t)gapc_get_dev_info_req_ind_handler},
    {GAPC_SET_DEV_INFO_REQ_IND,    (ke_msg_func_t)gapc_set_dev_info_req_ind_handler},

    {GAPC_PARAM_UPDATE_REQ_IND,    (ke_msg_func_t)gapc_conn_param_update_req_ind_handler},
    {GAPC_PARAM_UPDATED_IND,       (ke_msg_func_t)gapc_conn_param_updated_handler},

    {GAPC_BOND_DATA_UPDATE_IND,    (ke_msg_func_t)gapc_bond_data_update_ind_handler},

    {GAPC_LOC_TX_PWR_IND,          (ke_msg_func_t)gapc_get_local_tx_pwr_ind_handler},
    {GAPC_PEER_TX_PWR_IND,         (ke_msg_func_t)gapc_get_peer_tx_pwr_ind_handler},
    {GAPC_LOC_TX_PWR_REPORT_IND,   (ke_msg_func_t)gapc_local_tx_pwr_repot_ind_handler},
    {GAPC_PEER_TX_PWR_REPORT_IND,  (ke_msg_func_t)gapc_peer_tx_pwr_repot_ind_handler},
    {GAPC_PATH_LOSS_THRESHOLD_IND, (ke_msg_func_t)gapc_peer_path_loss_report_handler},
    {GAPC_SUBRATE_CHANGE_IND,      (ke_msg_func_t)gapc_subrate_change_ind_handler},

    {KE_MSG_DEFAULT_HANDLER,       (ke_msg_func_t)appm_msg_handler},//<---------------
};

\bthost\service\ble_app\app_datapath\app_datapath_server.c
/*
 * LOCAL VARIABLE DEFINITIONS
 ****************************************************************************************
 */

/// Default State handlers definition
const struct ke_msg_handler app_datapath_server_msg_handler_list[] =
{
    // Note: first message is latest message checked by kernel so default is put on top.
    {KE_MSG_DEFAULT_HANDLER,        (ke_msg_func_t)app_datapath_server_msg_handler},

    {DATAPATHPS_TX_CCC_CHANGED,     (ke_msg_func_t)app_datapath_server_tx_ccc_changed_handler},
    {DATAPATHPS_TX_DATA_SENT,       (ke_msg_func_t)app_datapath_server_tx_data_sent_handler},
    {DATAPATHPS_RX_DATA_RECEIVED,   (ke_msg_func_t)app_datapath_server_rx_data_received_handler},
    {DATAPATHPS_NOTIFICATION_RECEIVED, (ke_msg_func_t)app_datapath_server_rx_data_received_handler},
};


const struct app_subtask_handlers app_datapath_server_table_handler =
    {&app_datapath_server_msg_handler_list[0], (sizeof(app_datapath_server_msg_handler_list)/sizeof(struct ke_msg_handler))};

\bthost\service\ble_app\app_datapath\app_datapath_server.c
static int app_datapath_server_rx_data_received_handler(ke_msg_id_t const msgid,
                              struct ble_datapath_rx_data_ind_t *param,
                              ke_task_id_t const dest_id,
                              ke_task_id_t const src_id)
{
    // loop back the received data
    app_datapath_server_send_data_via_notification(param->data, param->length);

    TRACE(2,"%s length %d", __func__, param->length);
    //DUMP8("%02x ", (param->data+i), len);

#ifndef __INTERCONNECTION__
    BLE_custom_command_receive_data(param->data, param->length);//ble客制app数据接收函数
#endif

    if (NULL != rx_done_callback)
    {
        rx_done_callback(param->data, param->length);
    }

    if(dp_event_callback)
    {
        app_dp_rec_data_msg_t data_msg;
        data_msg.data     = param->data;
        data_msg.data_len = param->length;
        dp_event_callback(DP_DATA_RECEIVED, (ble_if_app_dp_param_u *)&data_msg);
    }

    return (KE_MSG_CONSUMED);
}

BLE_CUSTOM_CMD_RET_STATUS_E BLE_custom_command_receive_data(uint8_t* ptrData, uint32_t dataLength)

app_ble_cmd_handler.c
BLE_CUSTOM_CMD_RET_STATUS_E BLE_custom_command_receive_data(uint8_t* ptrData, uint32_t dataLength)
{
    TRACE(1,"%s Receive length %d data: ", __func__,dataLength);
    DUMP8("0x%02x ", ptrData, dataLength);

    app_custom_receive_data_handle(ptrData,dataLength);//客制app数据接收处理函数

    return NO_ERROR;
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值