Class: Phidgets::ResistanceInput

Inherits:
Common
  • Object
show all
Defined in:
lib/phidgets/resistance_input.rb,
ext/phidgets/phidgets_resistance_input.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 ResistanceInput object.



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

VALUE ph_resistance_init(VALUE self) {
  ph_data_t *ph = get_ph_data(self);
  ph_raise(PhidgetResistanceInput_create((PhidgetResistanceInputHandle *)(&(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 ResistanceChange event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between ResistanceChange events can also affected by the ResistanceChangeTrigger.



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

VALUE ph_resistance_get_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetResistanceInput_getDataInterval);
}

#getMaxDataIntervalObject Also known as: max_data_interval

The maximum value that DataInterval can be set to.



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

VALUE ph_resistance_get_max_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetResistanceInput_getMaxDataInterval);
}

#getMaxResistanceObject Also known as: max_resistance

The maximum value that the ResistanceChange event will report.



38
39
40
# File 'ext/phidgets/phidgets_resistance_input.c', line 38

VALUE ph_resistance_get_max_resistance(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetResistanceInput_getMaxResistance);
}

#getMaxResistanceChangeTriggerObject Also known as: max_resistance_change_trigger

The maximum value that ResistanceChangeTrigger can be set to.



55
56
57
# File 'ext/phidgets/phidgets_resistance_input.c', line 55

VALUE ph_resistance_get_max_resistance_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetResistanceInput_getMaxResistanceChangeTrigger);
}

#getMinDataIntervalObject Also known as: min_data_interval

The minimum value that DataInterval can be set to.



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

VALUE ph_resistance_get_min_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetResistanceInput_getMinDataInterval);
}

#getMinResistanceObject Also known as: min_resistance

The minimum value that the ResistanceChange event will report.



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

VALUE ph_resistance_get_min_resistance(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetResistanceInput_getMinResistance);
}

#getMinResistanceChangeTriggerObject Also known as: min_resistance_change_trigger

The minimum value that ResistanceChangeTrigger can be set to.



51
52
53
# File 'ext/phidgets/phidgets_resistance_input.c', line 51

VALUE ph_resistance_get_min_resistance_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetResistanceInput_getMinResistanceChangeTrigger);
}

#getResistanceObject Also known as: resistance

The most recent resistance value that the channel has reported. This value will always be between MinResistance and MaxResistance.



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

VALUE ph_resistance_get_resistance(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetResistanceInput_getResistance);
}

#getResistanceChangeTriggerObject Also known as: resistance_change_trigger

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



42
43
44
# File 'ext/phidgets/phidgets_resistance_input.c', line 42

VALUE ph_resistance_get_resistance_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetResistanceInput_getResistanceChangeTrigger);
}

#getRTDWireSetupObject Also known as: rtd_wire_setup

Select the RTD wiring configuration. More information about RTD wiring can be found in the user guide.



59
60
61
# File 'ext/phidgets/phidgets_resistance_input.c', line 59

VALUE ph_resistance_get_rtd_wire_setup(VALUE self) {
  return ph_get_int(get_ph_handle(self), (phidget_get_int_func)PhidgetResistanceInput_getRTDWireSetup);
}

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

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



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

VALUE ph_resistance_set_data_interval(VALUE self, VALUE interval) {
  ph_raise(PhidgetResistanceInput_setDataInterval((PhidgetResistanceInputHandle)get_ph_handle(self), NUM2UINT(interval)));
  return Qnil;
}

#setOnResistanceChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_resistance_change

call-seq:

setOnResistanceChangeHandler(proc=nil, &block)

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



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

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

#setResistanceChangeTrigger(change_trigger) ⇒ Object Also known as: resistance_change_trigger=

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



46
47
48
49
# File 'ext/phidgets/phidgets_resistance_input.c', line 46

VALUE ph_resistance_set_resistance_change_trigger(VALUE self, VALUE change_trigger) {
  ph_raise(PhidgetResistanceInput_setResistanceChangeTrigger((PhidgetResistanceInputHandle)get_ph_handle(self), NUM2DBL(change_trigger)));
  return Qnil;
}

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

Select the RTD wiring configuration. More information about RTD wiring can be found in the user guide.



63
64
65
66
# File 'ext/phidgets/phidgets_resistance_input.c', line 63

VALUE ph_resistance_set_rtd_wire_setup(VALUE self, VALUE wire_setup) {
  ph_raise(PhidgetResistanceInput_setRTDWireSetup((PhidgetResistanceInputHandle)get_ph_handle(self), NUM2INT(wire_setup)));
  return Qnil;
}