当前位置: 首页>>代码示例>>C++>>正文


C++ KE_MSG_ALLOC函数代码示例

本文整理汇总了C++中KE_MSG_ALLOC函数的典型用法代码示例。如果您正苦于以下问题:C++ KE_MSG_ALLOC函数的具体用法?C++ KE_MSG_ALLOC怎么用?C++ KE_MSG_ALLOC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了KE_MSG_ALLOC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gatt_handle_value_cfm_handler

/**
 ****************************************************************************************
 * @brief Handles @ref GATT_HANDLE_VALUE_CFM message meaning that Measurement indication
 * has been correctly sent to peer device.
 *
 * Convey this information to appli task using @ref GLPS_MEAS_SEND_CFM
 *
 * @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 gatt_handle_value_cfm_handler(ke_msg_id_t const msgid,
                                        struct gatt_handle_value_cfm const *param,
                                        ke_task_id_t const dest_id,
                                        ke_task_id_t const src_id)
{
    // verify if indication should be conveyed to application task
    if(glps_env.racp_ind_src == glps_env.con_info.appid)
    {
        // send completed information to APP task
        struct glps_req_cmp_evt * cmp_evt = KE_MSG_ALLOC(GLPS_REQ_CMP_EVT, glps_env.con_info.appid,
                                                     TASK_GLPS, glps_req_cmp_evt);

        cmp_evt->conhdl     = glps_env.con_info.conhdl;
        cmp_evt->request    = GLPS_SEND_RACP_RSP_IND_CMP;
        cmp_evt->status     = param->status;

        ke_msg_send(cmp_evt);
    }
    return (KE_MSG_CONSUMED);
}
开发者ID:nephen,项目名称:BluetoothLamp,代码行数:34,代码来源:glps_task.c

示例2: pasps_send_cmp_evt

void pasps_send_cmp_evt(ke_task_id_t src_id, ke_task_id_t dest_id, uint16_t conhdl,
                        uint8_t operation, uint8_t status)
{
    // Come back to the Connected state if the state was busy.
    if (ke_state_get(src_id) == PASPS_BUSY)
    {
        ke_state_set(src_id, PASPS_CONNECTED);
    }

    // Send the message to the application
    struct pasps_cmp_evt *evt = KE_MSG_ALLOC(PASPS_CMP_EVT,
                                             dest_id, src_id,
                                             pasps_cmp_evt);

    evt->conhdl      = conhdl;
    evt->operation   = operation;
    evt->status      = status;

    ke_msg_send(evt);
}
开发者ID:nephen,项目名称:BluetoothLamp,代码行数:20,代码来源:pasps.c

示例3: gatt_write_char_rsp_handler

/**
 ****************************************************************************************
 * @brief Handles reception of the @ref GATT_WRITE_CHAR_RESP message.
 * Generic event received after every simple write command sent to peer server.
 * @param[in] msgid Id of the message received (probably unused).
 * @param[in] param Pointer to the parameters of the message.
 * @param[in] dest_id ID of the receiving task instance (probably unused).
 * @param[in] src_id ID of the sending task instance.
 * @return If the message was consumed or not.
 ****************************************************************************************
 */
static int gatt_write_char_rsp_handler(ke_msg_id_t const msgid,
                                       struct gatt_write_char_resp const *param,
                                       ke_task_id_t const dest_id,
                                       ke_task_id_t const src_id)
{
    // Get the address of the environment
    struct htpc_env_tag *htpc_env = PRF_CLIENT_GET_ENV(dest_id, htpc);

    struct htpc_wr_char_rsp *wr_cfm = KE_MSG_ALLOC(HTPC_WR_CHAR_RSP,
                                                   htpc_env->con_info.appid, dest_id,
                                                   htpc_wr_char_rsp);

    wr_cfm->conhdl    = htpc_env->con_info.conhdl;
    //it will be a GATT status code
    wr_cfm->status    = param->status;
    // send the message
    ke_msg_send(wr_cfm);

    return (KE_MSG_CONSUMED);
}
开发者ID:nephen,项目名称:BluetoothLamp,代码行数:31,代码来源:htpc_task.c

示例4: app_proxr_enable

void app_proxr_enable(void)
{
		
    // Allocate the message
    struct proxr_enable_req * req = KE_MSG_ALLOC(PROXR_ENABLE_REQ, TASK_PROXR, TASK_APP,
                                                 proxr_enable_req);

  	// init application alert state
		app_proxr_alert_stop();
	
    // Fill in the parameter structure
        req->conhdl = app_env.conhdl;
		req->sec_lvl = PERM(SVC, ENABLE);
		req->lls_alert_lvl = (uint8_t) alert_state.ll_alert_lvl;  
		req->txp_lvl = alert_state.txp_lvl; 
	
    // Send the message
    ke_msg_send(req);

}
开发者ID:imGit,项目名称:DA14580,代码行数:20,代码来源:app_proxr.c

示例5: app_adc_notify_enable

void app_adc_notify_enable(void)
{
		
    // Allocate the message
    struct adc_notify_enable_req* req = KE_MSG_ALLOC(ADC_NOTIFY_ENABLE_REQ, TASK_ADC_NOTIFY, TASK_APP,
                                                 adc_notify_enable_req);
  	
    req->conhdl = app_env.conhdl;
	req->sec_lvl = PERM(SVC, ENABLE);
    
	adc_init(GP_ADC_SE, ADC_POLARITY_UNSIGNED); // Single ended mode
	adc_enable_channel(ADC_CHANNEL_P01);  //
    
    req->adc_notify_val = SWAP(adc_get_sample());//dummy value
    req->feature = 0x00; //client CFG notif/ind disable
    
    // Send the message
    ke_msg_send(req);

}
开发者ID:Samwuzhitao,项目名称:My_DA14580_SPS,代码行数:20,代码来源:app_adc_notify.c

示例6: gapm_device_ready_ind_handler

/**
 ****************************************************************************************
 * @brief Handles ready indication from the GAP. - Reset the stack
 *
 * @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 (TASK_GAP).
 * @param[in] src_id    ID of the sending task instance.
 *
 * @return If the message was consumed or not.
 ****************************************************************************************
 */
int gapm_device_ready_ind_handler(ke_msg_id_t const msgid,
                                         void const *param,
                                         ke_task_id_t const dest_id,
                                         ke_task_id_t const src_id)
{
    if (ke_state_get(dest_id) == APP_DISABLED) {
        // reset the lower layers.
        struct gapm_reset_cmd* cmd = KE_MSG_ALLOC(GAPM_RESET_CMD, TASK_GAPM, TASK_APP,
                                                  gapm_reset_cmd);

        cmd->operation = GAPM_RESET;
        ke_msg_send(cmd);
    }
    else {
        // APP_DISABLED state is used to wait the GAP_READY_EVT message
        ASSERT_ERR(0);
    }

    return (KE_MSG_CONSUMED);
}
开发者ID:GumpYangchh,项目名称:DA14582-Remote-Audio,代码行数:32,代码来源:app_task.c

示例7: bass_disable

void bass_disable(void)
{
    // Counter
    uint8_t i;
    // Information get in the DB
    atts_size_t att_length;
    uint8_t *att_value;

    // Send current configuration to the application
    struct bass_disable_ind *ind = KE_MSG_ALLOC(BASS_DISABLE_IND,
                                                bass_env.con_info.appid, TASK_BASS,
                                                bass_disable_ind);

    ind->conhdl = bass_env.con_info.conhdl;

    for (i = 0; i < bass_env.bas_nb; i++)
    {
        if((bass_env.features[i] & BASS_FLAG_NTF_CFG_BIT)
                                 == BASS_FLAG_NTF_CFG_BIT)
        {
            ind->batt_level_ntf_cfg[i] = PRF_CLI_START_NTF;

            // Reset ntf cfg bit in features
            bass_env.features[i] &= ~BASS_FLAG_NTF_CFG_BIT;
        }
        else
        {
            ind->batt_level_ntf_cfg[i] = PRF_CLI_STOP_NTFIND;
        }

        // Get Battery Level value
        attsdb_att_get_value(bass_env.shdl[i] + BAS_IDX_BATT_LVL_VAL,
                             &att_length, &att_value);
        ind->batt_lvl[i] = *att_value;
    }

    ke_msg_send(ind);

    // Go to idle state
    ke_state_set(TASK_BASS, BASS_IDLE);
}
开发者ID:GurjeetSPannu,项目名称:WearWare-BTLE,代码行数:41,代码来源:bass.c

示例8: app_send_ltk_exch_func

void app_send_ltk_exch_func(struct gapc_bond_req_ind *param)
{
    
    struct gapc_bond_cfm* cfm = KE_MSG_ALLOC(GAPC_BOND_CFM, TASK_GAPC, TASK_APP, gapc_bond_cfm);

    // generate ltk
    app_sec_gen_ltk(param->data.key_size);

    cfm->request = GAPC_LTK_EXCH;

    cfm->accept = true;

    cfm->data.ltk.key_size = app_sec_env.key_size;
    cfm->data.ltk.ediv = app_sec_env.ediv;

    memcpy(&(cfm->data.ltk.randnb), &(app_sec_env.rand_nb) , RAND_NB_LEN);
    memcpy(&(cfm->data.ltk.ltk), &(app_sec_env.ltk) , KEY_LEN);

    ke_msg_send(cfm);

}
开发者ID:xiaomaozi121,项目名称:Portable_PM2.5_Software,代码行数:21,代码来源:app_xAPP_proj.c

示例9: spotar_create_db_cfm_handler

/**
 ****************************************************************************************
 * @brief Handles start indication from the SPOTAR profile.
 *
 * @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 (TASK_GAP).
 * @param[in] src_id    ID of the sending task instance.
 *
 * @return If the message was consumed or not.
 ****************************************************************************************
 */
int spotar_create_db_cfm_handler(ke_msg_id_t const msgid,
                                      struct spotar_create_db_cfm const *param,
                                      ke_task_id_t const dest_id,
                                      ke_task_id_t const src_id)
{
    // If state is not idle, ignore the message
    if (ke_state_get(dest_id) == APP_DB_INIT)
    {						
    
        // Inform the Application Manager
        struct app_module_init_cmp_evt *cfm = KE_MSG_ALLOC(APP_MODULE_INIT_CMP_EVT,
                                                       TASK_APP, TASK_APP,
                                                       app_module_init_cmp_evt);

        cfm->status = param->status;

        ke_msg_send(cfm);
    }

    return (KE_MSG_CONSUMED);
}
开发者ID:FuangCao,项目名称:jwaoo-toy,代码行数:33,代码来源:app_spotar_task.c

示例10: app_hrpc_enable_req

/*
 ****************************************************************************************
 * @brief Start the Heart Rate Collector profile - at connection. *//**
 * @param[in] hrs           Heart Rate Service Content Structure.
 * @param[in] conhdl        Connection handle for which the profile Heart Rate Collector role is enabled.
 * @response  HRPC_ENABLE_CFM
 * @description
 *
 *  This API is used for enabling the Collector role of the Heart Rate profile. This function contains 
 *  BLE connection handle, the connection type and the previously saved discovered HRS details on peer. 
 *  The connection type may be 0 = Connection for discovery/initial configuration or 1 = Normal connection. This 
 *  parameter is used by Application to discover peer device services once at first connection. Application shall save those 
 *  information to reuse them for other connections. During normal connection, previously discovered device 
 *  information can be reused.
 *
 *  This is useful since most use cases allow Heart Rate Sensor to disconnect the link once all measurements have been 
 *  sent to Collector.
 *
 *  If it is a discovery /configuration type of connection, the HRS parameters are useless, they will be filled with 0's. 
 *  Otherwise they will contain pertinent data which will be kept in the Collector environment while enabled. It allows for 
 *  the Application to not be aware of attribute details.
 *
 *  For a normal connection, the response to this request is sent right away after saving the HRS content in the 
 *  environment and registering HRPC in GATT to receive the indications and notifications for the known attribute 
 *  handles in HRS that would be notified/indicated. For a discovery connection, discovery of the peer HRS is started and 
 *  the response will be sent at the end of the discovery with the discovered attribute details. 
 *
 ****************************************************************************************
 */
void app_hrpc_enable_req(struct hrs_content *hrs, uint16_t conhdl)
{
    struct hrpc_enable_req * msg = KE_MSG_ALLOC(HRPC_ENABLE_REQ, KE_BUILD_ID(TASK_HRPC, conhdl), TASK_APP,
                                                 hrpc_enable_req);

    ///Connection handle
    msg->conhdl = conhdl;
    ///Connection type
    if (hrs == NULL)
    {
        msg->con_type = PRF_CON_DISCOVERY;
    }
    else
    {
        msg->con_type = PRF_CON_NORMAL;
        memcpy(&msg->hrs, hrs, sizeof(struct hrs_content));
    }

    // Send the message
    ke_msg_send(msg);
}
开发者ID:nephen,项目名称:BluetoothLamp,代码行数:50,代码来源:app_hrpc.c

示例11: app_neb_msg_rx_resp_flow

void app_neb_msg_rx_resp_flow(struct app_neb_msg_resp_flow* msg)
{
    uint8_t status = NEB_ERR_SUCCESS;

    if(ke_state_get(TASK_APP_NEB) == APP_NEB_CONNECTED)
    {
        ASSERT_INFO(app_neb_env.resp_flow_sample_nb < NEB_RESP_FLOW_PCK_NB, app_neb_env.resp_flow_sample_nb, NEB_RESP_FLOW_PCK_NB);

        // Store sample
        app_neb_env.resp_flow_sample_buf[app_neb_env.resp_flow_sample_nb++] = msg->flow;

        // Check the buffer size
        if(app_neb_env.resp_flow_sample_nb == NEB_RESP_FLOW_PCK_NB)
        {
            // Allocate message to profile
            struct nbps_neb_record_send_req *req = KE_MSG_ALLOC(NBPS_NEB_RECORD_SEND_REQ,
                    TASK_NBPS, TASK_APP_NEB,
                    nbps_neb_record_send_req);
            req->conhdl = app_neb_env.conhdl;
            req->neb_rec.neb_id = app_neb_env.curr_neb_id;
            req->neb_rec.rec_id = app_neb_env.next_rec_id;
            req->neb_rec.flags = NEB_REC_RESP_RATE_FLAG;

            // Parameters
            req->neb_rec.nb_resp_rate = NEB_RESP_FLOW_PCK_NB;
            memcpy(&req->neb_rec.resp_rate[0], &app_neb_env.resp_flow_sample_buf[0], NEB_RESP_FLOW_PCK_NB * sizeof(uint16_t));

            ke_msg_send(req);

            // Clear number of samples
            app_neb_env.resp_flow_sample_nb = 0;

            // Increment record ID
            app_neb_env.next_rec_id++;
        }
    }

    // Confirm the message
    app_neb_msg_tx_confirm_basic(NEB_MSG_ID_RESP_FLOW, status);
}
开发者ID:GumpYangchh,项目名称:wuzhuangbo,代码行数:40,代码来源:app_neb.c

示例12: app_smpc_start_enc_req

void app_smpc_start_enc_req(uint8_t idx, 
                               uint8_t auth_req,
                               uint16_t ediv,
                               struct rand_nb *rand_nb,
                               struct smp_key *ltk)
{
    struct smpc_start_enc_req *msg = KE_MSG_ALLOC(SMPC_START_ENC_REQ, TASK_SMPC, TASK_APP,
                                                  smpc_start_enc_req);

    ///Connection index
    msg->idx = idx;
    ///Authentication Requirements - needed if slave
    msg->auth_req = auth_req;
    ///EDIV
    msg->ediv = ediv;
    ///Random number
    msg->randnb = *rand_nb;
    ///LTK
    msg->ltk = *ltk;

    ke_msg_send(msg);
}
开发者ID:charliexp,项目名称:FireBLE,代码行数:22,代码来源:app_smp.c

示例13: clear_white_list

/**
 ****************************************************************************************
 * @brief       Clears both the normal and the virtual White Lists.
 *
 * @param       void
 *
 * @return      void
 ****************************************************************************************
 */
void clear_white_list(void)
{
    int i;

    if (con_fsm_params.has_white_list) {
        struct gapm_white_list_mgt_cmd * req = KE_MSG_ALLOC(GAPM_WHITE_LIST_MGT_CMD, 
                                                            TASK_GAPM, TASK_APP, 
                                                            gapm_white_list_mgt_cmd);

        // Fill in the parameter structure
        req->operation = GAPM_CLEAR_WLIST;
        req->nb = 0;
        ke_msg_send(req);
    }
    else if (con_fsm_params.has_virtual_white_list) {
        for (i = 0; i < MAX_BOND_PEER; i++) {
            virtual_white_list[i].status = UNUSED;
        }
        virtual_wlist_policy = ADV_ALLOW_SCAN_ANY_CON_ANY;
    }
    white_list_written = 0;
}
开发者ID:GumpYangchh,项目名称:DA14582-Remote-Audio,代码行数:31,代码来源:app_white_list.c

示例14: streamdatad_create_db_req_handler

/**
 ****************************************************************************************
 * @brief Handles reception of the @ref STREAMDATAD_CREATE_DB_REQ message.
 * The handler adds STREAMDATAD Service into the database using the database
 * configuration value given in param.
 * @param[in] msgid Id of the message received (probably unused).
 * @param[in] param Pointer to the parameters of the message.
 * @param[in] dest_id ID of the receiving task instance (probably unused).
 * @param[in] src_id ID of the sending task instance.
 * @return If the message was consumed or not.
 ****************************************************************************************
 */
static int streamdatad_create_db_req_handler(ke_msg_id_t const msgid,
                                      struct streamdatad_create_db_req const *param,
                                      ke_task_id_t const dest_id,
                                      ke_task_id_t const src_id)
{
    //Service Configuration Flag
    uint32_t cfg_flag = 0xFFFFFFFF;
    //Database Creation Status
    uint8_t status;

    //Save Application ID
    streamdatad_env.appid = src_id;


    // set start handle or automatically set it when creating database (start_hdl = 0)
    streamdatad_env.shdl=param->start_hdl;

    //Add Service Into Database
    status = attm_svc_create_db(&streamdatad_env.shdl, (uint8_t *)&cfg_flag,  STREAMDATAD_IDX_NB, NULL,
                               dest_id, &streamdatad_att_db[0]);

    //Disable GLS
    attmdb_svc_set_permission(streamdatad_env.shdl, PERM(SVC, DISABLE));

    //Go to Idle State
    if (status == ATT_ERR_NO_ERROR)
    {
        //If we are here, database has been fulfilled with success, go to idle test
        ke_state_set(TASK_STREAMDATAD, STREAMDATAD_IDLE);
    }

    //Send response to application
    struct streamdatad_create_db_cfm * cfm = KE_MSG_ALLOC(STREAMDATAD_CREATE_DB_CFM, streamdatad_env.appid,
                                                    TASK_STREAMDATAD, streamdatad_create_db_cfm);
    cfm->status = status;
    ke_msg_send(cfm);

    return (KE_MSG_CONSUMED);
}
开发者ID:FuangCao,项目名称:jwaoo-toy,代码行数:51,代码来源:streamdatad_task.c

示例15: app_smpc_chk_bd_addr_req_rsp

void app_smpc_chk_bd_addr_req_rsp(uint8_t idx, 
                                    uint8_t found_flag,
                                    uint8_t sec_status,
                                    uint8_t type,
                                    struct bd_addr *addr)
{
    struct smpc_chk_bd_addr_rsp *msg = KE_MSG_ALLOC(SMPC_CHK_BD_ADDR_REQ_RSP, TASK_SMPC, TASK_APP,
                                                smpc_chk_bd_addr_rsp);

    ///Connection index -may be a free task index
    msg->idx = idx;
    ///Status - found or not
    msg->found_flag = found_flag;
    ///Saved link security status from higher layer
    msg->lk_sec_status = sec_status;
    ///Type of address to check
    msg->type = type;
    ///Random address to resolve or Public address to check in APP
    msg->addr = *addr;

    ke_msg_send(msg);
}
开发者ID:charliexp,项目名称:FireBLE,代码行数:22,代码来源:app_smp.c


注:本文中的KE_MSG_ALLOC函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。