Class: Phidgets::PHSensor

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

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 PHSensor object.



8
9
10
11
12
# File 'ext/phidgets/phidgets_phsensor.c', line 8

VALUE ph_phsensor_init(VALUE self) {
  ph_data_t *ph = get_ph_data(self);
  ph_raise(PhidgetPHSensor_create((PhidgetPHSensorHandle *)(&(ph->handle))));
  return self;
}

Instance Method Details

#getCorrectionTemperatureObject Also known as: correction_temperature

Set this property to the measured temperature of the solution to correct the slope of the pH conversion for temperature.



14
15
16
# File 'ext/phidgets/phidgets_phsensor.c', line 14

VALUE ph_phsensor_get_correction_temperature(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getCorrectionTemperature);
}

#getDataIntervalObject Also known as: data_interval

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



31
32
33
# File 'ext/phidgets/phidgets_phsensor.c', line 31

VALUE ph_phsensor_get_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetPHSensor_getDataInterval);
}

#getMaxCorrectionTemperatureObject Also known as: max_correction_temperature

The maximum value that CorrectionTemperature can be set to.



27
28
29
# File 'ext/phidgets/phidgets_phsensor.c', line 27

VALUE ph_phsensor_get_max_correction_temperature(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getMaxCorrectionTemperature);
}

#getMaxDataIntervalObject Also known as: max_data_interval

The maximum value that DataInterval can be set to.



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

VALUE ph_phsensor_get_max_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetPHSensor_getMaxDataInterval);
}

#getMaxPHObject Also known as: max_ph

The maximum value the PHChange event will report.



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

VALUE ph_phsensor_get_max_ph(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getMaxPH);
}

#getMaxPHChangeTriggerObject Also known as: max_ph_change_trigger

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



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

VALUE ph_phsensor_get_max_ph_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getMaxPHChangeTrigger);
}

#getMinCorrectionTemperatureObject Also known as: min_correction_temperature

The minimum value that CorrectionTemperature can be set to.



23
24
25
# File 'ext/phidgets/phidgets_phsensor.c', line 23

VALUE ph_phsensor_get_min_correction_temperature(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getMinCorrectionTemperature);
}

#getMinDataIntervalObject Also known as: min_data_interval

The minimum value that DataInterval can be set to.



40
41
42
# File 'ext/phidgets/phidgets_phsensor.c', line 40

VALUE ph_phsensor_get_min_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetPHSensor_getMinDataInterval);
}

#getMinPHObject Also known as: min_ph

The minimum value the PHChange event will report.



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

VALUE ph_phsensor_get_min_ph(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getMinPH);
}

#getMinPHChangeTriggerObject Also known as: min_ph_change_trigger

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



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

VALUE ph_phsensor_get_min_ph_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getMinPHChangeTrigger);
}

#getPHObject Also known as: ph

The most recent pH value that the channel has reported. This value will always be between MinPH and MaxPH.



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

VALUE ph_phsensor_get_ph(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getPH);
}

#getPHChangeTriggerObject Also known as: ph_change_trigger

The channel will not issue a PHChange event until the pH value has changed by the amount specified by the PHChangeTrigger. Setting the PHChangeTrigger 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_phsensor.c', line 60

VALUE ph_phsensor_get_ph_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPHSensor_getPHChangeTrigger);
}

#setCorrectionTemperature(temperature) ⇒ Object Also known as: correction_temperature=

Set this property to the measured temperature of the solution to correct the slope of the pH conversion for temperature.



18
19
20
21
# File 'ext/phidgets/phidgets_phsensor.c', line 18

VALUE ph_phsensor_set_correction_temperature(VALUE self, VALUE temperature) {
  ph_raise(PhidgetPHSensor_setCorrectionTemperature((PhidgetPHSensorHandle)get_ph_handle(self), NUM2DBL(temperature)));
  return Qnil;
}

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

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



35
36
37
38
# File 'ext/phidgets/phidgets_phsensor.c', line 35

VALUE ph_phsensor_set_data_interval(VALUE self, VALUE interval) {
  ph_raise(PhidgetPHSensor_setDataInterval((PhidgetPHSensorHandle)get_ph_handle(self), NUM2UINT(interval)));
  return Qnil;
}

#setOnPHChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_ph_change

call-seq:

setOnPHChangeHandler(proc=nil, &block)

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



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

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

#setPHChangeTrigger(trigger) ⇒ Object Also known as: ph_change_trigger=

The channel will not issue a PHChange event until the pH value has changed by the amount specified by the PHChangeTrigger. Setting the PHChangeTrigger 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_phsensor.c', line 64

VALUE ph_phsensor_set_ph_change_trigger(VALUE self, VALUE trigger) {
  ph_raise(PhidgetPHSensor_setPHChangeTrigger((PhidgetPHSensorHandle)get_ph_handle(self), NUM2DBL(trigger)));
  return Qnil;
}