Class: TimexDatalinkClient::Protocol7::Eeprom::Activity
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol7::Eeprom::Activity
- Includes:
- Helpers::FourByteFormatter
- Defined in:
- lib/timex_datalink_client/protocol_7/eeprom/activity.rb
Constant Summary collapse
- METADATA_BYTES_BASE =
6
- METADATA_BYTES_SIZE =
5
- PACKETS_TERMINATOR =
0x04
Constants included from Helpers::FourByteFormatter
Helpers::FourByteFormatter::BYTE_NULL, Helpers::FourByteFormatter::BYTE_TERMINATOR_ENDF, Helpers::FourByteFormatter::BYTE_TERMINATOR_ENDR
Instance Attribute Summary collapse
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#random_speech ⇒ Object
Returns the value of attribute random_speech.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
-
.packets(activities) ⇒ Array
Compile data for all activities.
Instance Method Summary collapse
-
#initialize(time:, messages:, random_speech:) ⇒ Activity
constructor
Create an Activity instance.
-
#messages_packet ⇒ Array<Integer>
Compile a message packet for an activity.
-
#metadata_packet(activity_index) ⇒ Array<Integer>
Compile a metadata packet for an activity.
Methods included from Helpers::FourByteFormatter
Constructor Details
#initialize(time:, messages:, random_speech:) ⇒ Activity
Create an Activity instance.
59 60 61 62 63 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/activity.rb', line 59 def initialize(time:, messages:, random_speech:) @time = time @messages = @random_speech = random_speech end |
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
51 52 53 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/activity.rb', line 51 def @messages end |
#random_speech ⇒ Object
Returns the value of attribute random_speech.
51 52 53 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/activity.rb', line 51 def random_speech @random_speech end |
#time ⇒ Object
Returns the value of attribute time.
51 52 53 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/activity.rb', line 51 def time @time end |
Class Method Details
.packets(activities) ⇒ Array
Compile data for all activities.
20 21 22 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/activity.rb', line 20 def self.packets(activities) header(activities) + (activities) + [PACKETS_TERMINATOR] end |
Instance Method Details
#messages_packet ⇒ Array<Integer>
Compile a message packet for an activity.
82 83 84 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/activity.rb', line 82 def four_byte_format_for() end |
#metadata_packet(activity_index) ⇒ Array<Integer>
Compile a metadata packet for an activity.
69 70 71 72 73 74 75 76 77 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/activity.rb', line 69 def (activity_index) [ time.hour, time.min, .count, (activity_index), 0 ].flatten end |