BlePeriph.DefineService

This command registers a new BLE service. When a BLE Central tries to discover services, this service will be amongst the available ones.

If currently enabled, this method disables BLE implicitly. To start the service, call BlePeriph.Enable(true) afterwards.

A maximum of 5 characteristics may be defined for the BLE service. The total size of all characteristics may not exceed 1536 bytes.

Properties

Parameters (request frame)

Name Type/Size Description
RFU Raw data (length 1 Byte) Fixed value 0x00
Length of ServiceUUID Integer (8 bits) Length of ServiceUUID in bytes
ServiceUUID Raw data Specifies the UUID (16 or 128 bits) of the BLE service
Length of Characteristics Integer (8 bits) Number of elements in the Characteristics array
Characteristics Array List of characteristics (max. 5)
Length of CharacteristicUUID Integer (8 bits) Length of CharacteristicUUID in bytes
CharacteristicUUID Raw data Specifies the UUID (16 or 128 bits) of the BLE characteristic
Properties Bit mask (16 bits) -
RFU Integer (bit mask area 0xFFC0) Zero padding
SupportsIndicate Boolean (bit 0x0020) -
SupportsNotify Boolean (bit 0x0010) -
SupportsWrite Boolean (bit 0x0008) -
SupportsWriteNoResponse Boolean (bit 0x0004) -
SupportsRead Boolean (bit 0x0002) -
RFU Integer (bit 0x0001) Zero padding
Flags Bit mask (8 bits) -
RFU Integer (bit mask area 0xFE) Zero padding
VariableSize Boolean (bit 0x01) -
Size Integer (16 bits) Specifies the size of the characteristic in bytes. If VariableSize in Flags parameter is set, this is not the exact size, but the maximum size of the attribute. The maximum supported size of a single characteristic is 512 bytes. The total size of all characteristics may not exceed 1536 bytes.

Returned values (response frame)

None