API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
This is an interface to add and retrieve custom data elements from the Bluetooth database. Each element in the sequence is a basic type such as int, string and so on, and has an ID associated with it.
Adding an element, appends the element at the end of the sequence.
The caller can retrieve a list of data element IDs that are present in the sequence by invoking IBTDevDBCustomData_RetrieveDataIDSeq(). Each element can then be retrieved by calling individual APIs such as IBTDevDBCustomData_RetrieveU32() and so on, depending on the data type.
A data element can be deleted by calling IBTDevDBCustomData_Delete().

Usage example:

===== To get a list of data types

unsigned int dataIDSeq[10]; int dataIDSeqLenReq; IBTDevDBCustomData_GetDataIDList(piIBTDevDBData, dataIDSeq, // buffer to hold data types 10, // size of buffer &dataIDSeqLenReq);
// For each element in dataTypeSeq; do switch (dataIDSeq[i]) { // if dataIDSeq[i] represents a 32 bit value unsigned int uint32Data; IBTDevDBCustomData_GetU32(piIBTDevDBData, i, dataIDSeq[i], &uint32Data);
// if dataIDSeq[i] represents byte sequence int byteSequenceLenReq; unsigned char byteSequence[50]; IBTDevDBCustomData_GetByteSeq(piIBTDevDBData, i, dataIDSeq[i], byteSequence, 50, &byteSequenceLenReq);
// if dataIDSeq[i] represents a string int nLenReq; char szValue[50]; IBTDevDBCustomData_GetString(piIBTDevDBData, i, dataIDSeq[i], szValue, 50, &nLenReq);
// if dataIDSeq[i] represents a wstring int nLenReq; _wchar_t wszValue[50]; IBTDevDBCustomData_GetWideString(piIBTDevDBData, i, dataIDSeq[i], wszValue, // buffer to retrieve the wstring 50, // number of wide chars in wszValue &nLenReq); // number of wide chars required // to read the entire string . . . }

===== To Append a 32 bit value to the sequence

unsigned int value = 0x10; IBTDevDBCustomData_AppendU32(piIBTDevDBData, 0xA1, // Data ID value);

===== To Append a string

IBTDevDBCustomData_String(piIBTDevDBData, 0xA2, // Data ID "Fav device");

===== To Delete a particular element

// First retrieve list of elements IBTDevDBCustomData_GetDataIDList(piIBTDevDBData, dataIDSeq, // buffer to hold data types 10, // size of buffer &dataIDSeqLenReq);
// for all elements in dataIDSeq // if ( dataIDSeq[i] == 0xA2 ) // match the data ID IBTDevDBCustomData_Delete(piIBTDevDBData, i, // index of the element 0xA2); // data id of the element