alula-ruby 2.15.1 → 2.16.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION.md +1 -0
  3. data/bin/console +1 -0
  4. data/lib/alula/api_resource.rb +17 -20
  5. data/lib/alula/dcp/resource_attributes.rb +128 -7
  6. data/lib/alula/dcp/resource_state.rb +152 -0
  7. data/lib/alula/dcp/staged_value_methods.rb +50 -0
  8. data/lib/alula/dcp_resource.rb +119 -70
  9. data/lib/alula/monkey_patches.rb +27 -1
  10. data/lib/alula/resource_attributes.rb +12 -5
  11. data/lib/alula/resources/config_template.rb +49 -0
  12. data/lib/alula/resources/dcp/config/bus_modules/bus_module.rb +39 -0
  13. data/lib/alula/resources/dcp/config/bus_modules/dws_bus_module.rb +12 -0
  14. data/lib/alula/resources/dcp/config/bus_modules/input_bus_module.rb +12 -0
  15. data/lib/alula/resources/dcp/config/bus_modules/ism_transceiver_bus_module.rb +18 -0
  16. data/lib/alula/resources/dcp/config/bus_modules/output_bus_module.rb +12 -0
  17. data/lib/alula/resources/dcp/config/bus_modules/touchpad_bus_module.rb +17 -0
  18. data/lib/alula/resources/dcp/config/bus_modules/zwave_bus_module.rb +12 -0
  19. data/lib/alula/resources/dcp/config/bus_modules.rb +21 -0
  20. data/lib/alula/resources/dcp/config/comm_data/auto_comm_test_interval.rb +24 -0
  21. data/lib/alula/resources/dcp/config/comm_data/server_heartbeats.rb +25 -0
  22. data/lib/alula/resources/dcp/config/comm_data/server_keep_alives.rb +25 -0
  23. data/lib/alula/resources/dcp/config/comm_data.rb +27 -0
  24. data/lib/alula/resources/dcp/config/panel_options/ac_fail_detect_delay.rb +23 -0
  25. data/lib/alula/resources/dcp/config/panel_options/event_reporting_delay.rb +24 -0
  26. data/lib/alula/resources/dcp/config/panel_options/key_fob_button_functions.rb +45 -0
  27. data/lib/alula/resources/dcp/config/panel_options/minimum_pin_size.rb +23 -0
  28. data/lib/alula/resources/dcp/config/panel_options/panel_led_brightness.rb +23 -0
  29. data/lib/alula/resources/dcp/config/panel_options/panel_misc_options.rb +25 -0
  30. data/lib/alula/resources/dcp/config/panel_options/panel_options.rb +60 -0
  31. data/lib/alula/resources/dcp/config/panel_options/reportable_event_types_partitions.rb +38 -0
  32. data/lib/alula/resources/dcp/config/panel_options/reportable_event_types_system.rb +27 -0
  33. data/lib/alula/resources/dcp/config/panel_options/swinger_threshold.rb +24 -0
  34. data/lib/alula/resources/dcp/config/panel_options/system_options.rb +45 -0
  35. data/lib/alula/resources/dcp/config/panel_options/trouble_beep_suppress.rb +37 -0
  36. data/lib/alula/resources/dcp/config/panel_options/virtual_interface_options.rb +32 -0
  37. data/lib/alula/resources/dcp/config/panel_options.rb +57 -0
  38. data/lib/alula/resources/dcp/config/partitions/partition.rb +54 -0
  39. data/lib/alula/resources/dcp/{users_data/installer_pin.rb → config/partitions.rb} +6 -6
  40. data/lib/alula/resources/dcp/config/siren_data/siren.rb +59 -0
  41. data/lib/alula/resources/dcp/config/siren_data.rb +21 -0
  42. data/lib/alula/resources/dcp/config/synchronize.rb +1 -1
  43. data/lib/alula/resources/dcp/config/timers/entry_delays.rb +27 -0
  44. data/lib/alula/resources/dcp/config/timers/exit_delays.rb +27 -0
  45. data/lib/alula/resources/dcp/config/timers/sensor_supervision_time.rb +27 -0
  46. data/lib/alula/resources/dcp/config/timers/siren_timeout.rb +24 -0
  47. data/lib/alula/resources/dcp/config/timers.rb +33 -0
  48. data/lib/alula/resources/dcp/config/users_data/duress_pin.rb +24 -0
  49. data/lib/alula/resources/dcp/config/users_data/installer_pin.rb +25 -0
  50. data/lib/alula/resources/dcp/config/users_data/user.rb +104 -0
  51. data/lib/alula/resources/dcp/config/users_data.rb +25 -0
  52. data/lib/alula/resources/dcp/config.rb +10 -1
  53. data/lib/alula/version.rb +1 -1
  54. data/lib/alula.rb +66 -5
  55. metadata +44 -5
  56. data/lib/alula/resources/dcp/users_data/user.rb +0 -100
  57. data/lib/alula/resources/dcp/users_data.rb +0 -13
@@ -3,21 +3,27 @@
3
3
  module Alula
4
4
  # Parent class for all DCP objects
5
5
  class DcpResource
6
- attr_accessor :device_id, :index, :raw_data, :meta, :errors, :rate_limit, :dirty_attributes, :value, :staged
6
+ attr_accessor :device_id, :raw_data, :values, :meta, :errors, :rate_limit, :dirty_attributes
7
7
 
8
8
  def self.class_name
9
9
  name.split('::')[-1]
10
10
  end
11
11
 
12
- def initialize(device_id, index = nil, attributes = {})
12
+ def initialize(device_id, attributes = {})
13
13
  @raw_data = {}
14
- @dirty_attributes = {}
14
+ @dirty_attributes = Set.new
15
+ @values = attributes
15
16
  @errors = ModelErrors.new(self.class)
16
- construct_from(device_id, index, attributes)
17
+ klass = get_discriminated_class(attributes)
18
+ if klass != self.class
19
+ klass.new(device_id, attributes)
20
+ else
21
+ construct_from(device_id, attributes)
22
+ end
17
23
  end
18
24
 
19
25
  def clone
20
- self.class.new(@device_id, nil, @raw_data)
26
+ self.class.new(@device_id, @raw_data)
21
27
  end
22
28
 
23
29
  #
@@ -27,15 +33,13 @@ module Alula
27
33
  def self.build(device_id)
28
34
  fields = get_fields.keys.map { |k| Util.camelize(k) }
29
35
  empty_shell = fields.each_with_object({}) { |f, obj| obj[f] = nil }
30
- new(device_id, nil, empty_shell)
36
+ new(device_id, empty_shell)
31
37
  end
32
38
 
33
- def construct_from(device_id, index, json_object)
34
- raise ArgumentError, 'device_id is required' if device_id.empty?
35
-
39
+ def construct_from(device_id, json_object)
36
40
  @raw_data = json_object.dup
37
- assign_meta_value_staged(json_object)
38
- self.index = index
41
+ @values = json_object
42
+ @meta = Alula::Dcp::Meta.new(@values['meta']) unless empty_value?(@values['meta'])
39
43
  self.device_id = device_id
40
44
 
41
45
  @errors = ModelErrors.new(self.class)
@@ -45,16 +49,41 @@ module Alula
45
49
 
46
50
  #
47
51
  # Take a hash of attributes and apply them to the model
48
- def apply_attributes(attributes)
49
- attributes.each do |key, value|
50
- next unless fields.include?(key)
51
-
52
- @dirty_attributes[key] = value
52
+ def apply_attributes(attributes, merge_only: false)
53
+ res = attributes.each do |key, value|
54
+ json_key = Util.camelize(key.to_s)
55
+ sym_key = key.to_sym
56
+ opts = self.class.get_fields[sym_key] || self.class.get_fields[:primitive]
57
+ if merge_only
58
+ # merge the value into the existing value
59
+ if value.is_a?(Array)
60
+ value.each_index do |index|
61
+ send(sym_key)[index].apply_attributes(value[index], merge_only: true)
62
+ end
63
+ elsif value.is_a?(Hash) && send(sym_key).respond_to?(:apply_attributes)
64
+ send(sym_key).apply_attributes(value, merge_only: true)
65
+ elsif value.is_a?(Hash) && send(sym_key).respond_to?(:each)
66
+ send("#{key}=", value)
67
+ elsif opts[:type] == :number
68
+ @values[json_key] = value.to_i
69
+ elsif opts[:type] == :boolean
70
+ @values[json_key] = [true, 'true', 1, '1'].include?(value)
71
+ else
72
+ @values[json_key] = value
73
+ end
74
+ elsif self.class.has_svm
75
+ send(:staged).send("#{key}=", value) if send(:staged).respond_to?(key)
76
+ else
77
+ send("#{key}=", value)
78
+ end
53
79
  end
80
+ return @values if merge_only
81
+
82
+ res
54
83
  end
55
84
 
56
- def reconstruct_from(device_id, index, json_object)
57
- construct_from(device_id, index, json_object)
85
+ def reconstruct_from(device_id, json_object)
86
+ construct_from(device_id, json_object)
58
87
  end
59
88
 
60
89
  def errors?
@@ -64,7 +93,7 @@ module Alula
64
93
  def refresh
65
94
  response = Alula::Client.request(:get, resource_url, {}, {})
66
95
  if response.ok?
67
- model = construct_from(device_id, index, response.data)
96
+ model = construct_from(device_id, response.data)
68
97
  model.rate_limit = response.rate_limit
69
98
  model
70
99
  else
@@ -80,26 +109,50 @@ module Alula
80
109
  field_names.each_with_object({}) do |ruby_key, obj|
81
110
  key = Util.camelize(ruby_key)
82
111
  val = find_value(ruby_key)
83
-
112
+ # we don't want to include nil values in the JSON (for now?)
84
113
  next if val.nil?
85
114
 
86
- obj[key] = if val.is_a? Array
87
- val.map { |v| parse_value(v, ruby_key) }
88
- elsif val.is_a? Alula::Dcp::ObjectField
89
- val.as_json
90
- else
91
- parse_value(val, ruby_key)
92
- end
115
+ # if the key is primitive and the class has svm, use staged as key
116
+ if key == 'primitive' && self.class.has_svm
117
+ key = 'staged'
118
+ elsif self.class.has_svm && key != 'index'
119
+ # if has_svm and not primitive field need to nest values inside 'staged' or 'value'
120
+ # index is a special case, it's outside of staged/value
121
+ obj['staged'] ||= {}
122
+ obj['staged'][key] = pick_value_for_key(val, ruby_key)
123
+ next
124
+ end
125
+
126
+ obj[key] = pick_value_for_key(val, ruby_key)
127
+ end
128
+ end
129
+
130
+ def pick_value_for_key(val, ruby_key)
131
+ if val.is_a? Array
132
+ val.map { |v| parse_value(v, ruby_key) }
133
+ elsif val.is_a?(Alula::Dcp::ObjectField) || val.is_a?(Alula::DcpResource)
134
+ val.as_json
135
+ else
136
+ parse_value(val, ruby_key)
93
137
  end
94
138
  end
95
139
 
96
140
  def find_value(key)
141
+ # index is a special case, it's not in staged or value
142
+ # must return early to avoid errors when staged/value are primitive type
143
+ return send(key) if key == :index
144
+
145
+ json_key = Util.camelize(key.to_s)
146
+ return values[json_key] unless self.class.has_svm
147
+
97
148
  # prioritize dirty attributes, then staged, then value
98
149
  # ideally we should use only dirty attributes, done by executing .apply_attributes
99
150
  return @dirty_attributes[key] if @dirty_attributes.include?(key)
100
- return @staged.send(key) if @staged.respond_to?(key)
151
+ # for primitive types we should just return staged or value
152
+ return staged || value if key == :primitive
153
+ return staged.send(key) if staged.respond_to?(key)
101
154
 
102
- @value.send(key) if @value.respond_to?(key)
155
+ value.send(key) if value.respond_to?(key)
103
156
  end
104
157
 
105
158
  #
@@ -108,7 +161,6 @@ module Alula
108
161
  values = as_json.each_pair.each_with_object({}) do |(key, val), collector|
109
162
  collector[key] = val
110
163
  end
111
-
112
164
  values.reject { |k, _v| %w[index version].include? k } # blacklist index and version
113
165
  end
114
166
 
@@ -130,6 +182,20 @@ module Alula
130
182
  self.class
131
183
  end
132
184
 
185
+ class << self
186
+ def discriminator(field_name = nil)
187
+ return @discriminator unless field_name
188
+
189
+ @discriminator = field_name
190
+ end
191
+
192
+ def discriminate_by(mapping = nil)
193
+ return @discriminator_mapping unless mapping
194
+
195
+ @discriminator_mapping = mapping
196
+ end
197
+ end
198
+
133
199
  # Class for holding model errors
134
200
  class ModelErrors
135
201
  include Enumerable
@@ -170,54 +236,37 @@ module Alula
170
236
 
171
237
  private
172
238
 
173
- def assign_meta_value_staged(json_object)
174
- @meta = Alula::Dcp::Meta.new(json_object['meta']) unless empty_value?(json_object['meta'])
175
- @value = convert_to_ruby_object(json_object['value'])
176
- @staged = convert_to_ruby_object(json_object['staged'])
177
- end
178
-
179
- def convert_to_ruby_object(object)
180
- return nil if object.nil?
181
-
182
- fields.each_pair.each_with_object({}) do |(field_name, opts), obj|
183
- value = object[Util.camelize(field_name.to_s)]
184
- if value.nil?
185
- # we still need to define the method, even if it's nil
186
- obj[field_name] = nil
187
- obj.define_singleton_method(field_name) { obj[field_name] }
188
- next
189
- end
190
-
191
- obj[field_name] =
192
- if opts[:type] == :date && ![nil, ''].include?(value)
193
- begin
194
- DateTime.parse(value)
195
- rescue ArgumentError
196
- value
197
- end
198
- elsif opts[:type] == :object && opts[:use] && !value.nil? && value.respond_to?(:each)
199
- opts[:use].new(field_name, value)
200
- elsif opts[:type] == :array && opts[:use] && !value.nil? && value.respond_to?(:each)
201
- # Array of objects, each object is a new instance of the use class
202
- value.each_with_object([]) do |item, collector|
203
- collector << opts[:use].new(field_name, item)
204
- end
205
- elsif opts[:type] == :boolean
206
- [true, 'true', 1, '1'].include? value
207
- elsif opts[:type] == :number
208
- value&.to_i
209
- else
210
- value
211
- end
212
- obj.define_singleton_method(field_name) { obj[field_name] }
239
+ def get_discriminated_class(attributes)
240
+ return self.class unless self.class.respond_to?(:discriminator) && self.class.discriminator
241
+
242
+ discriminator_field = self.class.discriminator
243
+ json_key = Util.camelize(discriminator_field.to_s)
244
+
245
+ # Try staged first, then value, then raw attributes
246
+ discriminator_value = if attributes['staged']&.key?(json_key)
247
+ attributes['staged'][json_key]
248
+ elsif attributes['value']&.key?(json_key)
249
+ attributes['value'][json_key]
250
+ else
251
+ attributes[json_key]
252
+ end
253
+ if discriminator_value && self.class.discriminate_by&.key?(discriminator_value)
254
+ Object.const_get(self.class.discriminate_by[discriminator_value])
255
+ else
256
+ self.class
213
257
  end
214
258
  end
215
259
 
216
260
  def parse_value(value, ruby_key)
261
+ opts = self.class.get_fields[ruby_key.to_sym]
217
262
  if date_fields.include?(ruby_key) && ![nil, ''].include?(value)
218
263
  extract_date(value)
219
264
  elsif value.is_a? Alula::Dcp::ObjectField
220
265
  value.as_json
266
+ elsif opts[:type] == :boolean
267
+ [true, 'true', 1, '1'].include? value
268
+ elsif opts[:type] == :number
269
+ value&.to_i
221
270
  else
222
271
  value
223
272
  end
@@ -21,4 +21,30 @@ module HTTParty
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
25
+
26
+ class Object
27
+ # should only be used for deeply nested structures
28
+ def deep_dup
29
+ case self
30
+ when Numeric, Symbol, NilClass, TrueClass, FalseClass
31
+ self # Immutable types don't need duplication
32
+ when String
33
+ dup
34
+ when Array
35
+ map(&:deep_dup)
36
+ when Hash
37
+ each_with_object({}) do |(key, value), duped|
38
+ duped[key.deep_dup] = value.deep_dup
39
+ end
40
+ else
41
+ # Fall back to the original dup method
42
+ # Should NOT use marshalling/unmarshalling as this can lead to arbitrary code execution based on user input.
43
+ begin
44
+ dup
45
+ rescue StandardError
46
+ self
47
+ end
48
+ end
49
+ end
50
+ end
@@ -26,6 +26,7 @@ module Alula
26
26
 
27
27
  def get_resource_path(id = nil)
28
28
  return "#{@resource_path}/#{id}" if id
29
+
29
30
  @resource_path
30
31
  end
31
32
 
@@ -46,7 +47,7 @@ module Alula
46
47
  end
47
48
 
48
49
  #
49
- # Memoizes field names and options
50
+ # Memoizes field names and options
50
51
  def field(field_name, **opts)
51
52
  @fields ||= {}
52
53
  @fields[field_name] = opts
@@ -66,6 +67,8 @@ module Alula
66
67
  end
67
68
  elsif opts[:type] == :object && opts[:use] && !value.nil? && value.respond_to?(:each)
68
69
  opts[:use].new(@dirty_attributes, field_name, value)
70
+ elsif opts[:type] == :dcp_object && opts[:use]
71
+ opts[:use].new(nil, nil, value)
69
72
  elsif opts[:type] == :boolean
70
73
  [true, 'true', 1, '1'].include? value
71
74
  elsif opts[:symbolize] == true
@@ -93,8 +96,11 @@ module Alula
93
96
  new_value = Util.camelize(new_value.to_s)
94
97
  elsif opts[:type] == :boolean
95
98
  new_value = [true, 'true', 1, '1'].include? new_value
99
+ elsif opts[:type] == :dcp_object
100
+ old_val = @values.deep_dup
101
+ new_value = send(field_name).apply_attributes(new_value, merge_only: true)
102
+ mark_dirty(field_name, old_val[json_key], new_value)
96
103
  end
97
-
98
104
  # Mark the attribute as dirty if the new value is different
99
105
  mark_dirty(field_name, @values[json_key], new_value)
100
106
  #
@@ -217,22 +223,23 @@ module Alula
217
223
  @dirty_attributes = Set.new
218
224
 
219
225
  return unless properties
226
+
220
227
  valid_fields = self.class.get_fields
221
228
 
222
229
  properties.dup.each do |key, value|
223
- jsonKey = key;
224
230
  ruby_key = Alula::Util.underscore(key.to_s)
225
231
 
226
- self.public_send("#{ruby_key}=", value) if valid_fields.key?(ruby_key.to_sym)
232
+ public_send("#{ruby_key}=", value) if valid_fields.key?(ruby_key.to_sym)
227
233
  end
228
234
  end
235
+
229
236
  def mark_dirty(field_name, old_value, new_value)
230
237
  @parent_dirty_attributes << @parent_field if old_value != new_value
231
238
  end
232
239
 
233
240
  def as_json
234
241
  self.field_names.each_with_object({}) do |ruby_key, obj|
235
- key = Util.camelize(ruby_key)
242
+ key = Util.camelize(ruby_key)
236
243
  val = self.send(ruby_key)
237
244
 
238
245
  if self.date_fields.include?(ruby_key) && ![nil, ''].include?(val)
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alula
4
+ class ConfigTemplate < Alula::RestResource
5
+ extend Alula::ResourceAttributes
6
+ extend Alula::ApiOperations::Request
7
+ extend Alula::ApiOperations::List
8
+ extend Alula::ApiOperations::Save
9
+ extend Alula::ApiOperations::Delete
10
+
11
+ resource_path 'devices/config/templates'
12
+ type 'devices-config-templates'
13
+
14
+ class Alula::Dcp::Template < Alula::Dcp::ObjectField
15
+ field :timers, type: :object, use: Alula::Dcp::Config::Timers
16
+ field :panel_options, type: :object, use: Alula::Dcp::Config::PanelOptions
17
+ field :comm_data, type: :object, use: Alula::Dcp::Config::CommData
18
+ field :siren_data, type: :object, use: Alula::Dcp::Config::SirenData
19
+ field :bus_modules, type: :object, use: Alula::Dcp::Config::BusModules
20
+ field :partitions, type: :object, use: Alula::Dcp::Config::Partitions
21
+ field :users_data, type: :object, use: Alula::Dcp::Config::UsersData
22
+ end
23
+
24
+ field :dealer_id,
25
+ type: :string,
26
+ patchable_by: %i[system station dealer],
27
+ creatable_by: %i[system station dealer],
28
+ filterable: true,
29
+ sortable: true
30
+
31
+ field :program_id,
32
+ type: :number,
33
+ patchable_by: %i[system station dealer],
34
+ creatable_by: %i[system station dealer],
35
+ filterable: true,
36
+ sortable: true
37
+
38
+ field :name,
39
+ type: :string,
40
+ patchable_by: %i[system station dealer],
41
+ creatable_by: %i[system station dealer]
42
+
43
+ field :template,
44
+ type: :dcp_object,
45
+ use: Alula::Dcp::Template,
46
+ patchable_by: %i[system station dealer],
47
+ creatable_by: %i[system station dealer]
48
+ end
49
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alula
4
+ module Dcp
5
+ class Config
6
+ class BusModules < Alula::Dcp::BaseResource
7
+ class BusModule < Alula::Dcp::BaseResource
8
+ extend Alula::Dcp::ResourceAttributes
9
+ extend Alula::DcpOperations::Request
10
+ extend Alula::DcpOperations::Save
11
+ extend Alula::DcpOperations::Delete
12
+ extend Alula::DcpOperations::DeleteStaged
13
+ include Alula::Dcp::StagedValueMethods
14
+
15
+ resource_name 'config/busModules/busModule'
16
+
17
+ field :index, type: :number
18
+ field :id, type: :number
19
+ field :module_type, type: :string
20
+ field :address, type: :number
21
+ field :supervision_time, type: :number
22
+ field :wall_tamper_enabled, type: :boolean
23
+ field :module_enabled, type: :boolean
24
+ field :name, type: :string
25
+
26
+ discriminator :module_type
27
+ discriminate_by(
28
+ 'DWS' => 'Alula::Dcp::Config::BusModules::DwsBusModule',
29
+ 'ISM Transceiver Module' => 'Alula::Dcp::Config::BusModules::IsmTransceiverBusModule',
30
+ 'Input Module - 8 Inputs' => 'Alula::Dcp::Config::BusModules::InputBusModule',
31
+ 'Output Module - X Outputs' => 'Alula::Dcp::Config::BusModules::OutputBusModule',
32
+ 'Touchpad Module' => 'Alula::Dcp::Config::BusModules::TouchpadBusModule',
33
+ 'Zwave Module' => 'Alula::Dcp::Config::BusModules::ZwaveBusModule'
34
+ )
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,12 @@
1
+ module Alula
2
+ module Dcp
3
+ class Config
4
+ class BusModules
5
+ # DWS Bus Module
6
+ # id: 0 (indicates unused index)
7
+ class DwsBusModule < Alula::Dcp::Config::BusModules::BusModule
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module Alula
2
+ module Dcp
3
+ class Config
4
+ class BusModules
5
+ # Input Module - 8 Inputs
6
+ # id range: 0x81000000 - 0x81FFFFFF (2164260864 - 2181038079)
7
+ class InputBusModule < BusModule
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ module Alula
2
+ module Dcp
3
+ class Config
4
+ class BusModules
5
+ # ISM Transceiver Bus Module
6
+ # id range: 0x80000000 - 0x80FFFFFF (2147483648 - 2164260863)
7
+ class IsmTransceiverBusModule < BusModule
8
+ class TranslatorProtocol < Alula::Dcp::ObjectField
9
+ field :primary, type: :string
10
+ field :secondary, type: :string
11
+ end
12
+
13
+ field :translator_protocol, type: :object, use: TranslatorProtocol
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ module Alula
2
+ module Dcp
3
+ class Config
4
+ class BusModules
5
+ # Output Module - X Outputs
6
+ # id range: 0x82000000 - 0x82FFFFFF (2181038080 - 2197815295)
7
+ class OutputBusModule < BusModule
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module Alula
2
+ module Dcp
3
+ class Config
4
+ class BusModules
5
+ # Touchpad Module
6
+ # id range: 0x83000000 - 0x83FFFFFF (2197815296 - 2214592511)
7
+ class TouchpadBusModule < BusModule
8
+ class TouchpadData < Alula::Dcp::ObjectField
9
+ field :power_source, type: :string
10
+ end
11
+
12
+ field :data, type: :object, use: TouchpadData
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module Alula
2
+ module Dcp
3
+ class Config
4
+ class BusModules
5
+ # Zwave Module
6
+ # id range: 0x84000000 - 0x84FFFFFF (2214592512 - 2231369727)
7
+ class ZwaveBusModule < BusModule
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alula
4
+ module Dcp
5
+ class Config
6
+ class BusModules < Alula::Dcp::BaseResource
7
+ extend Alula::Dcp::ResourceAttributes
8
+ extend Alula::DcpOperations::Request
9
+ extend Alula::DcpOperations::Save
10
+ extend Alula::DcpOperations::Delete
11
+ extend Alula::DcpOperations::DeleteStaged
12
+
13
+ resource_name 'config/busModules'
14
+
15
+ field :bus_module,
16
+ type: :array,
17
+ of: Alula::Dcp::Config::BusModules::BusModule
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alula
4
+ module Dcp
5
+ class Config
6
+ class CommData
7
+ class AutoCommTestInterval < Alula::Dcp::BaseResource
8
+ extend Alula::Dcp::ResourceAttributes
9
+ extend Alula::DcpOperations::Request
10
+ extend Alula::DcpOperations::Save
11
+ extend Alula::DcpOperations::Delete
12
+ extend Alula::DcpOperations::DeleteStaged
13
+ include Alula::Dcp::StagedValueMethods
14
+
15
+ resource_name 'config/commData/autoCommTestInterval'
16
+ field :index,
17
+ type: :number
18
+ field :primitive,
19
+ type: :number
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alula
4
+ module Dcp
5
+ class Config < Alula::Dcp::BaseResource
6
+ class CommData < Alula::Dcp::BaseResource
7
+ class ServerHeartbeats < Alula::Dcp::BaseResource
8
+ extend Alula::Dcp::ResourceAttributes
9
+ extend Alula::DcpOperations::Request
10
+ extend Alula::DcpOperations::Save
11
+ extend Alula::DcpOperations::Delete
12
+ extend Alula::DcpOperations::DeleteStaged
13
+ include Alula::Dcp::StagedValueMethods
14
+
15
+ resource_name 'config/commData/serverHeartbeats'
16
+
17
+ field :server_heartbeat,
18
+ type: :number
19
+ field :server_heartbeat_gsm_cdma,
20
+ type: :number
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alula
4
+ module Dcp
5
+ class Config
6
+ class CommData
7
+ class ServerKeepAlives < Alula::Dcp::BaseResource
8
+ extend Alula::Dcp::ResourceAttributes
9
+ extend Alula::DcpOperations::Request
10
+ extend Alula::DcpOperations::Save
11
+ extend Alula::DcpOperations::Delete
12
+ extend Alula::DcpOperations::DeleteStaged
13
+ include Alula::Dcp::StagedValueMethods
14
+
15
+ resource_name 'config/commData/serverKeepAlives'
16
+
17
+ field :server_keep_alive,
18
+ type: :number
19
+ field :server_keep_alive_gsm_cdma,
20
+ type: :number
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alula
4
+ module Dcp
5
+ class Config < Alula::Dcp::BaseResource
6
+ class CommData < Alula::Dcp::BaseResource
7
+ extend Alula::Dcp::ResourceAttributes
8
+ extend Alula::DcpOperations::Request
9
+ extend Alula::DcpOperations::Save
10
+ extend Alula::DcpOperations::Delete
11
+ extend Alula::DcpOperations::DeleteStaged
12
+
13
+ resource_name 'config/commData'
14
+
15
+ field :server_heartbeats,
16
+ type: :object,
17
+ use: Alula::Dcp::Config::CommData::ServerHeartbeats
18
+ field :server_keep_alives,
19
+ type: :object,
20
+ use: Alula::Dcp::Config::CommData::ServerKeepAlives
21
+ field :auto_comm_test_interval,
22
+ type: :array,
23
+ of: Alula::Dcp::Config::CommData::AutoCommTestInterval
24
+ end
25
+ end
26
+ end
27
+ end