Class: PCPEasy::PMAPI::PmUnits
- Inherits:
-
Object
- Object
- PCPEasy::PMAPI::PmUnits
- Defined in:
- lib/pcp_easy/pmapi/pm_units.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #dim_count ⇒ Object
- #dim_space ⇒ Object
- #dim_time ⇒ Object
-
#initialize(pm_units) ⇒ PmUnits
constructor
Decodes a 32bit integer into the correct fields of pmUnits.
- #inspect ⇒ Object
- #scale_count ⇒ Object
- #scale_space ⇒ Object
- #scale_time ⇒ Object
Constructor Details
#initialize(pm_units) ⇒ PmUnits
Decodes a 32bit integer into the correct fields of pmUnits. This implementation assumes little-endian encoding
8 9 10 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 8 def initialize(pm_units) @pm_units = pm_units end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 40 def ==(other) self.class == other.class && \ dim_space == other.dim_space && \ dim_time == other.dim_time && \ dim_count == other.dim_count && \ scale_space == other.scale_space && \ scale_time == other.scale_time && \ scale_count == other.scale_count end |
#dim_count ⇒ Object
20 21 22 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 20 def dim_count signed_4_bit(@pm_units >> 20) end |
#dim_space ⇒ Object
12 13 14 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 12 def dim_space signed_4_bit(@pm_units >> 28) end |
#dim_time ⇒ Object
16 17 18 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 16 def dim_time signed_4_bit(@pm_units >> 24) end |
#inspect ⇒ Object
36 37 38 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 36 def inspect "<#{self.class.to_s}:#{object_id} @pm_units=#{@pm_units} {#{dim_space},#{dim_time},#{dim_count},#{scale_space},#{scale_time},#{scale_count}}>" end |
#scale_count ⇒ Object
32 33 34 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 32 def scale_count signed_4_bit(@pm_units >> 8) end |
#scale_space ⇒ Object
24 25 26 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 24 def scale_space unsigned_4_bit(@pm_units >> 16) end |
#scale_time ⇒ Object
28 29 30 |
# File 'lib/pcp_easy/pmapi/pm_units.rb', line 28 def scale_time unsigned_4_bit(@pm_units >> 12) end |