Class: Phidgets::TemperatureSensor::TemperatureSensorSensors

Inherits:
Object
  • Object
show all
Defined in:
lib/phidgets-ffi/temperature_sensor.rb

Overview

This class represents a thermocouple sensor attached for a PhidgetTemperatureSensor. All the properties of an thermocouple sensor are stored and modified in this class.

Constant Summary collapse

Klass =
Phidgets::FFI::CPhidgetTemperatureSensor

Instance Method Summary collapse

Instance Method Details

#indexInteger

Returns index of the thermocouple sensor, or raises an error.

Returns:

  • (Integer)

    returns index of the thermocouple sensor, or raises an error.



57
58
59
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 57

def index 
	@index
end

#inspectObject

Displays data for the thermocouple sensor.



52
53
54
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 52

def inspect
     "#<#{self.class} @index=#{index}, @sensitivity=#{sensitivity}, @temperature_min=#{temperature_min}, @temperature_max=#{temperature_max}, @type=#{type}>"
end

#potentialFloat

Returns the potential of the thermocouple sensor, in mV, or raises an error.

Returns:

  • (Float)

    returns the potential of the thermocouple sensor, in mV, or raises an error.



62
63
64
65
66
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 62

def potential
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getPotential(@handle, @index, ptr)
  ptr.get_double(0)
end

#potential_maxFloat

Returns the largest potential that the thermocouple sensor can return, in mV, or raises an error.

Returns:

  • (Float)

    returns the largest potential that the thermocouple sensor can return, in mV, or raises an error.



76
77
78
79
80
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 76

def potential_max
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getPotentialMax(@handle, @index, ptr)
  ptr.get_double(0)
end

#potential_minFloat

Returns the smallest potential that the thermocouple sensor can return, in mV, or raises an error.

Returns:

  • (Float)

    returns the smallest potential that the thermocouple sensor can return, in mV, or raises an error.



69
70
71
72
73
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 69

def potential_min
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getPotentialMin(@handle, @index, ptr)
  ptr.get_double(0)
end

#sensitivityFloat

Returns the temperature change trigger sensitivity for the thermocouple sensor, or raises an error.

Returns:

  • (Float)

    returns the temperature change trigger sensitivity for the thermocouple sensor, or raises an error.



83
84
85
86
87
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 83

def sensitivity
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getTemperatureChangeTrigger(@handle, @index, ptr)
  ptr.get_double(0)
end

#sensitivity=(new_sensitivity) ⇒ Float

Sets the temperature change trigger sensitivity of the thermocouple sensor, or raises an error.

Parameters:

  • new_senstivity (Float)

    new sensitivity

Returns:

  • (Float)

    returns the temperature change trigger sensitivity of the thermocouple sensor, or raises an error.



92
93
94
95
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 92

def sensitivity=(new_sensitivity)
  Klass.setTemperatureChangeTrigger(@handle, @index, new_sensitivity.to_f)
  new_sensitivity
end

#temperatureFloat

Returns the temperature of the thermocouple sensor, in degrees celcius, or raises an error.

Returns:

  • (Float)

    returns the temperature of the thermocouple sensor, in degrees celcius, or raises an error.



98
99
100
101
102
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 98

def temperature
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getTemperature(@handle, @index, ptr)
  ptr.get_double(0)
end

#temperature_maxFloat

Returns the maximum temperature value that the thermocouple sensor can return, in degrees celcius, or raises an error.

Returns:

  • (Float)

    returns the maximum temperature value that the thermocouple sensor can return, in degrees celcius, or raises an error.



112
113
114
115
116
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 112

def temperature_max
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getTemperatureMax(@handle, @index, ptr)
  ptr.get_double(0)
end

#temperature_minFloat

Returns the minimum temperature value that the thermocouple sensor can return, in degrees celcius, or raises an error.

Returns:

  • (Float)

    returns the minimum temperature value that the thermocouple sensor can return, in degrees celcius, or raises an error.



105
106
107
108
109
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 105

def temperature_min
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getTemperatureMin(@handle, @index, ptr)
  ptr.get_double(0)
end

#typePhidgets::FFI::TemperatureSensorThermocoupleTypes

Returns the thermocouple type of the thermocouple sensor, or raises an error.

Returns:



119
120
121
122
123
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 119

def type
  ptr = ::FFI::MemoryPointer.new(:int)
  Klass.getThermocoupleType(@handle, @index, ptr)
  Phidgets::FFI::TemperatureSensorThermocoupleTypes[ptr.get_int(0)]
end

#type=(new_type) ⇒ Phidgets::FFI::TemperatureSensorThermocoupleTypes

Sets the thermocouple type of the thermocouple sensor, or raises an error.

Parameters:

Returns:



128
129
130
131
132
# File 'lib/phidgets-ffi/temperature_sensor.rb', line 128

def type=(new_type)
  ptr = ::FFI::MemoryPointer.new(:int)
  Klass.setThermocoupleType(@handle, @index, Phidgets::FFI::TemperatureSensorThermocoupleTypes[new_type])
  new_type
end