timex_datalink_client 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/timex_datalink_client/protocol_4/alarm.rb +59 -0
 - data/lib/timex_datalink_client/protocol_4/eeprom/anniversary.rb +44 -0
 - data/lib/timex_datalink_client/protocol_4/eeprom/appointment.rb +49 -0
 - data/lib/timex_datalink_client/protocol_4/eeprom/list.rb +43 -0
 - data/lib/timex_datalink_client/protocol_4/eeprom/phone_number.rb +56 -0
 - data/lib/timex_datalink_client/protocol_4/eeprom.rb +95 -0
 - data/lib/timex_datalink_client/protocol_4/end.rb +20 -0
 - data/lib/timex_datalink_client/protocol_4/sound_options.rb +42 -0
 - data/lib/timex_datalink_client/protocol_4/sound_theme.rb +65 -0
 - data/lib/timex_datalink_client/protocol_4/start.rb +20 -0
 - data/lib/timex_datalink_client/protocol_4/sync.rb +40 -0
 - data/lib/timex_datalink_client/protocol_4/time.rb +77 -0
 - data/lib/timex_datalink_client/protocol_4/wrist_app.rb +67 -0
 - data/lib/timex_datalink_client/version.rb +1 -1
 - data/lib/timex_datalink_client.rb +19 -3
 - metadata +16 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f9e485933a8ebd16d37042e129d57ad2aef2814fc6b7c52c5a4a35230b7a2313
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 393b34c750c6861cffcba17050089f6afcf55f40ce7dae8613fbcd5500c22c16
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2175e0d2ef370e68ed0a89d9d76d28b2c17503e13ddcd155f070ceac5e4cfab4f5d20850878f6ba95e981865584cf44d9ba3e42dd4e431a48b06ebc9ddfbf35d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 28452c2ad771e7649870efff7136340f6699ee38877d8ff9085d5d26f1c4d5d19db96f4cfdeddd33c152fefd5a9474025a147f59d07ba0c012168b3b1f4744e1
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/char_encoders"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class Alarm
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include Helpers::CharEncoders
         
     | 
| 
      
 10 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  CPACKET_ALARM = [0x50]
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  attr_accessor :number, :audible, :time, :message
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  # Create an Alarm instance.
         
     | 
| 
      
 17 
     | 
    
         
            +
                  #
         
     | 
| 
      
 18 
     | 
    
         
            +
                  # @param number [Integer] Alarm number (from 1 to 5).
         
     | 
| 
      
 19 
     | 
    
         
            +
                  # @param audible [Boolean] Toggle alarm sounds.
         
     | 
| 
      
 20 
     | 
    
         
            +
                  # @param time [::Time] Time of alarm.
         
     | 
| 
      
 21 
     | 
    
         
            +
                  # @param message [String] Alarm message text.
         
     | 
| 
      
 22 
     | 
    
         
            +
                  # @return [Alarm] Alarm instance.
         
     | 
| 
      
 23 
     | 
    
         
            +
                  def initialize(number:, audible:, time:, message:)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    @number = number
         
     | 
| 
      
 25 
     | 
    
         
            +
                    @audible = audible
         
     | 
| 
      
 26 
     | 
    
         
            +
                    @time = time
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @message = message
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  # Compile packets for an alarm.
         
     | 
| 
      
 31 
     | 
    
         
            +
                  #
         
     | 
| 
      
 32 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 33 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 34 
     | 
    
         
            +
                    [
         
     | 
| 
      
 35 
     | 
    
         
            +
                      [
         
     | 
| 
      
 36 
     | 
    
         
            +
                        CPACKET_ALARM,
         
     | 
| 
      
 37 
     | 
    
         
            +
                        number,
         
     | 
| 
      
 38 
     | 
    
         
            +
                        time.hour,
         
     | 
| 
      
 39 
     | 
    
         
            +
                        time.min,
         
     | 
| 
      
 40 
     | 
    
         
            +
                        0,
         
     | 
| 
      
 41 
     | 
    
         
            +
                        0,
         
     | 
| 
      
 42 
     | 
    
         
            +
                        message_characters,
         
     | 
| 
      
 43 
     | 
    
         
            +
                        audible_integer
         
     | 
| 
      
 44 
     | 
    
         
            +
                      ].flatten
         
     | 
| 
      
 45 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                  private
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  def message_characters
         
     | 
| 
      
 51 
     | 
    
         
            +
                    chars_for(message, length: 8, pad: true)
         
     | 
| 
      
 52 
     | 
    
         
            +
                  end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  def audible_integer
         
     | 
| 
      
 55 
     | 
    
         
            +
                    audible ? 1 : 0
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,44 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/char_encoders"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/length_packet_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class Eeprom
         
     | 
| 
      
 9 
     | 
    
         
            +
                  class Anniversary
         
     | 
| 
      
 10 
     | 
    
         
            +
                    include Helpers::CharEncoders
         
     | 
| 
      
 11 
     | 
    
         
            +
                    prepend Helpers::LengthPacketWrapper
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    attr_accessor :time, :anniversary
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    # Create an Anniversary instance.
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #
         
     | 
| 
      
 17 
     | 
    
         
            +
                    # @param time [::Time] Time of anniversary.
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # @param anniversary [String] Anniversary text.
         
     | 
| 
      
 19 
     | 
    
         
            +
                    # @return [Anniversary] Anniversary instance.
         
     | 
| 
      
 20 
     | 
    
         
            +
                    def initialize(time:, anniversary:)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      @time = time
         
     | 
| 
      
 22 
     | 
    
         
            +
                      @anniversary = anniversary
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                    # Compile a packet for an anniversary.
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #
         
     | 
| 
      
 27 
     | 
    
         
            +
                    # @return [Array<Integer>] Array of integers that represent bytes.
         
     | 
| 
      
 28 
     | 
    
         
            +
                    def packet
         
     | 
| 
      
 29 
     | 
    
         
            +
                      [
         
     | 
| 
      
 30 
     | 
    
         
            +
                        time.month,
         
     | 
| 
      
 31 
     | 
    
         
            +
                        time.day,
         
     | 
| 
      
 32 
     | 
    
         
            +
                        anniversary_characters
         
     | 
| 
      
 33 
     | 
    
         
            +
                      ].flatten
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    private
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                    def anniversary_characters
         
     | 
| 
      
 39 
     | 
    
         
            +
                      eeprom_chars_for(anniversary)
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,49 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/char_encoders"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/length_packet_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class Eeprom
         
     | 
| 
      
 9 
     | 
    
         
            +
                  class Appointment
         
     | 
| 
      
 10 
     | 
    
         
            +
                    include Helpers::CharEncoders
         
     | 
| 
      
 11 
     | 
    
         
            +
                    prepend Helpers::LengthPacketWrapper
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    attr_accessor :time, :message
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    # Create an Appointment instance.
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #
         
     | 
| 
      
 17 
     | 
    
         
            +
                    # @param time [::Time] Time of appointment.
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # @param message [String] Appointment text.
         
     | 
| 
      
 19 
     | 
    
         
            +
                    # @return [Appointment] Appointment instance.
         
     | 
| 
      
 20 
     | 
    
         
            +
                    def initialize(time:, message:)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      @time = time
         
     | 
| 
      
 22 
     | 
    
         
            +
                      @message = message
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                    # Compile a packet for an appointment.
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #
         
     | 
| 
      
 27 
     | 
    
         
            +
                    # @return [Array<Integer>] Array of integers that represent bytes.
         
     | 
| 
      
 28 
     | 
    
         
            +
                    def packet
         
     | 
| 
      
 29 
     | 
    
         
            +
                      [
         
     | 
| 
      
 30 
     | 
    
         
            +
                        time.month,
         
     | 
| 
      
 31 
     | 
    
         
            +
                        time.day,
         
     | 
| 
      
 32 
     | 
    
         
            +
                        time_15m,
         
     | 
| 
      
 33 
     | 
    
         
            +
                        message_characters
         
     | 
| 
      
 34 
     | 
    
         
            +
                      ].flatten
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    private
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                    def time_15m
         
     | 
| 
      
 40 
     | 
    
         
            +
                      time.hour * 4 + time.min / 15
         
     | 
| 
      
 41 
     | 
    
         
            +
                    end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                    def message_characters
         
     | 
| 
      
 44 
     | 
    
         
            +
                      eeprom_chars_for(message)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,43 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/char_encoders"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/length_packet_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class Eeprom
         
     | 
| 
      
 9 
     | 
    
         
            +
                  class List
         
     | 
| 
      
 10 
     | 
    
         
            +
                    include Helpers::CharEncoders
         
     | 
| 
      
 11 
     | 
    
         
            +
                    prepend Helpers::LengthPacketWrapper
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    attr_accessor :list_entry, :priority
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    # Create a List instance.
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #
         
     | 
| 
      
 17 
     | 
    
         
            +
                    # @param list_entry [String] List entry text.
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # @param priority [Integer] List priority.
         
     | 
| 
      
 19 
     | 
    
         
            +
                    # @return [List] List instance.
         
     | 
| 
      
 20 
     | 
    
         
            +
                    def initialize(list_entry:, priority:)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      @list_entry = list_entry
         
     | 
| 
      
 22 
     | 
    
         
            +
                      @priority = priority
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                    # Compile a packet for a list.
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #
         
     | 
| 
      
 27 
     | 
    
         
            +
                    # @return [Array<Integer>] Array of integers that represent bytes.
         
     | 
| 
      
 28 
     | 
    
         
            +
                    def packet
         
     | 
| 
      
 29 
     | 
    
         
            +
                      [
         
     | 
| 
      
 30 
     | 
    
         
            +
                        priority,
         
     | 
| 
      
 31 
     | 
    
         
            +
                        list_entry_characters
         
     | 
| 
      
 32 
     | 
    
         
            +
                      ].flatten
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    private
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    def list_entry_characters
         
     | 
| 
      
 38 
     | 
    
         
            +
                      eeprom_chars_for(list_entry)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,56 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/char_encoders"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/length_packet_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class Eeprom
         
     | 
| 
      
 9 
     | 
    
         
            +
                  class PhoneNumber
         
     | 
| 
      
 10 
     | 
    
         
            +
                    include Helpers::CharEncoders
         
     | 
| 
      
 11 
     | 
    
         
            +
                    prepend Helpers::LengthPacketWrapper
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    PHONE_DIGITS = 12
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    attr_accessor :name, :number, :type
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    # Create a PhoneNumber instance.
         
     | 
| 
      
 18 
     | 
    
         
            +
                    #
         
     | 
| 
      
 19 
     | 
    
         
            +
                    # @param name [String] Name associated to phone number.
         
     | 
| 
      
 20 
     | 
    
         
            +
                    # @param number [String] Phone number text.
         
     | 
| 
      
 21 
     | 
    
         
            +
                    # @param type [String] Phone number type.
         
     | 
| 
      
 22 
     | 
    
         
            +
                    # @return [PhoneNumber] PhoneNumber instance.
         
     | 
| 
      
 23 
     | 
    
         
            +
                    def initialize(name:, number:, type: " ")
         
     | 
| 
      
 24 
     | 
    
         
            +
                      @name = name
         
     | 
| 
      
 25 
     | 
    
         
            +
                      @number = number
         
     | 
| 
      
 26 
     | 
    
         
            +
                      @type = type
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                    # Compile a packet for a phone number.
         
     | 
| 
      
 30 
     | 
    
         
            +
                    #
         
     | 
| 
      
 31 
     | 
    
         
            +
                    # @return [Array<Integer>] Array of integers that represent bytes.
         
     | 
| 
      
 32 
     | 
    
         
            +
                    def packet
         
     | 
| 
      
 33 
     | 
    
         
            +
                      [
         
     | 
| 
      
 34 
     | 
    
         
            +
                        number_with_type_characters,
         
     | 
| 
      
 35 
     | 
    
         
            +
                        name_characters
         
     | 
| 
      
 36 
     | 
    
         
            +
                      ].flatten
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                    private
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                    def number_with_type_padded
         
     | 
| 
      
 42 
     | 
    
         
            +
                      number_with_type = "#{number} #{type}"
         
     | 
| 
      
 43 
     | 
    
         
            +
                      number_with_type.rjust(PHONE_DIGITS)
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                    def number_with_type_characters
         
     | 
| 
      
 47 
     | 
    
         
            +
                      phone_chars_for(number_with_type_padded)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    def name_characters
         
     | 
| 
      
 51 
     | 
    
         
            +
                      eeprom_chars_for(name)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,95 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/cpacket_paginator"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class Eeprom
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include Helpers::CpacketPaginator
         
     | 
| 
      
 10 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  CPACKET_CLEAR = [0x93, 0x01]
         
     | 
| 
      
 13 
     | 
    
         
            +
                  CPACKET_SECT = [0x90, 0x01]
         
     | 
| 
      
 14 
     | 
    
         
            +
                  CPACKET_DATA = [0x91, 0x01]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  CPACKET_END = [0x92, 0x01]
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  CPACKET_DATA_LENGTH = 32
         
     | 
| 
      
 18 
     | 
    
         
            +
                  START_ADDRESS = 0x0236
         
     | 
| 
      
 19 
     | 
    
         
            +
                  APPOINTMENT_NO_NOTIFICATION = 0xff
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  # Create an Eeprom instance.
         
     | 
| 
      
 24 
     | 
    
         
            +
                  #
         
     | 
| 
      
 25 
     | 
    
         
            +
                  # @param appointments [Array<Appointment>] Appointments to be added to EEPROM data.
         
     | 
| 
      
 26 
     | 
    
         
            +
                  # @param anniversaries [Array<Anniversary>] Anniversaries to be added to EEPROM data.
         
     | 
| 
      
 27 
     | 
    
         
            +
                  # @param phone_numbers [Array<PhoneNumber>] Phone numbers to be added to EEPROM data.
         
     | 
| 
      
 28 
     | 
    
         
            +
                  # @param lists [Array<List>] Lists to be added to EEPROM data.
         
     | 
| 
      
 29 
     | 
    
         
            +
                  # @param appointment_notification [Integer] Appointment notification (intervals of 15 minutes, 255 for no
         
     | 
| 
      
 30 
     | 
    
         
            +
                  #   notification)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  # @return [Eeprom] Eeprom instance.
         
     | 
| 
      
 32 
     | 
    
         
            +
                  def initialize(appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification: APPOINTMENT_NO_NOTIFICATION)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    @appointments = appointments
         
     | 
| 
      
 34 
     | 
    
         
            +
                    @anniversaries = anniversaries
         
     | 
| 
      
 35 
     | 
    
         
            +
                    @phone_numbers = phone_numbers
         
     | 
| 
      
 36 
     | 
    
         
            +
                    @lists = lists
         
     | 
| 
      
 37 
     | 
    
         
            +
                    @appointment_notification = appointment_notification
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  # Compile packets for EEPROM data.
         
     | 
| 
      
 41 
     | 
    
         
            +
                  #
         
     | 
| 
      
 42 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 43 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 44 
     | 
    
         
            +
                    [CPACKET_CLEAR, header] + payloads + [CPACKET_END]
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  private
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def header
         
     | 
| 
      
 50 
     | 
    
         
            +
                    [
         
     | 
| 
      
 51 
     | 
    
         
            +
                      CPACKET_SECT,
         
     | 
| 
      
 52 
     | 
    
         
            +
                      payloads.length,
         
     | 
| 
      
 53 
     | 
    
         
            +
                      items_addresses,
         
     | 
| 
      
 54 
     | 
    
         
            +
                      items_lengths,
         
     | 
| 
      
 55 
     | 
    
         
            +
                      earliest_appointment_year,
         
     | 
| 
      
 56 
     | 
    
         
            +
                      appointment_notification
         
     | 
| 
      
 57 
     | 
    
         
            +
                    ].flatten
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  def payloads
         
     | 
| 
      
 61 
     | 
    
         
            +
                    paginate_cpackets(header: CPACKET_DATA, length: CPACKET_DATA_LENGTH, cpackets: all_packets)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                  def all_items
         
     | 
| 
      
 65 
     | 
    
         
            +
                    [appointments, lists, phone_numbers, anniversaries]
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  def all_packets
         
     | 
| 
      
 69 
     | 
    
         
            +
                    all_items.flatten.map(&:packet).flatten
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                  def items_addresses
         
     | 
| 
      
 73 
     | 
    
         
            +
                    address = START_ADDRESS
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                    all_items.each_with_object([]) do |items, addresses|
         
     | 
| 
      
 76 
     | 
    
         
            +
                      addresses.concat(address.divmod(256))
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                      address += items.sum { |item| item.packet.length }
         
     | 
| 
      
 79 
     | 
    
         
            +
                    end
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                  def items_lengths
         
     | 
| 
      
 83 
     | 
    
         
            +
                    all_items.map(&:length)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  def earliest_appointment_year
         
     | 
| 
      
 87 
     | 
    
         
            +
                    earliest_appointment = appointments.min_by(&:time)
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                    return 0 unless earliest_appointment
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                    earliest_appointment.time.year % 100
         
     | 
| 
      
 92 
     | 
    
         
            +
                  end
         
     | 
| 
      
 93 
     | 
    
         
            +
                end
         
     | 
| 
      
 94 
     | 
    
         
            +
              end
         
     | 
| 
      
 95 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 7 
     | 
    
         
            +
                class End
         
     | 
| 
      
 8 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  CPACKET_SKIP = [0x21]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  # Compile packets for data end command.
         
     | 
| 
      
 13 
     | 
    
         
            +
                  #
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 15 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 16 
     | 
    
         
            +
                    [CPACKET_SKIP]
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 7 
     | 
    
         
            +
                class SoundOptions
         
     | 
| 
      
 8 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  CPACKET_BEEPS = [0x71]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  attr_accessor :hourly_chime, :button_beep
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  # Create a SoundOptions instance.
         
     | 
| 
      
 15 
     | 
    
         
            +
                  #
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # @param hourly_chime [Boolean] Toggle hourly chime sounds.
         
     | 
| 
      
 17 
     | 
    
         
            +
                  # @param button_beep [Boolean] Toggle button beep sounds.
         
     | 
| 
      
 18 
     | 
    
         
            +
                  # @return [SoundOptions] SoundOptions instance.
         
     | 
| 
      
 19 
     | 
    
         
            +
                  def initialize(hourly_chime:, button_beep:)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @hourly_chime = hourly_chime
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @button_beep = button_beep
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  # Compile packets for sound options.
         
     | 
| 
      
 25 
     | 
    
         
            +
                  #
         
     | 
| 
      
 26 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 27 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 28 
     | 
    
         
            +
                    [
         
     | 
| 
      
 29 
     | 
    
         
            +
                      CPACKET_BEEPS + [hourly_chime_integer, button_beep_integer]
         
     | 
| 
      
 30 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def hourly_chime_integer
         
     | 
| 
      
 34 
     | 
    
         
            +
                    hourly_chime ? 1 : 0
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  def button_beep_integer
         
     | 
| 
      
 38 
     | 
    
         
            +
                    button_beep ? 1 : 0
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,65 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/cpacket_paginator"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class SoundTheme
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include Helpers::CpacketPaginator
         
     | 
| 
      
 10 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  CPACKET_SECT = [0x90, 0x03]
         
     | 
| 
      
 13 
     | 
    
         
            +
                  CPACKET_DATA = [0x91, 0x03]
         
     | 
| 
      
 14 
     | 
    
         
            +
                  CPACKET_END = [0x92, 0x03]
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  CPACKET_DATA_LENGTH = 32
         
     | 
| 
      
 17 
     | 
    
         
            +
                  SOUND_DATA_HEADER = "\x25\x04\x19\x69"
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  attr_accessor :spc_file
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  # Create a SoundTheme instance.
         
     | 
| 
      
 22 
     | 
    
         
            +
                  #
         
     | 
| 
      
 23 
     | 
    
         
            +
                  # @param sound_theme_data [String, nil] Sound theme data.
         
     | 
| 
      
 24 
     | 
    
         
            +
                  # @param spc_file [String, nil] Path to SPC file.
         
     | 
| 
      
 25 
     | 
    
         
            +
                  # @return [SoundTheme] SoundTheme instance.
         
     | 
| 
      
 26 
     | 
    
         
            +
                  def initialize(sound_theme_data: nil, spc_file: nil)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @sound_theme_data = sound_theme_data
         
     | 
| 
      
 28 
     | 
    
         
            +
                    @spc_file = spc_file
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  # Compile packets for a sound theme.
         
     | 
| 
      
 32 
     | 
    
         
            +
                  #
         
     | 
| 
      
 33 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 34 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 35 
     | 
    
         
            +
                    [load_sect] + payloads + [CPACKET_END]
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  private
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  def load_sect
         
     | 
| 
      
 41 
     | 
    
         
            +
                    CPACKET_SECT + [payloads.length, offset]
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  def payloads
         
     | 
| 
      
 45 
     | 
    
         
            +
                    paginate_cpackets(header: CPACKET_DATA, length: CPACKET_DATA_LENGTH, cpackets: sound_theme_data.bytes)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                  def sound_theme_data
         
     | 
| 
      
 49 
     | 
    
         
            +
                    @sound_theme_data || spc_file_data_without_header
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                  def spc_file_data
         
     | 
| 
      
 53 
     | 
    
         
            +
                    File.open(spc_file, "rb").read
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  def spc_file_data_without_header
         
     | 
| 
      
 57 
     | 
    
         
            +
                    spc_file_data.delete_prefix(SOUND_DATA_HEADER)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  def offset
         
     | 
| 
      
 61 
     | 
    
         
            +
                    0x100 - sound_theme_data.bytesize
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 6 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 7 
     | 
    
         
            +
                class Start
         
     | 
| 
      
 8 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  CPACKET_START = [0x20, 0x00, 0x00, 0x04]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  # Compile packets for data start command.
         
     | 
| 
      
 13 
     | 
    
         
            +
                  #
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 15 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 16 
     | 
    
         
            +
                    [CPACKET_START]
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Sync
         
     | 
| 
      
 6 
     | 
    
         
            +
                  PING_BYTE = [0x78]
         
     | 
| 
      
 7 
     | 
    
         
            +
                  SYNC_1_BYTE = [0x55]
         
     | 
| 
      
 8 
     | 
    
         
            +
                  SYNC_2_BYTE = [0xaa]
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  SYNC_2_LENGTH = 40
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  attr_accessor :length
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  # Create a Sync instance.
         
     | 
| 
      
 15 
     | 
    
         
            +
                  #
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # @param length [Integer] Number of 0x55 sync bytes to use.
         
     | 
| 
      
 17 
     | 
    
         
            +
                  # @return [Sync] Sync instance.
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def initialize(length: 300)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @length = length
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  # Compile packets for syncronization data.
         
     | 
| 
      
 23 
     | 
    
         
            +
                  #
         
     | 
| 
      
 24 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 25 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 26 
     | 
    
         
            +
                    [PING_BYTE + render_sync_1 + render_sync_2]
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  private
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  def render_sync_1
         
     | 
| 
      
 32 
     | 
    
         
            +
                    SYNC_1_BYTE * length
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  def render_sync_2
         
     | 
| 
      
 36 
     | 
    
         
            +
                    SYNC_2_BYTE * SYNC_2_LENGTH
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,77 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/char_encoders"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class Time
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include Helpers::CharEncoders
         
     | 
| 
      
 10 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  CPACKET_TIME = [0x32]
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  attr_accessor :zone, :is_24h, :date_format, :time
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  # Create a Time instance.
         
     | 
| 
      
 17 
     | 
    
         
            +
                  #
         
     | 
| 
      
 18 
     | 
    
         
            +
                  # @param zone [Integer] Time zone number (1 or 2).
         
     | 
| 
      
 19 
     | 
    
         
            +
                  # @param is_24h [Boolean] Toggle 24 hour time.
         
     | 
| 
      
 20 
     | 
    
         
            +
                  # @param date_format [Integer] Date format.
         
     | 
| 
      
 21 
     | 
    
         
            +
                  # @param time [::Time] Time to set (including time zone).
         
     | 
| 
      
 22 
     | 
    
         
            +
                  # @param name [String, nil] Name of time zone (defaults to zone from time; 3 chars max)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  # @return [Time] Time instance.
         
     | 
| 
      
 24 
     | 
    
         
            +
                  def initialize(zone:, is_24h:, date_format:, time:, name: nil)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    @zone = zone
         
     | 
| 
      
 26 
     | 
    
         
            +
                    @is_24h = is_24h
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @date_format = date_format
         
     | 
| 
      
 28 
     | 
    
         
            +
                    @time = time
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @name = name
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  # Compile packets for a time.
         
     | 
| 
      
 33 
     | 
    
         
            +
                  #
         
     | 
| 
      
 34 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 35 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 36 
     | 
    
         
            +
                    [
         
     | 
| 
      
 37 
     | 
    
         
            +
                      [
         
     | 
| 
      
 38 
     | 
    
         
            +
                        CPACKET_TIME,
         
     | 
| 
      
 39 
     | 
    
         
            +
                        zone,
         
     | 
| 
      
 40 
     | 
    
         
            +
                        time.sec,
         
     | 
| 
      
 41 
     | 
    
         
            +
                        time.hour,
         
     | 
| 
      
 42 
     | 
    
         
            +
                        time.min,
         
     | 
| 
      
 43 
     | 
    
         
            +
                        time.month,
         
     | 
| 
      
 44 
     | 
    
         
            +
                        time.day,
         
     | 
| 
      
 45 
     | 
    
         
            +
                        year_mod_1900,
         
     | 
| 
      
 46 
     | 
    
         
            +
                        name_characters,
         
     | 
| 
      
 47 
     | 
    
         
            +
                        wday_from_monday,
         
     | 
| 
      
 48 
     | 
    
         
            +
                        is_24h_value,
         
     | 
| 
      
 49 
     | 
    
         
            +
                        date_format
         
     | 
| 
      
 50 
     | 
    
         
            +
                      ].flatten
         
     | 
| 
      
 51 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 52 
     | 
    
         
            +
                  end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  private
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  def name
         
     | 
| 
      
 57 
     | 
    
         
            +
                    @name || time.zone.downcase
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  def name_characters
         
     | 
| 
      
 61 
     | 
    
         
            +
                    chars_for(name, length: 3, pad: true)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                  def year_mod_1900
         
     | 
| 
      
 65 
     | 
    
         
            +
                    time.year % 100
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  def wday_from_monday
         
     | 
| 
      
 69 
     | 
    
         
            +
                    (time.wday + 6) % 7
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                  def is_24h_value
         
     | 
| 
      
 73 
     | 
    
         
            +
                    is_24h ? 2 : 1
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
              end
         
     | 
| 
      
 77 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,67 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "timex_datalink_client/helpers/cpacket_paginator"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/helpers/crc_packets_wrapper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class TimexDatalinkClient
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Protocol4
         
     | 
| 
      
 8 
     | 
    
         
            +
                class WristApp
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include Helpers::CpacketPaginator
         
     | 
| 
      
 10 
     | 
    
         
            +
                  prepend Helpers::CrcPacketsWrapper
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  CPACKET_CLEAR = [0x93, 0x02]
         
     | 
| 
      
 13 
     | 
    
         
            +
                  CPACKET_SECT = [0x90, 0x02]
         
     | 
| 
      
 14 
     | 
    
         
            +
                  CPACKET_DATA = [0x91, 0x02]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  CPACKET_END = [0x92, 0x02]
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  CPACKET_DATA_LENGTH = 32
         
     | 
| 
      
 18 
     | 
    
         
            +
                  WRIST_APP_DELIMITER = /\xac.*\r\n/n
         
     | 
| 
      
 19 
     | 
    
         
            +
                  WRIST_APP_CODE_INDEX = 18
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  attr_accessor :zap_file
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  # Create a WristApp instance.
         
     | 
| 
      
 24 
     | 
    
         
            +
                  #
         
     | 
| 
      
 25 
     | 
    
         
            +
                  # @param wrist_app_data [String, nil] WristApp data.
         
     | 
| 
      
 26 
     | 
    
         
            +
                  # @param zap_file [String, nil] Path to ZAP file.
         
     | 
| 
      
 27 
     | 
    
         
            +
                  # @return [WristApp] WristApp instance.
         
     | 
| 
      
 28 
     | 
    
         
            +
                  def initialize(wrist_app_data: nil, zap_file: nil)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @wrist_app_data = wrist_app_data
         
     | 
| 
      
 30 
     | 
    
         
            +
                    @zap_file = zap_file
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  # Compile packets for an alarm.
         
     | 
| 
      
 34 
     | 
    
         
            +
                  #
         
     | 
| 
      
 35 
     | 
    
         
            +
                  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
         
     | 
| 
      
 36 
     | 
    
         
            +
                  def packets
         
     | 
| 
      
 37 
     | 
    
         
            +
                    [CPACKET_CLEAR, cpacket_sect] + payloads + [CPACKET_END]
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  private
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  def cpacket_sect
         
     | 
| 
      
 43 
     | 
    
         
            +
                    CPACKET_SECT + [payloads.length, 1]
         
     | 
| 
      
 44 
     | 
    
         
            +
                  end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                  def payloads
         
     | 
| 
      
 47 
     | 
    
         
            +
                    paginate_cpackets(header: CPACKET_DATA, length: CPACKET_DATA_LENGTH, cpackets: wrist_app_data.bytes)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  def wrist_app_data
         
     | 
| 
      
 51 
     | 
    
         
            +
                    @wrist_app_data || zap_file_data_binary
         
     | 
| 
      
 52 
     | 
    
         
            +
                  end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  def zap_file_data
         
     | 
| 
      
 55 
     | 
    
         
            +
                    File.open(zap_file, "rb").read
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                  def zap_file_data_ascii
         
     | 
| 
      
 59 
     | 
    
         
            +
                    zap_file_data.split(WRIST_APP_DELIMITER)[WRIST_APP_CODE_INDEX]
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                  def zap_file_data_binary
         
     | 
| 
      
 63 
     | 
    
         
            +
                    [zap_file_data_ascii].pack("H*")
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require "timex_datalink_client/version"
         
     | 
| 
       4 
3 
     | 
    
         
             
            require "timex_datalink_client/notebook_adapter"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "timex_datalink_client/version"
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            require "timex_datalink_client/protocol_1/alarm"
         
     | 
| 
       7 
7 
     | 
    
         
             
            require "timex_datalink_client/protocol_1/eeprom"
         
     | 
| 
         @@ -29,6 +29,20 @@ require "timex_datalink_client/protocol_3/sync" 
     | 
|
| 
       29 
29 
     | 
    
         
             
            require "timex_datalink_client/protocol_3/time"
         
     | 
| 
       30 
30 
     | 
    
         
             
            require "timex_datalink_client/protocol_3/wrist_app"
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
      
 32 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/alarm"
         
     | 
| 
      
 33 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/eeprom"
         
     | 
| 
      
 34 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/eeprom/anniversary"
         
     | 
| 
      
 35 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/eeprom/appointment"
         
     | 
| 
      
 36 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/eeprom/list"
         
     | 
| 
      
 37 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/eeprom/phone_number"
         
     | 
| 
      
 38 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/end"
         
     | 
| 
      
 39 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/sound_options"
         
     | 
| 
      
 40 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/sound_theme"
         
     | 
| 
      
 41 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/start"
         
     | 
| 
      
 42 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/sync"
         
     | 
| 
      
 43 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/time"
         
     | 
| 
      
 44 
     | 
    
         
            +
            require "timex_datalink_client/protocol_4/wrist_app"
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       32 
46 
     | 
    
         
             
            require "timex_datalink_client/protocol_9/alarm"
         
     | 
| 
       33 
47 
     | 
    
         
             
            require "timex_datalink_client/protocol_9/eeprom"
         
     | 
| 
       34 
48 
     | 
    
         
             
            require "timex_datalink_client/protocol_9/eeprom/chrono"
         
     | 
| 
         @@ -50,8 +64,10 @@ class TimexDatalinkClient 
     | 
|
| 
       50 
64 
     | 
    
         
             
              # @param models [Array<Protocol1::Sync, Protocol1::Start, Protocol1::Time, Protocol1::TimeName, Protocol1::Alarm,
         
     | 
| 
       51 
65 
     | 
    
         
             
              #   Protocol1::Eeprom, Protocol1::End, Protocol3::Sync, Protocol3::Start, Protocol3::Time, Protocol3::Alarm,
         
     | 
| 
       52 
66 
     | 
    
         
             
              #   Protocol3::Eeprom, Protocol3::SoundTheme, Protocol3::SoundOptions, Protocol3::WristApp, Protocol3::End,
         
     | 
| 
       53 
     | 
    
         
            -
              #    
     | 
| 
       54 
     | 
    
         
            -
              #    
     | 
| 
      
 67 
     | 
    
         
            +
              #   Protocol4::Sync, Protocol4::Start, Protocol4::Time, Protocol4::Alarm, Protocol4::Eeprom, Protocol4::SoundTheme,
         
     | 
| 
      
 68 
     | 
    
         
            +
              #   Protocol4::SoundOptions, Protocol4::WristApp, Protocol4::End, Protocol9::Sync, Protocol9::Start, Protocol9::Time,
         
     | 
| 
      
 69 
     | 
    
         
            +
              #   Protocol9::TimeName, Protocol9::Timer, Protocol9::Alarm, Protocol9::Eeprom, Protocol9::SoundOptions,
         
     | 
| 
      
 70 
     | 
    
         
            +
              #   Protocol9::End>] Models to compile data for.
         
     | 
| 
       55 
71 
     | 
    
         
             
              # @param byte_sleep [Integer, nil] Time to sleep after sending byte.
         
     | 
| 
       56 
72 
     | 
    
         
             
              # @param packet_sleep [Integer, nil] Time to sleep after sending packet of bytes.
         
     | 
| 
       57 
73 
     | 
    
         
             
              # @param verbose [Boolean] Write verbose output to console.
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: timex_datalink_client
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Maxwell Pray
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-11-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: crc
         
     | 
| 
         @@ -116,6 +116,19 @@ files: 
     | 
|
| 
       116 
116 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_3/sync.rb
         
     | 
| 
       117 
117 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_3/time.rb
         
     | 
| 
       118 
118 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_3/wrist_app.rb
         
     | 
| 
      
 119 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/alarm.rb
         
     | 
| 
      
 120 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/eeprom.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/eeprom/anniversary.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/eeprom/appointment.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/eeprom/list.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/eeprom/phone_number.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/end.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/sound_options.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/sound_theme.rb
         
     | 
| 
      
 128 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/start.rb
         
     | 
| 
      
 129 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/sync.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/time.rb
         
     | 
| 
      
 131 
     | 
    
         
            +
            - lib/timex_datalink_client/protocol_4/wrist_app.rb
         
     | 
| 
       119 
132 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_9/alarm.rb
         
     | 
| 
       120 
133 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_9/eeprom.rb
         
     | 
| 
       121 
134 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_9/eeprom/chrono.rb
         
     | 
| 
         @@ -128,7 +141,7 @@ files: 
     | 
|
| 
       128 
141 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_9/time_name.rb
         
     | 
| 
       129 
142 
     | 
    
         
             
            - lib/timex_datalink_client/protocol_9/timer.rb
         
     | 
| 
       130 
143 
     | 
    
         
             
            - lib/timex_datalink_client/version.rb
         
     | 
| 
       131 
     | 
    
         
            -
            homepage: https://github.com/synthead/timex_datalink_client/tree/v0. 
     | 
| 
      
 144 
     | 
    
         
            +
            homepage: https://github.com/synthead/timex_datalink_client/tree/v0.7.0
         
     | 
| 
       132 
145 
     | 
    
         
             
            licenses:
         
     | 
| 
       133 
146 
     | 
    
         
             
            - MIT
         
     | 
| 
       134 
147 
     | 
    
         
             
            metadata: {}
         
     |