Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /**
lypinator 0:bb348c97df44 2 *---------------------------------------------------------------------------
lypinator 0:bb348c97df44 3 * Copyright (c) 2016, u-blox Malmö, All Rights Reserved
lypinator 0:bb348c97df44 4 * SPDX-License-Identifier: LicenseRef-PBL
lypinator 0:bb348c97df44 5 *
lypinator 0:bb348c97df44 6 * This file and the related binary are licensed under the
lypinator 0:bb348c97df44 7 * Permissive Binary License, Version 1.0 (the "License");
lypinator 0:bb348c97df44 8 * you may not use these files except in compliance with the License.
lypinator 0:bb348c97df44 9 *
lypinator 0:bb348c97df44 10 * You may obtain a copy of the License here:
lypinator 0:bb348c97df44 11 * LICENSE-permissive-binary-license-1.0.txt and at
lypinator 0:bb348c97df44 12 * https://www.mbed.com/licenses/PBL-1.0
lypinator 0:bb348c97df44 13 *
lypinator 0:bb348c97df44 14 * See the License for the specific language governing permissions and
lypinator 0:bb348c97df44 15 * limitations under the License.
lypinator 0:bb348c97df44 16 *
lypinator 0:bb348c97df44 17 * Component : Bluetooth Connection Manager
lypinator 0:bb348c97df44 18 * File : cb_bt_conn_man.h
lypinator 0:bb348c97df44 19 *
lypinator 0:bb348c97df44 20 * Description : Bluetooth Connection Management
lypinator 0:bb348c97df44 21 *
lypinator 0:bb348c97df44 22 *-------------------------------------------------------------------------*/
lypinator 0:bb348c97df44 23
lypinator 0:bb348c97df44 24 /**
lypinator 0:bb348c97df44 25 * @file cb_bt_conn_man.h
lypinator 0:bb348c97df44 26 * @brief Connection management. Functionality for setting up and tearing
lypinator 0:bb348c97df44 27 * down Bluetooth connections. Profile services are also enabled
lypinator 0:bb348c97df44 28 * using this module.
lypinator 0:bb348c97df44 29 */
lypinator 0:bb348c97df44 30
lypinator 0:bb348c97df44 31 #ifndef _CB_BT_CONN_MAN_H_
lypinator 0:bb348c97df44 32 #define _CB_BT_CONN_MAN_H_
lypinator 0:bb348c97df44 33
lypinator 0:bb348c97df44 34 #include "cb_comdefs.h"
lypinator 0:bb348c97df44 35 #include "bt_types.h"
lypinator 0:bb348c97df44 36
lypinator 0:bb348c97df44 37 #ifdef __cplusplus
lypinator 0:bb348c97df44 38 extern "C" {
lypinator 0:bb348c97df44 39 #endif
lypinator 0:bb348c97df44 40
lypinator 0:bb348c97df44 41 /*===========================================================================
lypinator 0:bb348c97df44 42 * DEFINES
lypinator 0:bb348c97df44 43 *=========================================================================*/
lypinator 0:bb348c97df44 44 #define cbBCM_OK (0)
lypinator 0:bb348c97df44 45 #define cbBCM_ERROR (-1)
lypinator 0:bb348c97df44 46 #define cbBCM_ILLEGAL_HANDLE (-2)
lypinator 0:bb348c97df44 47 #define cbBCM_NOT_IMPLEMENTED (-3)
lypinator 0:bb348c97df44 48 #define cbBCM_ERROR_DISCONNECTING (-4)
lypinator 0:bb348c97df44 49 #define cbBCM_ERROR_ALREADY_REGISTERED (-5)
lypinator 0:bb348c97df44 50 #define cbBCM_ERROR_ALREADY_CONNECTED (-6)
lypinator 0:bb348c97df44 51
lypinator 0:bb348c97df44 52 #define cbBCM_ACL_CONNECTION_FAILED (-7)
lypinator 0:bb348c97df44 53 #define cbBCM_SERVICE_SEARCH_FAILED (-8)
lypinator 0:bb348c97df44 54 #define cbBCM_RFCOMM_CONNECTION_FAILED (-9)
lypinator 0:bb348c97df44 55 #define cbBCM_SPS_CONNECTION_FAILED (-10)
lypinator 0:bb348c97df44 56 #define cbBCM_ACL_DISCONNECTED (-11)
lypinator 0:bb348c97df44 57
lypinator 0:bb348c97df44 58 #define cbBCM_INVALID_CONNECTION_HANDLE (cb_UINT32_MAX)
lypinator 0:bb348c97df44 59 #define cbBCM_INVALID_SERVER_CHANNEL (cb_UINT8_MAX)
lypinator 0:bb348c97df44 60 #define cbBCM_SERVICE_NAME_MAX_LEN (32)
lypinator 0:bb348c97df44 61
lypinator 0:bb348c97df44 62 #define cbBCM_DEV_ID_VENDOR_ID_SRC_BLUETOOTH (0x0001)
lypinator 0:bb348c97df44 63 #define cbBCM_DEV_ID_VENDOR_ID_SRC_USB (0x0002)
lypinator 0:bb348c97df44 64 #define cbBCM_CONNECTBLUE_VENDOR_ID (0x0071)
lypinator 0:bb348c97df44 65
lypinator 0:bb348c97df44 66 /*===========================================================================
lypinator 0:bb348c97df44 67 * TYPES
lypinator 0:bb348c97df44 68 *=========================================================================*/
lypinator 0:bb348c97df44 69 typedef cb_uint32 cbBCM_Handle;
lypinator 0:bb348c97df44 70
lypinator 0:bb348c97df44 71 typedef enum
lypinator 0:bb348c97df44 72 {
lypinator 0:bb348c97df44 73 cbBCM_INVALID_CONNECTION = 0,
lypinator 0:bb348c97df44 74 cbBCM_SPP_CONNECTION, // Serial Port Profile
lypinator 0:bb348c97df44 75 cbBCM_DUN_CONNECTION, // Dial Up Networking Profile
lypinator 0:bb348c97df44 76 cbBCM_UUID_CONNECTION, // UUID
lypinator 0:bb348c97df44 77 cbBCM_PAN_CONNECTION, // PAN
lypinator 0:bb348c97df44 78
lypinator 0:bb348c97df44 79 cbBCM_ACL_LE_CONNECTION, // GATT
lypinator 0:bb348c97df44 80 cbBCM_SPS_CONNECTION // LE connectBlue Serial Service connection
lypinator 0:bb348c97df44 81 }cbBCM_ConnectionType;
lypinator 0:bb348c97df44 82
lypinator 0:bb348c97df44 83 typedef enum
lypinator 0:bb348c97df44 84 {
lypinator 0:bb348c97df44 85 cbBM_LINK_QUALITY_READY_OK,
lypinator 0:bb348c97df44 86 cbBM_LINK_QUALITY_READY_ERROR
lypinator 0:bb348c97df44 87 } cbBCM_LinkQualityEvt;
lypinator 0:bb348c97df44 88
lypinator 0:bb348c97df44 89 /**
lypinator 0:bb348c97df44 90 * Bluetooth Classic Acl connection parameters
lypinator 0:bb348c97df44 91 */
lypinator 0:bb348c97df44 92 typedef struct
lypinator 0:bb348c97df44 93 {
lypinator 0:bb348c97df44 94 cb_uint16 pageTimeout; /** Length of connection attempt. Default value 5000ms. */
lypinator 0:bb348c97df44 95 cb_uint16 packetType; /** Packet types allowed in the connection. By default all packets but 3MBit EDR are allowed. */
lypinator 0:bb348c97df44 96 TMasterSlavePolicy masterSlavePolicy; /** Whether master slave switch shall be allowed or not. By default master slave switch is allowed. */
lypinator 0:bb348c97df44 97 cb_uint16 clockOffset; /** Clock offset is part in inquiry response. Using this value may result in faster connection setup Default value 0. */
lypinator 0:bb348c97df44 98 cb_uint16 linkSupervisionTimeout; /** Link supervision timeout. Default value 2000ms. */
lypinator 0:bb348c97df44 99 } cbBCM_ConnectionParameters;
lypinator 0:bb348c97df44 100
lypinator 0:bb348c97df44 101 /**
lypinator 0:bb348c97df44 102 * Bluetooth Low Energy Acl connection parameters
lypinator 0:bb348c97df44 103 */
lypinator 0:bb348c97df44 104 typedef struct
lypinator 0:bb348c97df44 105 {
lypinator 0:bb348c97df44 106 cb_uint32 createConnectionTimeout; /** Length of connection attempt in ms. Default value 5000ms. */
lypinator 0:bb348c97df44 107 cb_uint16 connectionIntervalMin; /** Minimum connection interval in ms. Default value 6ms. */
lypinator 0:bb348c97df44 108 cb_uint16 connectionIntervalMax; /** Maximum connection interval in ms. Default value 8ms. */
lypinator 0:bb348c97df44 109 cb_uint16 connectionLatency; /** Slave latency. Default value 0. */
lypinator 0:bb348c97df44 110 cb_uint16 linkLossTimeout; /** Link loss timeout in ms. Default 2000ms. */
lypinator 0:bb348c97df44 111 } cbBCM_ConnectionParametersLe;
lypinator 0:bb348c97df44 112
lypinator 0:bb348c97df44 113 typedef enum
lypinator 0:bb348c97df44 114 {
lypinator 0:bb348c97df44 115 cbBCM_PAN_ROLE_PANU = 0,
lypinator 0:bb348c97df44 116 cbBCM_PAN_ROLE_NAP,
lypinator 0:bb348c97df44 117 cbBCM_PAN_ROLE_NONE
lypinator 0:bb348c97df44 118 }cbBCM_PAN_Role;
lypinator 0:bb348c97df44 119
lypinator 0:bb348c97df44 120 typedef struct
lypinator 0:bb348c97df44 121 {
lypinator 0:bb348c97df44 122 TBdAddr address;
lypinator 0:bb348c97df44 123 TNameOutgoing remoteName;
lypinator 0:bb348c97df44 124 cb_int8 remoteRssi;
lypinator 0:bb348c97df44 125 cbBCM_ConnectionType type;
lypinator 0:bb348c97df44 126 TConnHandle aclHandle;
lypinator 0:bb348c97df44 127 TBluetoothType btType;
lypinator 0:bb348c97df44 128 cb_uint8 serverChannel;
lypinator 0:bb348c97df44 129 cb_uint8 uuid[16] ;
lypinator 0:bb348c97df44 130 cb_boolean uuidValid;
lypinator 0:bb348c97df44 131 cb_char serviceName[cbBCM_SERVICE_NAME_MAX_LEN];
lypinator 0:bb348c97df44 132 } cbBCM_ConnectionInfo;
lypinator 0:bb348c97df44 133
lypinator 0:bb348c97df44 134 typedef void (*cbBCM_ConnectInd)(
lypinator 0:bb348c97df44 135 cbBCM_Handle handle,
lypinator 0:bb348c97df44 136 cbBCM_ConnectionInfo info);
lypinator 0:bb348c97df44 137
lypinator 0:bb348c97df44 138 typedef void (*cbBCM_ConnectEvt)(
lypinator 0:bb348c97df44 139 cbBCM_Handle handle,
lypinator 0:bb348c97df44 140 cbBCM_ConnectionInfo info);
lypinator 0:bb348c97df44 141
lypinator 0:bb348c97df44 142 typedef void (*cbBCM_ConnectCnf)(
lypinator 0:bb348c97df44 143 cbBCM_Handle handle,
lypinator 0:bb348c97df44 144 cbBCM_ConnectionInfo info,
lypinator 0:bb348c97df44 145 cb_int32 status);
lypinator 0:bb348c97df44 146
lypinator 0:bb348c97df44 147 typedef void (*cbBCM_DisconnectEvt)(
lypinator 0:bb348c97df44 148 cbBCM_Handle handle);
lypinator 0:bb348c97df44 149
lypinator 0:bb348c97df44 150 typedef struct
lypinator 0:bb348c97df44 151 {
lypinator 0:bb348c97df44 152 cbBCM_ConnectInd pfConnectInd;
lypinator 0:bb348c97df44 153 cbBCM_ConnectEvt pfConnectEvt;
lypinator 0:bb348c97df44 154 cbBCM_ConnectCnf pfConnectCnf;
lypinator 0:bb348c97df44 155 cbBCM_DisconnectEvt pfDisconnectEvt;
lypinator 0:bb348c97df44 156 } cbBCM_ConnectionCallback;
lypinator 0:bb348c97df44 157
lypinator 0:bb348c97df44 158 typedef void(*cbBCM_RoleDiscoveryCallback)(
lypinator 0:bb348c97df44 159 cbBCM_Handle handle,
lypinator 0:bb348c97df44 160 cb_int8 status,
lypinator 0:bb348c97df44 161 cb_uint8 role);
lypinator 0:bb348c97df44 162
lypinator 0:bb348c97df44 163 typedef void (*cbBCM_RssiCallback)(
lypinator 0:bb348c97df44 164 cbBCM_Handle handle,
lypinator 0:bb348c97df44 165 cb_int32 status,
lypinator 0:bb348c97df44 166 cb_int8 rssi);
lypinator 0:bb348c97df44 167
lypinator 0:bb348c97df44 168 typedef void (*cbBCM_DataEvt)(
lypinator 0:bb348c97df44 169 cbBCM_Handle handle,
lypinator 0:bb348c97df44 170 cb_uint8 *pBuf,
lypinator 0:bb348c97df44 171 cb_uint32 nBytes);
lypinator 0:bb348c97df44 172
lypinator 0:bb348c97df44 173 typedef void (*cbBCM_WriteCnf)(
lypinator 0:bb348c97df44 174 cbBCM_Handle handle,
lypinator 0:bb348c97df44 175 cb_int32 status);
lypinator 0:bb348c97df44 176
lypinator 0:bb348c97df44 177 /**
lypinator 0:bb348c97df44 178 * Set max number of Bluetooth links.
lypinator 0:bb348c97df44 179 * Not used by application
lypinator 0:bb348c97df44 180 * @return status TRUE if command was successful
lypinator 0:bb348c97df44 181 */
lypinator 0:bb348c97df44 182 typedef cb_int32 (*cbBCM_SetMaxLinksCmd)(cb_uint32 maxLinks);
lypinator 0:bb348c97df44 183
lypinator 0:bb348c97df44 184 /**
lypinator 0:bb348c97df44 185 * Check if Handle is free to use
lypinator 0:bb348c97df44 186 * @return TRUE if handle is free, FALSE otherwise
lypinator 0:bb348c97df44 187 */
lypinator 0:bb348c97df44 188 typedef cb_boolean (*cbBCM_IsHandleFree)(cbBCM_Handle handle);
lypinator 0:bb348c97df44 189
lypinator 0:bb348c97df44 190 /**
lypinator 0:bb348c97df44 191 * Callback to indicate that remaining buffer size needs to be obtained from
lypinator 0:bb348c97df44 192 * upper layer. The callback returns remaining buffer size and there is
lypinator 0:bb348c97df44 193 * therefore no response function.
lypinator 0:bb348c97df44 194 * Not used by application
lypinator 0:bb348c97df44 195 * @return Number of free bytes in channel data buffer
lypinator 0:bb348c97df44 196 */
lypinator 0:bb348c97df44 197 typedef cb_uint16 (*cbBCM_RemainBufSizeInd)(void);
lypinator 0:bb348c97df44 198
lypinator 0:bb348c97df44 199 typedef struct
lypinator 0:bb348c97df44 200 {
lypinator 0:bb348c97df44 201 cbBCM_ConnectEvt pfConnectEvt;
lypinator 0:bb348c97df44 202 cbBCM_DisconnectEvt pfDisconnectEvt;
lypinator 0:bb348c97df44 203 cbBCM_DataEvt pfDataEvt;
lypinator 0:bb348c97df44 204 cbBCM_WriteCnf pfWriteCnf;
lypinator 0:bb348c97df44 205 cbBCM_SetMaxLinksCmd pfSetMaxLinks;
lypinator 0:bb348c97df44 206 cbBCM_RemainBufSizeInd pfRemainBufSizeInd;
lypinator 0:bb348c97df44 207 cbBCM_IsHandleFree pfIsHandleFree;
lypinator 0:bb348c97df44 208 } cbBCM_DataCallback;
lypinator 0:bb348c97df44 209
lypinator 0:bb348c97df44 210 typedef void (*cbBCM_ServiceSearchCompleteCallback)(cb_int32 status);
lypinator 0:bb348c97df44 211
lypinator 0:bb348c97df44 212 typedef void (*cbBCM_ServiceSearchSppCallback)(
lypinator 0:bb348c97df44 213 cb_uint8 serverChannel,
lypinator 0:bb348c97df44 214 cb_char *pServiceName);
lypinator 0:bb348c97df44 215
lypinator 0:bb348c97df44 216 typedef void (*cbBCM_ServiceSearchDunCallback)(
lypinator 0:bb348c97df44 217 cb_uint8 serverChannel,
lypinator 0:bb348c97df44 218 cb_char *pServiceName);
lypinator 0:bb348c97df44 219
lypinator 0:bb348c97df44 220 typedef void (*cbBCM_ServiceSearchDeviceIdCallback)(
lypinator 0:bb348c97df44 221 cb_uint16 didSpecVersion,
lypinator 0:bb348c97df44 222 cb_uint16 didVendorId,
lypinator 0:bb348c97df44 223 cb_uint16 didProductId,
lypinator 0:bb348c97df44 224 cb_uint16 didProductVersion,
lypinator 0:bb348c97df44 225 cb_boolean didPrimaryService,
lypinator 0:bb348c97df44 226 cb_uint16 didVendorIdSource);
lypinator 0:bb348c97df44 227
lypinator 0:bb348c97df44 228 typedef void(*cbBCM_LinkQualityCallback)(
lypinator 0:bb348c97df44 229 cbBCM_LinkQualityEvt linkQualityEvt,
lypinator 0:bb348c97df44 230 uint8 linkQuality);
lypinator 0:bb348c97df44 231
lypinator 0:bb348c97df44 232 typedef void(*cbBCM_ServiceClassEnabled)(cb_uint8 serviceChannel);
lypinator 0:bb348c97df44 233 /*===========================================================================
lypinator 0:bb348c97df44 234 * FUNCTIONS
lypinator 0:bb348c97df44 235 *=========================================================================*/
lypinator 0:bb348c97df44 236 /**
lypinator 0:bb348c97df44 237 * Initialization of connection manager. Called during stack
lypinator 0:bb348c97df44 238 * initialization. Shall not be called by application.
lypinator 0:bb348c97df44 239 *
lypinator 0:bb348c97df44 240 * @return None
lypinator 0:bb348c97df44 241 */
lypinator 0:bb348c97df44 242 extern void cbBCM_init(void);
lypinator 0:bb348c97df44 243
lypinator 0:bb348c97df44 244 /**
lypinator 0:bb348c97df44 245 * Enable a Bluetooth Serial Port Profile (SPP)service record to
lypinator 0:bb348c97df44 246 * allow other devices to connect to this device using SPP.
lypinator 0:bb348c97df44 247 *
lypinator 0:bb348c97df44 248 * @param pServiceName The name of the service
lypinator 0:bb348c97df44 249 * @param pServerChannel Pointer to return variable. The server channel is used to identify
lypinator 0:bb348c97df44 250 * incoming connections.
lypinator 0:bb348c97df44 251 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 252 * @param pServiceClassEnabled Callback structure to inform when service is running.
lypinator 0:bb348c97df44 253 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 254 */
lypinator 0:bb348c97df44 255 extern cb_int32 cbBCM_enableServerProfileSpp(
lypinator 0:bb348c97df44 256 cb_char *pServiceName,
lypinator 0:bb348c97df44 257 cb_uint8 *pServerChannel,
lypinator 0:bb348c97df44 258 cbBCM_ConnectionCallback *pConnectionCallback,
lypinator 0:bb348c97df44 259 cbBCM_ServiceClassEnabled pServiceClassEnabled);
lypinator 0:bb348c97df44 260
lypinator 0:bb348c97df44 261 /**
lypinator 0:bb348c97df44 262 * Enable a Dial Up Networking Profile (DUN)service record to
lypinator 0:bb348c97df44 263 * allow other devices to connect to this device using DUN.
lypinator 0:bb348c97df44 264 *
lypinator 0:bb348c97df44 265 * @param pServiceName The name of the service
lypinator 0:bb348c97df44 266 * @param pServerChannel Pointer to return variable. The server channel is used to identify
lypinator 0:bb348c97df44 267 * incoming connections.
lypinator 0:bb348c97df44 268 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 269 * @param pServiceClassEnabled Callback structure to inform when service is running.
lypinator 0:bb348c97df44 270 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 271 */
lypinator 0:bb348c97df44 272 extern cb_int32 cbBCM_enableServerProfileDun(
lypinator 0:bb348c97df44 273 cb_char *pServiceName,
lypinator 0:bb348c97df44 274 cb_uint8 *pServerChannel,
lypinator 0:bb348c97df44 275 cbBCM_ConnectionCallback *pConnectionCallback,
lypinator 0:bb348c97df44 276 cbBCM_ServiceClassEnabled pServiceClassEnabled);
lypinator 0:bb348c97df44 277
lypinator 0:bb348c97df44 278 /**
lypinator 0:bb348c97df44 279 * Enable a service record with an application specific UUID.
lypinator 0:bb348c97df44 280 * This is used to enable Android and iOS support.
lypinator 0:bb348c97df44 281 *
lypinator 0:bb348c97df44 282 * @param pUuid128 The UUID of the service.
lypinator 0:bb348c97df44 283 * @param pServiceName The name of the service
lypinator 0:bb348c97df44 284 * @param pServerChannel Pointer to return variable. The server channel is used to identify
lypinator 0:bb348c97df44 285 * incoming connections.
lypinator 0:bb348c97df44 286 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 287 * @param pServiceClassEnabled Callback structure to inform when service is running.
lypinator 0:bb348c97df44 288 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 289 */
lypinator 0:bb348c97df44 290 extern cb_int32 cbBCM_enableServerProfileUuid128(
lypinator 0:bb348c97df44 291 cb_uint8 *pUuid128,
lypinator 0:bb348c97df44 292 cb_char *pServiceName,
lypinator 0:bb348c97df44 293 cb_uint8 *pServerChannel,
lypinator 0:bb348c97df44 294 cbBCM_ConnectionCallback *pConnectionCallback,
lypinator 0:bb348c97df44 295 cbBCM_ServiceClassEnabled pServiceClassEnabled);
lypinator 0:bb348c97df44 296
lypinator 0:bb348c97df44 297 /**
lypinator 0:bb348c97df44 298 * Registers the server role of the local device. If role is cbBCM_PAN_ROLE_NAP a service
lypinator 0:bb348c97df44 299 * record will be registred in the local service data base. The local device can only act as a
lypinator 0:bb348c97df44 300 * PAN NAP or Pan user at a time. If PAN NAP is enabled the device will only accept incoming
lypinator 0:bb348c97df44 301 * connections from PAN users. If PAN user is enabled it is only possible to be connected to
lypinator 0:bb348c97df44 302 * one remote PAN NAP device.
lypinator 0:bb348c97df44 303 *
lypinator 0:bb348c97df44 304 * @param pServiceName The name of the service
lypinator 0:bb348c97df44 305 * @param role The PAN role of the local device
lypinator 0:bb348c97df44 306 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 307 * @param pServiceClassEnabled Callback structure to inform when service is running.
lypinator 0:bb348c97df44 308 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 309 */
lypinator 0:bb348c97df44 310 extern cb_int32 cbBCM_enableServerProfilePan(
lypinator 0:bb348c97df44 311 cb_char *pServiceName,
lypinator 0:bb348c97df44 312 cbBCM_PAN_Role role,
lypinator 0:bb348c97df44 313 cbBCM_ConnectionCallback *pConnectionCallback,
lypinator 0:bb348c97df44 314 cbBCM_ServiceClassEnabled pServiceClassEnabled);
lypinator 0:bb348c97df44 315
lypinator 0:bb348c97df44 316 /**
lypinator 0:bb348c97df44 317 * Enable device id service record.The device id service record is a method by which
lypinator 0:bb348c97df44 318 * Bluetooth devices may provide information that may be used by peer Bluetooth devices
lypinator 0:bb348c97df44 319 * to find representative icons or load associated support software.
lypinator 0:bb348c97df44 320 * This information is published as Bluetooth SDP records, and optionally in the
lypinator 0:bb348c97df44 321 * Extended Inquiry Response.
lypinator 0:bb348c97df44 322 * @param vendorId Uniquely identifier for the vendor of the device. Used in conjunction with required attribute 0x0205, VendorIDSource, which determines which organization assigned the VendorID value. Note: The Bluetooth Special Interest Group assigns Device ID Vendor ID and the USB Implementer's Forum assigns vendor IDs, either of which can be used for the VendorID value here. Device providers should procure the vendor ID from the USB Implementer's Forum or the Company Identifier from the Bluetooth SIG. The VendorID '0xFFFF' is reserved as the default VendorID when no Device ID Service Record is present in the device.
lypinator 0:bb348c97df44 323 * @param productId This is intended to distinguish between different products made by the vendor above. These IDs are managed by the vendors themselves.
lypinator 0:bb348c97df44 324 * @param version A numeric expression identifying the device release number in Binary-Coded Decimal. This is a vendor-assigned field, which defines the version of the product identified by the VendorID and ProductID attributes. This attribute is intended to differentiate between versions of products with identical VendorIDs and ProductIDs. The value of the field is 0xJJMN for version JJ.M.N (JJ - major version number, M - minor version number, N - sub-minor version number); e.g., version 2.1.3 is represented with value 0x0213 and version 2.0.0 is represented with a value of 0x0200. When upward-compatible changes are made to the device, it is recommended that the minor version number be incremented. If incompatible changes are made to the device, it is recommended that the major version number be incremented.
lypinator 0:bb348c97df44 325 * @param vendorIdSource Organization that assigned the VendorID attribute. Use 0x0001 for Bluetooth SIG assigned Device ID Vendor ID value from the Assigned Numbers document and 0x0002 for USB Implementer's Forum assigned Vendor ID value
lypinator 0:bb348c97df44 326 * @return If the operation is successful cbBCM_OK is returned. Note that only one device id service record can be registered.
lypinator 0:bb348c97df44 327 */
lypinator 0:bb348c97df44 328 extern cb_int32 cbBCM_enableDeviceIdServiceRecord(
lypinator 0:bb348c97df44 329 cb_uint16 vendorId,
lypinator 0:bb348c97df44 330 cb_uint16 productId,
lypinator 0:bb348c97df44 331 cb_uint16 version,
lypinator 0:bb348c97df44 332 cb_uint16 vendorIdSource);
lypinator 0:bb348c97df44 333
lypinator 0:bb348c97df44 334 /**
lypinator 0:bb348c97df44 335 * Set Bluetooth watchdog settings
lypinator 0:bb348c97df44 336 *
lypinator 0:bb348c97df44 337 * @param disconnectReset Reset the device on any dropped Bluetooth connection
lypinator 0:bb348c97df44 338 * @return void
lypinator 0:bb348c97df44 339 */
lypinator 0:bb348c97df44 340 extern void cbBCM_setBluetoothWatchdogValue(cb_uint32 disconnectReset);
lypinator 0:bb348c97df44 341
lypinator 0:bb348c97df44 342 /**
lypinator 0:bb348c97df44 343 * Set the packet types to use. Call cbBCM_cmdChangePacketType()
lypinator 0:bb348c97df44 344 * to start using the new packet types.
lypinator 0:bb348c97df44 345 *
lypinator 0:bb348c97df44 346 * @param packetType See packet types in bt_types.h
lypinator 0:bb348c97df44 347 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 348 */
lypinator 0:bb348c97df44 349 extern cb_uint32 cbBCM_setPacketType(cb_uint16 packetType);
lypinator 0:bb348c97df44 350
lypinator 0:bb348c97df44 351 /**
lypinator 0:bb348c97df44 352 * Get BT classic packet type.
lypinator 0:bb348c97df44 353 *
lypinator 0:bb348c97df44 354 * @return Allowed packet types returned.
lypinator 0:bb348c97df44 355 */
lypinator 0:bb348c97df44 356 extern cb_uint16 cbBCM_getPacketType(void);
lypinator 0:bb348c97df44 357
lypinator 0:bb348c97df44 358 /**
lypinator 0:bb348c97df44 359 * Set max number of Bluetooth classic links. Reconfigures buffer management.
lypinator 0:bb348c97df44 360 *
lypinator 0:bb348c97df44 361 * @param maxLinks Max number of Bluetooth classic connections.
lypinator 0:bb348c97df44 362 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 363 */
lypinator 0:bb348c97df44 364 extern cb_int32 cbBCM_setMaxLinksClassic(cb_uint16 maxLinks);
lypinator 0:bb348c97df44 365
lypinator 0:bb348c97df44 366 /**
lypinator 0:bb348c97df44 367 * Get max number of Bluetooth classic links.
lypinator 0:bb348c97df44 368 *
lypinator 0:bb348c97df44 369 * @return The maximum number of Bluetooth classic links.
lypinator 0:bb348c97df44 370 */
lypinator 0:bb348c97df44 371 extern cb_uint16 cbBCM_getMaxLinksClassic(void);
lypinator 0:bb348c97df44 372
lypinator 0:bb348c97df44 373 /**
lypinator 0:bb348c97df44 374 * Set max number of Bluetooth Low Energy links. Reconfigures buffer management.
lypinator 0:bb348c97df44 375 *
lypinator 0:bb348c97df44 376 * @param maxLinks Max number of Bluetooth Low Energy connections.
lypinator 0:bb348c97df44 377 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 378 */
lypinator 0:bb348c97df44 379 extern cb_int32 cbBCM_setMaxLinksLE(cb_uint16 maxLinks);
lypinator 0:bb348c97df44 380
lypinator 0:bb348c97df44 381 /**
lypinator 0:bb348c97df44 382 * Get max number of Bluetooth Low Energy links.
lypinator 0:bb348c97df44 383 *
lypinator 0:bb348c97df44 384 * @return The maximum number of Bluetooth Low Energy links.
lypinator 0:bb348c97df44 385 */
lypinator 0:bb348c97df44 386 extern cb_uint16 cbBCM_getMaxLinksLE(void);
lypinator 0:bb348c97df44 387
lypinator 0:bb348c97df44 388 /**
lypinator 0:bb348c97df44 389 * Initiate a Bluetooth Serial Port Profile connection.
lypinator 0:bb348c97df44 390 * The connection sequence includes ACL connection setup, SDP service
lypinator 0:bb348c97df44 391 * search and RFCOMM connection setup. The server channel of the first
lypinator 0:bb348c97df44 392 * valid SPP service record will be used. A pfConnectCnf callback will
lypinator 0:bb348c97df44 393 * be received when the connection is complete.The error code in the
lypinator 0:bb348c97df44 394 * callback is cbBCM_OK if the connection was successfully established.
lypinator 0:bb348c97df44 395 * The error code in the callback is cbBCM_ERROR if the connection failed.
lypinator 0:bb348c97df44 396 * @param pAddress Pointer to address of remote device.
lypinator 0:bb348c97df44 397 * @param pServiceName Name of SPP service. Automatic service search
lypinator 0:bb348c97df44 398 * is performed to find a service with matching name.
lypinator 0:bb348c97df44 399 * If set to NULL then the last of the SPP services
lypinator 0:bb348c97df44 400 * on the remote device will be used. If serverChannel
lypinator 0:bb348c97df44 401 * parameter is different than cbBCM_INVALID_SERVER_CHANNEL
lypinator 0:bb348c97df44 402 * this parameter is ignored and the specified server channel
lypinator 0:bb348c97df44 403 * will be used.
lypinator 0:bb348c97df44 404 * @param serverChannel RFCOMM server channel that shall be used. Set to
lypinator 0:bb348c97df44 405 * cbBCM_INVALID_SERVER_CHANNEL to perform automatic
lypinator 0:bb348c97df44 406 * service search to find the server channel.
lypinator 0:bb348c97df44 407 * @param pRemoteName Pointer used in case user connects to the Bluetooth name
lypinator 0:bb348c97df44 408 * @param pAclParameters Link configuration including link supervision timeout
lypinator 0:bb348c97df44 409 * and master slave policy. Pass NULL to use default connection
lypinator 0:bb348c97df44 410 * parameters.
lypinator 0:bb348c97df44 411 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 412 * @return If the operation is successful the connection handle is returned. If
lypinator 0:bb348c97df44 413 * not cbBCM_INVALID_CONNECTION_HANDLE is returned.
lypinator 0:bb348c97df44 414 */
lypinator 0:bb348c97df44 415 extern cbBCM_Handle cbBCM_reqConnectSpp(
lypinator 0:bb348c97df44 416 TBdAddr *pAddress,
lypinator 0:bb348c97df44 417 cb_char *pServiceName,
lypinator 0:bb348c97df44 418 cb_uint8 serverChannel,
lypinator 0:bb348c97df44 419 cb_char *pRemoteName,
lypinator 0:bb348c97df44 420 cbBCM_ConnectionParameters *pAclParameters,
lypinator 0:bb348c97df44 421 cb_boolean qosEnable,
lypinator 0:bb348c97df44 422 cbBCM_ConnectionCallback *pConnectionCallback);
lypinator 0:bb348c97df44 423
lypinator 0:bb348c97df44 424 /**
lypinator 0:bb348c97df44 425 * Accept or reject an incoming SPP connection. This is a
lypinator 0:bb348c97df44 426 * response to a cbBCM_ConnectInd connection indication.
lypinator 0:bb348c97df44 427 *
lypinator 0:bb348c97df44 428 * @param handle Connection handle
lypinator 0:bb348c97df44 429 * @param accept TRUE to accept the incoming connection.
lypinator 0:bb348c97df44 430 FALSE to reject.
lypinator 0:bb348c97df44 431 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 432 */
lypinator 0:bb348c97df44 433 extern cb_int32 cbBCM_rspConnectSppCnf(
lypinator 0:bb348c97df44 434 cbBCM_Handle handle,
lypinator 0:bb348c97df44 435 cb_boolean accept);
lypinator 0:bb348c97df44 436
lypinator 0:bb348c97df44 437 /**
lypinator 0:bb348c97df44 438 * Initiate a Bluetooth Dial Up Networking Profile connection.
lypinator 0:bb348c97df44 439 * The connection sequence includes ACL connection setup, SDP service
lypinator 0:bb348c97df44 440 * search and RFCOMM connection setup. The server channel of the first
lypinator 0:bb348c97df44 441 * valid SPP service record will be used. A pfConnectCnf callback will
lypinator 0:bb348c97df44 442 * be received when the connection is complete.The error code in the
lypinator 0:bb348c97df44 443 * callback is cbBCM_OK if the connection was successfully established.
lypinator 0:bb348c97df44 444 * The error code in the callback is cbBCM_ERROR if the connection failed.
lypinator 0:bb348c97df44 445 * @param pAddress Pointer to address of remote device.
lypinator 0:bb348c97df44 446 * @param pServiceName Name of DUN service. Automatic service search
lypinator 0:bb348c97df44 447 * is performed to find a service with matching name.
lypinator 0:bb348c97df44 448 * If set to NULL then the last of the DUN services
lypinator 0:bb348c97df44 449 * on the remote device will be used. If serverChannel
lypinator 0:bb348c97df44 450 * parameter is different than cbBCM_INVALID_SERVER_CHANNEL
lypinator 0:bb348c97df44 451 * this parameter is ignored and the specified server channel
lypinator 0:bb348c97df44 452 * will be used.
lypinator 0:bb348c97df44 453 * @param serverChannel RFCOMM server channel that shall be used. Set to
lypinator 0:bb348c97df44 454 * cbBCM_INVALID_SERVER_CHANNEL to perform automatic
lypinator 0:bb348c97df44 455 * service search to find the server channel.
lypinator 0:bb348c97df44 456 * @param pAclParameters Link configuration including link supervision timeout
lypinator 0:bb348c97df44 457 * and master slave policy. Pass NULL to use default connection
lypinator 0:bb348c97df44 458 * parameters.
lypinator 0:bb348c97df44 459 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 460 * @return If the operation is successful the connection handle is returned. If
lypinator 0:bb348c97df44 461 * not cbBCM_INVALID_CONNECTION_HANDLE is returned.
lypinator 0:bb348c97df44 462 */
lypinator 0:bb348c97df44 463 extern cbBCM_Handle cbBCM_reqConnectDun(
lypinator 0:bb348c97df44 464 TBdAddr *pAddress,
lypinator 0:bb348c97df44 465 cb_char *pServiceName,
lypinator 0:bb348c97df44 466 cb_uint8 serverChannel,
lypinator 0:bb348c97df44 467 cbBCM_ConnectionParameters *pAclParameters,
lypinator 0:bb348c97df44 468 cb_boolean qosEnable,
lypinator 0:bb348c97df44 469 cbBCM_ConnectionCallback *pConnectionCallback);
lypinator 0:bb348c97df44 470
lypinator 0:bb348c97df44 471 /**
lypinator 0:bb348c97df44 472 * Accept or reject an incoming DUN connection. This is a
lypinator 0:bb348c97df44 473 * response to a cbBCM_ConnectInd connection indication.
lypinator 0:bb348c97df44 474 *
lypinator 0:bb348c97df44 475 * @param handle Connection handle
lypinator 0:bb348c97df44 476 * @param accept TRUE to accept the incoming connection.
lypinator 0:bb348c97df44 477 FALSE to reject.
lypinator 0:bb348c97df44 478 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 479 */
lypinator 0:bb348c97df44 480 extern cb_int32 cbBCM_rspConnectDunCnf(
lypinator 0:bb348c97df44 481 cbBCM_Handle handle,
lypinator 0:bb348c97df44 482 cb_boolean accept);
lypinator 0:bb348c97df44 483
lypinator 0:bb348c97df44 484 /**
lypinator 0:bb348c97df44 485 * Initiate a Bluetooth Serial Port Profile connection with a specific UUID.
lypinator 0:bb348c97df44 486 * The connection sequence includes ACL connection setup, SDP service
lypinator 0:bb348c97df44 487 * search and RFCOMM connection setup. The server channel of the first
lypinator 0:bb348c97df44 488 * valid SPP service record with the specified UUID will be used. A pfConnectCnf
lypinator 0:bb348c97df44 489 * callback will be received when the connection is complete.The error code in the
lypinator 0:bb348c97df44 490 * callback is cbBCM_OK if the connection was successfully established.
lypinator 0:bb348c97df44 491 * The error code in the callback is cbBCM_ERROR if the connection failed.
lypinator 0:bb348c97df44 492 * @param pAddress Pointer to address of remote device.
lypinator 0:bb348c97df44 493 * @param pUuid Pointer to uuid of the remote service.
lypinator 0:bb348c97df44 494 * @param pServiceName Name of SPP service. Automatic service search
lypinator 0:bb348c97df44 495 * is performed to find a service with matching name.
lypinator 0:bb348c97df44 496 * If set to NULL then the last of the SPP services
lypinator 0:bb348c97df44 497 * on the remote device will be used. If serverChannel
lypinator 0:bb348c97df44 498 * parameter is different than cbBCM_INVALID_SERVER_CHANNEL
lypinator 0:bb348c97df44 499 * this parameter is ignored and the specified server channel
lypinator 0:bb348c97df44 500 * will be used.
lypinator 0:bb348c97df44 501 * @param serverChannel RFCOMM server channel that shall be used. Set to
lypinator 0:bb348c97df44 502 * cbBCM_INVALID_SERVER_CHANNEL to perform automatic
lypinator 0:bb348c97df44 503 * service search to find the server channel.
lypinator 0:bb348c97df44 504 * @param pAclParameters Link configuration including link supervision timeout
lypinator 0:bb348c97df44 505 * and master slave policy. Pass NULL to use default connection
lypinator 0:bb348c97df44 506 * parameters.
lypinator 0:bb348c97df44 507 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 508 * @return If the operation is successful the connection handle is returned. If
lypinator 0:bb348c97df44 509 * not cbBCM_INVALID_CONNECTION_HANDLE is returned.
lypinator 0:bb348c97df44 510 */
lypinator 0:bb348c97df44 511 extern cbBCM_Handle cbBCM_reqConnectUuid(
lypinator 0:bb348c97df44 512 TBdAddr *pAddress,
lypinator 0:bb348c97df44 513 cb_uint8 *pUuid,
lypinator 0:bb348c97df44 514 cb_char *pServiceName,
lypinator 0:bb348c97df44 515 cb_uint8 serverChannel,
lypinator 0:bb348c97df44 516 cbBCM_ConnectionParameters *pAclParameters,
lypinator 0:bb348c97df44 517 cb_boolean qosEnable,
lypinator 0:bb348c97df44 518 cbBCM_ConnectionCallback *pConnectionCallback);
lypinator 0:bb348c97df44 519
lypinator 0:bb348c97df44 520 /**
lypinator 0:bb348c97df44 521 * Accept or reject an incoming SPP connection. This is a
lypinator 0:bb348c97df44 522 * response to a cbBCM_ConnectInd connection indication.
lypinator 0:bb348c97df44 523 *
lypinator 0:bb348c97df44 524 * @param handle Connection handle
lypinator 0:bb348c97df44 525 * @param accept TRUE to accept the incoming connection.
lypinator 0:bb348c97df44 526 * FALSE to reject.
lypinator 0:bb348c97df44 527 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 528 */
lypinator 0:bb348c97df44 529 extern cb_int32 cbBCM_rspConnectUuidCnf(
lypinator 0:bb348c97df44 530 cbBCM_Handle handle,
lypinator 0:bb348c97df44 531 cb_boolean accept);
lypinator 0:bb348c97df44 532
lypinator 0:bb348c97df44 533 /**
lypinator 0:bb348c97df44 534 * Initiate a Bluetooth PAN Profile connection.
lypinator 0:bb348c97df44 535 * The connection sequence includes ACL connection setup and L2CAP connection setup.
lypinator 0:bb348c97df44 536 * A pfConnectCnf callback will be received when the connection is complete.
lypinator 0:bb348c97df44 537 * The error code in the*callback is cbBCM_OK if the connection was successfully established.
lypinator 0:bb348c97df44 538 * The error code in the callback is cbBCM_ERROR if the connection failed.
lypinator 0:bb348c97df44 539 *
lypinator 0:bb348c97df44 540 * @param pAddress Pointer to address of remote device.
lypinator 0:bb348c97df44 541 * @param remoteRole PAN role of the remote device
lypinator 0:bb348c97df44 542 * @param localRole PAN role of the local device
lypinator 0:bb348c97df44 543 * @param pAclParams Link configuration including link supervision timeout
lypinator 0:bb348c97df44 544 * and master slave policy. Pass NULL to use default connection
lypinator 0:bb348c97df44 545 * parameters.
lypinator 0:bb348c97df44 546 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 547 * @return If the operation is successful the connection handle is returned. If
lypinator 0:bb348c97df44 548 * not cbBCM_INVALID_CONNECTION_HANDLE is returned.
lypinator 0:bb348c97df44 549 */
lypinator 0:bb348c97df44 550 extern cbBCM_Handle cbBCM_reqConnectPan(
lypinator 0:bb348c97df44 551 TBdAddr *pAddress,
lypinator 0:bb348c97df44 552 cbBCM_PAN_Role remoteRole,
lypinator 0:bb348c97df44 553 cbBCM_PAN_Role localRole,
lypinator 0:bb348c97df44 554 cbBCM_ConnectionParameters *pAclParams,
lypinator 0:bb348c97df44 555 cbBCM_ConnectionCallback *pConnectionCallback);
lypinator 0:bb348c97df44 556
lypinator 0:bb348c97df44 557 /**
lypinator 0:bb348c97df44 558 * Accept or reject an incoming PAN connection. This is a
lypinator 0:bb348c97df44 559 * response to a cbBCM_ConnectInd connection indication.
lypinator 0:bb348c97df44 560 *
lypinator 0:bb348c97df44 561 * @param handle Connection handle
lypinator 0:bb348c97df44 562 * @param accept TRUE to accept the incoming connection.
lypinator 0:bb348c97df44 563 * FALSE to reject.
lypinator 0:bb348c97df44 564 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 565 */
lypinator 0:bb348c97df44 566 extern cb_int32 cbBCM_rspConnectPan(
lypinator 0:bb348c97df44 567 cbBCM_Handle handle,
lypinator 0:bb348c97df44 568 cb_boolean accept);
lypinator 0:bb348c97df44 569
lypinator 0:bb348c97df44 570 /**
lypinator 0:bb348c97df44 571 * Enable Serial Port Service.
lypinator 0:bb348c97df44 572 * When the device is acting Bluetooth Low Energy peripheral the Serial
lypinator 0:bb348c97df44 573 * Port Service will be added to the attribute table.
lypinator 0:bb348c97df44 574 *
lypinator 0:bb348c97df44 575 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 576 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 577 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 578 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 579 */
lypinator 0:bb348c97df44 580 extern cb_int32 cbBCM_enableSps(
lypinator 0:bb348c97df44 581 cbBCM_ConnectionCallback *pConnectionCallback);
lypinator 0:bb348c97df44 582
lypinator 0:bb348c97df44 583 /**
lypinator 0:bb348c97df44 584 * Enable or disable Bluetooth low energy auto connect.
lypinator 0:bb348c97df44 585 * When the device is acting as central and auto connect is enabled it runs
lypinator 0:bb348c97df44 586 * passive scan and initiates an ACL connection to devices that performs
lypinator 0:bb348c97df44 587 * directed advertisements.
lypinator 0:bb348c97df44 588 * The serial port service muast be enabled using cbBCM_enableSps() before
lypinator 0:bb348c97df44 589 * auto connect is enabled.
lypinator 0:bb348c97df44 590 * If SPS is enabled the SPS Gatt client will initiate a SPS connection
lypinator 0:bb348c97df44 591 * attempt on the ACL connection.
lypinator 0:bb348c97df44 592 * When the device is acting peripheral this functionality is inactive.
lypinator 0:bb348c97df44 593 *
lypinator 0:bb348c97df44 594 * @param enable Set to TRUE to enable. Set to false to disable.
lypinator 0:bb348c97df44 595 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 596 */
lypinator 0:bb348c97df44 597 extern cb_int32 cbBCM_autoConnect(
lypinator 0:bb348c97df44 598 cb_boolean enable);
lypinator 0:bb348c97df44 599
lypinator 0:bb348c97df44 600 /**
lypinator 0:bb348c97df44 601 * Initiate a Serial Port Service connection.
lypinator 0:bb348c97df44 602 * The connection sequence includes ACL connection setup , GATT service
lypinator 0:bb348c97df44 603 * search and Serial Port Service connection setup. A connect confirm
lypinator 0:bb348c97df44 604 * callback will be received when the connection is complete. The error
lypinator 0:bb348c97df44 605 * code in the callback is cbBCM_OK if the connection was successfully established.
lypinator 0:bb348c97df44 606 * The error code in the callback is cbBCM_ERROR if the connection failed.
lypinator 0:bb348c97df44 607 * The serial port service must be enabled using cbBCM_enableSps() before
lypinator 0:bb348c97df44 608 * auto connect request is made..
lypinator 0:bb348c97df44 609 * @param pAddress Address of remote device.
lypinator 0:bb348c97df44 610 * @param pAclLeParams Link configuration parameters
lypinator 0:bb348c97df44 611 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 612 * @return If the operation is successful the connection handle is returned. If
lypinator 0:bb348c97df44 613 * not cbBCM_INVALID_CONNECTION_HANDLE is returned.
lypinator 0:bb348c97df44 614 */
lypinator 0:bb348c97df44 615 extern cbBCM_Handle cbBCM_reqConnectSps(
lypinator 0:bb348c97df44 616 TBdAddr *pAddress,
lypinator 0:bb348c97df44 617 cb_char *pRemoteName,
lypinator 0:bb348c97df44 618 cbBCM_ConnectionParametersLe *pAclLeParams,
lypinator 0:bb348c97df44 619 cbBCM_ConnectionCallback *pConnectionCallback);
lypinator 0:bb348c97df44 620
lypinator 0:bb348c97df44 621 /**
lypinator 0:bb348c97df44 622 * Accept or reject an incoming SPS connection. This is a
lypinator 0:bb348c97df44 623 * response to a cbBCM_ConnectInd connection indication.
lypinator 0:bb348c97df44 624 * @param handle Connection handle
lypinator 0:bb348c97df44 625 * @param accept TRUE to accept the incoming connection.
lypinator 0:bb348c97df44 626 * FALSE to reject.
lypinator 0:bb348c97df44 627 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 628 */
lypinator 0:bb348c97df44 629 extern cb_int32 cbBCM_rspConnectSpsCnf(
lypinator 0:bb348c97df44 630 cbBCM_Handle handle,
lypinator 0:bb348c97df44 631 cb_boolean accept);
lypinator 0:bb348c97df44 632
lypinator 0:bb348c97df44 633 /**
lypinator 0:bb348c97df44 634 * Initiate a Bluetooth low energy ACL connection. The ACL connection is
lypinator 0:bb348c97df44 635 * intended for GATT communication.
lypinator 0:bb348c97df44 636 * A connect confirm callback will be received when the connection is complete. The error
lypinator 0:bb348c97df44 637 * code in the callback is cbBCM_OK if the connection was successfully established.
lypinator 0:bb348c97df44 638 * The error code in the callback is cbBCM_ERROR if the connection failed.
lypinator 0:bb348c97df44 639 * @param pAddress Address of remote device.
lypinator 0:bb348c97df44 640 * @param pAclLeParams Link configuration parameters
lypinator 0:bb348c97df44 641 * @param pConnectionCallback Callback structure for connection management.
lypinator 0:bb348c97df44 642 * @return If the operation is successful the connection handle is returned. If
lypinator 0:bb348c97df44 643 * not cbBCM_INVALID_CONNECTION_HANDLE is returned.
lypinator 0:bb348c97df44 644 */
lypinator 0:bb348c97df44 645 extern cbBCM_Handle cbBCM_reqConnectAclLe(
lypinator 0:bb348c97df44 646 TBdAddr *pAddress,
lypinator 0:bb348c97df44 647 cbBCM_ConnectionParametersLe *pAclLeParams,
lypinator 0:bb348c97df44 648 cbBCM_ConnectionCallback *pConnectionCallback);
lypinator 0:bb348c97df44 649
lypinator 0:bb348c97df44 650 /**
lypinator 0:bb348c97df44 651 * @brief Initiate disconnection of active connection. A disconnect event
lypinator 0:bb348c97df44 652 * will be received when the disconnection is complete.
lypinator 0:bb348c97df44 653 *
lypinator 0:bb348c97df44 654 * @param handle Connection handle
lypinator 0:bb348c97df44 655 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 656 */
lypinator 0:bb348c97df44 657 extern cb_int32 cbBCM_cmdDisconnect(
lypinator 0:bb348c97df44 658 cbBCM_Handle handle);
lypinator 0:bb348c97df44 659
lypinator 0:bb348c97df44 660 /**
lypinator 0:bb348c97df44 661 * @brief Initiate a Serial Port Profile (SPP) service search to find server channel and service name.
lypinator 0:bb348c97df44 662 * @param pAddress Address of device on which service search shall be performed.
lypinator 0:bb348c97df44 663 * @param maxServices Max number of services
lypinator 0:bb348c97df44 664 * @param pCallback Callback used to notify each found service record
lypinator 0:bb348c97df44 665 * @param pCompleteCallback Callback used to notify that the search is completed
lypinator 0:bb348c97df44 666 * @return If the operation is successful initiated cbBCM_OK is returned.
lypinator 0:bb348c97df44 667 */
lypinator 0:bb348c97df44 668 extern cb_int32 cbBCM_reqServiceSearchSpp(
lypinator 0:bb348c97df44 669 TBdAddr *pAddress,
lypinator 0:bb348c97df44 670 cb_uint16 maxServices,
lypinator 0:bb348c97df44 671 cbBCM_ServiceSearchSppCallback pCallback,
lypinator 0:bb348c97df44 672 cbBCM_ServiceSearchCompleteCallback pCompleteCallback);
lypinator 0:bb348c97df44 673
lypinator 0:bb348c97df44 674 /**
lypinator 0:bb348c97df44 675 * @brief Initiate a Dial Up Networking (DUN) service search to find server channel and service name.
lypinator 0:bb348c97df44 676 * @param pAddress Address of device on which service search shall be performed.
lypinator 0:bb348c97df44 677 * @param maxServices Max number of services
lypinator 0:bb348c97df44 678 * @param pCallback Callback used to notify each found service record
lypinator 0:bb348c97df44 679 * @param pCompleteCallback Callback used to notify that the search is completed
lypinator 0:bb348c97df44 680 * @return If the operation is successful initiated cbBCM_OK is returned.
lypinator 0:bb348c97df44 681 */
lypinator 0:bb348c97df44 682 extern cb_int32 cbBCM_reqServiceSearchDun(
lypinator 0:bb348c97df44 683 TBdAddr *pAddress,
lypinator 0:bb348c97df44 684 cb_uint16 maxServices,
lypinator 0:bb348c97df44 685 cbBCM_ServiceSearchSppCallback pCallback,
lypinator 0:bb348c97df44 686 cbBCM_ServiceSearchCompleteCallback pCompleteCallback);
lypinator 0:bb348c97df44 687
lypinator 0:bb348c97df44 688 /**
lypinator 0:bb348c97df44 689 * @brief Initiate a UUID service search to find server channel and service name.
lypinator 0:bb348c97df44 690 * @param pAddress Address of device on which service search shall be performed.
lypinator 0:bb348c97df44 691 * @param pUuid128 128 UUID to search for.
lypinator 0:bb348c97df44 692 * @param maxServices Max number of services
lypinator 0:bb348c97df44 693 * @param pCallback Callback used to notify each found service record
lypinator 0:bb348c97df44 694 * @param pCompleteCallback Callback used to notify that the search is completed
lypinator 0:bb348c97df44 695 * @return If the operation is successful initiated cbBCM_OK is returned.
lypinator 0:bb348c97df44 696 */
lypinator 0:bb348c97df44 697 extern cb_int32 cbBCM_reqServiceSearchUuid(
lypinator 0:bb348c97df44 698 TBdAddr *pAddress,
lypinator 0:bb348c97df44 699 const cb_uint8 *pUuid128,
lypinator 0:bb348c97df44 700 cb_uint16 maxServices,
lypinator 0:bb348c97df44 701 cbBCM_ServiceSearchSppCallback pCallback,
lypinator 0:bb348c97df44 702 cbBCM_ServiceSearchCompleteCallback pCompleteCallback);
lypinator 0:bb348c97df44 703
lypinator 0:bb348c97df44 704 /**
lypinator 0:bb348c97df44 705 * @brief Initiate a Device information service search.
lypinator 0:bb348c97df44 706 * @param pAddress Address of device on which service search shall be performed.
lypinator 0:bb348c97df44 707 * @param maxServices Max number of services
lypinator 0:bb348c97df44 708 * @param pCallback Callback used to notify each found service record
lypinator 0:bb348c97df44 709 * @param pCompleteCallback Callback used to notify that the search is completed
lypinator 0:bb348c97df44 710 * @return If the operation is successful initiated cbBCM_OK is returned.
lypinator 0:bb348c97df44 711 */
lypinator 0:bb348c97df44 712 cb_int32 cbBCM_reqServiceSearchDeviceId(
lypinator 0:bb348c97df44 713 TBdAddr *pAddress,
lypinator 0:bb348c97df44 714 cb_uint16 maxServices,
lypinator 0:bb348c97df44 715 cbBCM_ServiceSearchDeviceIdCallback pCallback,
lypinator 0:bb348c97df44 716 cbBCM_ServiceSearchCompleteCallback pCompleteCallback);
lypinator 0:bb348c97df44 717
lypinator 0:bb348c97df44 718 /**
lypinator 0:bb348c97df44 719 * @brief Get local Master/Slave role in an active connection.
lypinator 0:bb348c97df44 720 * @param bdAddr address to the connection
lypinator 0:bb348c97df44 721 * @param roleDiscoveryCallback Callback function used to notify the role
lypinator 0:bb348c97df44 722 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 723 */
lypinator 0:bb348c97df44 724 extern cb_int32 cbBCM_RoleDiscovery(
lypinator 0:bb348c97df44 725 TBdAddr bdAddr,
lypinator 0:bb348c97df44 726 cbBCM_RoleDiscoveryCallback roleDiscoveryCallback);
lypinator 0:bb348c97df44 727
lypinator 0:bb348c97df44 728 /**
lypinator 0:bb348c97df44 729 * @brief Get current Received Signal Strength Indication (RSSI)
lypinator 0:bb348c97df44 730 * of an active connection.
lypinator 0:bb348c97df44 731 * @param bdAddress bt address to the connected device
lypinator 0:bb348c97df44 732 * @param rssiCallback Callback function used to notify the rssi value
lypinator 0:bb348c97df44 733 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 734 */
lypinator 0:bb348c97df44 735 extern cb_int32 cbBCM_getRssi(
lypinator 0:bb348c97df44 736 TBdAddr bdAddress,
lypinator 0:bb348c97df44 737 cbBCM_RssiCallback rssiCallback);
lypinator 0:bb348c97df44 738
lypinator 0:bb348c97df44 739 /*
lypinator 0:bb348c97df44 740 * Read the LinkQuality .
lypinator 0:bb348c97df44 741 * @return status as int32.
lypinator 0:bb348c97df44 742 * @cbBM_LinkQualityCallback is used to provide result.
lypinator 0:bb348c97df44 743 */
lypinator 0:bb348c97df44 744 extern cb_int32 cbBCM_GetLinkQuality(TBdAddr bdAddr, cbBCM_LinkQualityCallback linkQualityCallback);
lypinator 0:bb348c97df44 745
lypinator 0:bb348c97df44 746 /**
lypinator 0:bb348c97df44 747 * @brief Change the packet types currently used for an active Bluetooth
lypinator 0:bb348c97df44 748 * Classic connection.
lypinator 0:bb348c97df44 749 * @param handle Connection handle
lypinator 0:bb348c97df44 750 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 751 */
lypinator 0:bb348c97df44 752 extern cb_int32 cbBCM_cmdChangePacketType(
lypinator 0:bb348c97df44 753 cbBCM_Handle handle);
lypinator 0:bb348c97df44 754
lypinator 0:bb348c97df44 755 /**
lypinator 0:bb348c97df44 756 * @brief Get the current connection parameters for an active Bluetooth
lypinator 0:bb348c97df44 757 * Low Energy ACL connection.
lypinator 0:bb348c97df44 758 * @param handle Connection handle
lypinator 0:bb348c97df44 759 * @param pConnectionInterval Connection interval
lypinator 0:bb348c97df44 760 * @param pConnectionLatency Connection latency
lypinator 0:bb348c97df44 761 * @param pLinkSupervisionTmo Link supervision timeout
lypinator 0:bb348c97df44 762 * @return If the update is successfully initiated cbBCM_OK is returned.
lypinator 0:bb348c97df44 763 */
lypinator 0:bb348c97df44 764 extern cb_int32 cbBCM_getConnectionParams(
lypinator 0:bb348c97df44 765 cbBCM_Handle handle,
lypinator 0:bb348c97df44 766 cb_uint16 *pConnectionInterval,
lypinator 0:bb348c97df44 767 cb_uint16 *pConnectionLatency,
lypinator 0:bb348c97df44 768 cb_uint16 *pLinkSupervisionTmo);
lypinator 0:bb348c97df44 769
lypinator 0:bb348c97df44 770 /**
lypinator 0:bb348c97df44 771 * @brief Update connection parameters for an active Bluetooth
lypinator 0:bb348c97df44 772 * Low Energy ACL connection.
lypinator 0:bb348c97df44 773 * @param handle Connection handle
lypinator 0:bb348c97df44 774 * @param pAclLeParams New Link configuration parameters
lypinator 0:bb348c97df44 775 * @return If the update is successfully initiated cbBCM_OK is returned.
lypinator 0:bb348c97df44 776 */
lypinator 0:bb348c97df44 777 extern cb_int32 cbBCM_updateConnectionParams(
lypinator 0:bb348c97df44 778 cbBCM_Handle handle,
lypinator 0:bb348c97df44 779 cbBCM_ConnectionParametersLe *pAclLeParams);
lypinator 0:bb348c97df44 780
lypinator 0:bb348c97df44 781 /**
lypinator 0:bb348c97df44 782 * Register a GATT device information service. The device information service
lypinator 0:bb348c97df44 783 * is used by remote devices to get for example the model and firmware version
lypinator 0:bb348c97df44 784 * of this device.
lypinator 0:bb348c97df44 785 * Note that an application easily can define and register its own device information
lypinator 0:bb348c97df44 786 * service if other characteristics are required.
lypinator 0:bb348c97df44 787 * @param pManufacturer String defining the manufacturer.
lypinator 0:bb348c97df44 788 * @param pModel String defining the device model.
lypinator 0:bb348c97df44 789 * @param pFwVersion String defining the firmware version.
lypinator 0:bb348c97df44 790 * @param startIndex Start index of the attribute database for the device info service.
lypinator 0:bb348c97df44 791 * Note that this must not change during the lifetime of the product.
lypinator 0:bb348c97df44 792 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 793 */
lypinator 0:bb348c97df44 794 extern cb_int32 cbBCM_enableDevInfoService(
lypinator 0:bb348c97df44 795 const cb_char *pManufacturer,
lypinator 0:bb348c97df44 796 const cb_char *pModel,
lypinator 0:bb348c97df44 797 const cb_char *pFwVersion,
lypinator 0:bb348c97df44 798 cb_uint16 startIndex);
lypinator 0:bb348c97df44 799
lypinator 0:bb348c97df44 800 /**
lypinator 0:bb348c97df44 801 * @brief Get the address of the remote device on an
lypinator 0:bb348c97df44 802 * active connection
lypinator 0:bb348c97df44 803 *
lypinator 0:bb348c97df44 804 * @param handle Connection handle
lypinator 0:bb348c97df44 805 * @return Address of the remote device.
lypinator 0:bb348c97df44 806 */
lypinator 0:bb348c97df44 807 extern TBdAddr cbBCM_getAddress(cbBCM_Handle handle);
lypinator 0:bb348c97df44 808
lypinator 0:bb348c97df44 809 /**
lypinator 0:bb348c97df44 810 * @brief Register a data manager for a type of connections. Shall not be
lypinator 0:bb348c97df44 811 * used by the application. Only used by data managers.
lypinator 0:bb348c97df44 812 *
lypinator 0:bb348c97df44 813 * @param type Connection type.
lypinator 0:bb348c97df44 814 * @param pDataCallback Data callback
lypinator 0:bb348c97df44 815 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 816 */
lypinator 0:bb348c97df44 817 extern cb_int32 cbBCM_registerDataCallback(
lypinator 0:bb348c97df44 818 cbBCM_ConnectionType type,
lypinator 0:bb348c97df44 819 const cbBCM_DataCallback *pDataCallback);
lypinator 0:bb348c97df44 820
lypinator 0:bb348c97df44 821 /**
lypinator 0:bb348c97df44 822 * @brief Get the protocol handle for an active connection. Shall not be used
lypinator 0:bb348c97df44 823 * by the application. Only used by data managers.
lypinator 0:bb348c97df44 824 *
lypinator 0:bb348c97df44 825 * @param handle Connection handle
lypinator 0:bb348c97df44 826 * @return If the operation is not successful cbBCM_INVALID_CONNECTION_HANDLE
lypinator 0:bb348c97df44 827 * is returned. If the operation is successful the protocol handle is
lypinator 0:bb348c97df44 828 * returned.
lypinator 0:bb348c97df44 829 */
lypinator 0:bb348c97df44 830 extern cbBCM_Handle cbBCM_getProtocolHandle(
lypinator 0:bb348c97df44 831 cbBCM_Handle handle);
lypinator 0:bb348c97df44 832
lypinator 0:bb348c97df44 833 /**
lypinator 0:bb348c97df44 834 * @brief Get the bcm id from acl handle for an active connection.
lypinator 0:bb348c97df44 835 *
lypinator 0:bb348c97df44 836 * @param handle Connection handle
lypinator 0:bb348c97df44 837 * @return bcm handle.
lypinator 0:bb348c97df44 838 */
lypinator 0:bb348c97df44 839 extern cbBCM_Handle cbBCM_getIdFromAclHandle(TConnHandle aclHandle);
lypinator 0:bb348c97df44 840
lypinator 0:bb348c97df44 841 /**
lypinator 0:bb348c97df44 842 * @brief Get the acl handle from bcm handle.
lypinator 0:bb348c97df44 843 *
lypinator 0:bb348c97df44 844 * @param handle bcm handle
lypinator 0:bb348c97df44 845 * @return acl handle
lypinator 0:bb348c97df44 846 */
lypinator 0:bb348c97df44 847 extern TConnHandle cbBCM_getAclFromIdHandle(cbBCM_Handle bcmHandle);
lypinator 0:bb348c97df44 848
lypinator 0:bb348c97df44 849 /**
lypinator 0:bb348c97df44 850 * @brief Set active poll mode to introduce periodic BT classic link polling.
lypinator 0:bb348c97df44 851 * @param mode Active poll mode 0=disable, 1=enable (default period), 2-UINT16_MAX: period of poll
lypinator 0:bb348c97df44 852 * @return If the update is successfully initiated cbBCM_OK is returned.
lypinator 0:bb348c97df44 853 */
lypinator 0:bb348c97df44 854 extern cb_int32 cbBCM_setActivePollMode(cb_uint16 mode);
lypinator 0:bb348c97df44 855
lypinator 0:bb348c97df44 856 /**
lypinator 0:bb348c97df44 857 * @brief Get active poll mode.
lypinator 0:bb348c97df44 858 * @return Active poll mode 0=disable, 1=enable
lypinator 0:bb348c97df44 859 */
lypinator 0:bb348c97df44 860 extern cb_uint16 cbBCM_getActivePollMode(void);
lypinator 0:bb348c97df44 861
lypinator 0:bb348c97df44 862 /**
lypinator 0:bb348c97df44 863 * @brief Change which packet types can be used for the connection identified by the handle
lypinator 0:bb348c97df44 864 * @param handle Connection handle
lypinator 0:bb348c97df44 865 * @param aclPacketType bit map according to packet types defined in bt_types.h
lypinator 0:bb348c97df44 866 * @return If the operation is successful cbBCM_OK is returned.
lypinator 0:bb348c97df44 867 */
lypinator 0:bb348c97df44 868 extern cb_int32 cbBCM_changeConnectionPacketType(
lypinator 0:bb348c97df44 869 cbBCM_Handle handle,
lypinator 0:bb348c97df44 870 TPacketType aclPacketType);
lypinator 0:bb348c97df44 871
lypinator 0:bb348c97df44 872
lypinator 0:bb348c97df44 873 #ifdef __cplusplus
lypinator 0:bb348c97df44 874 }
lypinator 0:bb348c97df44 875 #endif
lypinator 0:bb348c97df44 876
lypinator 0:bb348c97df44 877
lypinator 0:bb348c97df44 878 #endif /* _CB_BT_CONN_MAN_H_ */