Class: Phidgets::CurrentInput
- Defined in:
- lib/phidgets/current_input.rb,
ext/phidgets/phidgets_current_input.c
Instance Method Summary collapse
-
#getCurrent ⇒ Object
(also: #current)
The most recent current value that the channel has reported.
-
#getCurrentChangeTrigger ⇒ Object
(also: #current_change_trigger)
The channel will not issue a CurrentChange event until the current value has changed by the amount specified by the CurrentChangeTrigger.
-
#getDataInterval ⇒ Object
(also: #data_interval)
The DataInterval is the time that must elapse before the channel will fire another CurrentChange event.
-
#getMaxCurrent ⇒ Object
(also: #max_current)
The maximum value the CurrentChange event will report.
-
#getMaxCurrentChangeTrigger ⇒ Object
(also: #max_current_change_trigger)
The maximum value that CurrentChangeTrigger can be set to.
-
#getMaxDataInterval ⇒ Object
(also: #max_data_interval)
The maximum value that DataInterval can be set to.
-
#getMinCurrent ⇒ Object
(also: #min_current)
The minimum value the CurrentChange event will report.
-
#getMinCurrentChangeTrigger ⇒ Object
(also: #min_current_change_trigger)
The minimum value that CurrentChangeTrigger can be set to.
-
#getMinDataInterval ⇒ Object
(also: #min_data_interval)
The minimum value that DataInterval can be set to.
-
#getPowerSupply ⇒ Object
(also: #power_supply)
Choose the power supply voltage.
-
#new ⇒ Object
constructor
Creates a Phidget CurrentInput object.
-
#setCurrentChangeTrigger(trigger) ⇒ Object
(also: #current_change_trigger=)
The channel will not issue a CurrentChange event until the current value has changed by the amount specified by the CurrentChangeTrigger.
-
#setDataInterval(interval) ⇒ Object
(also: #data_interval=)
The DataInterval is the time that must elapse before the channel will fire another CurrentChange event.
-
#setOnCurrentChangeHandler(cb_proc = nil, &cb_block) ⇒ Object
(also: #on_current_change)
call-seq: setOnCurrentChangeHandler(proc=nil, &block).
-
#setPowerSupply(power_supply) ⇒ Object
(also: #power_supply=)
Choose the power supply voltage.
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
#new ⇒ Object
Creates a Phidget CurrentInput object.
7 8 9 10 11 |
# File 'ext/phidgets/phidgets_current_input.c', line 7
VALUE ph_current_input_init(VALUE self) {
ph_data_t *ph = get_ph_data(self);
ph_raise(PhidgetCurrentInput_create((PhidgetCurrentInputHandle *)(&(ph->handle))));
return self;
}
|
Instance Method Details
#getCurrent ⇒ Object Also known as: current
The most recent current value that the channel has reported. This value will always be between MinCurrent and MaxCurrent.
13 14 15 |
# File 'ext/phidgets/phidgets_current_input.c', line 13
VALUE ph_current_input_get_current(VALUE self) {
return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCurrentInput_getCurrent);
}
|
#getCurrentChangeTrigger ⇒ Object Also known as: current_change_trigger
The channel will not issue a CurrentChange event until the current value has changed by the amount specified by the CurrentChangeTrigger. Setting the CurrentChangeTrigger to 0 will result in the channel firing events every DataInterval. This is useful for applications that implement their own data filtering.
25 26 27 |
# File 'ext/phidgets/phidgets_current_input.c', line 25
VALUE ph_current_input_get_current_change_trigger(VALUE self) {
return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCurrentInput_getCurrentChangeTrigger);
}
|
#getDataInterval ⇒ Object Also known as: data_interval
The DataInterval is the time that must elapse before the channel will fire another CurrentChange event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between CurrentChange events can also affected by the CurrentChangeTrigger.
42 43 44 |
# File 'ext/phidgets/phidgets_current_input.c', line 42
VALUE ph_current_input_get_data_interval(VALUE self) {
return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetCurrentInput_getDataInterval);
}
|
#getMaxCurrent ⇒ Object Also known as: max_current
The maximum value the CurrentChange event will report.
21 22 23 |
# File 'ext/phidgets/phidgets_current_input.c', line 21
VALUE ph_current_input_get_max_current(VALUE self) {
return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCurrentInput_getMaxCurrent);
}
|
#getMaxCurrentChangeTrigger ⇒ Object Also known as: max_current_change_trigger
The maximum value that CurrentChangeTrigger can be set to.
38 39 40 |
# File 'ext/phidgets/phidgets_current_input.c', line 38
VALUE ph_current_input_get_max_current_change_trigger(VALUE self) {
return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCurrentInput_getMaxCurrentChangeTrigger);
}
|
#getMaxDataInterval ⇒ Object Also known as: max_data_interval
The maximum value that DataInterval can be set to.
55 56 57 |
# File 'ext/phidgets/phidgets_current_input.c', line 55
VALUE ph_current_input_get_max_data_interval(VALUE self) {
return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetCurrentInput_getMaxDataInterval);
}
|
#getMinCurrent ⇒ Object Also known as: min_current
The minimum value the CurrentChange event will report.
17 18 19 |
# File 'ext/phidgets/phidgets_current_input.c', line 17
VALUE ph_current_input_get_min_current(VALUE self) {
return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCurrentInput_getMinCurrent);
}
|
#getMinCurrentChangeTrigger ⇒ Object Also known as: min_current_change_trigger
The minimum value that CurrentChangeTrigger can be set to.
34 35 36 |
# File 'ext/phidgets/phidgets_current_input.c', line 34
VALUE ph_current_input_get_min_current_change_trigger(VALUE self) {
return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCurrentInput_getMinCurrentChangeTrigger);
}
|
#getMinDataInterval ⇒ Object Also known as: min_data_interval
The minimum value that DataInterval can be set to.
51 52 53 |
# File 'ext/phidgets/phidgets_current_input.c', line 51
VALUE ph_current_input_get_min_data_interval(VALUE self) {
return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetCurrentInput_getMinDataInterval);
}
|
#getPowerSupply ⇒ Object Also known as: power_supply
Choose the power supply voltage. Set this to the voltage specified in the attached sensor’s data sheet to power it. Set to POWER_SUPPLY_OFF to turn off the supply to save power.
59 60 61 |
# File 'ext/phidgets/phidgets_current_input.c', line 59
VALUE ph_current_input_get_power_supply(VALUE self) {
return ph_get_int(get_ph_handle(self), (phidget_get_int_func)PhidgetCurrentInput_getPowerSupply);
}
|
#setCurrentChangeTrigger(trigger) ⇒ Object Also known as: current_change_trigger=
The channel will not issue a CurrentChange event until the current value has changed by the amount specified by the CurrentChangeTrigger. Setting the CurrentChangeTrigger to 0 will result in the channel firing events every DataInterval. This is useful for applications that implement their own data filtering.
29 30 31 32 |
# File 'ext/phidgets/phidgets_current_input.c', line 29
VALUE ph_current_input_set_current_change_trigger(VALUE self, VALUE trigger) {
ph_raise(PhidgetCurrentInput_setCurrentChangeTrigger((PhidgetCurrentInputHandle)get_ph_handle(self), NUM2DBL(trigger)));
return Qnil;
}
|
#setDataInterval(interval) ⇒ Object Also known as: data_interval=
The DataInterval is the time that must elapse before the channel will fire another CurrentChange event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between CurrentChange events can also affected by the CurrentChangeTrigger.
46 47 48 49 |
# File 'ext/phidgets/phidgets_current_input.c', line 46
VALUE ph_current_input_set_data_interval(VALUE self, VALUE interval) {
ph_raise(PhidgetCurrentInput_setDataInterval((PhidgetCurrentInputHandle)get_ph_handle(self), NUM2UINT(interval)));
return Qnil;
}
|
#setOnCurrentChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_current_change
call-seq:
setOnCurrentChangeHandler(proc=nil, &block)
Assigns a handler that will be called when the CurrentChange event occurs.
11 12 13 14 15 |
# File 'lib/phidgets/current_input.rb', line 11 def setOnCurrentChangeHandler(cb_proc = nil, &cb_block) @on_current_change_thread.kill if defined? @on_current_change_thread and @on_current_change_thread.alive? callback = cb_proc || cb_block @on_current_change_thread = Thread.new {ext_setOnCurrentChangeHandler(callback)} end |
#setPowerSupply(power_supply) ⇒ Object Also known as: power_supply=
Choose the power supply voltage. Set this to the voltage specified in the attached sensor’s data sheet to power it. Set to POWER_SUPPLY_OFF to turn off the supply to save power.
63 64 65 66 |
# File 'ext/phidgets/phidgets_current_input.c', line 63
VALUE ph_current_input_set_power_supply(VALUE self, VALUE power_supply) {
ph_raise(PhidgetCurrentInput_setPowerSupply((PhidgetCurrentInputHandle)get_ph_handle(self), NUM2INT(power_supply)));
return Qnil;
}
|