28 #ifndef __BTR_CORE_H__
29 #define __BTR_CORE_H__
31 #include "btrCoreTypes.h"
61 #define BTRCORE_MAX_NUM_BT_ADAPTERS 4 // TODO:Better to make this configurable at runtime
62 #define BTRCORE_MAX_NUM_BT_DEVICES 64 // TODO:Better to make this configurable at runtime
63 #define BTRCORE_MAX_DEVICE_PROFILE 32
64 #define BTRCORE_MAX_MEDIA_ELEMENTS 64
66 #define BTRCORE_UUID_LEN BTRCORE_STR_LEN
67 #define BTRCORE_MAX_DEV_OP_DATA_LEN BTRCORE_MAX_STR_LEN * 3
68 #define BTRCORE_MAX_SERVICE_DATA_LEN 32
70 typedef unsigned long long int tBTRCoreMediaElementId;
72 typedef enum _enBTRCoreOpType {
73 enBTRCoreOpTypeAdapter,
77 typedef enum _enBTRCoreDeviceType {
80 enBTRCoreMobileAudioIn,
85 } enBTRCoreDeviceType;
87 typedef enum _enBTRCoreDeviceClass {
89 enBTRCore_DC_Tablet = 0x11Cu,
90 enBTRCore_DC_SmartPhone = 0x20Cu,
91 enBTRCore_DC_WearableHeadset = 0x404u,
92 enBTRCore_DC_Handsfree = 0x408u,
93 enBTRCore_DC_Reserved = 0x40Cu,
94 enBTRCore_DC_Microphone = 0x410u,
95 enBTRCore_DC_Loudspeaker = 0x414u,
96 enBTRCore_DC_Headphones = 0x418u,
97 enBTRCore_DC_PortableAudio = 0x41Cu,
98 enBTRCore_DC_CarAudio = 0x420u,
99 enBTRCore_DC_STB = 0x424u,
100 enBTRCore_DC_HIFIAudioDevice = 0x428u,
101 enBTRCore_DC_VCR = 0x42Cu,
102 enBTRCore_DC_VideoCamera = 0x430u,
103 enBTRCore_DC_Camcoder = 0x434u,
104 enBTRCore_DC_VideoMonitor = 0x438u,
105 enBTRCore_DC_TV = 0x43Cu,
106 enBTRCore_DC_VideoConference = 0x440u,
109 enBTRCore_DC_Tile = 0xfeedu,
110 enBTRCore_DC_HID_AudioRemote = 0x50Cu,
111 enBTRCore_DC_HID_Keyboard = 0x540u,
112 enBTRCore_DC_HID_Mouse = 0x580u,
113 enBTRCore_DC_HID_MouseKeyBoard = 0x5C0u,
114 enBTRCore_DC_HID_Joystick = 0x504u,
115 enBTRCore_DC_HID_GamePad = 0x508u,
117 enBTRCore_DC_Unknown = 0x000u
118 } enBTRCoreDeviceClass;
120 typedef enum _enBTRCoreDeviceState {
121 enBTRCoreDevStInitialized,
123 enBTRCoreDevStPaired,
124 enBTRCoreDevStUnpaired,
125 enBTRCoreDevStConnecting,
126 enBTRCoreDevStConnected,
127 enBTRCoreDevStDisconnecting,
128 enBTRCoreDevStDisconnected,
129 enBTRCoreDevStPlaying,
131 enBTRCoreDevStOpReady,
132 enBTRCoreDevStOpInfo,
133 enBTRCoreDevStUnknown
134 } enBTRCoreDeviceState;
136 typedef enum _eBTRCoreDevMediaType {
137 eBTRCoreDevMediaTypePCM,
138 eBTRCoreDevMediaTypeSBC,
139 eBTRCoreDevMediaTypeMPEG,
140 eBTRCoreDevMediaTypeAAC,
141 eBTRCoreDevMediaTypeUnknown
142 } eBTRCoreDevMediaType;
144 typedef enum _eBTRCoreDevMediaAChan {
145 eBTRCoreDevMediaAChanMono,
146 eBTRCoreDevMediaAChanDualChannel,
147 eBTRCoreDevMediaAChanStereo,
148 eBTRCoreDevMediaAChanJointStereo,
149 eBTRCoreDevMediaAChan5_1,
150 eBTRCoreDevMediaAChan7_1,
151 eBTRCoreDevMediaAChanUnknown
152 } eBTRCoreDevMediaAChan;
154 typedef enum _enBTRCoreMediaCtrl {
155 enBTRCoreMediaCtrlPlay,
156 enBTRCoreMediaCtrlPause,
157 enBTRCoreMediaCtrlStop,
158 enBTRCoreMediaCtrlNext,
159 enBTRCoreMediaCtrlPrevious,
160 enBTRCoreMediaCtrlFastForward,
161 enBTRCoreMediaCtrlRewind,
162 enBTRCoreMediaCtrlVolumeUp,
163 enBTRCoreMediaCtrlVolumeDown,
164 enBTRCoreMediaCtrlEqlzrOff,
165 enBTRCoreMediaCtrlEqlzrOn,
166 enBTRCoreMediaCtrlShflOff,
167 enBTRCoreMediaCtrlShflAllTracks,
168 enBTRCoreMediaCtrlShflGroup,
169 enBTRCoreMediaCtrlRptOff,
170 enBTRCoreMediaCtrlRptSingleTrack,
171 enBTRCoreMediaCtrlRptAllTracks,
172 enBTRCoreMediaCtrlRptGroup,
173 enBTRCoreMediaCtrlScanOff,
174 enBTRCoreMediaCtrlScanAllTracks,
175 enBTRCoreMediaCtrlScanGroup,
176 enBTRCoreMediaCtrlMute,
177 enBTRCoreMediaCtrlUnMute,
178 enBTRCoreMediaCtrlUnknown
179 } enBTRCoreMediaCtrl;
181 typedef enum _eBTRCoreMediaStatusUpdate {
182 eBTRCoreMediaTrkStStarted,
183 eBTRCoreMediaTrkStPlaying,
184 eBTRCoreMediaTrkStPaused,
185 eBTRCoreMediaTrkStStopped,
186 eBTRCoreMediaTrkStChanged,
187 eBTRCoreMediaTrkPosition,
188 eBTRCoreMediaPlaybackEnded,
189 eBTRCoreMediaPlyrName,
190 eBTRCoreMediaPlyrVolume,
191 eBTRCoreMediaPlyrEqlzrStOff,
192 eBTRCoreMediaPlyrEqlzrStOn,
193 eBTRCoreMediaPlyrShflStOff,
194 eBTRCoreMediaPlyrShflStAllTracks,
195 eBTRCoreMediaPlyrShflStGroup,
196 eBTRCoreMediaPlyrRptStOff,
197 eBTRCoreMediaPlyrRptStSingleTrack,
198 eBTRCoreMediaPlyrRptStAllTracks,
199 eBTRCoreMediaPlyrRptStGroup,
200 eBTRCoreMediaPlyrScanStOff,
201 eBTRCoreMediaPlyrScanStAllTracks,
202 eBTRCoreMediaPlyrScanStGroup,
203 eBTRCoreMediaElementInScope,
204 eBTRCoreMediaElementOofScope,
205 eBTRCoreMediaStUnknown
206 } eBTRCoreMediaStatusUpdate;
208 typedef enum _eBTRCoreMedElementType {
209 enBTRCoreMedETypeUnknown,
210 enBTRCoreMedETypeAlbum,
211 enBTRCoreMedETypeArtist,
212 enBTRCoreMedETypeGenre,
213 enBTRCoreMedETypeCompilation,
214 enBTRCoreMedETypePlayList,
215 enBTRCoreMedETypeTrackList,
216 enBTRCoreMedETypeTrack
217 } eBTRCoreMedElementType;
219 typedef enum _enBTRCoreLeOp {
221 enBTRCoreLeOpGReadValue,
222 enBTRCoreLeOpGWriteValue,
223 enBTRCoreLeOpGStartNotify,
224 enBTRCoreLeOpGStopNotify,
228 typedef enum _enBTRCoreLeProp {
229 enBTRCoreLePropGUUID,
230 enBTRCoreLePropGPrimary,
231 enBTRCoreLePropGDevice,
232 enBTRCoreLePropGService,
233 enBTRCoreLePropGValue,
234 enBTRCoreLePropGNotifying,
235 enBTRCoreLePropGFlags,
236 enBTRCoreLePropGChar,
237 enBTRCoreLEGPropGDesc,
238 enBTRCoreLePropUnknown
244 #define BD_ADDR_LEN 6
245 typedef unsigned char BD_ADDR[BD_ADDR_LEN];
249 #define BD_NAME_LEN BTRCORE_STR_LEN - 1
250 typedef char BD_NAME[BD_NAME_LEN + 1];
251 typedef char *BD_NAME_PTR;
253 #define UUID_LEN BTRCORE_UUID_LEN - 1
254 typedef char UUID[UUID_LEN+1];
258 unsigned char number_of_adapters;
262 unsigned char number_of_adapters;
263 BD_NAME adapter_path[BTRCORE_MAX_NUM_BT_ADAPTERS];
264 BD_NAME adapterAddr[BTRCORE_MAX_NUM_BT_ADAPTERS];
269 BD_NAME service_name;
274 tBTRCoreDevId deviceId;
276 char deviceAddress[BTRCORE_MAX_STR_LEN];
277 enBTRCoreDeviceType eDeviceType;
278 enBTRCoreDeviceClass eDeviceClass;
279 enBTRCoreDeviceState eDevicePrevState;
280 enBTRCoreDeviceState eDeviceCurrState;
281 unsigned char isPaired;
282 unsigned int ui32DevClassBtSpec;
283 char uuid[BTRCORE_UUID_LEN];
284 char devOpResponse[BTRCORE_MAX_DEV_OP_DATA_LEN];
285 enBTRCoreLeProp eCoreLeProp;
286 enBTRCoreLeOp eCoreLeOper;
290 unsigned int uuid_value;
291 BD_NAME profile_name;
300 char pcUUIDs[BTRCORE_UUID_LEN];;
301 unsigned char pcData[BTRCORE_MAX_SERVICE_DATA_LEN];
307 unsigned char adapter_number;
309 char* pcAdapterDevName;
313 unsigned int DiscoverableTimeout;
319 tBTRCoreDevId tDeviceId;
320 enBTRCoreDeviceClass enDeviceType;
324 unsigned int ui32VendorId;
325 unsigned int ui32DevClassBtSpec;
326 char pcDeviceName[BD_NAME_LEN+1];
327 char pcDeviceAddress[BD_NAME_LEN+1];
328 char pcDevicePath[BD_NAME_LEN+1];
344 unsigned int ui32devPassKey;
345 unsigned char ucIsReqConfirmation;
346 char cConnAuthDeviceName[BTRCORE_STR_LEN];
354 eBTRCoreDevMediaAChan eDevMAChan;
355 unsigned int ui32DevMSFreq;
356 unsigned int ui32DevMSFmt;
360 eBTRCoreDevMediaAChan eDevMAChan;
361 unsigned int ui32DevMSFreq;
362 unsigned char ui8DevMSbcAllocMethod;
363 unsigned char ui8DevMSbcSubbands;
364 unsigned char ui8DevMSbcBlockLength;
365 unsigned char ui8DevMSbcMinBitpool;
366 unsigned char ui8DevMSbcMaxBitpool;
367 unsigned short ui16DevMSbcFrameLen;
368 unsigned short ui16DevMSbcBitrate;
372 eBTRCoreDevMediaAChan eDevMAChan;
373 unsigned int ui32DevMSFreq;
374 unsigned char ui8DevMMpegCrc;
375 unsigned char ui8DevMMpegLayer;
376 unsigned char ui8DevMMpegMpf;
377 unsigned char ui8DevMMpegRfa;
378 unsigned short ui16DevMMpegFrameLen;
379 unsigned short ui16DevMMpegBitrate;
383 eBTRCoreDevMediaType eBtrCoreDevMType;
384 void* pstBtrCoreDevMCodecInfo;
388 char pcAlbum[BTRCORE_MAX_STR_LEN];
389 char pcGenre[BTRCORE_MAX_STR_LEN];
390 char pcTitle[BTRCORE_MAX_STR_LEN];
391 char pcArtist[BTRCORE_MAX_STR_LEN];
392 unsigned int ui32TrackNumber;
393 unsigned int ui32Duration;
394 unsigned int ui32NumberOfTracks;
398 unsigned int ui32Duration;
399 unsigned int ui32Position;
403 eBTRCoreMedElementType eAVMedElementType;
404 tBTRCoreMediaElementId ui32MediaElementId;
405 unsigned char bIsPlayable;
406 char m_mediaElementName[BTRCORE_MAX_STR_LEN];
411 unsigned short m_numOfElements;
416 eBTRCoreMediaStatusUpdate eBTMediaStUpdate;
423 char m_mediaPlayerName[BTRCORE_MAX_STR_LEN];
424 unsigned char m_mediaPlayerVolume;
429 tBTRCoreDevId deviceId;
431 enBTRCoreDeviceClass eDeviceClass;
437 unsigned char m_mediaAbsoluteVolume;
450 unsigned short flags;
451 char uuid[BTRCORE_UUID_LEN];
455 unsigned char numberOfUUID;
460 enBTRCoreOpType type;
468 typedef enBTRCoreRet (*fPtr_BTRCore_DeviceDiscCb) (
stBTRCoreDiscoveryCBInfo* astBTRCoreDiscoveryCbInfo,
void* apvUserData);
471 typedef enBTRCoreRet (*fPtr_BTRCore_ConnIntimCb) (
stBTRCoreConnCBInfo* apstConnCbInfo,
int* api32ConnInIntimResp,
void* apvUserData);
472 typedef enBTRCoreRet (*fPtr_BTRCore_ConnAuthCb) (
stBTRCoreConnCBInfo* apstConnCbInfo,
int* api32ConnInAuthResp,
void* apvUserData);
563 enBTRCoreRet
BTRCore_SetAdapterPower (tBTRCoreHandle hBTRCore,
const char* pAdapterPath,
unsigned char powerStatus);
575 enBTRCoreRet
BTRCore_GetAdapterPower (tBTRCoreHandle hBTRCore,
const char* pAdapterPath,
unsigned char* pAdapterPower);
642 enBTRCoreRet
BTRCore_GetAdapterAddr (tBTRCoreHandle hBTRCore,
unsigned char aui8adapterIdx,
char* apui8adapterAddr);
702 enBTRCoreRet
BTRCore_SetAdapterName (tBTRCoreHandle hBTRCore,
const char* pAdapterPath,
const char* pAdapterName);
714 enBTRCoreRet
BTRCore_GetAdapterName (tBTRCoreHandle hBTRCore,
const char* pAdapterPath,
char* pAdapterName);
752 enBTRCoreRet
BTRCore_StartDiscovery (tBTRCoreHandle hBTRCore,
const char* pAdapterPath, enBTRCoreDeviceType aenBTRCoreDevType,
unsigned int aui32DiscDuration);
767 enBTRCoreRet
BTRCore_StopDiscovery (tBTRCoreHandle hBTRCore,
const char* pAdapterPath, enBTRCoreDeviceType aenBTRCoreDevType);
790 enBTRCoreRet
BTRCore_PairDevice (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId);
827 enBTRCoreRet
BTRCore_FindDevice (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId);
841 enBTRCoreRet
BTRCore_FindService (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId,
const char* UUID,
char* XMLdata,
int* found);
882 enBTRCoreRet
BTRCore_ConnectDevice (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType);
894 enBTRCoreRet
BTRCore_DisconnectDevice (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType);
906 enBTRCoreRet
BTRCore_GetDeviceConnected (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType);
931 enBTRCoreRet
BTRCore_GetDeviceTypeClass (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType* apenBTRCoreDevTy, enBTRCoreDeviceClass* apenBTRCoreDevCl);
959 enBTRCoreRet
BTRCore_AcquireDeviceDataPath(tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType,
int* aiDataPath,
int* aidataReadMTU,
int* aidataWriteMTU,
unsigned int* apui32Delay);
995 enBTRCoreRet
BTRCore_MediaControl(tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, enBTRCoreMediaCtrl aenBTRCoreMediaCtrl,
stBTRCoreMediaCtData* apstBTRCoreMediaCData);
1052 enBTRCoreRet
BTRCore_GetMediaProperty ( tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType,
const char* mediaPropertyKey,
void* mediaPropertyValue);
1066 enBTRCoreRet
BTRCore_SetMediaElementActive (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, tBTRCoreMediaElementId aBtrMediaElementId, enBTRCoreDeviceType aenBTRCoreDevType, eBTRCoreMedElementType aeBTRCoreMedElementType);
1083 enBTRCoreRet
BTRCore_GetMediaElementList (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, tBTRCoreMediaElementId aBtrMediaElementId,
unsigned short aui16BtrMedElementStartIdx,
unsigned short aui16BtrMedElementEndIdx, enBTRCoreDeviceType aenBTRCoreDevType, eBTRCoreMedElementType aenBTRCoreMedElementType,
stBTRCoreMediaElementInfoList* apstMediaElementListInfo);
1096 enBTRCoreRet
BTRCore_SelectMediaElement (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, tBTRCoreMediaElementId aBtrMediaElementId, enBTRCoreDeviceType aenBTRCoreDevType, eBTRCoreMedElementType aenBTRCoreMedElementType);
1110 enBTRCoreRet
BTRCore_GetLEProperty(tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId,
const char* apcBTRCoreLEUuid, enBTRCoreLeProp aenBTRCoreLeProp,
void* apvBTRCorePropVal);
1125 enBTRCoreRet
BTRCore_PerformLEOp (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId,
const char* apcBTRCoreLEUuid, enBTRCoreLeOp aenBTRCoreLeOp,
char* apLeOpArg,
char* rpLeOpRes);
1175 enBTRCoreRet
BTRCore_SetManufacturerData(tBTRCoreHandle hBTRCore,
unsigned short aManfId,
unsigned char *aDeviceDetails,
int aLenManfData);
1195 enBTRCoreRet
BTRCore_GetPropertyValue(tBTRCoreHandle hBTRCore,
char *aUUID,
char *aValue, enBTRCoreLeProp aElement);
1215 enBTRCoreRet
BTRCore_SetGattInfo(tBTRCoreHandle hBTRCore,
char *aParentUUID,
char *aCharUUID,
unsigned short aFlags,
char *aValue, enBTRCoreLeProp aElement);
1225 enBTRCoreRet
BTRCore_SetPropertyValue(tBTRCoreHandle hBTRCore,
char *aUUID,
char *aValue, enBTRCoreLeProp aElement);
1229 enBTRCoreRet BTRCore_RegisterDiscoveryCb (tBTRCoreHandle hBTRCore, fPtr_BTRCore_DeviceDiscCb afpcBBTRCoreDeviceDiscovery,
void* apUserData);
1232 enBTRCoreRet BTRCore_RegisterStatusCb (tBTRCoreHandle hBTRCore, fPtr_BTRCore_StatusCb afpcBBTRCoreStatus,
void* apUserData);
1235 enBTRCoreRet BTRCore_RegisterMediaStatusCb (tBTRCoreHandle hBTRCore, fPtr_BTRCore_MediaStatusCb afpcBBTRCoreMediaStatus,
void* apUserData);
1238 enBTRCoreRet BTRCore_RegisterConnectionIntimationCb (tBTRCoreHandle hBTRCore, fPtr_BTRCore_ConnIntimCb afpcBBTRCoreConnAuth,
void* apUserData);
1241 enBTRCoreRet BTRCore_RegisterConnectionAuthenticationCb (tBTRCoreHandle hBTRCore, fPtr_BTRCore_ConnAuthCb afpcBBTRCoreConnAuth,
void* apUserData);
1249 #endif // __BTR_CORE_H__