Added quality of service functions

pull/4338/head
andreas.larsson 2017-05-17 23:12:54 +02:00
parent db2623d318
commit dcc303225c
2 changed files with 162 additions and 18 deletions

View File

@ -129,6 +129,17 @@ typedef struct
cb_char serviceName[cbBCM_SERVICE_NAME_MAX_LEN];
} cbBCM_ConnectionInfo;
typedef struct
{
cb_uint8 flags; /** Reserved for future use. */
cb_uint8 flowDirection; /** 0x00 for Outgoing Flow and 0x01 for Incoming Flow */
cb_uint8 serviceType; /** 0x00 No Traffic; 0x01 Best Effort; 0x02 Guaranteed */
cb_uint32 tokenRate; /** Token Rate in octets per second */
cb_uint32 tokenBucketSize; /** Token Bucket Size in octets */
cb_uint32 peakBandwidth; /** Peak Bandwidth in octets per second */
cb_uint32 latency; /** Latency in microseconds */
} cbBCM_FlowSpecParams;
typedef void (*cbBCM_ConnectInd)(
cbBCM_Handle handle,
cbBCM_ConnectionInfo info);
@ -156,7 +167,7 @@ typedef struct
typedef void(*cbBCM_RoleDiscoveryCallback)(
cbBCM_Handle handle,
cb_int8 status,
cb_int8 role);
cb_uint8 role);
typedef void (*cbBCM_RssiCallback)(
cbBCM_Handle handle,
@ -226,6 +237,13 @@ typedef void(*cbBCM_LinkQualityCallback)(
cbBCM_LinkQualityEvt linkQualityEvt,
uint8 linkQuality);
typedef void(*cbBCM_ServiceClassEnabled)(cb_uint8 serviceChannel);
typedef void(*cbBCM_SetFlowSpecCallback)(
cb_uint8 status,
cbBCM_Handle handle,
cbBCM_FlowSpecParams parameters);
/*===========================================================================
* FUNCTIONS
*=========================================================================*/
@ -245,12 +263,14 @@ extern void cbBCM_init(void);
* @param pServerChannel Pointer to return variable. The server channel is used to identify
* incoming connections.
* @param pConnectionCallback Callback structure for connection management.
* @param pServiceClassEnabled Callback structure to inform when service is running.
* @return If the operation is successful cbBCM_OK is returned.
*/
extern cb_int32 cbBCM_enableServerProfileSpp(
cb_char *pServiceName,
cb_uint8 *pServerChannel,
cbBCM_ConnectionCallback *pConnectionCallback);
cbBCM_ConnectionCallback *pConnectionCallback,
cbBCM_ServiceClassEnabled pServiceClassEnabled);
/**
* Enable a Dial Up Networking Profile (DUN)service record to
@ -260,12 +280,14 @@ extern cb_int32 cbBCM_enableServerProfileSpp(
* @param pServerChannel Pointer to return variable. The server channel is used to identify
* incoming connections.
* @param pConnectionCallback Callback structure for connection management.
* @param pServiceClassEnabled Callback structure to inform when service is running.
* @return If the operation is successful cbBCM_OK is returned.
*/
extern cb_int32 cbBCM_enableServerProfileDun(
cb_char *pServiceName,
cb_uint8 *pServerChannel,
cbBCM_ConnectionCallback *pConnectionCallback);
cbBCM_ConnectionCallback *pConnectionCallback,
cbBCM_ServiceClassEnabled pServiceClassEnabled);
/**
* Enable a service record with an application specific UUID.
@ -276,13 +298,15 @@ extern cb_int32 cbBCM_enableServerProfileDun(
* @param pServerChannel Pointer to return variable. The server channel is used to identify
* incoming connections.
* @param pConnectionCallback Callback structure for connection management.
* @param pServiceClassEnabled Callback structure to inform when service is running.
* @return If the operation is successful cbBCM_OK is returned.
*/
extern cb_int32 cbBCM_enableServerProfileUuid128(
cb_uint8 *pUuid128,
cb_char *pServiceName,
cb_uint8 *pServerChannel,
cbBCM_ConnectionCallback *pConnectionCallback);
cbBCM_ConnectionCallback *pConnectionCallback,
cbBCM_ServiceClassEnabled pServiceClassEnabled);
/**
@ -295,12 +319,14 @@ extern cb_int32 cbBCM_enableServerProfileUuid128(
* @param pServiceName The name of the service
* @param role The PAN role of the local device
* @param pConnectionCallback Callback structure for connection management.
* @param pServiceClassEnabled Callback structure to inform when service is running.
* @return If the operation is successful cbBCM_OK is returned.
*/
extern cb_int32 cbBCM_enableServerProfilePan(
cb_char *pServiceName,
cbBCM_PAN_Role role,
cbBCM_ConnectionCallback *pConnectionCallback);
cbBCM_ConnectionCallback *pConnectionCallback,
cbBCM_ServiceClassEnabled pServiceClassEnabled);
/**
* 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);
* @param serverChannel RFCOMM server channel that shall be used. Set to
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
* service search to find the server channel.
* @param pAclParameters Link configuration including link supervision timeout
* @param pAclParameters Link configuration including link supervision timeout
* and master slave policy. Pass NULL to use default connection
* parameters.
* @param pConnectionCallback Callback structure for connection management.
@ -439,7 +465,7 @@ extern cb_int32 cbBCM_rspConnectSppCnf(
* @param serverChannel RFCOMM server channel that shall be used. Set to
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
* service search to find the server channel.
* @param pAclParameters Link configuration including link supervision timeout
* @param pAclParameters Link configuration including link supervision timeout
* and master slave policy. Pass NULL to use default connection
* parameters.
* @param pConnectionCallback Callback structure for connection management.
@ -457,7 +483,7 @@ extern cbBCM_Handle cbBCM_reqConnectDun(
* Accept or reject an incoming DUN connection. This is a
* response to a cbBCM_ConnectInd connection indication.
*
* @param handle Connection handle
* @param handle Connection handle
* @param accept TRUE to accept the incoming connection.
FALSE to reject.
* @return If the operation is successful cbBCM_OK is returned.
@ -505,7 +531,7 @@ extern cbBCM_Handle cbBCM_reqConnectUuid(
* Accept or reject an incoming SPP connection. This is a
* response to a cbBCM_ConnectInd connection indication.
*
* @param handle Connection handle
* @param handle Connection handle
* @param accept TRUE to accept the incoming connection.
FALSE to reject.
* @return If the operation is successful cbBCM_OK is returned.
@ -542,7 +568,7 @@ extern cbBCM_Handle cbBCM_reqConnectPan(
* Accept or reject an incoming PAN connection. This is a
* response to a cbBCM_ConnectInd connection indication.
*
* @param handle Connection handle
* @param handle Connection handle
* @param accept TRUE to accept the incoming connection.
* FALSE to reject.
* @return If the operation is successful cbBCM_OK is returned.
@ -604,7 +630,7 @@ extern cbBCM_Handle cbBCM_reqConnectSps(
/**
* Accept or reject an incoming SPS connection. This is a
* response to a cbBCM_ConnectInd connection indication.
* @param handle Connection handle
* @param handle Connection handle
* @param accept TRUE to accept the incoming connection.
* FALSE to reject.
* @return If the operation is successful cbBCM_OK is returned.
@ -813,10 +839,50 @@ extern cb_int32 cbBCM_registerDataCallback(
extern cbBCM_Handle cbBCM_getProtocolHandle(
cbBCM_Handle handle);
/**
* @brief Get the bcm id from acl handle for an active connection.
*
* @param handle Connection handle
* @return bcm handle.
*/
extern cbBCM_Handle cbBCM_getIdFromAclHandle(TConnHandle aclHandle);
/**
* @brief Get the acl handle from bcm handle.
*
* @param handle bcm handle
* @return acl handle
*/
extern TConnHandle cbBCM_getAclFromIdHandle(cbBCM_Handle bcmHandle);
/**
* @brief This will send cbHCI_cmdFlowSpecification command for the specified link
* with the specified parameters.
* @param handle Connection handle
* @param parameters Flow Specification parameters. For details see Bluetooth Core
* Specification [Vol 3] Part A, Section 5.3
* @param flowSpecCallback Callback contains the data in Flow Specification Complete event
* @return If the operation is successful cbBCM_OK is returned.
*/
extern cb_int32 cbBCM_setFlowSpecification(
cbBCM_Handle handle,
cbBCM_FlowSpecParams parameters,
cbBCM_SetFlowSpecCallback flowSpecCallback);
/**
* @brief Change which packet types can be used for the connection identified by the handle
* @param handle Connection handle
* @param aclPacketType bit map according to packet types defined in bt_types.h
* @return If the operation is successful cbBCM_OK is returned.
*/
extern cb_int32 cbBCM_changeConnectionPacketType(
cbBCM_Handle handle,
TPacketType aclPacketType);
#ifdef __cplusplus
}
#endif
#endif /* _CB_BT_CONN_MAN_H_ */

View File

@ -141,6 +141,7 @@ typedef void (*cbBM_ChannelMapCallb)(
TChannelMap *pChMap);
typedef void (*cbBM_InitComplete)(void);
typedef void(*cbBM_LocalAddressCb)(void);
typedef enum
{
@ -149,6 +150,17 @@ typedef enum
cbBM_LE_ROLE_PERIPHERAL = 2,
} cbBM_LeRole;
typedef struct
{
cb_uint8 flags;
cb_uint8 flowDirection;
cb_uint8 serviceType;
cb_uint32 tokenRate;
cb_uint32 tokenBucketSize;
cb_uint32 peakBandwidth;
cb_uint32 latency;
} cbBM_FlowSpecParams;
/**
* Bluetooth Manager initialization parameters.
*/
@ -157,12 +169,13 @@ typedef struct
TBdAddr address; /** Bluetooth address that shall be assigned to controller. Pass invalidBdAddress to use controller default address*/
cbBM_LeRole leRole; /** Bluetooth low energy role */
cb_int8 maxOutputPower; /** Maximum output power. */
cb_uint32 nvdsStartIdLinkKeysClassic; /** Start id for CLASSIC link keys storage in NVDS. */
cb_uint32 maxLinkKeysClassic; /** Max number of CLASSIC link keys */
cb_uint32 nvdsStartIdLinkKeysLe; /** Start id for BLE link keys storage in NVDS. */
cb_uint32 maxLinkKeysLe; /** Max number of link keys BLE*/
cb_int32 nvdsStartIdLinkKeysClassic; /** Start id for CLASSIC link keys storage in NVDS. */
cb_int32 maxLinkKeysClassic; /** Max number of CLASSIC link keys */
cb_int32 nvdsStartIdLinkKeysLe; /** Start id for BLE link keys storage in NVDS. */
cb_int32 maxLinkKeysLe; /** Max number of link keys BLE*/
} cbBM_InitParams;
typedef void(*cbBM_ServiceEnabled)(cb_uint8 serviceChannel);
/*===========================================================================
* FUNCTIONS
*=========================================================================*/
@ -184,12 +197,70 @@ extern void cbBM_init(
cbBM_InitParams *pInitParameters,
cbBM_InitComplete initCompleteCallback);
/**
* This function sets the default link supervision timeout. The specified timeout will
* apply for new connections.
* @param linkSupervisionTimeout timeout in milliseconds
* @return If the operation is successful cbBM_OK is returned.
*/
extern cb_int32 cbBM_setLinkSupervisionTimeout(
cb_uint16 linkSupervisionTimeout);
/**
* This function gets the default link supervision timeout.
* @return link supervision timeout in milliseconds.
*/
extern cb_uint16 cbBM_getLinkSupervisionTimeout(void);
/**
* This function enables or disables the fast connect feature (interlaced page scan).
* @param fastConnect
* @return cbBM_OK if in parameter is valid.
*/
extern cb_int32 cbBM_setFastConnect(
cb_boolean fastConnect);
/**
* This function gets whether the fast connect feature is enabled or disabled.
* @return TRUE if feature is enabled
*/
extern cb_boolean cbBM_getFastConnect(void);
/**
* This function enables or disables the fast discovery feature (interlaced inquiry scan).
* @param fastDiscovery
* @return cbBM_OK if in parameter is valid.
*/
extern cb_int32 cbBM_setFastDiscovery(
cb_boolean fastDiscovery);
/**
* This function gets whether the fast discovery feature is enabled or disabled.
* @return TRUE if feature is enabled
*/
extern cb_boolean cbBM_getFastDiscovery(void);
/**
* This function sets all default parameters for LE.
* This function needs to be called before the cbBM_init.
*/
extern void cbBM_setDefaultValuesLeParams(void);
/**
* This function executes HCI_cmdWrScanEnable command according to parameters.
* @param discoverableMode discoverable mode
* @param connectableMode connectable mode
* @return true if HCI command could be executed.
*/
extern cb_int32 cbBM_updateScan(
cbBM_DiscoverableMode discoverableMode,
cbBM_ConnectableMode connectableMode);
/**
* Get the current Bluetooth address of the device from radio. This can
* be a way to get a alive-message from the radio.
*
* @param callback to application when address has been read.
*/
extern void cbBM_checkRadioAlive(cbBM_LocalAddressCb callback);
/**
* Get the current Bluetooth address of the device.
* @param pAddress Pointer to return variable.
@ -335,9 +406,11 @@ extern cb_int32 cbBM_remoteName(
* Add service class to inquiry response data. Typically
* not used by the application.
* @param uuid16 The UUID to add
* @param pCallback callback to indicate service is enabled.
* @param serviceChannel channel the service is started on.
* @return If the operation is successful cbBM_OK is returned.
*/
extern cb_int32 cbBM_addServiceClass(cb_uint16 uuid16);
extern cb_int32 cbBM_addServiceClass(cb_uint16 uuid16, cbBM_ServiceEnabled pCallback,cb_uint8 serviceChannel);
/**
* Check if service class is already registered.
@ -350,9 +423,11 @@ cb_boolean cbBM_isServiceClassRegistered(cb_uint16 uuid16 );
* Add service class to inquiry response data. Typically
* not used by the application.
* @param uuid128 The UUID to add.
* @param pCallback callback to indicate service is enabled.
* @param serviceChannel channel the service is started on.
* @return If the operation is successful cbBM_OK is returned.
*/
extern cb_int32 cbBM_add128BitsServiceClass(cb_uint8* uuid128);
extern cb_int32 cbBM_add128BitsServiceClass(cb_uint8* uuid128, cbBM_ServiceEnabled pCallback, cb_uint8 serviceChannel);
/**
* Set maximum Bluetooth Classic ACL links the stack
@ -521,7 +596,7 @@ extern cb_int32 cbBM_deviceDiscoveryLeCancel(void);
/**
* Perform a remote name request for Bluetooth Low Energy.
* @param pAddress Pointer to address of remote device.
* @param remoteNameCallback Callback used to notify the the completion of the
* @param remoteNameCallback Callback used to notify the the completion of the
* name request.
* @return If the operation is successfully initiated cbBM_OK is returned.
*/
@ -560,6 +635,9 @@ void cbBM_getConnectParameters(TAclParamsLe* aclParams);
*/
void cbBM_getRemoteNameReqParameters(TAclParamsLe* aclParams);
cb_int32 cbBM_setForceClassicNotSupportedInAdv(cb_boolean enforceDisable);
cb_boolean cbBM_getForceClassicNotSupportedInAdv(void);
/*
* Sets the LE parameter.
* @newValue new parameter value.