BLE-Stack APIs  3.00.00
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
central.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!*****************************************************************************
33  * @defgroup Central GAPRole (Central)
34  * @brief This module implements the Central GAP Role
35  * @{
36  * @file central.h
37  * @brief Central layer interface
38  */
39 
40 #ifndef CENTRAL_H
41 #define CENTRAL_H
42 
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif
47 
48 /*********************************************************************
49  * INCLUDES
50  */
51 #include "bcomdef.h"
52 #include "osal.h"
53 #include "gap.h"
54 
55 /*********************************************************************
56  * CONSTANTS
57  */
58 
79 #define GAPCENTRALROLE_IRK 0x400
80 
81 
92 #define GAPCENTRALROLE_SRK 0x401
93 
94 
103 #define GAPCENTRALROLE_SIGNCOUNTER 0x402
104 
117 #define GAPCENTRALROLE_BD_ADDR 0x403
118 
128 #define GAPCENTRALROLE_MAX_SCAN_RES 0x404
129 
139 #define GAPCENTRALROLE_LINK_PARAM_UPDATE_REQ_REPLY 0x405
140 
145 #define GAPCENTRALROLE_PARAM_UPDATE_REQ_AUTO_REJECT 0x00
146 #define GAPCENTRALROLE_PARAM_UPDATE_REQ_AUTO_ACCEPT 0x01
147 #define GAPCENTRALROLE_PARAM_UPDATE_REQ_SEND_TO_APP 0x02
148 
152 /*********************************************************************
153  * VARIABLES
154  */
155 
156 /*********************************************************************
157  * MACROS
158  */
159 
160 /*********************************************************************
161  * TYPEDEFS
162  */
163 
168 typedef union
170 {
180 
221 typedef uint8_t (*pfnGapCentralRoleEventCB_t)
222 (
223  gapCentralRoleEvent_t *pEvent
224 );
225 
234 typedef struct
235 {
240 /*********************************************************************
241  * VARIABLES
242  */
243 
244 /*********************************************************************
245  * API FUNCTIONS
246  */
247 
248 /*-------------------------------------------------------------------
249  * Central Profile Public APIs
250  */
251 
262 
276 extern bStatus_t GAPCentralRole_SetParameter(uint16_t param, uint8_t len, void *pValue);
277 
287 extern bStatus_t GAPCentralRole_GetParameter(uint16_t param, void *pValue);
288 
299 extern bStatus_t GAPCentralRole_TerminateLink(uint16_t connHandle);
300 
315 extern bStatus_t GAPCentralRole_EstablishLink(uint8_t highDutyCycle, uint8_t whiteList,
316  uint8_t addrTypePeer, uint8_t *peerAddr);
317 
341 extern bStatus_t GAPCentralRole_UpdateLink(uint16_t connHandle, uint16_t connIntervalMin,
342  uint16_t connIntervalMax, uint16_t connLatency,
343  uint16_t connTimeout);
356 extern bStatus_t GAPCentralRole_StartDiscovery(uint8_t mode, uint8_t activeScan, uint8_t whiteList);
357 
366 
368 
369 /*-------------------------------------------------------------------
370  * TASK FUNCTIONS - Don't call these. These are system functions.
371  */
372 
377 extern void GAPCentralRole_createTask(void);
378 
380 
381 /*********************************************************************
382 *********************************************************************/
383 
384 #ifdef __cplusplus
385 }
386 #endif
387 
388 #endif /* CENTRAL_H */
389 
This API allows the software components in the Z-Stack to be written independently of the specifics o...
bStatus_t GAPCentralRole_StartDiscovery(uint8_t mode, uint8_t activeScan, uint8_t whiteList)
Start a device discovery scan.
Central GAPRole Callback Structure.
Definition: central.h:234
bStatus_t GAPCentralRole_StartDevice(gapCentralRoleCB_t *pAppCallbacks)
Start the device in Central role. This function is typically called once during system startup...
gapDeviceInfoEvent_t deviceInfo
Discovery device information event structure.
Definition: central.h:173
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:766
gapDeviceInitDoneEvent_t initDone
GAP initialization done.
Definition: central.h:172
GAP event header format.
Definition: gap.h:709
bStatus_t GAPCentralRole_UpdateLink(uint16_t connHandle, uint16_t connIntervalMin, uint16_t connIntervalMax, uint16_t connLatency, uint16_t connTimeout)
Update the link connection parameters.
bStatus_t GAPCentralRole_CancelDiscovery(void)
Cancel a device discovery scan.
gapDevDiscEvent_t discCmpl
Discovery complete event structure.
Definition: central.h:174
bStatus_t GAPCentralRole_EstablishLink(uint8_t highDutyCycle, uint8_t whiteList, uint8_t addrTypePeer, uint8_t *peerAddr)
Establish a link to a peer device.
gapTerminateLinkEvent_t linkTerminate
Link terminated event structure.
Definition: central.h:178
gapLinkUpdateEvent_t linkUpdate
Link update event structure.
Definition: central.h:176
GAP_DEVICE_INFO_EVENT message format.
Definition: gap.h:801
gapEstLinkReqEvent_t linkCmpl
Link complete event structure.
Definition: central.h:175
Central Event Structure.
Definition: central.h:169
bStatus_t GAPCentralRole_GetParameter(uint16_t param, void *pValue)
Get a parameter in the Central Profile.
Type definitions and macros for BLE stack.
GAP layer interface.
gapUpdateLinkParamReqEvent_t linkUpdateReply
Link update request reply structure.
Definition: central.h:177
bStatus_t GAPCentralRole_SetParameter(uint16_t param, uint8_t len, void *pValue)
Set a parameter in the Central Profile.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:243
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:847
gapEventHdr_t gap
GAP_MSG_EVENT and status.
Definition: central.h:171
uint8_t(* pfnGapCentralRoleEventCB_t)(gapCentralRoleEvent_t *pEvent)
Central Event Callback Function.
Definition: central.h:222
bStatus_t GAPCentralRole_TerminateLink(uint16_t connHandle)
Terminate a link.
Copyright 2016, Texas Instruments Incorporated