Class: TimexDatalinkClient::Protocol7::Eeprom::Games

Inherits:
Object
  • Object
show all
Includes:
Helpers::FourByteFormatter, Helpers::LsbMsbFormatter
Defined in:
lib/timex_datalink_client/protocol_7/eeprom/games.rb

Constant Summary collapse

COUNTDOWN_TIMER_SECONDS_DEFAULT =
60
COUNTDOWN_TIMER_SOUND_DEFAULT =
0x062
MUSIC_TIME_KEEPER_SOUND_DEFAULT =
0x062
PACKETS_TERMINATOR =
0x02

Constants included from Helpers::FourByteFormatter

Helpers::FourByteFormatter::BYTE_NULL, Helpers::FourByteFormatter::BYTE_TERMINATOR_ENDF, Helpers::FourByteFormatter::BYTE_TERMINATOR_ENDR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::LsbMsbFormatter

#lsb_msb_format_for

Methods included from Helpers::FourByteFormatter

#four_byte_format_for

Constructor Details

#initialize(memory_game_enabled: false, fortune_teller_enabled: false, countdown_timer_enabled: false, countdown_timer_seconds: COUNTDOWN_TIMER_SECONDS_DEFAULT, countdown_timer_sound: COUNTDOWN_TIMER_SOUND_DEFAULT, mind_reader_enabled: false, music_time_keeper_enabled: false, music_time_keeper_sound: MUSIC_TIME_KEEPER_SOUND_DEFAULT, morse_code_practice_enabled: false, treasure_hunter_enabled: false, rhythm_rhyme_buster_enabled: false, stop_watch_enabled: false, red_light_green_light_enabled: false) ⇒ Games

Create a Games instance.

Parameters:

  • memory_game_enabled (Boolean) (defaults to: false)

    Toggle memory game.

  • fortune_teller_enabled (Boolean) (defaults to: false)

    Toggle fortune teller.

  • countdown_timer_enabled (Boolean) (defaults to: false)

    Toggle countdown timer.

  • countdown_timer_seconds (Integer) (defaults to: COUNTDOWN_TIMER_SECONDS_DEFAULT)

    Duration for countdown timer in seconds.

  • countdown_timer_sound (Integer) (defaults to: COUNTDOWN_TIMER_SOUND_DEFAULT)

    Sound for countdown timer.

  • mind_reader_enabled (Boolean) (defaults to: false)

    Toggle mind reader.

  • music_time_keeper_enabled (Boolean) (defaults to: false)

    Toggle music time keeper.

  • music_time_keeper_sound (Integer) (defaults to: MUSIC_TIME_KEEPER_SOUND_DEFAULT)

    Sound for music time keeper.

  • morse_code_practice_enabled (Boolean) (defaults to: false)

    Toggle Morse code practice.

  • treasure_hunter_enabled (Boolean) (defaults to: false)

    Toggle treasure hunter.

  • rhythm_rhyme_buster_enabled (Boolean) (defaults to: false)

    Toggle rhythm & rhyme buster.

  • stop_watch_enabled (Boolean) (defaults to: false)

    Toggle stop watch.

  • red_light_green_light_enabled (Boolean) (defaults to: false)

    Toggle red light, green light.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 41

def initialize(
  memory_game_enabled: false,
  fortune_teller_enabled: false,
  countdown_timer_enabled: false,
  countdown_timer_seconds: COUNTDOWN_TIMER_SECONDS_DEFAULT,
  countdown_timer_sound: COUNTDOWN_TIMER_SOUND_DEFAULT,
  mind_reader_enabled: false,
  music_time_keeper_enabled: false,
  music_time_keeper_sound: MUSIC_TIME_KEEPER_SOUND_DEFAULT,
  morse_code_practice_enabled: false,
  treasure_hunter_enabled: false,
  rhythm_rhyme_buster_enabled: false,
  stop_watch_enabled: false,
  red_light_green_light_enabled: false
)
  @memory_game_enabled = memory_game_enabled
  @fortune_teller_enabled = fortune_teller_enabled
  @countdown_timer_enabled = countdown_timer_enabled
  @countdown_timer_seconds = countdown_timer_seconds
  @countdown_timer_sound = countdown_timer_sound
  @mind_reader_enabled = mind_reader_enabled
  @music_time_keeper_enabled = music_time_keeper_enabled
  @music_time_keeper_sound = music_time_keeper_sound
  @morse_code_practice_enabled = morse_code_practice_enabled
  @treasure_hunter_enabled = treasure_hunter_enabled
  @rhythm_rhyme_buster_enabled = rhythm_rhyme_buster_enabled
  @stop_watch_enabled = stop_watch_enabled
  @red_light_green_light_enabled = red_light_green_light_enabled
end

Instance Attribute Details

#countdown_timer_enabledObject

Returns the value of attribute countdown_timer_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def countdown_timer_enabled
  @countdown_timer_enabled
end

#countdown_timer_secondsObject

Returns the value of attribute countdown_timer_seconds.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def countdown_timer_seconds
  @countdown_timer_seconds
end

#countdown_timer_soundObject

Returns the value of attribute countdown_timer_sound.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def countdown_timer_sound
  @countdown_timer_sound
end

#fortune_teller_enabledObject

Returns the value of attribute fortune_teller_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def fortune_teller_enabled
  @fortune_teller_enabled
end

#memory_game_enabledObject

Returns the value of attribute memory_game_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def memory_game_enabled
  @memory_game_enabled
end

#mind_reader_enabledObject

Returns the value of attribute mind_reader_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def mind_reader_enabled
  @mind_reader_enabled
end

#morse_code_practice_enabledObject

Returns the value of attribute morse_code_practice_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def morse_code_practice_enabled
  @morse_code_practice_enabled
end

#music_time_keeper_enabledObject

Returns the value of attribute music_time_keeper_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def music_time_keeper_enabled
  @music_time_keeper_enabled
end

#music_time_keeper_soundObject

Returns the value of attribute music_time_keeper_sound.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def music_time_keeper_sound
  @music_time_keeper_sound
end

#red_light_green_light_enabledObject

Returns the value of attribute red_light_green_light_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def red_light_green_light_enabled
  @red_light_green_light_enabled
end

#rhythm_rhyme_buster_enabledObject

Returns the value of attribute rhythm_rhyme_buster_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def rhythm_rhyme_buster_enabled
  @rhythm_rhyme_buster_enabled
end

#stop_watch_enabledObject

Returns the value of attribute stop_watch_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def stop_watch_enabled
  @stop_watch_enabled
end

#treasure_hunter_enabledObject

Returns the value of attribute treasure_hunter_enabled.



20
21
22
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 20

def treasure_hunter_enabled
  @treasure_hunter_enabled
end

Instance Method Details

#packetArray<Integer>

Compile data for games.

Returns:

  • (Array<Integer>)

    Compiled data for games.



74
75
76
77
78
79
80
81
# File 'lib/timex_datalink_client/protocol_7/eeprom/games.rb', line 74

def packet
  [
    enabled_games,
    countdown_timer_time,
    sounds,
    PACKETS_TERMINATOR
  ].flatten
end