Class: Phidgets::Spatial::SpatialCompassAxes
- Inherits:
-
Object
- Object
- Phidgets::Spatial::SpatialCompassAxes
- Defined in:
- lib/phidgets-ffi/spatial.rb
Overview
This class represents an axis of compass for a PhidgetSpatial. All the properties of an compass axis are stored and modified in this class.
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetSpatial
Instance Method Summary collapse
-
#index ⇒ Integer
Returns index of the compass axis, or raises an error.
-
#inspect ⇒ Object
Displays data for the compass axis.
-
#magnetic_field ⇒ Float
Returns the magnetic field strength of the axis, in Gauss, or raises an error.
-
#magnetic_field_max ⇒ Float
Returns the maximum magnetic field strength measurable by the compass axis, or raises an error.
-
#magnetic_field_min ⇒ Float
Returns the minimum magnetic field strength measurable by the compass axis, or raises an error.
Instance Method Details
#index ⇒ Integer
Returns index of the compass axis, or raises an error.
229 230 231 |
# File 'lib/phidgets-ffi/spatial.rb', line 229 def index @index end |
#inspect ⇒ Object
Displays data for the compass axis
224 225 226 |
# File 'lib/phidgets-ffi/spatial.rb', line 224 def inspect "#<#{self.class} @magnetic_field=#{magnetic_field}, @magnetic_field_max=#{magnetic_field_max}, @magnetic_field_min=#{magnetic_field_min}>" end |
#magnetic_field ⇒ Float
Returns the magnetic field strength of the axis, in Gauss, or raises an error.
234 235 236 237 238 |
# File 'lib/phidgets-ffi/spatial.rb', line 234 def magnetic_field ptr = ::FFI::MemoryPointer.new(:double) Klass.getMagneticField(@handle, @index, ptr) ptr.get_double(0) end |
#magnetic_field_max ⇒ Float
Returns the maximum magnetic field strength measurable by the compass axis, or raises an error.
241 242 243 244 245 |
# File 'lib/phidgets-ffi/spatial.rb', line 241 def magnetic_field_max ptr = ::FFI::MemoryPointer.new(:double) Klass.getMagneticFieldMax(@handle, @index, ptr) ptr.get_double(0) end |
#magnetic_field_min ⇒ Float
Returns the minimum magnetic field strength measurable by the compass axis, or raises an error.
248 249 250 251 252 |
# File 'lib/phidgets-ffi/spatial.rb', line 248 def magnetic_field_min ptr = ::FFI::MemoryPointer.new(:double) Klass.getMagneticFieldMin(@handle, @index, ptr) ptr.get_double(0) end |