Class: Flic::Protocol::Primitives::BluetoothAddress

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/flic/protocol/primitives/bluetooth_address.rb

Constant Summary collapse

PRINTF_FORMAT_STRING =
'%.2X:%.2X:%.2X:%.2X:%.2X:%.2X'.freeze
SCANF_FORMAT_STRING =
'%X:%X:%X:%X:%X:%X'.freeze

Instance Method Summary collapse

Instance Method Details

#getObject



15
16
17
# File 'lib/flic/protocol/primitives/bluetooth_address.rb', line 15

def get
  sprintf(PRINTF_FORMAT_STRING, *big_endian_octets)
end

#set(value) ⇒ Object



19
20
21
# File 'lib/flic/protocol/primitives/bluetooth_address.rb', line 19

def set(value)
  self.big_endian_octets = value.scanf(SCANF_FORMAT_STRING)
end