BLE-Stack APIs  3.00.00
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
multi.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 Multi GAPRole (Multi)
34  * @brief This module implements the Multi GAP Role
35  * @{
36  * @file multi.h
37  * @brief Multi layer interface
38  */
39 
40 #ifndef MULTI_H
41 #define MULTI_H
42 
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif
47 
48 /*-------------------------------------------------------------------
49  * INCLUDES
50  */
51 #include "gap.h"
52 
53 /*-------------------------------------------------------------------
54  * CONSTANTS
55  */
56 
73 #define GAPROLE_PROFILEROLE 0x300
74 
86 #define GAPROLE_IRK 0x301
87 
99 #define GAPROLE_SRK 0x302
100 
110 #define GAPROLE_SIGNCOUNTER 0x303
111 
124 #define GAPROLE_BD_ADDR 0x304
125 
137 #define GAPROLE_ADVERT_ENABLED 0x305
138 
150 #define GAPROLE_ADVERT_OFF_TIME 0x306
151 
162 #define GAPROLE_ADVERT_DATA 0x307
163 
173 #define GAPROLE_SCAN_RSP_DATA 0x308
174 
184 #define GAPROLE_ADV_EVENT_TYPE 0x309
185 
195 #define GAPROLE_ADV_DIRECT_TYPE 0x30A
196 
206 #define GAPROLE_ADV_DIRECT_ADDR 0x30B
207 
219 #define GAPROLE_ADV_CHANNEL_MAP 0x30C
220 
232 #define GAPROLE_ADV_FILTER_POLICY 0x30D
233 
243 #define GAPROLE_MIN_CONN_INTERVAL 0x311
244 
254 #define GAPROLE_MAX_CONN_INTERVAL 0x312
255 
265 #define GAPROLE_SLAVE_LATENCY 0x313
266 
276 #define GAPROLE_TIMEOUT_MULTIPLIER 0x314
277 
289 #define GAPROLE_ADV_NONCONN_ENABLED 0x31B
290 
300 #define GAPROLE_MAX_SCAN_RES 0x404
301 
308 #define GAPROLE_NO_ACTION 0
309 #define GAPROLE_RESEND_PARAM_UPDATE 1
310 #define GAPROLE_TERMINATE_LINK 2
311 
318 #define GAPROLE_LINK_PARAM_UPDATE_ACCEPT 0
319 #define GAPROLE_LINK_PARAM_UPDATE_REJECT 1
320 #define GAPROLE_LINK_PARAM_UPDATE_APP_DECIDES 2
321 #define GAPROLE_LINK_PARAM_UPDATE_NUM_OPTIONS 3
322 
326 /*-------------------------------------------------------------------
327  * TYPEDEFS
328  */
329 
334 typedef union
336 {
345 
347 typedef struct
348 {
350  uint16_t connHandle;
351  uint16_t minConnInterval;
352  uint16_t maxConnInterval;
353  uint16_t slaveLatency;
354  uint16_t timeoutMultiplier;
358 /*-------------------------------------------------------------------
359  * MACROS
360  */
361 
362 /*-------------------------------------------------------------------
363  * Profile Callbacks
364  */
365 
403 typedef uint8_t (*passThroughToApp_t)
404 (
405  gapMultiRoleEvent_t *pEvent
406 );
407 
408 /*
409  * @brief Callback for the app to decide on a parameter update request
410  *
411  * This callback will be used if the @ref GAP_UPDATE_LINK_PARAM_REQ_EVENT parameter
412  * is set to @ref GAPROLE_LINK_PARAM_UPDATE_APP_DECIDES
413  *
414  * @param pReq Pointer to param update request
415  * @param pRsp Pointer to param update response.
416  */
417 typedef void (*paramUpdateAppDecision_t)
418 (
421 );
422 
429 typedef struct
430 {
432  paramUpdateAppDecision_t pfnParamUpdateAppDecision;
433 } gapRolesCBs_t;
434 
437 /*-------------------------------------------------------------------
438  * API FUNCTIONS
439  */
440 
460 extern bStatus_t GAPRole_SetParameter(uint16_t param, uint8_t len, void *pValue, uint8 connHandle);
461 
478 extern bStatus_t GAPRole_GetParameter(uint16_t param, void *pValue, uint8 connHandle);
479 
495 bStatus_t GAPRole_StartDevice(gapRolesCBs_t *pAppCallbacks, uint8_t* numConns);
496 
504 extern bStatus_t GAPRole_TerminateConnection(uint16_t connHandle);
505 
518 extern bStatus_t GAPRole_StartDiscovery(uint8_t mode, uint8_t activeScan, uint8_t whiteList);
519 
528 
543 extern bStatus_t GAPRole_EstablishLink(uint8_t highDutyCycle, uint8_t whiteList,
544  uint8_t addrTypePeer, uint8_t *peerAddr);
545 
546 
563 extern bStatus_t gapRole_connUpdate(uint8_t handleFailure,
564  gapRole_updateConnParams_t *pConnParams);
565 
567 
568 /*-------------------------------------------------------------------
569  * TASK FUNCTIONS - Don't call these. These are system functions.
570  */
571 
576 extern void GAPRole_createTask(void);
577 
578 extern void gapRole_abort(void);
579 
581 
582 /*-------------------------------------------------------------------
583 -------------------------------------------------------------------*/
584 
585 #ifdef __cplusplus
586 }
587 #endif
588 
589 #endif /* MULTI_H */
590 
bStatus_t GAPRole_GetParameter(uint16_t param, void *pValue, uint8 connHandle)
Get a GAP Role parameter.
bStatus_t GAPRole_StartDevice(gapRolesCBs_t *pAppCallbacks, uint8_t *numConns)
Initialize the GAP layer.
Multi GAPRole Parameter Update Structure.
Definition: multi.h:347
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:766
GAP event header format.
Definition: gap.h:709
gapEstLinkReqEvent_t linkCmpl
Link complete event structure.
Definition: multi.h:341
bStatus_t GAPRole_TerminateConnection(uint16_t connHandle)
Terminates the existing connection.
bStatus_t gapRole_connUpdate(uint8_t handleFailure, gapRole_updateConnParams_t *pConnParams)
Send a connection parameter update to a connected device.
bStatus_t GAPRole_StartDiscovery(uint8_t mode, uint8_t activeScan, uint8_t whiteList)
Start a device discovery scan.
passThroughToApp_t pfnPassThrough
When the event should be processed by the app instead of the GAP Role.
Definition: multi.h:431
gapDeviceInitDoneEvent_t initDone
GAP initialization done.
Definition: multi.h:338
GAP_DEVICE_INFO_EVENT message format.
Definition: gap.h:801
uint16_t timeoutMultiplier
supervision timeout
Definition: multi.h:354
uint8_t paramUpdateEnable
Parameter Update Options
Definition: multi.h:349
gapEventHdr_t gap
GAP_MSG_EVENT and status.
Definition: multi.h:337
uint16_t minConnInterval
minimum connection interval
Definition: multi.h:351
bStatus_t GAPRole_CancelDiscovery(void)
Cancel a device discovery scan.
Peripheral GAPRole Callback structure.
Definition: peripheral.h:482
Multi GAPRole Event Structure.
Definition: multi.h:335
GAP layer interface.
uint16_t slaveLatency
slave latency
Definition: multi.h:353
uint8_t(* passThroughToApp_t)(gapMultiRoleEvent_t *pEvent)
Multi Event Callback Function.
Definition: multi.h:404
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:243
paramUpdateAppDecision_t pfnParamUpdateAppDecision
When the app should decide on a param update request.
Definition: multi.h:432
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:847
gapDeviceInfoEvent_t deviceInfo
Discovery device information event structure.
Definition: multi.h:339
gapLinkUpdateEvent_t linkUpdate
Link update event structure.
Definition: multi.h:342
bStatus_t GAPRole_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: multi.h:343
bStatus_t GAPRole_SetParameter(uint16_t param, uint8_t len, void *pValue, uint8 connHandle)
Set a GAP Role parameter.
uint16_t connHandle
connection handle
Definition: multi.h:350
gapDevDiscEvent_t discCmpl
Discovery complete event structure.
Definition: multi.h:340
uint16_t maxConnInterval
maximum connection interval
Definition: multi.h:352
Copyright 2016, Texas Instruments Incorporated