Class: Phidgets::TemperatureSensor

Inherits:
Common
  • Object
show all
Defined in:
lib/phidgets/temperature_sensor.rb,
ext/phidgets/phidgets_temp_sensor.c

Constant Summary collapse

RTD_TYPE_PT100_3850 =
INT2NUM(RTD_TYPE_PT100_3850)
RTD_TYPE_PT1000_3850 =
INT2NUM(RTD_TYPE_PT1000_3850)
RTD_TYPE_PT100_3920 =
INT2NUM(RTD_TYPE_PT100_3920)
RTD_TYPE_PT1000_3920 =
INT2NUM(RTD_TYPE_PT1000_3920)
THERMOCOUPLE_TYPE_K =
INT2NUM(THERMOCOUPLE_TYPE_K)
THERMOCOUPLE_TYPE_J =
INT2NUM(THERMOCOUPLE_TYPE_J)
THERMOCOUPLE_TYPE_E =
INT2NUM(THERMOCOUPLE_TYPE_E)
THERMOCOUPLE_TYPE_T =
INT2NUM(THERMOCOUPLE_TYPE_T)

Instance Method Summary collapse

Methods inherited from Common

#close, #getAttached, #getChannel, #getChannelClass, #getChannelClassName, #getChannelName, #getChannelSubclass, #getDeviceChannelCount, #getDeviceClass, #getDeviceClassName, #getDeviceID, #getDeviceLabel, #getDeviceName, #getDeviceSKU, #getDeviceSerialNumber, #getDeviceVersion, #getHubPort, #getHubPortCount, #getIsChannel, #getIsHubPortDevice, #getIsLocal, #getIsRemote, #getServerHostname, #getServerName, #getServerPeerName, #getServerUniqueName, #open, #openWaitForAttachment, #setChannel, #setDeviceLabel, #setDeviceSerialNumber, #setHubPort, #setIsHubPortDevice, #setIsLocal, #setIsRemote, #setOnAttachHandler, #setOnDetachHandler, #setOnErrorHandler, #setOnPropertyChangeHandler, #setServerName, #writeDeviceLabel

Constructor Details

#newObject

Creates a Phidget TemperatureSensor object.



7
8
9
10
11
# File 'ext/phidgets/phidgets_temp_sensor.c', line 7

VALUE ph_temp_init(VALUE self) {
  ph_data_t *ph = get_ph_data(self);
  ph_raise(PhidgetTemperatureSensor_create((PhidgetTemperatureSensorHandle *)(&(ph->handle))));
  return self;
}

Instance Method Details

#getDataIntervalObject Also known as: data_interval

The DataInterval is the time that must elapse before the channel will fire another TemperatureChange event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between TemperatureChange events can also affected by the TemperatureChangeTrigger.



13
14
15
# File 'ext/phidgets/phidgets_temp_sensor.c', line 13

VALUE ph_temp_get_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetTemperatureSensor_getDataInterval);
}

#getMaxDataIntervalObject Also known as: max_data_interval

The maximum value that DataInterval can be set to.



26
27
28
# File 'ext/phidgets/phidgets_temp_sensor.c', line 26

VALUE ph_temp_get_max_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetTemperatureSensor_getMaxDataInterval);
}

#getMaxTemperatureObject Also known as: max_temperature

The maximum value the TemperatureChange event will report.



56
57
58
# File 'ext/phidgets/phidgets_temp_sensor.c', line 56

VALUE ph_temp_get_max_temperature(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetTemperatureSensor_getMaxTemperature);
}

#getMaxTemperatureChangeTriggerObject Also known as: max_temperature_change_trigger

The maximum value that TemperatureChangeTrigger can be set to.



73
74
75
# File 'ext/phidgets/phidgets_temp_sensor.c', line 73

VALUE ph_temp_get_max_temperature_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetTemperatureSensor_getMaxTemperatureChangeTrigger);
}

#getMinDataIntervalObject Also known as: min_data_interval

The minimum value that DataInterval can be set to.



22
23
24
# File 'ext/phidgets/phidgets_temp_sensor.c', line 22

VALUE ph_temp_get_min_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetTemperatureSensor_getMinDataInterval);
}

#getMinTemperatureObject Also known as: min_temperature

The minimum value the TemperatureChange event will report.



52
53
54
# File 'ext/phidgets/phidgets_temp_sensor.c', line 52

VALUE ph_temp_get_min_temperature(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetTemperatureSensor_getMinTemperature);
}

#getMinTemperatureChangeTriggerObject Also known as: min_temperature_change_trigger

The minimum value that TemperatureChangeTrigger can be set to.



69
70
71
# File 'ext/phidgets/phidgets_temp_sensor.c', line 69

VALUE ph_temp_get_min_temperature_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetTemperatureSensor_getMinTemperatureChangeTrigger);
}

#getRTDTypeObject Also known as: rtd_type

The RTDType must correspond to the RTD type you are using in your application. If you are unsure which RTDType to use, visit your device’s User Guide for more information.



30
31
32
# File 'ext/phidgets/phidgets_temp_sensor.c', line 30

VALUE ph_temp_get_rtd_type(VALUE self) {
  return ph_get_int(get_ph_handle(self), (phidget_get_int_func)PhidgetTemperatureSensor_getRTDType);
}

#getRTDWireSetupObject Also known as: rtd_wire_setup

The RTDWireSetup must correspond to the wire configuration you are using in your application. If you are unsure which RTDWireSetup to use, visit your device’s User Guide for more information.



39
40
41
# File 'ext/phidgets/phidgets_temp_sensor.c', line 39

VALUE ph_temp_get_rtd_wire_setup(VALUE self) {
  return ph_get_int(get_ph_handle(self), (phidget_get_int_func)PhidgetTemperatureSensor_getRTDWireSetup);
}

#getTemperatureObject Also known as: temperature

The most recent temperature value that the channel has reported. This value will always be between MinTemperature and MaxTemperature.



48
49
50
# File 'ext/phidgets/phidgets_temp_sensor.c', line 48

VALUE ph_temp_get_temperature(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetTemperatureSensor_getTemperature);
}

#getTemperatureChangeTriggerObject Also known as: temperature_change_trigger

The channel will not issue a TemperatureChange event until the temperature value has changed by the amount specified by the TemperatureChangeTrigger. Setting the TemperatureChangeTrigger to 0 will result in the channel firing events every DataInterval. This is useful for applications that implement their own data filtering.



60
61
62
# File 'ext/phidgets/phidgets_temp_sensor.c', line 60

VALUE ph_temp_get_temperature_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetTemperatureSensor_getTemperatureChangeTrigger);
}

#getThermocoupleTypeObject Also known as: thermocouple_type

The ThermocoupleType must correspond to the thermocouple type you are using in your application. If you are unsure which ThermocoupleType to use, visit the Thermocouple Primer for more information.



77
78
79
# File 'ext/phidgets/phidgets_temp_sensor.c', line 77

VALUE ph_temp_get_thermocouple_type(VALUE self) {
  return ph_get_int(get_ph_handle(self), (phidget_get_int_func)PhidgetTemperatureSensor_getThermocoupleType);
}

#setDataInterval(interval) ⇒ Object Also known as: data_interval=

The DataInterval is the time that must elapse before the channel will fire another TemperatureChange event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between TemperatureChange events can also affected by the TemperatureChangeTrigger.



17
18
19
20
# File 'ext/phidgets/phidgets_temp_sensor.c', line 17

VALUE ph_temp_set_data_interval(VALUE self, VALUE interval) {
  ph_raise(PhidgetTemperatureSensor_setDataInterval((PhidgetTemperatureSensorHandle)get_ph_handle(self), NUM2UINT(interval)));
  return Qnil;
}

#setOnTemperatureChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_temperature_change

call-seq:

setOnTemperatureChangeHandler(proc=nil, &block)

Assigns a handler that will be called when the TemperatureChange event occurs.



11
12
13
14
15
# File 'lib/phidgets/temperature_sensor.rb', line 11

def setOnTemperatureChangeHandler(cb_proc = nil, &cb_block)
  @on_temperature_change_thread.kill if defined? @on_temperature_change_thread and @on_temperature_change_thread.alive?
  callback = cb_proc || cb_block
  @on_temperature_change_thread = Thread.new {ext_setOnTemperatureChangeHandler(callback)}
end

#setRTDType(rtd_type) ⇒ Object Also known as: rtd_type=

The RTDType must correspond to the RTD type you are using in your application. If you are unsure which RTDType to use, visit your device’s User Guide for more information.



34
35
36
37
# File 'ext/phidgets/phidgets_temp_sensor.c', line 34

VALUE ph_temp_set_rtd_type(VALUE self, VALUE rtd_type) {
  ph_raise(PhidgetTemperatureSensor_setRTDType((PhidgetTemperatureSensorHandle)get_ph_handle(self), NUM2INT(rtd_type)));
  return Qnil;
}

#setRTDWireSetup(wire_setup) ⇒ Object Also known as: rtd_wire_setup=

The RTDWireSetup must correspond to the wire configuration you are using in your application. If you are unsure which RTDWireSetup to use, visit your device’s User Guide for more information.



43
44
45
46
# File 'ext/phidgets/phidgets_temp_sensor.c', line 43

VALUE ph_temp_set_rtd_wire_setup(VALUE self, VALUE wire_setup) {
  ph_raise(PhidgetTemperatureSensor_setRTDWireSetup((PhidgetTemperatureSensorHandle)get_ph_handle(self), NUM2INT(wire_setup)));
  return Qnil;
}

#setTemperatureChangeTrigger(trigger) ⇒ Object Also known as: temperature_change_trigger=

The channel will not issue a TemperatureChange event until the temperature value has changed by the amount specified by the TemperatureChangeTrigger. Setting the TemperatureChangeTrigger to 0 will result in the channel firing events every DataInterval. This is useful for applications that implement their own data filtering.



64
65
66
67
# File 'ext/phidgets/phidgets_temp_sensor.c', line 64

VALUE ph_temp_set_temperature_change_trigger(VALUE self, VALUE temperature) {
  ph_raise(PhidgetTemperatureSensor_setTemperatureChangeTrigger((PhidgetTemperatureSensorHandle)get_ph_handle(self), NUM2DBL(temperature)));
  return Qnil;
}

#setThermocoupleType(type) ⇒ Object Also known as: thermocouple_type=

The ThermocoupleType must correspond to the thermocouple type you are using in your application. If you are unsure which ThermocoupleType to use, visit the Thermocouple Primer for more information.



81
82
83
84
# File 'ext/phidgets/phidgets_temp_sensor.c', line 81

VALUE ph_temp_set_thermocouple_type(VALUE self, VALUE type) {
  ph_raise(PhidgetTemperatureSensor_setThermocoupleType((PhidgetTemperatureSensorHandle)get_ph_handle(self), (PhidgetTemperatureSensor_ThermocoupleType)NUM2INT(type)));
  return Qnil;
}