BLE-Stack APIs  3.00.00
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
peripheral.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 Peripheral GAPRole (Peripheral)
34  * @brief This module implements the Peripheral GAP Role
35  * @{
36  * @file peripheral.h
37  * @brief Peripheral layer interface
38  */
39 
40 #ifndef PERIPHERAL_H
41 #define PERIPHERAL_H
42 
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif
47 
48 /*-------------------------------------------------------------------
49  * INCLUDES
50  */
51 
52 /*-------------------------------------------------------------------
53  * CONSTANTS
54  */
55 
72 #define GAPROLE_PROFILEROLE 0x300
73 
85 #define GAPROLE_IRK 0x301
86 
98 #define GAPROLE_SRK 0x302
99 
109 #define GAPROLE_SIGNCOUNTER 0x303
110 
123 #define GAPROLE_BD_ADDR 0x304
124 
136 #define GAPROLE_ADVERT_ENABLED 0x305
137 
149 #define GAPROLE_ADVERT_OFF_TIME 0x306
150 
161 #define GAPROLE_ADVERT_DATA 0x307
162 
172 #define GAPROLE_SCAN_RSP_DATA 0x308
173 
183 #define GAPROLE_ADV_EVENT_TYPE 0x309
184 
194 #define GAPROLE_ADV_DIRECT_TYPE 0x30A
195 
205 #define GAPROLE_ADV_DIRECT_ADDR 0x30B
206 
218 #define GAPROLE_ADV_CHANNEL_MAP 0x30C
219 
231 #define GAPROLE_ADV_FILTER_POLICY 0x30D
232 
240 #define GAPROLE_CONNHANDLE 0x30E
241 
243 
251 #define GAPROLE_RSSI_READ_RATE 0x30F
252 
263 #define GAPROLE_PARAM_UPDATE_ENABLE 0x310
264 
274 #define GAPROLE_MIN_CONN_INTERVAL 0x311
275 
285 #define GAPROLE_MAX_CONN_INTERVAL 0x312
286 
296 #define GAPROLE_SLAVE_LATENCY 0x313
297 
307 #define GAPROLE_TIMEOUT_MULTIPLIER 0x314
308 
316 #define GAPROLE_CONN_BD_ADDR 0x315
317 
325 #define GAPROLE_CONN_INTERVAL 0x316
326 
334 #define GAPROLE_CONN_LATENCY 0x317
335 
343 #define GAPROLE_CONN_TIMEOUT 0x318
344 
345 
352 #define GAPROLE_PARAM_UPDATE_REQ 0x319
353 
363 #define GAPROLE_STATE 0x31A
364 
376 #define GAPROLE_ADV_NONCONN_ENABLED 0x31B
377 
385 #define GAPROLE_BD_ADDR_TYPE 0x31C
386 
394 #define GAPROLE_CONN_TERM_REASON 0x31D
395 
398 /*-------------------------------------------------------------------
399  * TYPEDEFS
400  */
401 
403 typedef enum
404 {
415 
421 #define GAPROLE_NO_ACTION 0
422 #define GAPROLE_RESEND_PARAM_UPDATE 1
423 #define GAPROLE_TERMINATE_LINK 2
424 
431 #define GAPROLE_LINK_PARAM_UPDATE_WAIT_REMOTE_PARAMS 0
432 #define GAPROLE_LINK_PARAM_UPDATE_INITIATE_BOTH_PARAMS 1
433 #define GAPROLE_LINK_PARAM_UPDATE_INITIATE_APP_PARAMS 2
434 #define GAPROLE_LINK_PARAM_UPDATE_WAIT_APP_PARAMS 3
435 #define GAPROLE_LINK_PARAM_UPDATE_WAIT_BOTH_PARAMS 4
436 #define GAPROLE_LINK_PARAM_UPDATE_REJECT_REQUEST 5
437 #define GAPROLE_LINK_PARAM_UPDATE_NUM_OPTIONS 6
438 
442 /*-------------------------------------------------------------------
443  * MACROS
444  */
445 
446 /*-------------------------------------------------------------------
447  * Profile Callbacks
448  */
449 
456 /*
457  * @brief Callback when the connection parameters are updated.
458  *
459  * @param connInterval new connection interval
460  * @param connSlaveLatency new slave latency
461  * @param connTimeout new supervision timeout
462  */
463 typedef void (*gapRolesParamUpdateCB_t)(uint16_t connInterval,
464  uint16_t connSlaveLatency,
465  uint16_t connTimeout);
466 
474 typedef void (*gapRolesStateNotify_t)(gaprole_States_t newState);
475 
482 typedef struct
483 {
485 } gapRolesCBs_t;
486 
489 /*-------------------------------------------------------------------
490  * API FUNCTIONS
491  */
492 
514 extern bStatus_t GAPRole_SetParameter(uint16_t param, uint8_t len, void *pValue);
515 
531 extern bStatus_t GAPRole_GetParameter(uint16_t param, void *pValue);
532 
543 extern bStatus_t GAPRole_StartDevice(gapRolesCBs_t *pAppCallbacks);
544 
553 
573 extern bStatus_t GAPRole_SendUpdateParam(uint16_t minConnInterval,
574  uint16_t maxConnInterval,
575  uint16_t latency, uint16_t connTimeout,
576  uint8_t handleFailure);
577 
583 extern void GAPRole_RegisterAppCBs(gapRolesParamUpdateCB_t *pParamUpdateCB);
584 
586 
587 /*-------------------------------------------------------------------
588  * TASK FUNCTIONS - Don't call these. These are system functions.
589  */
590 
595 extern void GAPRole_createTask(void);
596 
598 
599 /*-------------------------------------------------------------------
600 -------------------------------------------------------------------*/
601 
602 #ifdef __cplusplus
603 }
604 #endif
605 
606 #endif /* PERIPHERAL_H */
607 
void GAPRole_RegisterAppCBs(gapRolesParamUpdateCB_t *pParamUpdateCB)
Register application's callbacks.
Waiting to be started.
Definition: peripheral.h:405
In a connection + advertising.
Definition: peripheral.h:412
Error occurred - invalid state.
Definition: peripheral.h:413
bStatus_t GAPRole_StartDevice(gapRolesCBs_t *pAppCallbacks)
Initialize the GAP layer.
In a connection.
Definition: peripheral.h:411
Device just timed out from a connection but is not yet advertising, is in waiting period before adver...
Definition: peripheral.h:410
Device is started but not advertising, is in waiting period before advertising again.
Definition: peripheral.h:409
bStatus_t GAPRole_TerminateConnection(void)
Terminates the existing connection.
void(* gapRolesStateNotify_t)(gaprole_States_t newState)
State Change Callback Type.
Definition: peripheral.h:474
bStatus_t GAPRole_SetParameter(uint16_t param, uint8_t len, void *pValue)
Set a GAP Role parameter.
bStatus_t GAPRole_GetParameter(uint16_t param, void *pValue)
Get a GAP Role parameter.
Peripheral GAPRole Callback structure.
Definition: peripheral.h:482
bStatus_t GAPRole_SendUpdateParam(uint16_t minConnInterval, uint16_t maxConnInterval, uint16_t latency, uint16_t connTimeout, uint8_t handleFailure)
Update the parameters of an existing connection.
gaprole_States_t
GAP Peripheral Role States.
Definition: peripheral.h:403
Currently Advertising.
Definition: peripheral.h:407
Currently using non-connectable Advertising.
Definition: peripheral.h:408
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:243
Started but not advertising.
Definition: peripheral.h:406
gapRolesStateNotify_t pfnStateChange
Whenever the device changes state.
Definition: peripheral.h:484
Copyright 2016, Texas Instruments Incorporated