Module: Alula::DeviceHelpers::ProgramIdHelper

Included in:
Alula::Device
Defined in:
lib/alula/helpers/device_helpers/program_id_helper.rb

Overview

Helper methods for determining the device type based on the program ID

Constant Summary collapse

CONNECT_PROGRAM_IDS =
[
  211, # D3
  4096, # Camera
  35, # BAT-FIRE
  34, # BAT-CONNECT
  33, # CONNECT-XT
  32, # CONNECT+
  36, # CONNECT-XiP
  38, # WTP-01 (is ALDER-WTP)
  39, # BAT-Mini
  40, # CONNECT-FLX
  41, # CONNECT+PRO
  42, # CONNECT+PRO-SC
  43, # BAT-Mini AV
  44, # WTP-02 (is ALDER-WTP_WIFI)
  45, # Connect-FLX-Z
  46, # Connect-FLX-DUAL
  47  # Connect-FLX-DUAL-Z
].freeze
GSM_PROGRAM_IDS =
[
  15, 271, # IPD-BAT-CDMA
  16, 272, # IPD-BAT-CDMA-WIFI
  17, # IPD-BAT-CDMA-L
  783, # BAT-LTE
  788 # BAT-LTE-WIFI
].freeze
KAMI_CAMERA_PROGRAM_IDS =
[
  3072,
  3073,
  3074,
  3075,
  3076,
  3090
].freeze
EUFY_CAMERA_PROGRAM_IDS =
[
  3086,
  3087,
  3088,
  3089,
  3091,
  3092,
  3093,
].freeze
XIP_FAMILY_PROGRAM_IDS =
[
  36, # CONNECT-XiP
  40, # C+Flex
  41, # C+Pro
  42, # C+Pro-SC
  45, # C+Flex-Z
  46, # C+Flex-Dual
  47  # C+Flex-Dual-Z
].freeze

Instance Method Summary collapse

Instance Method Details

#alder_wtp?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 80

def alder_wtp?
  [38, 44].include?(program_id)
end

#alder_wtp_01?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 84

def alder_wtp_01?
  program_id == 38
end

#bat_mini?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 100

def bat_mini?
  [39, 43].include?(program_id)
end

#connect_device?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 64

def connect_device?
  self.class::CONNECT_PROGRAM_IDS.include?(program_id)
end

#connect_xip?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 96

def connect_xip?
  program_id == 36
end

#connect_xt?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 76

def connect_xt?
  program_id == 33
end

#eufy_camera?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 92

def eufy_camera?
  self.class::EUFY_CAMERA_PROGRAM_IDS.include?(program_id)
end

#gsm_device?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 72

def gsm_device?
  self.class::GSM_PROGRAM_IDS.include?(program_id)
end

#kami_camera?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 88

def kami_camera?
  self.class::KAMI_CAMERA_PROGRAM_IDS.include?(program_id)
end

#legacy_device?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 68

def legacy_device?
  !connect_device?
end

#supports_onvif?Boolean

Returns:

  • (Boolean)


108
109
110
111
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 108

def supports_onvif?
  # C+Pro-SC, BAT-Mini, BAT-Mini AV
  [42, 39, 43].include?(program_id)
end

#xip_family?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/alula/helpers/device_helpers/program_id_helper.rb', line 104

def xip_family?
  self.class::XIP_FAMILY_PROGRAM_IDS.include?(program_id)
end