Class: TimexDatalinkClient::Protocol3::Alarm
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol3::Alarm
- Includes:
- ActiveModel::Validations, Helpers::CharEncoders, Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_3/alarm.rb
Constant Summary collapse
- CPACKET_ALARM =
[0x50]
Constants included from Helpers::CharEncoders
Helpers::CharEncoders::CHARS, Helpers::CharEncoders::CHARS_PROTOCOL_6, Helpers::CharEncoders::EEPROM_CHARS, Helpers::CharEncoders::EEPROM_TERMINATOR, Helpers::CharEncoders::INVALID_CHAR, Helpers::CharEncoders::PHONE_CHARS
Instance Attribute Summary collapse
-
#audible ⇒ Object
Returns the value of attribute audible.
-
#message ⇒ Object
Returns the value of attribute message.
-
#number ⇒ Object
Returns the value of attribute number.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(number:, audible:, time:, message:) ⇒ Alarm
constructor
Create an Alarm instance.
-
#packets ⇒ Array<Array<Integer>>
Compile packets for an alarm.
Methods included from Helpers::CharEncoders
#chars_for, #eeprom_chars_for, #phone_chars_for, #protocol_6_chars_for
Constructor Details
#initialize(number:, audible:, time:, message:) ⇒ Alarm
Create an Alarm instance.
31 32 33 34 35 36 |
# File 'lib/timex_datalink_client/protocol_3/alarm.rb', line 31 def initialize(number:, audible:, time:, message:) @number = number @audible = audible @time = time @message = end |
Instance Attribute Details
#audible ⇒ Object
Returns the value of attribute audible.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_3/alarm.rb', line 17 def audible @audible end |
#message ⇒ Object
Returns the value of attribute message.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_3/alarm.rb', line 17 def @message end |
#number ⇒ Object
Returns the value of attribute number.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_3/alarm.rb', line 17 def number @number end |
#time ⇒ Object
Returns the value of attribute time.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_3/alarm.rb', line 17 def time @time end |
Instance Method Details
#packets ⇒ Array<Array<Integer>>
Compile packets for an alarm.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/timex_datalink_client/protocol_3/alarm.rb', line 42 def packets validate! [ [ CPACKET_ALARM, number, time.hour, time.min, 0, 0, , audible_integer ].flatten ] end |