Class: SML::TupelEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-sml/sml-tupelentry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_id, seconds_index, status, unit_pa, scaler_pa, value_pa, unit_r1, scaler_r1, value_r1, unit_r4, scaler_r4, value_r4, signature_pa_r1_r4, unit_ma, scaler_ma, value_ma, unit_r2, scaler_r2, value_r2, unit_r3, scaler_r3, value_r3, signature_ma_r2_r3) ⇒ TupelEntry

Returns a new instance of TupelEntry.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ruby-sml/sml-tupelentry.rb', line 9

def initialize(server_id, seconds_index, status, unit_pa, scaler_pa, value_pa, unit_r1, scaler_r1, value_r1, unit_r4, scaler_r4, value_r4, signature_pa_r1_r4, unit_ma, scaler_ma, value_ma, unit_r2, scaler_r2, value_r2, unit_r3, scaler_r3, value_r3, signature_ma_r2_r3)
  @server_id = server_id
  @seconds_index = seconds_index
  @status = status

  @unit_pa = unit_pa
  @scaler_pa = scaler_pa
  @value_pa = value_pa

  @unit_r1 = unit_r1
  @scaler_r1 = scaler_r1
  @value_r1 = value_r1

  @unit_r4 = unit_r4
  @scaler_r4 = scaler_r4
  @value_r4 = value_r4

  @signature_pa_r1_r4 = signature_pa_r1_r4

  @unit_ma = unit_ma
  @scaler_ma = scaler_ma
  @value_ma = value_ma
  
  @unit_r2 = unit_r2
  @scaler_r2 = scaler_r2
  @value_r2 = value_r2
  
  @unit_r3 = unit_r3
  @scaler_r3 = scaler_r3
  @value_r3 = value_r3

  @signature_ma_r2_r3 = signature_ma_r2_r3
end

Instance Attribute Details

#scaler_maObject

Returns the value of attribute scaler_ma.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def scaler_ma
  @scaler_ma
end

#scaler_paObject

Returns the value of attribute scaler_pa.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def scaler_pa
  @scaler_pa
end

#scaler_r1Object

Returns the value of attribute scaler_r1.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def scaler_r1
  @scaler_r1
end

#scaler_r2Object

Returns the value of attribute scaler_r2.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def scaler_r2
  @scaler_r2
end

#scaler_r3Object

Returns the value of attribute scaler_r3.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def scaler_r3
  @scaler_r3
end

#scaler_r4Object

Returns the value of attribute scaler_r4.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def scaler_r4
  @scaler_r4
end

#seconds_indexObject

Returns the value of attribute seconds_index.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def seconds_index
  @seconds_index
end

#server_idObject

Returns the value of attribute server_id.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def server_id
  @server_id
end

#signature_ma_r2_r3Object

Returns the value of attribute signature_ma_r2_r3.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def signature_ma_r2_r3
  @signature_ma_r2_r3
end

#signature_pa_r1_r4Object

Returns the value of attribute signature_pa_r1_r4.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def signature_pa_r1_r4
  @signature_pa_r1_r4
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def status
  @status
end

#unit_maObject

Returns the value of attribute unit_ma.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def unit_ma
  @unit_ma
end

#unit_paObject

Returns the value of attribute unit_pa.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def unit_pa
  @unit_pa
end

#unit_r1Object

Returns the value of attribute unit_r1.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def unit_r1
  @unit_r1
end

#unit_r2Object

Returns the value of attribute unit_r2.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def unit_r2
  @unit_r2
end

#unit_r3Object

Returns the value of attribute unit_r3.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def unit_r3
  @unit_r3
end

#unit_r4Object

Returns the value of attribute unit_r4.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def unit_r4
  @unit_r4
end

#value_maObject

Returns the value of attribute value_ma.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def value_ma
  @value_ma
end

#value_paObject

Returns the value of attribute value_pa.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def value_pa
  @value_pa
end

#value_r1Object

Returns the value of attribute value_r1.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def value_r1
  @value_r1
end

#value_r2Object

Returns the value of attribute value_r2.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def value_r2
  @value_r2
end

#value_r3Object

Returns the value of attribute value_r3.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def value_r3
  @value_r3
end

#value_r4Object

Returns the value of attribute value_r4.



7
8
9
# File 'lib/ruby-sml/sml-tupelentry.rb', line 7

def value_r4
  @value_r4
end

Class Method Details

.construct(array_rep) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ruby-sml/sml-tupelentry.rb', line 43

def self.construct(array_rep)
  return nil if array_rep.nil?
  server_id = array_rep.shift
  seconds_index = SML::Time.construct(array_rep.shift)
  status = array_rep.shift
  array_rep.shift

  unit_pa = array_rep.shift
  array_rep.shift
  scaler_pa = array_rep.shift
  array_rep.shift
  value_pa = array_rep.shift
  array_rep.shift

  unit_r1 = array_rep.shift
  array_rep.shift
  scaler_r1 = array_rep.shift
  array_rep.shift
  value_r1 = array_rep.shift
  array_rep.shift

  unit_r4 = array_rep.shift
  array_rep.shift
  scaler_r4 = array_rep.shift
  array_rep.shift
  value_r4 = array_rep.shift
  array_rep.shift

  signature_pa_r1_r4 = array_rep.shift

  unit_ma = array_rep.shift
  array_rep.shift
  scaler_ma = array_rep.shift
  array_rep.shift
  value_ma = array_rep.shift
  array_rep.shift
  
  unit_r2 = array_rep.shift
  array_rep.shift
  scaler_r2 = array_rep.shift
  array_rep.shift
  value_r2 = array_rep.shift
  array_rep.shift
  
  unit_r3 = array_rep.shift
  array_rep.shift
  scaler_r3 = array_rep.shift
  array_rep.shift
  value_r3 = array_rep.shift
  array_rep.shift

  signature_ma_r2_r3 = array_rep.shift

  return nil if seconds_index.nil?
  return SML::TupelEntry.new(server_id, seconds_index, status, unit_pa, scaler_pa, value_pa, unit_r1, scaler_r1, value_r1, unit_r4, scaler_r4, value_r4, signature_pa_r1_r4, unit_ma, scaler_ma, value_ma, unit_r2, scaler_r2, value_r2, unit_r3, scaler_r3, value_r3, signature_ma_r2_r3)
end

Instance Method Details

#to_aObject



99
100
101
# File 'lib/ruby-sml/sml-tupelentry.rb', line 99

def to_a
  return [] << server_id << seconds_index.to_a << status << :uint64 << unit_pa << :uint8 << scaler_pa << :int8 << value_pa << :int64 << unit_r1 << :uint8 << scaler_r1 << :int8 << value_r1 << :int64 << unit_r4 << :uint8 << scaler_r4 << :int8 << value_r4 << :int64 << signature_pa_r1_r4 << unit_ma << :uint8 << scaler_ma << :int8 << value_ma << :int64 << unit_r2 << :uint8 << scaler_r2 << :int8 << value_r2 << :int64 << unit_r3 << :uint8 << scaler_r3 << :int8 << value_r3 << :int64 << signature_ma_r2_r3
end