Class: TimexDatalinkClient::Protocol6::PagerOptions
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol6::PagerOptions
- Includes:
- ActiveModel::Validations, Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_6/pager_options.rb
Constant Summary collapse
- CPACKET_PAGER =
0x73
- ALERT_SOUND_SILENT =
6
Instance Attribute Summary collapse
-
#alert_sound ⇒ Object
Returns the value of attribute alert_sound.
-
#auto_on_off ⇒ Object
Returns the value of attribute auto_on_off.
-
#off_hour ⇒ Object
Returns the value of attribute off_hour.
-
#off_minute ⇒ Object
Returns the value of attribute off_minute.
-
#on_hour ⇒ Object
Returns the value of attribute on_hour.
-
#on_minute ⇒ Object
Returns the value of attribute on_minute.
Instance Method Summary collapse
- #alert_sound_formatted ⇒ Object
- #auto_on_off_formatted ⇒ Object
-
#initialize(auto_on_off: false, on_hour: 0, on_minute: 0, off_hour: 0, off_minute: 0, alert_sound: 0) ⇒ PagerOptions
constructor
Create a PagerOptions instance.
-
#packets ⇒ Array<Array<Integer>>
Compile packets for pager options.
Constructor Details
#initialize(auto_on_off: false, on_hour: 0, on_minute: 0, off_hour: 0, off_minute: 0, alert_sound: 0) ⇒ PagerOptions
Create a PagerOptions instance.
51 52 53 54 55 56 57 58 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 51 def initialize(auto_on_off: false, on_hour: 0, on_minute: 0, off_hour: 0, off_minute: 0, alert_sound: 0) @auto_on_off = auto_on_off @on_hour = on_hour @on_minute = on_minute @off_hour = off_hour @off_minute = off_minute @alert_sound = alert_sound end |
Instance Attribute Details
#alert_sound ⇒ Object
Returns the value of attribute alert_sound.
40 41 42 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 40 def alert_sound @alert_sound end |
#auto_on_off ⇒ Object
Returns the value of attribute auto_on_off.
40 41 42 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 40 def auto_on_off @auto_on_off end |
#off_hour ⇒ Object
Returns the value of attribute off_hour.
40 41 42 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 40 def off_hour @off_hour end |
#off_minute ⇒ Object
Returns the value of attribute off_minute.
40 41 42 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 40 def off_minute @off_minute end |
#on_hour ⇒ Object
Returns the value of attribute on_hour.
40 41 42 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 40 def on_hour @on_hour end |
#on_minute ⇒ Object
Returns the value of attribute on_minute.
40 41 42 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 40 def on_minute @on_minute end |
Instance Method Details
#alert_sound_formatted ⇒ Object
84 85 86 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 84 def alert_sound_formatted alert_sound || ALERT_SOUND_SILENT end |
#auto_on_off_formatted ⇒ Object
80 81 82 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 80 def auto_on_off_formatted auto_on_off ? 1 : 0 end |
#packets ⇒ Array<Array<Integer>>
Compile packets for pager options.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/timex_datalink_client/protocol_6/pager_options.rb', line 64 def packets validate! [ [ CPACKET_PAGER, auto_on_off_formatted, on_hour, on_minute, off_hour, off_minute, alert_sound_formatted ] ] end |