Skip to content

Commit dcc3032

Browse files
author
andreas.larsson
committed
Added quality of service functions
1 parent db2623d commit dcc3032

File tree

2 files changed

+162
-18
lines changed

2 files changed

+162
-18
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_bt_conn_man.h

Lines changed: 77 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,17 @@ typedef struct
129129
cb_char serviceName[cbBCM_SERVICE_NAME_MAX_LEN];
130130
} cbBCM_ConnectionInfo;
131131

132+
typedef struct
133+
{
134+
cb_uint8 flags; /** Reserved for future use. */
135+
cb_uint8 flowDirection; /** 0x00 for Outgoing Flow and 0x01 for Incoming Flow */
136+
cb_uint8 serviceType; /** 0x00 No Traffic; 0x01 Best Effort; 0x02 Guaranteed */
137+
cb_uint32 tokenRate; /** Token Rate in octets per second */
138+
cb_uint32 tokenBucketSize; /** Token Bucket Size in octets */
139+
cb_uint32 peakBandwidth; /** Peak Bandwidth in octets per second */
140+
cb_uint32 latency; /** Latency in microseconds */
141+
} cbBCM_FlowSpecParams;
142+
132143
typedef void (*cbBCM_ConnectInd)(
133144
cbBCM_Handle handle,
134145
cbBCM_ConnectionInfo info);
@@ -156,7 +167,7 @@ typedef struct
156167
typedef void(*cbBCM_RoleDiscoveryCallback)(
157168
cbBCM_Handle handle,
158169
cb_int8 status,
159-
cb_int8 role);
170+
cb_uint8 role);
160171

161172
typedef void (*cbBCM_RssiCallback)(
162173
cbBCM_Handle handle,
@@ -226,6 +237,13 @@ typedef void(*cbBCM_LinkQualityCallback)(
226237
cbBCM_LinkQualityEvt linkQualityEvt,
227238
uint8 linkQuality);
228239

240+
typedef void(*cbBCM_ServiceClassEnabled)(cb_uint8 serviceChannel);
241+
242+
typedef void(*cbBCM_SetFlowSpecCallback)(
243+
cb_uint8 status,
244+
cbBCM_Handle handle,
245+
cbBCM_FlowSpecParams parameters);
246+
229247
/*===========================================================================
230248
* FUNCTIONS
231249
*=========================================================================*/
@@ -245,12 +263,14 @@ extern void cbBCM_init(void);
245263
* @param pServerChannel Pointer to return variable. The server channel is used to identify
246264
* incoming connections.
247265
* @param pConnectionCallback Callback structure for connection management.
266+
* @param pServiceClassEnabled Callback structure to inform when service is running.
248267
* @return If the operation is successful cbBCM_OK is returned.
249268
*/
250269
extern cb_int32 cbBCM_enableServerProfileSpp(
251270
cb_char *pServiceName,
252271
cb_uint8 *pServerChannel,
253-
cbBCM_ConnectionCallback *pConnectionCallback);
272+
cbBCM_ConnectionCallback *pConnectionCallback,
273+
cbBCM_ServiceClassEnabled pServiceClassEnabled);
254274

255275
/**
256276
* Enable a Dial Up Networking Profile (DUN)service record to
@@ -260,12 +280,14 @@ extern cb_int32 cbBCM_enableServerProfileSpp(
260280
* @param pServerChannel Pointer to return variable. The server channel is used to identify
261281
* incoming connections.
262282
* @param pConnectionCallback Callback structure for connection management.
283+
* @param pServiceClassEnabled Callback structure to inform when service is running.
263284
* @return If the operation is successful cbBCM_OK is returned.
264285
*/
265286
extern cb_int32 cbBCM_enableServerProfileDun(
266287
cb_char *pServiceName,
267288
cb_uint8 *pServerChannel,
268-
cbBCM_ConnectionCallback *pConnectionCallback);
289+
cbBCM_ConnectionCallback *pConnectionCallback,
290+
cbBCM_ServiceClassEnabled pServiceClassEnabled);
269291

270292
/**
271293
* Enable a service record with an application specific UUID.
@@ -276,13 +298,15 @@ extern cb_int32 cbBCM_enableServerProfileDun(
276298
* @param pServerChannel Pointer to return variable. The server channel is used to identify
277299
* incoming connections.
278300
* @param pConnectionCallback Callback structure for connection management.
301+
* @param pServiceClassEnabled Callback structure to inform when service is running.
279302
* @return If the operation is successful cbBCM_OK is returned.
280303
*/
281304
extern cb_int32 cbBCM_enableServerProfileUuid128(
282305
cb_uint8 *pUuid128,
283306
cb_char *pServiceName,
284307
cb_uint8 *pServerChannel,
285-
cbBCM_ConnectionCallback *pConnectionCallback);
308+
cbBCM_ConnectionCallback *pConnectionCallback,
309+
cbBCM_ServiceClassEnabled pServiceClassEnabled);
286310

287311

288312
/**
@@ -295,12 +319,14 @@ extern cb_int32 cbBCM_enableServerProfileUuid128(
295319
* @param pServiceName The name of the service
296320
* @param role The PAN role of the local device
297321
* @param pConnectionCallback Callback structure for connection management.
322+
* @param pServiceClassEnabled Callback structure to inform when service is running.
298323
* @return If the operation is successful cbBCM_OK is returned.
299324
*/
300325
extern cb_int32 cbBCM_enableServerProfilePan(
301326
cb_char *pServiceName,
302327
cbBCM_PAN_Role role,
303-
cbBCM_ConnectionCallback *pConnectionCallback);
328+
cbBCM_ConnectionCallback *pConnectionCallback,
329+
cbBCM_ServiceClassEnabled pServiceClassEnabled);
304330

305331
/**
306332
* Enable device id service record.The device id service record is a method by which
@@ -393,7 +419,7 @@ extern cb_uint16 cbBCM_getMaxLinksLE(void);
393419
* @param serverChannel RFCOMM server channel that shall be used. Set to
394420
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
395421
* service search to find the server channel.
396-
* @param pAclParameters Link configuration including link supervision timeout
422+
* @param pAclParameters Link configuration including link supervision timeout
397423
* and master slave policy. Pass NULL to use default connection
398424
* parameters.
399425
* @param pConnectionCallback Callback structure for connection management.
@@ -439,7 +465,7 @@ extern cb_int32 cbBCM_rspConnectSppCnf(
439465
* @param serverChannel RFCOMM server channel that shall be used. Set to
440466
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
441467
* service search to find the server channel.
442-
* @param pAclParameters Link configuration including link supervision timeout
468+
* @param pAclParameters Link configuration including link supervision timeout
443469
* and master slave policy. Pass NULL to use default connection
444470
* parameters.
445471
* @param pConnectionCallback Callback structure for connection management.
@@ -457,7 +483,7 @@ extern cbBCM_Handle cbBCM_reqConnectDun(
457483
* Accept or reject an incoming DUN connection. This is a
458484
* response to a cbBCM_ConnectInd connection indication.
459485
*
460-
* @param handle Connection handle
486+
* @param handle Connection handle
461487
* @param accept TRUE to accept the incoming connection.
462488
FALSE to reject.
463489
* @return If the operation is successful cbBCM_OK is returned.
@@ -505,7 +531,7 @@ extern cbBCM_Handle cbBCM_reqConnectUuid(
505531
* Accept or reject an incoming SPP connection. This is a
506532
* response to a cbBCM_ConnectInd connection indication.
507533
*
508-
* @param handle Connection handle
534+
* @param handle Connection handle
509535
* @param accept TRUE to accept the incoming connection.
510536
FALSE to reject.
511537
* @return If the operation is successful cbBCM_OK is returned.
@@ -542,7 +568,7 @@ extern cbBCM_Handle cbBCM_reqConnectPan(
542568
* Accept or reject an incoming PAN connection. This is a
543569
* response to a cbBCM_ConnectInd connection indication.
544570
*
545-
* @param handle Connection handle
571+
* @param handle Connection handle
546572
* @param accept TRUE to accept the incoming connection.
547573
* FALSE to reject.
548574
* @return If the operation is successful cbBCM_OK is returned.
@@ -604,7 +630,7 @@ extern cbBCM_Handle cbBCM_reqConnectSps(
604630
/**
605631
* Accept or reject an incoming SPS connection. This is a
606632
* response to a cbBCM_ConnectInd connection indication.
607-
* @param handle Connection handle
633+
* @param handle Connection handle
608634
* @param accept TRUE to accept the incoming connection.
609635
* FALSE to reject.
610636
* @return If the operation is successful cbBCM_OK is returned.
@@ -813,10 +839,50 @@ extern cb_int32 cbBCM_registerDataCallback(
813839
extern cbBCM_Handle cbBCM_getProtocolHandle(
814840
cbBCM_Handle handle);
815841

842+
/**
843+
* @brief Get the bcm id from acl handle for an active connection.
844+
*
845+
* @param handle Connection handle
846+
* @return bcm handle.
847+
*/
848+
extern cbBCM_Handle cbBCM_getIdFromAclHandle(TConnHandle aclHandle);
849+
850+
/**
851+
* @brief Get the acl handle from bcm handle.
852+
*
853+
* @param handle bcm handle
854+
* @return acl handle
855+
*/
856+
extern TConnHandle cbBCM_getAclFromIdHandle(cbBCM_Handle bcmHandle);
857+
/**
858+
* @brief This will send cbHCI_cmdFlowSpecification command for the specified link
859+
* with the specified parameters.
860+
* @param handle Connection handle
861+
* @param parameters Flow Specification parameters. For details see Bluetooth Core
862+
* Specification [Vol 3] Part A, Section 5.3
863+
* @param flowSpecCallback Callback contains the data in Flow Specification Complete event
864+
* @return If the operation is successful cbBCM_OK is returned.
865+
*/
866+
extern cb_int32 cbBCM_setFlowSpecification(
867+
cbBCM_Handle handle,
868+
cbBCM_FlowSpecParams parameters,
869+
cbBCM_SetFlowSpecCallback flowSpecCallback);
870+
871+
/**
872+
* @brief Change which packet types can be used for the connection identified by the handle
873+
* @param handle Connection handle
874+
* @param aclPacketType bit map according to packet types defined in bt_types.h
875+
* @return If the operation is successful cbBCM_OK is returned.
876+
*/
877+
extern cb_int32 cbBCM_changeConnectionPacketType(
878+
cbBCM_Handle handle,
879+
TPacketType aclPacketType);
880+
816881
#ifdef __cplusplus
817882
}
818883
#endif
819884

885+
820886
#endif /* _CB_BT_CONN_MAN_H_ */
821887

822888

targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_bt_man.h

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ typedef void (*cbBM_ChannelMapCallb)(
141141
TChannelMap *pChMap);
142142

143143
typedef void (*cbBM_InitComplete)(void);
144+
typedef void(*cbBM_LocalAddressCb)(void);
144145

145146
typedef enum
146147
{
@@ -149,6 +150,17 @@ typedef enum
149150
cbBM_LE_ROLE_PERIPHERAL = 2,
150151
} cbBM_LeRole;
151152

153+
typedef struct
154+
{
155+
cb_uint8 flags;
156+
cb_uint8 flowDirection;
157+
cb_uint8 serviceType;
158+
cb_uint32 tokenRate;
159+
cb_uint32 tokenBucketSize;
160+
cb_uint32 peakBandwidth;
161+
cb_uint32 latency;
162+
} cbBM_FlowSpecParams;
163+
152164
/**
153165
* Bluetooth Manager initialization parameters.
154166
*/
@@ -157,12 +169,13 @@ typedef struct
157169
TBdAddr address; /** Bluetooth address that shall be assigned to controller. Pass invalidBdAddress to use controller default address*/
158170
cbBM_LeRole leRole; /** Bluetooth low energy role */
159171
cb_int8 maxOutputPower; /** Maximum output power. */
160-
cb_uint32 nvdsStartIdLinkKeysClassic; /** Start id for CLASSIC link keys storage in NVDS. */
161-
cb_uint32 maxLinkKeysClassic; /** Max number of CLASSIC link keys */
162-
cb_uint32 nvdsStartIdLinkKeysLe; /** Start id for BLE link keys storage in NVDS. */
163-
cb_uint32 maxLinkKeysLe; /** Max number of link keys BLE*/
172+
cb_int32 nvdsStartIdLinkKeysClassic; /** Start id for CLASSIC link keys storage in NVDS. */
173+
cb_int32 maxLinkKeysClassic; /** Max number of CLASSIC link keys */
174+
cb_int32 nvdsStartIdLinkKeysLe; /** Start id for BLE link keys storage in NVDS. */
175+
cb_int32 maxLinkKeysLe; /** Max number of link keys BLE*/
164176
} cbBM_InitParams;
165177

178+
typedef void(*cbBM_ServiceEnabled)(cb_uint8 serviceChannel);
166179
/*===========================================================================
167180
* FUNCTIONS
168181
*=========================================================================*/
@@ -184,12 +197,70 @@ extern void cbBM_init(
184197
cbBM_InitParams *pInitParameters,
185198
cbBM_InitComplete initCompleteCallback);
186199

200+
/**
201+
* This function sets the default link supervision timeout. The specified timeout will
202+
* apply for new connections.
203+
* @param linkSupervisionTimeout timeout in milliseconds
204+
* @return If the operation is successful cbBM_OK is returned.
205+
*/
206+
extern cb_int32 cbBM_setLinkSupervisionTimeout(
207+
cb_uint16 linkSupervisionTimeout);
208+
209+
/**
210+
* This function gets the default link supervision timeout.
211+
* @return link supervision timeout in milliseconds.
212+
*/
213+
extern cb_uint16 cbBM_getLinkSupervisionTimeout(void);
214+
215+
/**
216+
* This function enables or disables the fast connect feature (interlaced page scan).
217+
* @param fastConnect
218+
* @return cbBM_OK if in parameter is valid.
219+
*/
220+
extern cb_int32 cbBM_setFastConnect(
221+
cb_boolean fastConnect);
222+
/**
223+
* This function gets whether the fast connect feature is enabled or disabled.
224+
* @return TRUE if feature is enabled
225+
*/
226+
extern cb_boolean cbBM_getFastConnect(void);
227+
228+
/**
229+
* This function enables or disables the fast discovery feature (interlaced inquiry scan).
230+
* @param fastDiscovery
231+
* @return cbBM_OK if in parameter is valid.
232+
*/
233+
extern cb_int32 cbBM_setFastDiscovery(
234+
cb_boolean fastDiscovery);
235+
/**
236+
* This function gets whether the fast discovery feature is enabled or disabled.
237+
* @return TRUE if feature is enabled
238+
*/
239+
extern cb_boolean cbBM_getFastDiscovery(void);
187240
/**
188241
* This function sets all default parameters for LE.
189242
* This function needs to be called before the cbBM_init.
190243
*/
191244
extern void cbBM_setDefaultValuesLeParams(void);
192245

246+
/**
247+
* This function executes HCI_cmdWrScanEnable command according to parameters.
248+
* @param discoverableMode discoverable mode
249+
* @param connectableMode connectable mode
250+
* @return true if HCI command could be executed.
251+
*/
252+
extern cb_int32 cbBM_updateScan(
253+
cbBM_DiscoverableMode discoverableMode,
254+
cbBM_ConnectableMode connectableMode);
255+
256+
/**
257+
* Get the current Bluetooth address of the device from radio. This can
258+
* be a way to get a alive-message from the radio.
259+
*
260+
* @param callback to application when address has been read.
261+
*/
262+
extern void cbBM_checkRadioAlive(cbBM_LocalAddressCb callback);
263+
193264
/**
194265
* Get the current Bluetooth address of the device.
195266
* @param pAddress Pointer to return variable.
@@ -335,9 +406,11 @@ extern cb_int32 cbBM_remoteName(
335406
* Add service class to inquiry response data. Typically
336407
* not used by the application.
337408
* @param uuid16 The UUID to add
409+
* @param pCallback callback to indicate service is enabled.
410+
* @param serviceChannel channel the service is started on.
338411
* @return If the operation is successful cbBM_OK is returned.
339412
*/
340-
extern cb_int32 cbBM_addServiceClass(cb_uint16 uuid16);
413+
extern cb_int32 cbBM_addServiceClass(cb_uint16 uuid16, cbBM_ServiceEnabled pCallback,cb_uint8 serviceChannel);
341414

342415
/**
343416
* Check if service class is already registered.
@@ -350,9 +423,11 @@ cb_boolean cbBM_isServiceClassRegistered(cb_uint16 uuid16 );
350423
* Add service class to inquiry response data. Typically
351424
* not used by the application.
352425
* @param uuid128 The UUID to add.
426+
* @param pCallback callback to indicate service is enabled.
427+
* @param serviceChannel channel the service is started on.
353428
* @return If the operation is successful cbBM_OK is returned.
354429
*/
355-
extern cb_int32 cbBM_add128BitsServiceClass(cb_uint8* uuid128);
430+
extern cb_int32 cbBM_add128BitsServiceClass(cb_uint8* uuid128, cbBM_ServiceEnabled pCallback, cb_uint8 serviceChannel);
356431

357432
/**
358433
* Set maximum Bluetooth Classic ACL links the stack
@@ -521,7 +596,7 @@ extern cb_int32 cbBM_deviceDiscoveryLeCancel(void);
521596
/**
522597
* Perform a remote name request for Bluetooth Low Energy.
523598
* @param pAddress Pointer to address of remote device.
524-
* @param remoteNameCallback Callback used to notify the the completion of the
599+
* @param remoteNameCallback Callback used to notify the the completion of the
525600
* name request.
526601
* @return If the operation is successfully initiated cbBM_OK is returned.
527602
*/
@@ -560,6 +635,9 @@ void cbBM_getConnectParameters(TAclParamsLe* aclParams);
560635
*/
561636
void cbBM_getRemoteNameReqParameters(TAclParamsLe* aclParams);
562637

638+
639+
cb_int32 cbBM_setForceClassicNotSupportedInAdv(cb_boolean enforceDisable);
640+
cb_boolean cbBM_getForceClassicNotSupportedInAdv(void);
563641
/*
564642
* Sets the LE parameter.
565643
* @newValue new parameter value.

0 commit comments

Comments
 (0)