本文整理汇总了C++中KE_IDX_GET函数的典型用法代码示例。如果您正苦于以下问题:C++ KE_IDX_GET函数的具体用法?C++ KE_IDX_GET怎么用?C++ KE_IDX_GET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KE_IDX_GET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: app_hogprh_report_ind_handler
/*
****************************************************************************************
* @brief Handles the generic message Boot Mouse Input Report value send to APP
* (after Read Request or Notification) . *//**
*
* @param[in] msgid HOGPRH_REPORT_IND
* @param[in] param Pointer to the struct hogprh_report_ind
* @param[in] dest_id TASK_APP
* @param[in] src_id TASK_HOGPRH
*
* @return If the message was consumed or not.
* @description
*
* This API is used to inform the application about the read Client Characteristic Configuration
* Descriptor value.
*
* The following table present all the possible values for the ind_type parameter:
* - HOGPRH_IND_NTF (0x00): The Report Characteristic value has been received has a
* notification and the value is complete.
* - HOGPRH_IND_RD_RSP (0x01): The Report Characteristic value has been received has a read
* response.
* - HOGPRH_IND_INCOMPLETE_NTF (0x02): The Report Characteristic value has been received has a
* notification and the value is not complete. See the note below.
*
* @note
*
* Here is an extract of the BLE HIDS specification,
* "Notification of characteristic values can contain at most [ATT_MTU-3] bytes of data by definition. Data beyond
* [ATT_MTU-3] bytes long is not included in a notification, and must instead be read using the GATT Read Long
* Characteristic Value sub-procedure. The possibility that data to be notified in a Report characteristic value could
* change before the HID Host completed an outstanding Read Long Characteristic Value sub-procedure, and therefore be
* lost, exists. For this reason it is strongly recommended that HID Devices support an ATT_MTU large enough to transfer
* their largest possible Report characteristic value in a single transaction."
*
* Thus when an indication in received with an indication type set to HOGPRH_IND_INCOMPLETE_NTF, the application
* can begin to parse this incomplete Report value. Then it must wait for another indication whose the indication type
* will be set to HOGPRH_IND_RD_RSP and which will contain the whole Report Characteristic value (the first indication
* can be discarded if needed).
*
****************************************************************************************
*/
int app_hogprh_report_ind_handler(ke_msg_id_t const msgid,
struct hogprh_report_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint8_t idx = KE_IDX_GET(src_id);
switch (param->ind_type)
{
case HOGPRH_IND_RD_RSP:
QPRINTF("HOGPRH Read HIDS Report(%d).\r\n", param->hids_nb);
QTRACE(param->report, param->report_length, 0, 2);
QPRINTF("\r\n");
break;
case HOGPRH_IND_NTF:
QPRINTF("HOGPRH Notification(%d).\r\n", param->hids_nb);
QTRACE(param->report, param->report_length, 0, 2);
QPRINTF("\r\n");
if ((!app_hogprh_env[idx].cur_code) && (param->hids_nb+1 < app_hogprh_env[idx].hids_nb)) {
// start notification
app_hogprh_cfg_ntf_req(0, PRF_CLI_START_NTF, param->hids_nb+1, param->conhdl); /* 0 is our demo input report */
app_hogprh_env[idx].cur_code = 1;
}
break;
default:
break;
}
return (KE_MSG_CONSUMED);
}
示例2: app_hogpbh_boot_report_ind_handler
/*
****************************************************************************************
* @brief Handles the generic message Boot Report value send to APP. (after Read Request or Notification) *//**
*
* @param[in] msgid HOGPBH_BOOT_REPORT_IND
* @param[in] param Pointer to the struct hogpbh_boot_report_ind
* @param[in] dest_id TASK_APP
* @param[in] src_id TASK_HOGPBH
*
* @return If the message was consumed or not.
* @description
*
* This API is used to inform the application about the read Boot Keyboard Input Report
* Characteristic value.
*
****************************************************************************************
*/
int app_hogpbh_boot_report_ind_handler(ke_msg_id_t const msgid,
struct hogpbh_boot_report_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint8_t idx = KE_IDX_GET(src_id);
switch (param->ind_type)
{
case HOGPBH_IND_RD_RSP:
break;
case HOGPBH_IND_NTF:
if (param->char_code == HOGPBH_CHAR_BOOT_KB_IN_REPORT) {
QPRINTF("HOGPBH Keyboard in report notification(%d):\r\n", param->hids_nb);
QTRACE(param->report, param->report_length, 0, 2);
QPRINTF("\r\n");
if (app_hogpbh_env[idx].cur_code == 2) {
// Start Mouse Notify here
app_hogpbh_cfg_ntf_req(HOGPBH_DESC_BOOT_MOUSE_IN_REPORT_CFG, PRF_CLI_START_NTF,
app_hogpbh_env[idx].hids_mouse, param->conhdl);
app_hogpbh_env[idx].cur_code = 0;
}
}
else if (param->char_code == HOGPBH_CHAR_BOOT_MOUSE_IN_REPORT) {
QPRINTF("HOGPBH Mouse in report notification(%d):\r\n", param->hids_nb);
QTRACE(param->report, param->report_length, 0, 2);
QPRINTF("\r\n");
}
break;
default:
break;
}
return (KE_MSG_CONSUMED);
}
示例3: gattc_event_ind_handler
/**
****************************************************************************************
* @brief Handles reception of the @ref GATTC_EVENT_IND message.
* @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 gattc_event_ind_handler(ke_msg_id_t const msgid,
struct gattc_event_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
// Get the address of the environment
struct blpc_env_tag *blpc_env = PRF_CLIENT_GET_ENV(dest_id, blpc);
if(KE_IDX_GET(src_id) == blpc_env->con_info.conidx)
{
if((param->handle == blpc_env->bps.chars[BLPC_CHAR_CP_MEAS].val_hdl)
|| ((param->handle == blpc_env->bps.chars[BLPC_CHAR_BP_MEAS].val_hdl)))
{
//build a BLPC_BP_MEAD_IND message with stable blood pressure value code.
struct blpc_meas_ind * ind = KE_MSG_ALLOC(BLPC_BP_MEAS_IND,
blpc_env->con_info.appid, dest_id,
blpc_meas_ind);
// retrieve connection handle
ind->conhdl = gapc_get_conhdl(blpc_env->con_info.conidx);
// Intermediate cuff pressure value
ind->flag_interm_cp = ((param->type == GATTC_NOTIFY) ? 0x01 : 0x00);
// unpack blood pressure measurement.
blpc_unpack_meas_value(&(ind->meas_val), (uint8_t*) param->value);
ke_msg_send(ind);
}
}
return (KE_MSG_CONSUMED);
}
示例4: prf_client_disable_ind_send
void prf_client_disable_ind_send(prf_env_struct ***p_envs, ke_msg_id_t msg_id,
ke_task_id_t task_id, uint8_t state, uint16_t conhdl)
{
// retrieve current state
uint8_t cur_state = ke_state_get(task_id);
// prevent doing freeing structure if state already of profile is already free.
if(cur_state != state)
{
// Get the address of the environment
prf_env_struct *env = prf_client_get_env(*p_envs, task_id);
ASSERT_WARN(env != NULL);
if (env != NULL)
{
struct prf_client_disable_ind *ind = KE_MSG_ALLOC(msg_id,
env->con_info.appid, env->con_info.prf_id,
prf_client_disable_ind);
ind->conhdl = conhdl;
ind->status = prf_client_disable(p_envs, KE_IDX_GET(env->con_info.prf_id));
// Send the message
ke_msg_send(ind);
// Go to idle state
ke_state_set(task_id, state);
}
}
}
示例5: pasps_disable
void pasps_disable(struct pasps_idx_env_tag *idx_env)
{
// Disable PAS service
attsdb_svc_set_permission(pasps_env.pass_shdl, PERM(SVC, DISABLE));
struct pasps_disable_ind *ind = KE_MSG_ALLOC(PASPS_DISABLE_IND,
idx_env->con_info.appid, idx_env->con_info.prf_id,
pasps_disable_ind);
memset(ind, 0x00, sizeof(struct pasps_disable_ind));
ind->conhdl = idx_env->con_info.conhdl;
if (PASPS_IS_NTF_ENABLED(idx_env, PASPS_FLAG_ALERT_STATUS_CFG))
{
ind->alert_status_ntf_cfg = PRF_CLI_START_NTF;
}
if (PASPS_IS_NTF_ENABLED(idx_env, PASPS_FLAG_RINGER_SETTING_CFG))
{
ind->ringer_setting_ntf_cfg = PRF_CLI_START_NTF;
}
ke_msg_send(ind);
// Go to idle state
ke_state_set(idx_env->con_info.prf_id, PASPS_IDLE);
// Free the environment allocated for this connection
prf_client_disable((prf_env_struct ***)&pasps_idx_envs, KE_IDX_GET(idx_env->con_info.prf_id));
}
示例6: gattc_event_ind_handler
/**
****************************************************************************************
* @brief Handles reception of the @ref GATTC_EVENT_IND message.
* @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 gattc_event_ind_handler(ke_msg_id_t const msgid,
struct gattc_event_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
// Get the address of the environment
struct scppc_env_tag *scppc_env = PRF_CLIENT_GET_ENV(dest_id, scppc);
if (KE_IDX_GET(src_id) == scppc_env->con_info.conidx)
{
//Scan Refresh
if (param->handle == scppc_env->scps.chars[SCPPC_CHAR_SCAN_REFRESH].val_hdl)
{
if (param->value[0] == SCPP_SERVER_REQUIRES_REFRESH)
{
// Rewrite the most recent settings written on the server
struct scppc_scan_intv_wd_wr_req * req = KE_MSG_ALLOC(SCPPC_SCAN_INTV_WD_WR_REQ,
dest_id, dest_id,
scppc_scan_intv_wd_wr_req);
req->conhdl = gapc_get_conhdl(scppc_env->con_info.conidx);
co_write16p(&req->scan_intv_wd.le_scan_intv, scppc_env->scan_intv_wd.le_scan_intv);
co_write16p(&req->scan_intv_wd.le_scan_window, scppc_env->scan_intv_wd.le_scan_window);
ke_msg_send(req);
}
}
}
return (KE_MSG_CONSUMED);
}
示例7: gapc_connection_req_ind_handler
int gapc_connection_req_ind_handler(ke_msg_id_t msgid,
struct gapc_connection_req_ind *param,
ke_task_id_t dest_id,
ke_task_id_t src_id)
{
start_pair = 1;
if (app_env.state == APP_IDLE)
{
// We are now connected
app_env.state = APP_CONNECTED;
// Retrieve the connection info from the parameters
app_env.peer_device.device.conhdl = param->conhdl;
// Retrieve the connection index from the src_id
app_env.peer_device.device.conidx = KE_IDX_GET(src_id);
// On Reconnection check if device is bonded and send pairing request. Otherwise it is not bonded.
if (bdaddr_compare(&app_env.peer_device.device.adv_addr, ¶m->peer_addr))
{
if (app_env.peer_device.bonded)
start_pair = 0;
}
memcpy(app_env.peer_device.device.adv_addr.addr, param->peer_addr.addr, sizeof(struct bd_addr));
app_connect_confirm(GAP_AUTH_REQ_NO_MITM_NO_BOND);
app_security_enable();
}
return 0;
}
示例8: gattc_event_ind_handler
/**
****************************************************************************************
* @brief Handles reception of the @ref GATTC_EVENT_IND message.
* @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 gattc_event_ind_handler(ke_msg_id_t const msgid,
struct gattc_event_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
// Get the address of the environment
struct tipc_env_tag *tipc_env = PRF_CLIENT_GET_ENV(dest_id, tipc);
if(KE_IDX_GET(src_id) == tipc_env->con_info.conidx)
{
if(param->handle == tipc_env->cts.chars[TIPC_CHAR_CTS_CURR_TIME].val_hdl)
{
//Build a TIPC_CT_IND message
struct tipc_ct_ind * ind = KE_MSG_ALLOC(TIPC_CT_IND,
tipc_env->con_info.appid, dest_id,
tipc_ct_ind);
// retrieve connection handle
ind->conhdl = gapc_get_conhdl(tipc_env->con_info.conidx);
// Unpack Current Time Value.
tipc_unpack_curr_time_value(&(ind->ct_val), (uint8_t*) param->value);
// Indication Type
ind->ind_type = TIP_NTF;
ke_msg_send(ind);
}
}
return (KE_MSG_CONSUMED);
}
示例9: app_hogpbh_enable_cfm_handler
/*
****************************************************************************************
* @brief Handles the enable confirmation from the HOGPBH. *//**
*
* @param[in] msgid HOGPBH_ENABLE_CFM
* @param[in] param Pointer to the struct hogpbh_enable_cfm
* @param[in] dest_id TASK_APP
* @param[in] src_id TASK_HOGPBH
*
* @return If the message was consumed or not.
* @description
*
* This API is used by the Boot Host to either send the discovery results of HIDS on the HID device
* and confirm enabling of the Boot Host role, or to simply confirm enabling of Boot Host role if it is a normal connection
* and the attribute details are already known.
*
****************************************************************************************
*/
int app_hogpbh_enable_cfm_handler(ke_msg_id_t const msgid,
struct hogpbh_enable_cfm *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
QPRINTF("HOGPBH enable confirmation status: 0x%X.\r\n", param->status);
if (param->status == CO_ERROR_NO_ERROR)
{
uint8_t idx = KE_IDX_GET(src_id);
app_hogpbh_env[idx].conhdl = param->conhdl;
app_hogpbh_env[idx].enabled = true;
app_hogpbh_env[idx].cur_code = 0;
// Get keyboard instance number here
if (param->hids[0].descs[HOGPBH_DESC_BOOT_KB_IN_REPORT_CFG].desc_hdl != 0)
app_hogpbh_env[idx].hids_kb = 0;
else if (param->hids[1].descs[HOGPBH_DESC_BOOT_KB_IN_REPORT_CFG].desc_hdl != 0)
app_hogpbh_env[idx].hids_kb = 1;
else
app_hogpbh_env[idx].hids_kb = 0xFF;
// Get mouse instance number here
if (param->hids[0].descs[HOGPBH_DESC_BOOT_MOUSE_IN_REPORT_CFG].desc_hdl != 0)
app_hogpbh_env[idx].hids_mouse = 0;
else if (param->hids[1].descs[HOGPBH_DESC_BOOT_MOUSE_IN_REPORT_CFG].desc_hdl != 0)
app_hogpbh_env[idx].hids_mouse = 1;
else
app_hogpbh_env[idx].hids_mouse = 0xFF;
if (app_hogpbh_env[idx].hids_kb < HOGPBH_NB_HIDS_INST_MAX)
{
// Set Keyboard to Boot report mode
app_hogpbh_set_boot_proto_mode_req(app_hogpbh_env[idx].hids_kb, param->conhdl);
// Start Keybaord Notify here
app_hogpbh_cfg_ntf_req(HOGPBH_DESC_BOOT_KB_IN_REPORT_CFG, PRF_CLI_START_NTF,
app_hogpbh_env[idx].hids_kb, param->conhdl);
app_hogpbh_env[idx].cur_code = 1;
}
if (app_hogpbh_env[idx].hids_mouse != app_hogpbh_env[idx].hids_kb
&& app_hogpbh_env[idx].hids_mouse < HOGPBH_NB_HIDS_INST_MAX)
{
// Set Mouse to Boot protocol mode
app_hogpbh_set_boot_proto_mode_req(app_hogpbh_env[idx].hids_mouse, param->conhdl);
if (!app_hogpbh_env[idx].cur_code) {
// Start Mouse Notify here
app_hogpbh_cfg_ntf_req(HOGPBH_DESC_BOOT_MOUSE_IN_REPORT_CFG, PRF_CLI_START_NTF,
app_hogpbh_env[idx].hids_mouse, param->conhdl);
}
else {
app_hogpbh_env[idx].cur_code = 2;
}
}
}
return (KE_MSG_CONSUMED);
}
示例10: gattc_write_cmd_ind_handler
/**
****************************************************************************************
* @brief Handles reception of the @ref GATT_WRITE_CMD_IND message.
* @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 gattc_write_cmd_ind_handler(ke_msg_id_t const msgid,
struct gattc_write_cmd_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint8_t char_code = ADC_NOTIFY_ERR_CHAR;
uint8_t status = PRF_APP_ERROR;
if (KE_IDX_GET(src_id) == adc_notify_env.con_info.conidx)
{
if (param->handle == adc_notify_env.adc_notify_shdl + ADC_NOTIFY_IDX_CFG)
{
char_code = ADC_NOTIFY_CFG;
}
if (char_code == ADC_NOTIFY_CFG)
{
// Written value
uint16_t ntf_cfg;
// Extract value before check
ntf_cfg = co_read16p(¶m->value[0]);
// Only update configuration if value for stop or notification enable
if ((ntf_cfg == PRF_CLI_STOP_NTFIND) || (ntf_cfg == PRF_CLI_START_NTF))
{
//Save value in DB
attmdb_att_set_value(param->handle, sizeof(uint16_t), (uint8_t *)¶m->value[0]);
// Conserve information in environment
if (ntf_cfg == PRF_CLI_START_NTF)
{
// Ntf cfg bit set to 1
adc_notify_env.feature |= PRF_CLI_START_NTF;
}
else
{
// Ntf cfg bit set to 0
adc_notify_env.feature &= ~PRF_CLI_START_NTF;
}
adc_notify_send_cfg(ntf_cfg);
status = PRF_ERR_OK;
}
}
}
// Send Write Response
atts_write_rsp_send(adc_notify_env.con_info.conidx, param->handle, status);
return (KE_MSG_CONSUMED);
}
示例11: prf_client_enable
uint8_t prf_client_enable(prf_env_struct ***p_envs, struct prf_con_info *p_con_info,
void const *p_param, uint16_t env_size)
{
// Status
uint8_t status = PRF_ERR_OK;
// Index
uint8_t conidx;
// Pointer to an environment structure
prf_env_struct *env;
// Get the index matching this connection handle
conidx = p_con_info->conidx;
// Check if the connection exists
if (conidx != GAP_INVALID_CONIDX)
{
// Check if we are in the good task instance
if (conidx != KE_IDX_GET(p_con_info->prf_id))
{
// Forward the message to the good instance of the task
ke_msg_forward(p_param, KE_BUILD_ID(KE_TYPE_GET(p_con_info->prf_id), conidx), p_con_info->appid);
/*
* Here, the status PRF_ERR_FEATURE_NOT_SUPPORTED is used to inform that the message
* has been forwarded.
*/
status = PRF_ERR_FEATURE_NOT_SUPPORTED;
}
else
{
// Create the environment for the provided connection.
status = prf_client_env_alloc(p_envs, conidx, env_size);
// Check if the environment has been successfully created.
if (status == PRF_ERR_OK)
{
// Get the profile environment address
env = *(*p_envs + conidx);
/*
* Save the connection information in the environment.
* The first parameter of a profile client role environment is:
* struct prf_con_info con_info
*/
memcpy(&env->con_info, p_con_info, sizeof(struct prf_con_info));
}
}
}
else
{
// The connection doesn't exists
status = PRF_ERR_REQ_DISALLOWED;
}
return status;
}
示例12: app_paspc_pass_content_handler
/*
****************************************************************************************
* @brief Handles Indicate the content of the pointer device Phone Alert Status service. *//**
*
* @param[in] msgid PASPC_PASS_CONTENT_IND
* @param[in] param Pointer to struct paspc_pass_content
* @param[in] dest_id TASK_APP
* @param[in] src_id TASK_PASPC
* @return If the message was consumed or not.
* @description
*
* This handler message is sent to the application at the end of the discovery procedure
* performed after the connection establishment. It contains the structure of the peer
* device PASS.
*
****************************************************************************************
*/
int app_paspc_pass_content_handler(ke_msg_id_t const msgid,
struct paspc_pass_content_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint8_t idx = KE_IDX_GET(src_id);
app_paspc_env[idx].conhdl = param->conhdl;
app_paspc_env[idx].enabled = true;
return (KE_MSG_CONSUMED);
}
示例13: app_rscpc_rscs_content_ind_handler
/*
****************************************************************************************
* @brief Handles the result of discovery procedure from TASK_RSCPC. *//**
*
* @param[in] msgid RSCPC_RSCS_CONTENT_IND
* @param[in] param Pointer to struct rscpc_rscs_content_ind
* @param[in] dest_id TASK_APP
* @param[in] src_id TASK_RSCPC
* @return If the message was consumed or not.
* @description
*
* This handler is used to inform the application that the result of discovery
* Running Speed and Cadence Profile Sensor. It contains the structure of the peer
* device RSCS.
*
****************************************************************************************
*/
int app_rscpc_rscs_content_ind_handler(ke_msg_id_t const msgid,
struct rscpc_rscs_content_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint8_t idx = KE_IDX_GET(src_id);
app_rscpc_env[idx].conhdl = param->conhdl;
app_rscpc_env[idx].enabled = true;
//app_rscpc_env[app_env.select_idx].rscs = param->rscs;
return (KE_MSG_CONSUMED);
}
示例14: gapc_disconnect_ind_handler
/**
****************************************************************************************
* @brief Disconnection indication to HTPT.
* @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 gapc_disconnect_ind_handler(ke_msg_id_t const msgid,
struct gapc_disconnect_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
if (KE_IDX_GET(src_id) == htpt_env.con_info.conidx)
{
htpt_disable(param->conhdl);
}
return (KE_MSG_CONSUMED);
}
示例15: app_glpc_disable_ind_handler
/*
****************************************************************************************
* @brief Handles the disable indication to APP. *//*
*
* @param[in] msgid GLPC_DISABLE_IND
* @param[in] param Pointer to struct prf_client_disable_ind
* @param[in] dest_id TASK_APP
* @param[in] src_id TASK_GLPC
* @return If the message was consumed or not.
* @description
*
* This handler is used to inform the application that the Glucose collector Client
* Role task has been correctly disabled or if an error has occurred during this process.
*
****************************************************************************************
*/
int app_glpc_disable_ind_handler(ke_msg_id_t const msgid,
struct prf_client_disable_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint8_t idx = KE_IDX_GET(src_id);
app_glpc_env[idx].op_state = OPERATION_STATE_IDLE;
QPRINTF("GLPC disable ind\r\n");
return (KE_MSG_CONSUMED);
}