Class: TimexDatalinkClient::Protocol9::Time
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol9::Time
- Includes:
- ActiveModel::Validations, Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_9/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.
28 29 30 31 32 |
# File 'lib/timex_datalink_client/protocol_9/time.rb', line 28 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.
15 16 17 |
# File 'lib/timex_datalink_client/protocol_9/time.rb', line 15 def is_24h @is_24h end |
#time ⇒ Object
Returns the value of attribute time.
15 16 17 |
# File 'lib/timex_datalink_client/protocol_9/time.rb', line 15 def time @time end |
#zone ⇒ Object
Returns the value of attribute zone.
15 16 17 |
# File 'lib/timex_datalink_client/protocol_9/time.rb', line 15 def zone @zone end |
Instance Method Details
#packets ⇒ Array<Array<Integer>>
Compile packets for a time.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/timex_datalink_client/protocol_9/time.rb', line 38 def packets validate! [ [ CPACKET_TIME, zone, time.hour, time.min, time.month, time.day, year_mod_1900, wday_from_monday, time.sec, is_24h_value ].flatten ] end |