BLE-Stack APIs  3.00.00
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ugap.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  * @addtogroup Micro_BLE_Stack
34  * @{
35  * @defgroup UGAP Micro Gap Layer
36  * @{
37  * @file ugap.h
38  * @brief Micro BLE GAP API
39  *
40  * This file contains the interface to the Micro GAP Layer.
41  */
42 
43 #ifndef UGAP_H
44 #define UGAP_H
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50 
51 /*-------------------------------------------------------------------
52  * INCLUDES
53  */
54 
55 /*-------------------------------------------------------------------
56  * CONSTANTS
57  */
58 
63 #define UG_DUTY_TIME_UNIT 100L
65 
66 #if defined(FEATURE_BROADCASTER)
67 
71 #define UG_BCAST_STATE_INVALID 0
72 #define UG_BCAST_STATE_INITIALIZED 1
73 #define UG_BCAST_STATE_IDLE 2
74 #define UG_BCAST_STATE_ADVERTISING 3
75 #define UG_BCAST_STATE_WAITING 4
76 #define UG_BCAST_STATE_SUSPENDED 5
77 
82 #define UGB_EVT_STATE_CHANGE 1
83 #define UGB_EVT_ADV_PREPARE 2
84 #define UGB_EVT_ADV_POSTPROCESS 3
85 
86 #endif /* FEATURE_BROADCASTER */
87 
90 /*-------------------------------------------------------------------
91  * TYPEDEFS
92  */
93 
94 #if defined(FEATURE_BROADCASTER)
95 
99 typedef uint8 ugBcastState_t;
100 
112 typedef void (*ugbStateChangeCb_t)(ugBcastState_t state);
113 
119 typedef void (*ugbAdvPrepareCb_t)(void);
120 
126 typedef void (*ugbAdvDoneCb_t)(bStatus_t status);
127 
131 typedef struct
132 {
136 } ugBcastCBs_t;
137 
142  ugBcastState_t state;
143 } ugbMsgStateChange_t;
144 
149  bStatus_t status;
150 } ugbMsgAdvPostprocess_t;
151 
154 #endif /* FEATURE_BROADCASTER */
155 
156 /*-------------------------------------------------------------------
157  * MACROS
158  */
159 
160 /*-------------------------------------------------------------------
161  * API FUNCTIONS
162  */
163 
164 #if defined(FEATURE_BROADCASTER)
165 
175 
189 bStatus_t ug_bcastSetDuty(uint16 dutyOnTime, uint16 dutyOffTime);
190 
205 bStatus_t ug_bcastStart(uint16 numAdvEvent);
206 
215 bStatus_t ug_bcastStop(void);
216 #endif /* FEATURE_BROADCASTER */
217 
218 /*-------------------------------------------------------------------
219 -------------------------------------------------------------------*/
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif /* UGAP_H */
226  // end of Micro_BLE_Stack
uint8 ugBcastState_t
Broadcaster state.
Definition: ugap.h:99
ugbAdvPrepareCb_t pfnAdvPrepareCB
Notification for Adv preperation.
Definition: ugap.h:134
void(* ugbAdvPrepareCb_t)(void)
Callback of when the next Adverting Event is about to start.
Definition: ugap.h:119
bStatus_t ug_bcastInit(ugBcastCBs_t *pCBs)
Initialize Micro Broadcaster.
bStatus_t ug_bcastStop(void)
Stop Broadcaster. Proceed the state from either Advertising or Waiting to IDLE.
void(* ugbStateChangeCb_t)(ugBcastState_t state)
Callback of when the Broadcaster's state changes.
Definition: ugap.h:112
bStatus_t ug_bcastStart(uint16 numAdvEvent)
Start Broadcaster. Proceed the state from either Initialized or IDLE to Advertising.
ugbAdvDoneCb_t pfnAdvDoneCB
Notification of Adv event done.
Definition: ugap.h:135
void(* ugbAdvDoneCb_t)(bStatus_t status)
Callback of when an Advertising Event has just been done.
Definition: ugap.h:126
ugbStateChangeCb_t pfnStateChangeCB
State change notification.
Definition: ugap.h:133
Set of Broadcaster callbacks - must be setup by the application.
Definition: ugap.h:131
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:243
bStatus_t ug_bcastSetDuty(uint16 dutyOnTime, uint16 dutyOffTime)
Set Broadcaster Duty On/Off time.
PACKED_TYPEDEF_STRUCT
Message payload for the event UGB_EVT_STATE_CHANGE.
Definition: ugap.h:141
Copyright 2016, Texas Instruments Incorporated