class Flic::Protocol::Primitives::BluetoothAddress
A bluetooth address (bdaddr_t) is encoded in little endan, 6 bytes in total. When such an address is written as a string, it is normally written in big endian, where each byte is encoded in hex and colon as separator for each byte. For example, the address 08:09:0a:0b:0c:0d is encoded as the bytes 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08.
Constants
- PRINTF_FORMAT_STRING
- SCANF_FORMAT_STRING
Public Instance Methods
get()
click to toggle source
# File lib/flic/protocol/primitives/bluetooth_address.rb, line 16 def get sprintf(PRINTF_FORMAT_STRING, *big_endian_octets) end
set(value)
click to toggle source
# File lib/flic/protocol/primitives/bluetooth_address.rb, line 20 def set(value) self.big_endian_octets = value.scanf(SCANF_FORMAT_STRING) end
Private Instance Methods
big_endian_octets()
click to toggle source
# File lib/flic/protocol/primitives/bluetooth_address.rb, line 26 def big_endian_octets little_endian_octets.to_a.reverse end
big_endian_octets=(big_endian_octets)
click to toggle source
# File lib/flic/protocol/primitives/bluetooth_address.rb, line 30 def big_endian_octets=(big_endian_octets) self.little_endian_octets = big_endian_octets.to_a.reverse end