|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||Bluetooth||MBS Bluetooth Plugin||18.3||Yes||No||No||Yes, macOS only||No|
The data types described by the spec have been mapped onto the base Xojo classes and data types double, Array, Memoryblock as well as IOBluetoothSDPUUID. The number and boolean types (type descriptor 1, 2 and 5) are represented as booleans with the exception of 128-bit numbers which are represented as memoryblock objects in their raw format. The UUID type (type descriptor 3) is represented by IOBluetoothSDPUUID. The string and URL types (type descriptor 4 and 8) are represented by string. The sequence types (type descriptor 6 and 7) are represented by array.
Typically, you will not need to create an IOBluetoothSDPDataElement directly, the system will do that automatically for both client and server operations. However, the current API for adding SDP services to the system does allow the use of an Dictionary based format for creating new services. The purpose for that is to allow a service to be built up completely in a text file (a plist for example) and then easily imported into an app and added to the system without a lot of tedious code to build up the entire SDP service record.
The basis for that dictionary comes from the IOBluetoothSDPDataElement. At its simplest, a data element is made up of three parts: the type descriptor, the size (from which the size descriptor is generated) and the actual value. To provide a complete representation of a data element, an dictionary with three entries can be used. Each of the three entries has a key/value pair representing one of the three attributes of a data element. The first key/value pair has a key 'DataElementType' that contains a number value with the actual type descriptor for the data element. The second pair has a key 'DataElementSize' that contains the actual size of the element in bytes. The size descriptor will be calculated based on the size and type of the element. The third pair is the value itself whose key is 'DataElementValue' and whose type corresponds to the type mapping above.
In addition to this complete description of a data element, their are some shortcuts that can be used for some of the common types and sizes.
If the 'DataElementType' value is one of the numeric types (1, 2), the 'DataElementValue' can be an memoryblock instead of an number. In that case, the numeric data is taken in network byte order (MSB first). Additionally, the 'DataElementSize' parameter may be omitted and the size will be taken from the length of the data object.
If the 'DataElementType' value is the nil type (0), no 'DataElementSize' or 'DataElementValue' entries are needed.
If the 'DataElementType' value is any of the other types, the 'DataElementSize' entry is not needed since the size will be taken directly from the value (data, array, string).
In the case where the element is an unsigned, 32-bit integer (type descriptor 1, size descriptor 4), the value itself may simply be a number (instead of a dictionary as in the previous examples). In the case where the element is a UUID (type descriptor 3), the value itself may be a data object. The UUID type will be inferred and the size taken from the length of the data object.
In the case where the element is a text string (type descriptor 4), the value may be a string object. The text string type will be inferred and the size taken from the length of the string.
In the case where the element is a data element sequence, the value may be an array object. The type will be inferred and the size taken from the length of the array. Additionally, the array must contain sub-elements that will be parsed out individually.
- 9 properties
- 4 methods
- 2 shared methods
- 11 constants
End of reserved numbers
Begin of reserved numbers.
This class has no sub classes.
Some methods using this class:
- IOBluetoothSDPServiceRecordMBS.AttributeDataElement(attributeID as Integer) as IOBluetoothSDPDataElementMBS
Some properties using for this class:
- IOBluetoothSDPServiceAttributeMBS.DataElement as IOBluetoothSDPDataElementMBS
- IOBluetoothSDPServiceAttributeMBS.IDDataElement as IOBluetoothSDPDataElementMBS
The items on this page are in the following plugins: MBS Bluetooth Plugin.
MBS Xojo Chart Plugins