Creates a Service Record byte array from the given
ServiceRecord object.
| C# | Visual Basic |
public byte[] CreateServiceRecord( ServiceRecord record )
Public Function CreateServiceRecord ( _ record As ServiceRecord _ ) As Byte()
- record (ServiceRecord)
- An instance of ServiceRecord containing the record to be created.
An array of Byte containing the resultant
record bytes. The length of the array is the length of the record bytes.
The only oddity (as with parsing) is with the TextString type. The ServiceElement can either hold the string already encoded to its array of bytes or an String. In the latter case we will always simply encode the string to an array of bytes using encoding UTF8.
Currently any UUIDs in the record are written out in the form supplied, we should probably write a ‘short-form’ equivalent if its a ‘Bluetooth-based’ UUID e.g. Uuid128 as Uuid16.