Class: TimexDatalinkClient::Protocol6::NightModeOptions
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol6::NightModeOptions
- Includes:
- ActiveModel::Validations, Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_6/night_mode_options.rb
Constant Summary collapse
- CPACKET_NIGHT_MODE =
0x72
Instance Attribute Summary collapse
-
#indiglo_timeout_seconds ⇒ Object
Returns the value of attribute indiglo_timeout_seconds.
-
#night_mode_deactivate_hours ⇒ Object
Returns the value of attribute night_mode_deactivate_hours.
-
#night_mode_on_notification ⇒ Object
Returns the value of attribute night_mode_on_notification.
Instance Method Summary collapse
-
#initialize(night_mode_deactivate_hours: 8, indiglo_timeout_seconds: 4, night_mode_on_notification: false) ⇒ NightModeOptions
constructor
Create a NightModeOptions instance.
- #night_mode_on_notification_formatted ⇒ Object
-
#packets ⇒ Array<Array<Integer>>
Compile packets for night mode options.
Constructor Details
#initialize(night_mode_deactivate_hours: 8, indiglo_timeout_seconds: 4, night_mode_on_notification: false) ⇒ NightModeOptions
Create a NightModeOptions instance.
31 32 33 34 35 |
# File 'lib/timex_datalink_client/protocol_6/night_mode_options.rb', line 31 def initialize(night_mode_deactivate_hours: 8, indiglo_timeout_seconds: 4, night_mode_on_notification: false) @night_mode_deactivate_hours = night_mode_deactivate_hours @indiglo_timeout_seconds = indiglo_timeout_seconds @night_mode_on_notification = night_mode_on_notification end |
Instance Attribute Details
#indiglo_timeout_seconds ⇒ Object
Returns the value of attribute indiglo_timeout_seconds.
23 24 25 |
# File 'lib/timex_datalink_client/protocol_6/night_mode_options.rb', line 23 def indiglo_timeout_seconds @indiglo_timeout_seconds end |
#night_mode_deactivate_hours ⇒ Object
Returns the value of attribute night_mode_deactivate_hours.
23 24 25 |
# File 'lib/timex_datalink_client/protocol_6/night_mode_options.rb', line 23 def night_mode_deactivate_hours @night_mode_deactivate_hours end |
#night_mode_on_notification ⇒ Object
Returns the value of attribute night_mode_on_notification.
23 24 25 |
# File 'lib/timex_datalink_client/protocol_6/night_mode_options.rb', line 23 def night_mode_on_notification @night_mode_on_notification end |
Instance Method Details
#night_mode_on_notification_formatted ⇒ Object
54 55 56 |
# File 'lib/timex_datalink_client/protocol_6/night_mode_options.rb', line 54 def night_mode_on_notification_formatted night_mode_on_notification ? 1 : 0 end |
#packets ⇒ Array<Array<Integer>>
Compile packets for night mode options.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/timex_datalink_client/protocol_6/night_mode_options.rb', line 41 def packets validate! [ [ CPACKET_NIGHT_MODE, night_mode_on_notification_formatted, night_mode_deactivate_hours, indiglo_timeout_seconds ] ] end |