Class: Phidgets::CapacitiveTouch

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



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

VALUE ph_capacitive_touch_init(VALUE self) {
  ph_data_t *ph = get_ph_data(self);
  ph_raise(PhidgetCapacitiveTouch_create((PhidgetCapacitiveTouchHandle *)(&(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 Touch event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between Touch events can also affected by the TouchValueChangeTrigger.



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

VALUE ph_capacitive_touch_get_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetCapacitiveTouch_getDataInterval);
}

#getIsTouchedBoolean Also known as: is_touched?

The most recent touch state that the channel has reported.

Returns:

  • (Boolean)


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

VALUE ph_capacitive_touch_get_is_touched(VALUE self) {
  return ph_get_bool(get_ph_handle(self), (phidget_get_bool_func)PhidgetCapacitiveTouch_getIsTouched);
}

#getMaxDataIntervalObject Also known as: max_data_interval

The maximum value that DataInterval can be set to.



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

VALUE ph_capacitive_touch_get_max_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetCapacitiveTouch_getMaxDataInterval);
}

#getMaxSensitivityObject Also known as: max_sensitivity

The maximum value that Sensitivity can be set to.



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

VALUE ph_capacitive_touch_get_max_sensitivity(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getMaxSensitivity);
}

#getMaxTouchValueObject Also known as: max_touch_value

The maximum value the Touch event will report.



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

VALUE ph_capacitive_touch_get_max_touch_value(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getMaxTouchValue);
}

#getMaxTouchValueChangeTriggerObject Also known as: max_touch_value_change_trigger

The maximum value that TouchValueChangeTrigger can be set to.



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

VALUE ph_capacitive_touch_get_max_touch_value_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getMaxTouchValueChangeTrigger);
}

#getMinDataIntervalObject Also known as: min_data_interval

The minimum value that DataInterval can be set to.



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

VALUE ph_capacitive_touch_get_min_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetCapacitiveTouch_getMinDataInterval);
}

#getMinSensitivityObject Also known as: min_sensitivity

The minimum value that Sensitivity can be set to.



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

VALUE ph_capacitive_touch_get_min_sensitivity(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getMinSensitivity);
}

#getMinTouchValueObject Also known as: min_touch_value

The minimum value the Touch event will report.



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

VALUE ph_capacitive_touch_get_min_touch_value(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getMinTouchValue);
}

#getMinTouchValueChangeTriggerObject Also known as: min_touch_value_change_trigger

The minimum value that TouchValueChangeTrigger can be set to.



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

VALUE ph_capacitive_touch_get_min_touch_value_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getMinTouchValueChangeTrigger);
}

#getSensitivityObject Also known as: sensitivity

Determines the sensitivity of all capacitive regions on the device. Higher values result in greater touch sensitivity. The sensitivity value is bounded by MinSensitivity and MaxSensitivity.



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

VALUE ph_capacitive_touch_get_sensitivity(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getSensitivity);
}

#getTouchValueObject Also known as: touch_value

The most recent touch value that the channel has reported. This will be 0 or 1 for button-type inputs, or a ratio between 0-1 for axis-type inputs. This value is bounded by MinTouchValue and MaxTouchValue The value is not reset when the touch ends.



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

VALUE ph_capacitive_touch_get_touch_value(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getTouchValue);
}

#getTouchValueChangeTriggerObject Also known as: touch_value_change_trigger

The channel will not issue a Touch event until the touch value has changed by the amount specified by the TouchValueChangeTrigger. Setting the TouchValueChangeTrigger 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
# File 'ext/phidgets/phidgets_capacitive_touch.c', line 64

VALUE ph_capacitive_touch_get_touch_value_change_trigger(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetCapacitiveTouch_getTouchValueChangeTrigger);
}

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

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



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

VALUE ph_capacitive_touch_set_data_interval(VALUE self, VALUE interval) {
  ph_raise(PhidgetCapacitiveTouch_setDataInterval((PhidgetCapacitiveTouchHandle)get_ph_handle(self), NUM2UINT(interval)));
  return Qnil;
}

#setOnTouchEndHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_touch_end

call-seq:

setOnTouchEndHandler(proc=nil, &block)

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



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

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

#setOnTouchHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_touch

call-seq:

setOnTouchHandler(proc=nil, &block)

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



22
23
24
25
26
# File 'lib/phidgets/capacitive_touch.rb', line 22

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

#setSensitivity(sensitivity) ⇒ Object Also known as: sensitivity=

Determines the sensitivity of all capacitive regions on the device. Higher values result in greater touch sensitivity. The sensitivity value is bounded by MinSensitivity and MaxSensitivity.



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

VALUE ph_capacitive_touch_set_sensitivity(VALUE self, VALUE sensitivity) {
  ph_raise(PhidgetCapacitiveTouch_setSensitivity((PhidgetCapacitiveTouchHandle)get_ph_handle(self), NUM2DBL(sensitivity)));
  return Qnil;
}

#setTouchValueChangeTrigger(trigger) ⇒ Object Also known as: touch_value_change_trigger=

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



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

VALUE ph_capacitive_touch_set_touch_value_change_trigger(VALUE self, VALUE trigger) {
  ph_raise(PhidgetCapacitiveTouch_setTouchValueChangeTrigger((PhidgetCapacitiveTouchHandle)get_ph_handle(self), NUM2DBL(trigger)));
  return Qnil;
}