-
Notifications
You must be signed in to change notification settings - Fork 2
/
sink_ble_advertising.h
108 lines (77 loc) · 2.47 KB
/
sink_ble_advertising.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/****************************************************************************
Copyright Cambridge Silicon Radio Limited 2014 - 2015.
Part of ADK 4.0
FILE NAME
sink_ble_advertising.h
DESCRIPTION
BLE Advertising functionality
*/
#ifndef _SINK_BLE_ADVERTISING_H_
#define _SINK_BLE_ADVERTISING_H_
#include <connection.h>
#include <csrtypes.h>
#define ADVERTISING theSink.rundata->ble.gap.advertising
#define MAX_AD_DATA_SIZE_IN_OCTECTS (0x1F) /* AD Data max size = 31 octets (defined by BT spec) */
#define AD_DATA_HEADER_SIZE (0x02) /* AD header{Octet[0]=length, Octet[1]=Tag} AD data{Octets[2]..[n]} */
#define OCTETS_PER_SERVICE (0x02) /* 2 octets per uint16 service UUID */
/*
Defines structure used for setting up the advertisement data for the device
*/
typedef struct __built_adv_data
{
uint8* ptr; /* Pointer to AD Data */
uint16 size; /* Size of AD Data */
} built_adv_data_t;
/* Discoverable mode */
typedef enum __adv_discoverable_mode
{
adv_discoverable_mode_general,
adv_discoverable_mode_limited
} adv_discoverable_mode_t;
/*******************************************************************************
NAME
bleSetupAdvertisingData
DESCRIPTION
Function to setup the BLE Advertising data for the device.
PARAMETERS
size_local_name Length of the local name buffer.
local_name Buffer containing the local name.
RETURN
None
*/
#ifdef GATT_ENABLED
void bleSetupAdvertisingData(uint16 size_local_name, const uint8 *local_name, adv_discoverable_mode_t mode);
#else
#define bleSetupAdvertisingData(size_local_name, local_name, mode) (void(0))
#endif
/*******************************************************************************
NAME
bleHandleSetAdvertisingData
DESCRIPTION
Function to handle when BLE advertising data has been registered with CL.
PARAMETERS
cfm pointer to a CL_DM_BLE_SET_ADVERTISING_DATA_CFM message.
RETURN
None
*/
#ifdef GATT_ENABLED
void bleHandleSetAdvertisingData(CL_DM_BLE_SET_ADVERTISING_DATA_CFM_T * cfm);
#else
#define bleHandleSetAdvertisingData(cfm) ((void)(0))
#endif
/*******************************************************************************
NAME
bleStopAdvertising
DESCRIPTION
Function to stop advertising the registered BLE AD Data
PARAMETERS
None
RETURNS
None
*/
#ifdef GATT_ENABLED
void bleStopAdvertising(void);
#else
#define bleStopAdvertising()
#endif
#endif /* _SINK_BLE_ADVERTISING_H_ */