Sha256: ad4fb374fff0d4f26a10611a7f40e3b3b6cc0f3f60b0226828e676adfccaa981

Contents?: true

Size: 1.21 KB

Versions: 21

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Alula
  module DeviceHelpers
    #
    # Relies on the implementing class having reader properties of `auto_cfg`.
    # Translates it into a usable string
    module AttributeTranslationsHelper
      PANEL_NAME_MAP = {
        0 => 'Honeywell/Vista',
        1 => 'Honeywell/Vista+Passive',
        2 => 'Honeywell/Lynx',
        3 => 'Honeywell/Lynx+Passive',
        4 => 'DSC/Depricated',
        5 => 'GE-Interlogix/Caddx',
        6 => 'DSC/Alexor',
        7 => 'DSC/PowerSeries',
        8 => 'Dialer Capture or Keyswitch',
        9 => 'GE-Interlogix/Concord',
        10 => '',
        11 => 'Gateway',
        12 => 'GE Simon XT/XTi',
        13 => 'Cinch',
        14 => 'Helix',
        15 => 'Clare D3',
        19 => 'No Panel'
      }.freeze

      #
      # autoCfg contains multiple pieces of information depending on how you examine it.
      # Doing a bitwise operation with 0xff takes the last 8 bits,
      # which is the connected panel ID.
      # https://ipdatatel.atlassian.net/wiki/spaces/SYS/pages/16482314/auto+cfg
      def panel_name
        panel_id = auto_cfg.to_i & 0xff
        self.class::PANEL_NAME_MAP[panel_id] || "Unknown (#{panel_id})"
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
alula-ruby-2.12.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.11.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.10.1 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.10.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.9.1 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.9.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.8.1 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.8.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.7.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.6.3 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.6.2 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.6.1 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.6.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.5.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.4.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.3.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.2.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.1.2 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.1.1 lib/alula/helpers/device_helpers/attribute_translations_helper.rb
alula-ruby-2.1.0 lib/alula/helpers/device_helpers/attribute_translations_helper.rb