S115 SoftDevice for nRF54LM20 API documentation 10.0.0
Loading...
Searching...
No Matches
ble.h
1/*
2 * Copyright (c) Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form, except as embedded into a Nordic
12 * Semiconductor ASA integrated circuit in a product or a software update for
13 * such product, must reproduce the above copyright notice, this list of
14 * conditions and the following disclaimer in the documentation and/or other
15 * materials provided with the distribution.
16 *
17 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * 4. This software, with or without modification, must only be used with a
22 * Nordic Semiconductor ASA integrated circuit.
23 *
24 * 5. Any software provided in binary form under this license must not be reverse
25 * engineered, decompiled, modified and/or disassembled.
26 *
27 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
49#ifndef BLE_H__
50#define BLE_H__
51
52#include <stdint.h>
53#include "nrf_svc.h"
54#include "nrf_error.h"
55#include "ble_err.h"
56#include "ble_gap.h"
57#include "ble_gatt.h"
58#include "ble_gattc.h"
59#include "ble_gatts.h"
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
85
95
107
116
125
126
134#define BLE_EVT_PTR_ALIGNMENT 4
135
138#define BLE_MAX(a, b) ((a) < (b) ? (b) : (a))
139
144#define BLE_EVT_LEN_MAX(ATT_MTU) ( \
145 offsetof(ble_evt_t, evt.gattc_evt.params.prim_srvc_disc_rsp.services) + ((ATT_MTU) - 1) / 4 * sizeof(ble_gattc_service_t) \
146)
147
150#define BLE_USER_MEM_TYPE_INVALID 0x00
151#define BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES 0x01
157#define BLE_UUID_VS_COUNT_DEFAULT 10
158#define BLE_UUID_VS_COUNT_MAX 254
164#define BLE_CONN_CFG_TAG_DEFAULT 0
175typedef struct
176{
177 uint8_t *p_mem;
178 uint16_t len;
180
182typedef struct
183{
184 uint8_t type;
186
193
204
206typedef struct
207{
208 uint16_t evt_id;
209 uint16_t evt_len;
211
224
225
229typedef struct
230{
232 uint16_t company_id;
235
247typedef struct
248{
249 uint8_t enable : 1;
251
252
253
254
260
268
300
306typedef struct
307{
312
318
327
379SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(uint32_t * p_app_ram_base));
380
417SVCALL(SD_BLE_CFG_SET, uint32_t, sd_ble_cfg_set(uint32_t cfg_id, ble_cfg_t const * p_cfg, uint32_t app_ram_base));
418
455SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len));
456
457
484SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type));
485
486
505SVCALL(SD_BLE_UUID_VS_REMOVE, uint32_t, sd_ble_uuid_vs_remove(uint8_t *p_uuid_type));
506
507
526SVCALL(SD_BLE_UUID_DECODE, uint32_t, sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const *p_uuid_le, ble_uuid_t *p_uuid));
527
528
541SVCALL(SD_BLE_UUID_ENCODE, uint32_t, sd_ble_uuid_encode(ble_uuid_t const *p_uuid, uint8_t *p_uuid_le_len, uint8_t *p_uuid_le));
542
543
555
556
580SVCALL(SD_BLE_USER_MEM_REPLY, uint32_t, sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block));
581
598SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt));
599
600
618SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt));
619
621#ifdef __cplusplus
622}
623#endif
624#endif /* BLE_H__ */
625
BLE_COMMON_CFGS
BLE Common Configuration IDs.
Definition ble.h:113
@ BLE_COMMON_CFG_VS_UUID
Definition ble.h:114
BLE_CONN_CFGS
BLE Connection Configuration IDs.
Definition ble.h:101
@ BLE_CONN_CFG_GATTC
Definition ble.h:103
@ BLE_CONN_CFG_GAP
Definition ble.h:102
@ BLE_CONN_CFG_GATT
Definition ble.h:105
@ BLE_CONN_CFG_GATTS
Definition ble.h:104
BLE_COMMON_EVTS
BLE Module Independent Event IDs.
Definition ble.h:90
@ BLE_EVT_USER_MEM_REQUEST
Definition ble.h:91
@ BLE_EVT_USER_MEM_RELEASE
Definition ble.h:93
BLE_COMMON_OPTS
Common Option IDs. IDs that uniquely identify a common option.
Definition ble.h:121
@ BLE_COMMON_OPT_NUMBER
Definition ble.h:123
@ BLE_COMMON_OPT_CONN_EVT_EXT
Definition ble.h:122
BLE_COMMON_SVCS
Common API SVC numbers.
Definition ble.h:72
@ SD_BLE_CFG_SET
Definition ble.h:83
@ SD_BLE_UUID_VS_ADD
Definition ble.h:75
@ SD_BLE_OPT_SET
Definition ble.h:81
@ SD_BLE_EVT_GET
Definition ble.h:74
@ SD_BLE_ENABLE
Definition ble.h:73
@ SD_BLE_UUID_DECODE
Definition ble.h:77
@ SD_BLE_USER_MEM_REPLY
Definition ble.h:80
@ SD_BLE_VERSION_GET
Definition ble.h:79
@ SD_BLE_UUID_VS_REMOVE
Definition ble.h:76
@ SD_BLE_OPT_GET
Definition ble.h:82
@ SD_BLE_UUID_ENCODE
Definition ble.h:78
uint32_t sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type)
Add a Vendor Specific base UUID.
uint32_t sd_ble_uuid_encode(ble_uuid_t const *p_uuid, uint8_t *p_uuid_le_len, uint8_t *p_uuid_le)
Encode a ble_uuid_t structure into little endian raw UUID bytes (16-bit or 128-bit).
uint32_t sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len)
Get an event from the pending events queue.
uint32_t sd_ble_cfg_set(uint32_t cfg_id, ble_cfg_t const *p_cfg, uint32_t app_ram_base)
Add configurations for the BLE stack.
uint32_t sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt)
Set a BLE option.
uint32_t sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const *p_uuid_le, ble_uuid_t *p_uuid)
Decode little endian raw UUID bytes (16-bit or 128-bit) into a 24 bit ble_uuid_t structure.
uint32_t sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block)
Provide a user memory block.
uint32_t sd_ble_enable(uint32_t *p_app_ram_base)
Enable the BLE stack.
uint32_t sd_ble_version_get(ble_version_t *p_version)
Get Version Information.
uint32_t sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt)
Get a BLE option.
uint32_t sd_ble_uuid_vs_remove(uint8_t *p_uuid_type)
Remove a Vendor Specific base UUID.
#define BLE_OPT_BASE
Definition ble_ranges.h:98
#define BLE_CONN_CFG_BASE
Definition ble_ranges.h:120
#define BLE_EVT_BASE
Definition ble_ranges.h:82
#define BLE_SVC_BASE
Definition ble_ranges.h:66
#define BLE_CFG_BASE
Definition ble_ranges.h:117
uint8_t vs_uuid_count
Definition ble.h:308
Configuration of Vendor Specific base UUIDs, set with sd_ble_cfg_set.
Definition ble.h:307
ble_evt_user_mem_release_t user_mem_release
Definition ble.h:201
ble_evt_user_mem_request_t user_mem_request
Definition ble.h:200
uint16_t conn_handle
Definition ble.h:197
Event structure for events not associated with a specific function module.
Definition ble.h:196
uint8_t enable
Definition ble.h:249
Configuration of extended BLE connection events.
Definition ble.h:248
uint8_t conn_cfg_tag
Definition ble.h:287
ble_gattc_conn_cfg_t gattc_conn_cfg
Definition ble.h:295
ble_gatts_conn_cfg_t gatts_conn_cfg
Definition ble.h:296
ble_gatt_conn_cfg_t gatt_conn_cfg
Definition ble.h:297
ble_gap_conn_cfg_t gap_conn_cfg
Definition ble.h:294
BLE connection configuration type, wrapping the module specific configurations, set with sd_ble_cfg_s...
Definition ble.h:286
uint16_t evt_id
Definition ble.h:208
uint16_t evt_len
Definition ble.h:209
BLE Event header.
Definition ble.h:207
ble_gattc_evt_t gattc_evt
Definition ble.h:220
ble_evt_hdr_t header
Definition ble.h:215
ble_common_evt_t common_evt
Definition ble.h:218
ble_gap_evt_t gap_evt
Definition ble.h:219
ble_gatts_evt_t gatts_evt
Definition ble.h:221
Common BLE Event type, wrapping the module specific event reports.
Definition ble.h:214
uint8_t type
Definition ble.h:190
ble_user_mem_block_t mem_block
Definition ble.h:191
Event structure for BLE_EVT_USER_MEM_RELEASE.
Definition ble.h:189
uint8_t type
Definition ble.h:184
Event structure for BLE_EVT_USER_MEM_REQUEST.
Definition ble.h:183
BLE GAP connection configuration parameters, set with sd_ble_cfg_set.
Definition ble_gap.h:1102
GAP event structure.
Definition ble_gap.h:1066
BLE GATT connection configuration parameters, set with sd_ble_cfg_set.
Definition ble_gatt.h:190
BLE GATTC connection configuration parameters, set with sd_ble_cfg_set.
Definition ble_gattc.h:137
GATTC event structure.
Definition ble_gattc.h:350
BLE GATTS connection configuration parameters, set with sd_ble_cfg_set.
Definition ble_gatts.h:209
GATTS event structure.
Definition ble_gatts.h:424
uint16_t len
Definition ble.h:178
uint8_t * p_mem
Definition ble.h:177
User Memory Block.
Definition ble.h:176
128 bit UUID values.
Definition ble_types.h:187
Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs.
Definition ble_types.h:193
uint16_t company_id
Definition ble.h:232
uint16_t subversion_number
Definition ble.h:233
uint8_t version_number
Definition ble.h:231
Version Information.
Definition ble.h:230
ble_conn_cfg_t conn_cfg
Definition ble.h:322
ble_gatts_cfg_t gatts_cfg
Definition ble.h:325
ble_gap_cfg_t gap_cfg
Definition ble.h:324
ble_common_cfg_t common_cfg
Definition ble.h:323
BLE Configuration type, wrapping the module specific configurations.
Definition ble.h:321
ble_common_cfg_vs_uuid_t vs_uuid_cfg
Definition ble.h:316
Common BLE Configuration type, wrapping the common configurations.
Definition ble.h:315
ble_common_opt_conn_evt_ext_t conn_evt_ext
Definition ble.h:258
Option structure for common options.
Definition ble.h:257
Configuration structure for GAP configurations.
Definition ble_gap.h:1190
Option structure for GAP options.
Definition ble_gap.h:1303
Option structure for GATTC options.
Definition ble_gattc.h:401
Config structure for GATTS configurations.
Definition ble_gatts.h:353
ble_gattc_opt_t gattc_opt
Definition ble.h:266
ble_gap_opt_t gap_opt
Definition ble.h:265
ble_common_opt_t common_opt
Definition ble.h:264
Common BLE Option type, wrapping the module specific options.
Definition ble.h:263