3 - Data Formats
eDynamo| Secure Card Reader Authenticator | Programmer’s Manual (COMMANDS)
Page 31 of 245 (
D998200115-17
)
3.2
How to Use GATT Format (GATT Only)
When operating as a vendor-defined GATT device, the device may send
Sent from Device to Host (MSR Only | Keypad Entry Only)
Notification Messages Sent from
Device to Host (Extended Notifications Only)
in either normal or RLE format, depending on whether
RLE would help compress the data or not. The host software should understand both formats.
Regardless of whether the device has GATT notifications enabled or disabled (see section
and section
2.2.4 How to Receive Data On the Bluetooth LE Connection
), the
first byte of the card data block contains the GATT card data format field, which indicates what type of
data it is sending and whether the data is RLE compressed as follows:
0x00 =
Card Data Normal
, which indicates the card data payload contains uncompressed card data
in USB HID vendor defined report format (see section
6 Magnetic Stripe Card Data Sent from
0x01 =
Card Data RLE
, which indicates the card data payload contains run-length-encoded
compressed card data in USB HID vendor-defined report format (see section
Card Data Sent from Device to Host
and the information below about RLE decoding).
0x02 =
Notification Uncompressed
, which indicates the payload contains an uncompressed
notification message [see section
7 Notification Messages Sent from Device to Host (Extended
0x03 =
Notification RLE
, which indicates the payload contains a run-length-encoded compressed
notification message [see section
7 Notification Messages Sent from Device to Host (Extended
and the information below about RLE decoding].
The device implements RLE as follows:
1)
Any byte that is repeated more than once consecutively is run length encoded. Bytes that are not
repeated stay as-is.
2)
Repeated bytes are run-length encoded by repeating the byte twice, followed by the number of times
the byte was repeated in the original data.
3)
The maximum length of an encoded run is 255, so runs larger than 255 bytes are encoded as multiple
runs of 255 bytes each until the last run.
For example, the data
0x44 0x55 0x55 0x55 0x55 0x55 0x55 0x55 0x55 0x055 0x66
0x00 0x00
is encoded as
0x44 0x55 0x55 0x09 0x66 0x00 0x00 0x02
. A run of 260
0x00
bytes would be encoded as
0x00 0x00 0xFF 0x00 0x00 0x05
.
The second and third byte of card data and notification data contain the uncompressed data payload field
size in big endian order.
The fourth byte onward contains the data for the
Magnetic Stripe Card Data Sent from Device to Host
Notification Messages Sent from Device to Host (Extended Notifications Only)
The data size for command data and card data may increase with firmware updates, so the
host software should be able to adapt to this. Adapting can be as simple as ignoring any
extra data bytes that are not understood or expected.
If the
Card Data
characteristic (see section
2.2.1 About GATT Characteristics
) is not configured to use
notifications, the maximum notification message packet data length is the maximum characteristic size
allowed by the Bluetooth LE specification (512), times the maximum number of block identifiers (256) =
131072 bytes minus headers (3 + 8) = 131061 bytes, which is large enough to fit a maximum sized
notification message with a complete data length of 65535 bytes without splitting it into multiple packets.