-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaugmented.rb
48 lines (42 loc) · 1.34 KB
/
augmented.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true
module Wilhelm
module Virtual
class Device
module BMBT
# BMBT::Augmented
class Augmented < Device::Augmented
include Wilhelm::Helpers::DataTools
include Capabilities
include Sent
include Received
PUBLISH = [BMBT_A, BMBT_B, MFL_VOL].freeze
SUBSCRIBE = [RAD_LED].freeze
PROC = 'BMBT::Augmented'
def handle_virtual_transmit(message)
command_id = message.command.d
return false unless publish?(command_id)
case command_id
when MFL_VOL
logger.debug(moi) { "Tx: MFL_VOL (#{d2h(MFL_VOL)})" }
evaluate_mfl_vol_button(message.command)
when BMBT_A
logger.debug(moi) { "Tx: BMBT A (#{d2h(BMBT_A)})" }
evaluate_bmbt_1_button(message.command)
when BMBT_B
logger.debug(moi) { "Tx: BMBT A (#{d2h(BMBT_B)})" }
evaluate_bmbt_2_button(message.command)
end
end
def handle_virtual_receive(message)
command_id = message.command.d
return false unless subscribe?(command_id)
case command_id
when RAD_LED
handle_rad_led(message.command)
end
end
end
end
end
end
end