Class: TimexDatalinkClient::Protocol4::Time
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol4::Time
- Includes:
- Helpers::CharEncoders, Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_4/time.rb
Constant Summary collapse
- CPACKET_TIME =
[0x32]
Constants included from Helpers::CharEncoders
Helpers::CharEncoders::CHARS, Helpers::CharEncoders::EEPROM_CHARS, Helpers::CharEncoders::EEPROM_TERMINATOR, Helpers::CharEncoders::INVALID_CHAR, Helpers::CharEncoders::PHONE_CHARS
Instance Attribute Summary collapse
-
#date_format ⇒ Object
Returns the value of attribute date_format.
-
#is_24h ⇒ Object
Returns the value of attribute is_24h.
-
#time ⇒ Object
Returns the value of attribute time.
-
#zone ⇒ Object
Returns the value of attribute zone.
Instance Method Summary collapse
-
#initialize(zone:, is_24h:, date_format:, time:, name: nil) ⇒ Time
constructor
Create a Time instance.
-
#packets ⇒ Array<Array<Integer>>
Compile packets for a time.
Methods included from Helpers::CharEncoders
#chars_for, #eeprom_chars_for, #phone_chars_for
Constructor Details
#initialize(zone:, is_24h:, date_format:, time:, name: nil) ⇒ Time
Create a Time instance.
24 25 26 27 28 29 30 |
# File 'lib/timex_datalink_client/protocol_4/time.rb', line 24 def initialize(zone:, is_24h:, date_format:, time:, name: nil) @zone = zone @is_24h = is_24h @date_format = date_format @time = time @name = name end |
Instance Attribute Details
#date_format ⇒ Object
Returns the value of attribute date_format.
14 15 16 |
# File 'lib/timex_datalink_client/protocol_4/time.rb', line 14 def date_format @date_format end |
#is_24h ⇒ Object
Returns the value of attribute is_24h.
14 15 16 |
# File 'lib/timex_datalink_client/protocol_4/time.rb', line 14 def is_24h @is_24h end |
#time ⇒ Object
Returns the value of attribute time.
14 15 16 |
# File 'lib/timex_datalink_client/protocol_4/time.rb', line 14 def time @time end |
#zone ⇒ Object
Returns the value of attribute zone.
14 15 16 |
# File 'lib/timex_datalink_client/protocol_4/time.rb', line 14 def zone @zone end |
Instance Method Details
#packets ⇒ Array<Array<Integer>>
Compile packets for a time.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/timex_datalink_client/protocol_4/time.rb', line 35 def packets [ [ CPACKET_TIME, zone, time.sec, time.hour, time.min, time.month, time.day, year_mod_1900, name_characters, wday_from_monday, is_24h_value, date_format ].flatten ] end |