uint32_t ble_gattc_exchange_mtu_request_req_enc(uint16_t conn_handle, uint16_t client_rx_mtu, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GATTC_EXCHANGE_MTU_REQUEST); SER_PUSH_uint16(&conn_handle); SER_PUSH_uint16(&client_rx_mtu); SER_REQ_ENC_END; }
uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, uint16_t handle, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GATTC_HV_CONFIRM); SER_PUSH_uint16(&conn_handle); SER_PUSH_uint16(&handle); SER_REQ_ENC_END; }
uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_evt_read_t); SER_PUSH_uint16(&p_struct->handle); SER_PUSH_FIELD(&p_struct->uuid, ble_uuid_t_enc); SER_PUSH_uint16(&p_struct->offset); SER_STRUCT_ENC_END; }
uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const * const p_srvc_uuid, uint8_t * const p_buf, uint32_t * p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER); SER_PUSH_uint16(&conn_handle); SER_PUSH_uint16(&start_handle); SER_PUSH_COND(p_srvc_uuid, ble_uuid_t_enc); SER_REQ_ENC_END; }
uint32_t ble_gattc_evt_write_cmd_tx_complete_enc(ble_evt_t const * const p_event, uint32_t event_len, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_EVT_ENC_BEGIN(BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE); SER_PUSH_uint16(&p_event->evt.gattc_evt.conn_handle); SER_PUSH_uint16(&p_event->evt.gattc_evt.gatt_status); SER_PUSH_uint16(&p_event->evt.gattc_evt.error_handle); SER_PUSH_uint8(&p_event->evt.gattc_evt.params.write_cmd_tx_complete.count); SER_EVT_ENC_END; }
uint32_t ble_gatts_char_handles_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_char_handles_t); SER_PUSH_uint16(&p_struct->value_handle); SER_PUSH_uint16(&p_struct->user_desc_handle); SER_PUSH_uint16(&p_struct->cccd_handle); SER_PUSH_uint16(&p_struct->sccd_handle); SER_STRUCT_ENC_END; }
uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, uint16_t handle, uint16_t offset, uint8_t * const p_buf, uint32_t * p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GATTC_READ); SER_PUSH_uint16(&conn_handle); SER_PUSH_uint16(&handle); SER_PUSH_uint16(&offset); SER_REQ_ENC_END; }
uint32_t ble_gattc_evt_hvx_enc(ble_evt_t const * const p_event, uint32_t event_len, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_EVT_ENC_BEGIN(BLE_GATTC_EVT_HVX); SER_PUSH_uint16(&p_event->evt.gattc_evt.conn_handle); SER_PUSH_uint16(&p_event->evt.gattc_evt.gatt_status); SER_PUSH_uint16(&p_event->evt.gattc_evt.error_handle); SER_PUSH_FIELD(&p_event->evt.gattc_evt.params.hvx, ble_gattc_evt_hvx_t_enc); SER_EVT_ENC_END; }
uint32_t ble_gattc_evt_exchange_mtu_rsp_enc(ble_evt_t const * const p_event, uint32_t event_len, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_EVT_ENC_BEGIN(BLE_GATTC_EVT_EXCHANGE_MTU_RSP); SER_PUSH_uint16(&p_event->evt.gattc_evt.conn_handle); SER_PUSH_uint16(&p_event->evt.gattc_evt.gatt_status); SER_PUSH_uint16(&p_event->evt.gattc_evt.error_handle); SER_PUSH_FIELD(&p_event->evt.gattc_evt.params.exchange_mtu_rsp, ble_gattc_evt_exchange_mtu_rsp_t_enc); SER_EVT_ENC_END; }
uint32_t ble_gattc_evt_char_vals_read_rsp_enc(ble_evt_t const * const p_event, uint32_t event_len, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_EVT_ENC_BEGIN(BLE_GATTC_EVT_CHAR_VALS_READ_RSP); SER_PUSH_uint16(&p_event->evt.gattc_evt.conn_handle); SER_PUSH_uint16(&p_event->evt.gattc_evt.gatt_status); SER_PUSH_uint16(&p_event->evt.gattc_evt.error_handle); SER_PUSH_FIELD(&p_event->evt.gattc_evt.params.char_vals_read_rsp, ble_gattc_evt_char_vals_read_rsp_t_enc); SER_EVT_ENC_END; }
uint32_t ble_gatts_authorize_params_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_authorize_params_t); uint8_t ser_data = p_struct->update & 0x01; SER_PUSH_uint16(&p_struct->gatt_status); SER_PUSH_uint8(&ser_data); SER_PUSH_uint16(&p_struct->offset); SER_PUSH_len16data(p_struct->p_data, p_struct->len); SER_STRUCT_ENC_END; }
uint32_t ble_gattc_evt_attr_info_disc_rsp_enc(ble_evt_t const * const p_event, uint32_t event_len, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_EVT_ENC_BEGIN(BLE_GATTC_EVT_ATTR_INFO_DISC_RSP); SER_PUSH_uint16(&p_event->evt.gattc_evt.conn_handle); SER_PUSH_uint16(&p_event->evt.gattc_evt.gatt_status); SER_PUSH_uint16(&p_event->evt.gattc_evt.error_handle); SER_PUSH_FIELD(&p_event->evt.gattc_evt.params.attr_info_disc_rsp, ble_gattc_evt_attr_info_disc_rsp_t_enc); SER_EVT_ENC_END; }
uint32_t ble_gatts_char_pf_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_char_pf_t); SER_PUSH_uint8(&p_struct->format); SER_PUSH_int8(&p_struct->exponent); SER_PUSH_uint16(&p_struct->unit); SER_PUSH_uint8(&p_struct->name_space); SER_PUSH_uint16(&p_struct->desc); SER_STRUCT_ENC_END; }
uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle, uint8_t key_type, uint8_t const * const p_key, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_AUTH_KEY_REPLY); uint8_t key_len; switch (key_type) { case BLE_GAP_AUTH_KEY_TYPE_NONE: key_len = 0; break; case BLE_GAP_AUTH_KEY_TYPE_PASSKEY: key_len = 6; break; case BLE_GAP_AUTH_KEY_TYPE_OOB: key_len = 16; break; default: return NRF_ERROR_INVALID_PARAM; } SER_PUSH_uint16(&conn_handle); SER_PUSH_uint8(&key_type); SER_PUSH_buf(p_key, key_len); SER_REQ_ENC_END; }
uint32_t ble_gap_evt_auth_status_enc(ble_evt_t const * const p_event, uint32_t event_len, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_EVT_ENC_BEGIN(BLE_GAP_EVT_AUTH_STATUS); SER_PUSH_uint16(&p_event->evt.gap_evt.conn_handle); SER_PUSH_FIELD(&p_event->evt.gap_evt.params.auth_status, ble_gap_evt_auth_status_t_enc); // keyset is an extension of standard event data - used to synchronize keys at application uint32_t conn_index; err_code = conn_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index); if (err_code == NRF_SUCCESS) { SER_PUSH_FIELD(&(m_conn_keys_table[conn_index].keyset), ble_gap_sec_keyset_t_enc); err_code = conn_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); SER_ASSERT(err_code == NRF_SUCCESS, err_code); } else { err_code = NRF_SUCCESS; } SER_EVT_ENC_END; }
uint32_t ble_gatts_attr_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_attr_t); SER_PUSH_COND(p_struct->p_uuid, ble_uuid_t_enc); SER_PUSH_COND(p_struct->p_attr_md, ble_gatts_attr_md_t_enc); SER_PUSH_uint16(&p_struct->init_offs); SER_PUSH_uint16(&p_struct->max_len); SER_ERROR_CHECK(p_struct->init_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); SER_PUSH_len16data(p_struct->p_value, p_struct->init_len); SER_STRUCT_ENC_END; }
uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_evt_write_t); SER_PUSH_uint16(&p_struct->handle); SER_PUSH_FIELD(&p_struct->uuid, ble_uuid_t_enc); SER_PUSH_uint8(&p_struct->op); SER_PUSH_uint8(&p_struct->auth_required); SER_PUSH_uint16(&p_struct->offset); SER_PUSH_uint16(&p_struct->len); SER_PUSH_uint8array(p_struct->data, p_struct->len); SER_STRUCT_ENC_END; }
uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_RSSI_STOP); SER_PUSH_uint16(&conn_handle); SER_REQ_ENC_END; }
uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_APPEARANCE_SET); SER_PUSH_uint16(&appearance); SER_REQ_ENC_END; }
uint32_t ble_gatt_conn_cfg_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatt_conn_cfg_t); SER_PUSH_uint16(&p_struct->att_mtu); SER_STRUCT_ENC_END; }
uint32_t ble_gatts_evt_exchange_mtu_request_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_evt_exchange_mtu_request_t); SER_PUSH_uint16(&p_struct->client_rx_mtu); SER_STRUCT_ENC_END; }
uint32_t ble_gatts_evt_hvc_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_evt_hvc_t); SER_PUSH_uint16(&p_struct->handle); SER_STRUCT_ENC_END; }
uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_hvx_params_t); SER_PUSH_uint16(&p_struct->handle); SER_PUSH_uint8(&p_struct->type); SER_PUSH_uint16(&p_struct->offset); SER_PUSH_COND(p_struct->p_len, uint16_t_enc); if (p_struct->p_len) { SER_PUSH_buf(p_struct->p_data, *p_struct->p_len); } SER_STRUCT_ENC_END; }
uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle, int8_t const * const p_rssi, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_RSSI_GET); SER_PUSH_uint16(&conn_handle); SER_PUSH_COND(p_rssi, NULL); SER_REQ_ENC_END; }
uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle, uint8_t hci_status_code, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_DISCONNECT); SER_PUSH_uint16(&conn_handle); SER_PUSH_uint8(&hci_status_code); SER_REQ_ENC_END; }
uint32_t ble_gatts_value_t_enc(void const * const p_void_struct, uint8_t * const p_buf, uint32_t buf_len, uint32_t * const p_index) { SER_STRUCT_ENC_BEGIN(ble_gatts_value_t); SER_PUSH_uint16(&p_struct->offset); SER_PUSH_len16data(p_struct->p_value, p_struct->len); SER_STRUCT_ENC_END; }
uint32_t ble_gap_lesc_dhkey_reply_req_enc(uint16_t conn_handle, ble_gap_lesc_dhkey_t const *p_dhkey, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_LESC_DHKEY_REPLY); SER_PUSH_uint16(&conn_handle); SER_PUSH_COND(p_dhkey, ble_gap_lesc_dhkey_t_enc); SER_REQ_ENC_END; }
uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle, ble_gap_conn_sec_t const * const p_conn_sec, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_CONN_SEC_GET); SER_PUSH_uint16(&conn_handle); SER_PUSH_COND(p_conn_sec, NULL); SER_REQ_ENC_END; }
uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle, ble_gap_conn_params_t const * const p_conn_params, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_CONN_PARAM_UPDATE); SER_PUSH_uint16(&conn_handle); SER_PUSH_COND(p_conn_params, ble_gap_conn_params_t_enc); SER_REQ_ENC_END; }
uint32_t ble_gap_keypress_notify_req_enc(uint16_t conn_handle, uint8_t kp_not, uint8_t * const p_buf, uint32_t * const p_buf_len) { SER_REQ_ENC_BEGIN(SD_BLE_GAP_KEYPRESS_NOTIFY); SER_PUSH_uint16(&conn_handle); SER_PUSH_uint8(&kp_not); SER_REQ_ENC_END; }