uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf, uint32_t packet_len, ble_evt_t * const p_event, uint32_t * const p_event_len) { SER_EVT_DEC_BEGIN(BLE_GAP_EVT_PASSKEY_DISPLAY, gap, passkey_display); uint8_t ser_data; SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle); SER_PULL_uint8array(p_event->evt.gap_evt.params.passkey_display.passkey, BLE_GAP_PASSKEY_LEN); SER_PULL_uint8(&ser_data); p_event->evt.gap_evt.params.passkey_display.match_request = (ser_data & 0x01); SER_EVT_DEC_END; }
uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf, uint32_t packet_len, uint8_t * const p_dev_name, uint16_t * const p_dev_name_len, uint32_t * const p_result_code) { SER_RSP_DEC_BEGIN(SD_BLE_GAP_DEVICE_NAME_GET); SER_PULL_COND(&p_dev_name_len, uint16_t_dec); if (p_dev_name_len) { SER_PULL_uint8array(p_dev_name, *p_dev_name_len); } SER_RSP_DEC_END; }
uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf, uint32_t buf_len, uint32_t * const p_index, uint32_t * const p_ext_len, void * const p_void_struct) { SER_STRUCT_DEC_BEGIN(ble_gatts_evt_write_t); SER_PULL_uint16(&p_struct->handle); SER_PULL_FIELD(&p_struct->uuid, ble_uuid_t_dec); SER_PULL_uint8(&p_struct->op); SER_PULL_uint8(&p_struct->auth_required); SER_PULL_uint16(&p_struct->offset); SER_PULL_uint16(&p_struct->len); // Data field is defined as 1-element array, so the first element // is always allocated in the structure. SER_ASSERT_LENGTH_LEQ(p_struct->len, *p_ext_len + 1); SER_PULL_uint8array(p_struct->data, p_struct->len); *p_ext_len = (p_struct->len > 1) ? p_struct->len - 1 : 0; SER_STRUCT_ENC_END; }