Class: TimexDatalinkClient::Protocol1::Time
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol1::Time
- Includes:
- Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_1/time.rb
Constant Summary collapse
- CPACKET_TIME =
[0x30]
Instance Attribute Summary collapse
-
#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:, time:) ⇒ Time
constructor
Create a Time instance.
-
#packets ⇒ Array<Array<Integer>>
Compile packets for a time.
Constructor Details
#initialize(zone:, is_24h:, time:) ⇒ Time
Create a Time instance.
20 21 22 23 24 |
# File 'lib/timex_datalink_client/protocol_1/time.rb', line 20 def initialize(zone:, is_24h:, time:) @zone = zone @is_24h = is_24h @time = time end |
Instance Attribute Details
#is_24h ⇒ Object
Returns the value of attribute is_24h.
12 13 14 |
# File 'lib/timex_datalink_client/protocol_1/time.rb', line 12 def is_24h @is_24h end |
#time ⇒ Object
Returns the value of attribute time.
12 13 14 |
# File 'lib/timex_datalink_client/protocol_1/time.rb', line 12 def time @time end |
#zone ⇒ Object
Returns the value of attribute zone.
12 13 14 |
# File 'lib/timex_datalink_client/protocol_1/time.rb', line 12 def zone @zone end |
Instance Method Details
#packets ⇒ Array<Array<Integer>>
Compile packets for a time.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/timex_datalink_client/protocol_1/time.rb', line 29 def packets [ [ CPACKET_TIME, zone, time.hour, time.min, time.month, time.day, year_mod_1900, wday_from_monday, time.sec, is_24h_value ].flatten ] end |