Flipper Zero Firmware
Loading...
Searching...
No Matches
ble_const.h
1#pragma once
2
3#include <stdint.h>
4#include <string.h>
5#include <ble/core/ble_std.h>
6#include <ble/core/ble_defs.h>
7#include "osal.h"
8#include "compiler.h"
9
10/* Default BLE variant */
11#ifndef BASIC_FEATURES
12#define BASIC_FEATURES 0
13#endif
14#ifndef SLAVE_ONLY
15#define SLAVE_ONLY 0
16#endif
17#ifndef LL_ONLY
18#define LL_ONLY 0
19#endif
20#ifndef LL_ONLY_BASIC
21#define LL_ONLY_BASIC 0
22#endif
23#ifndef BEACON_ONLY
24#define BEACON_ONLY 0
25#endif
26
27/* Size of command/events buffers:
28 *
29 * To change the size of commands and events parameters used in the
30 * auto-generated files, you need to update 2 defines:
31 *
32 * - BLE_CMD_MAX_PARAM_LEN
33 * - BLE_EVT_MAX_PARAM_LEN
34 *
35 * These 2 defines are set below with default values and can be changed.
36 *
37 * To compute the value to support a characteristic of 512 bytes for a specific
38 * command or an event, you need to look in "ble_types.h".
39 *
40 * Here are 2 examples, one with a command and one with an event:
41 *
42 * - aci_gatt_update_char_value_ext_cp0
43 * ----------------------------------
44 *
45 * we have in the structure:
46 *
47 * uint8_t Value[(BLE_CMD_MAX_PARAM_LEN- 12)/sizeof(uint8_t)];
48 *
49 * so to support a 512 byte value, we need to have
50 *
51 * BLE_CMD_MAX_PARAM_LEN at least equal to: 512 + 12 = 524
52 *
53 * - aci_gatt_read_handle_value_rp0
54 * ------------------------------
55 *
56 * we have in the structure:
57 *
58 * uint8_t Value[((BLE_EVT_MAX_PARAM_LEN - 3) - 5)/sizeof(uint8_t)];
59 *
60 * so to support a 512 byte value, we need to have
61 *
62 * BLE_EVT_MAX_PARAM_LEN at least equal to: 512 + 3 + 5 = 520
63 *
64 * If you need several events or commands with 512-size values, you need to
65 * take the maximum values for BLE_EVT_MAX_PARAM_LEN and BLE_CMD_MAX_PARAM_LEN.
66 *
67 */
68
69/* Maximum parameter size of BLE commands.
70 * Change this value if needed. */
71#define BLE_CMD_MAX_PARAM_LEN HCI_COMMAND_MAX_PARAM_LEN
72
73/* Maximum parameter size of BLE responses/events.
74 * Change this value if needed. */
75#define BLE_EVT_MAX_PARAM_LEN HCI_EVENT_MAX_PARAM_LEN
76
77/* Callback function to send command and receive response */
79 uint16_t ogf;
80 uint16_t ocf;
81 int event;
82 void* cparam;
83 int clen;
84 void* rparam;
85 int rlen;
86};
87extern int hci_send_req(struct hci_request* req, uint8_t async);
88
89#ifndef FALSE
90#define FALSE 0
91#endif
92
93#ifndef MIN
94#define MIN(a, b) (((a) < (b)) ? (a) : (b))
95#endif
96
97#ifndef MAX
98#define MAX(a, b) (((a) > (b)) ? (a) : (b))
99#endif
Furi string container.
Definition ble_const.h:78