Class: Phidgets::Common
- Inherits:
-
Object
- Object
- Phidgets::Common
- Defined in:
- ext/phidgets/phidgets_common.c,
lib/phidgets/common.rb
Direct Known Subclasses
Accelerometer, BLDCMotor, CapacitiveTouch, CurrentInput, DCMotor, Dictionary, DigitalInput, DigitalOutput, DistanceSensor, Encoder, FrequencyCounter, GPS, Gyroscope, Hub, HumiditySensor, IR, LCD, LightSensor, Magnetometer, MotorPositionController, PHSensor, PowerGuard, PressureSensor, RCServo, RFID, ResistanceInput, SoundSensor, Spatial, Stepper, TemperatureSensor, VoltageInput, VoltageOutput, VoltageRatioInput
Instance Method Summary collapse
-
#close ⇒ Object
Closes a Phidget channel that has been opened.
-
#getAttached ⇒ Object
(also: #attached?)
Gets the attached status of channel.
-
#getChannel ⇒ Object
(also: #channel)
Gets the channel index of the channel on the device.
-
#getChannelClass ⇒ Object
(also: #channel_class)
Gets the channel class of the channel.
-
#getChannelClassName ⇒ Object
(also: #channel_class_name)
Gets the name of the channel class the channel belongs to.
-
#getChannelName ⇒ Object
(also: #channel_name)
Gets the channel’s name.
-
#getChannelSubclass ⇒ Object
(also: #channel_subclass)
Gets the subclass for this channel.
-
#getDataInterval ⇒ Object
(also: #data_interval)
Gets the data interval for any channel that supports one.
-
#getDeviceChannelCount(channel_class) ⇒ Object
(also: #device_channel_count)
Gets the number of channels of the specified channel class on the device.
-
#getDeviceClass ⇒ Object
(also: #device_class)
Gets the device class for the Phidget which this channel is a part of.
-
#getDeviceClassName ⇒ Object
(also: #device_class_name)
Gets the name of the device class for the Phidget which this channel is a part of.
-
#getDeviceID ⇒ Object
(also: #device_id)
Gets the DeviceID for the Phidget which this channel is a part of.
-
#getDeviceLabel ⇒ Object
(also: #device_label)
Gets the label of the Phidget which this channel is a part of.
-
#getDeviceName ⇒ Object
(also: #device_name)
Gets the name of the Phidget which this channel is a part of.
-
#getDeviceSerialNumber ⇒ Object
(also: #device_serial_number)
Gets the serial number of the Phidget which this channel is a part of.
-
#getDeviceSKU ⇒ Object
(also: #device_sku)
Gets the SKU (part number) of the Phidget which this channel is a part of.
-
#getDeviceVersion ⇒ Object
(also: #device_version)
Gets the firmware version of the Phidget which this channel is a part of.
-
#getHubPort ⇒ Object
(also: #hub_port)
Gets the hub port index of the VINT Hub port that the channel is attached to.
-
#getHubPortCount ⇒ Object
(also: #hub_port_count)
Gets the number of VINT ports present on the VINT Hub that the channel is attached to.
-
#getIsChannel ⇒ Object
(also: #is_channel?)
Returns true if it is a channel.
-
#getIsHubPortDevice ⇒ Object
(also: #is_hub_port_device?)
Gets whether this channel is a VINT Hub port channel, or part of a VINT device attached to a hub port.
-
#getIsLocal ⇒ Object
(also: #is_local?)
Returns true when this channel is attached directly on the local machine, or false otherwise.
-
#getIsRemote ⇒ Object
(also: #is_remote?)
Returns true when this channel is attached via a Phidget network server, or false otherwise.
-
#getServerHostname ⇒ Object
(also: #server_hostname)
Gets the hostname of the Phidget network server for network attached Phidgets.
-
#getServerName ⇒ Object
(also: #server_name)
Gets the name of the Phidget network server the channel is attached to, if any.
-
#getServerPeerName ⇒ Object
(also: #server_peer_name)
Gets the peer name (address and port) of the Phidget server for network attached Phidgets, formatted as: address:port Fails if the channel is not connected to a Phidget network server.
-
#getServerUniqueName ⇒ Object
(also: #server_unique_name)
Gets the unique name for the server the channel is attached to, if any.
-
#open ⇒ Object
Opens the Phidget channel.
-
#openWaitForAttachment(milliseconds) ⇒ Object
(also: #open_wait_for_attachment)
Opens the Phidget channel and waits a defined amount of time for the device to attach.The specific channel to be opened can be specified by setting any of the following properties: DeviceSerialNumber DeviceLabel Channel HubPort IsHubPortDevice ServerName IsLocal IsRemote.
-
#setChannel(channel) ⇒ Object
(also: #channel=)
Specifies the channel index to be opened.
-
#setDataInterval(data_interval) ⇒ Object
(also: #data_interval=)
Sets the data interval for any channel that supports one.
-
#setDeviceLabel(label) ⇒ Object
(also: #device_label=)
Specifies the label of the Phidget to be opened.
-
#setDeviceSerialNumber(serial_number) ⇒ Object
(also: #device_serial_number=)
Specifies the serial number of the Phidget to be opened.
-
#setHubPort(hub_port) ⇒ Object
(also: #hub_port=)
Specifies the hub port index of the VINT Hub port to open this channel on.
-
#setIsHubPortDevice(is_hub_port_device) ⇒ Object
(also: #is_hub_port_device=)
Specifies whether this channel should be opened on a VINT Hub port directly, or on a VINT device attached to a hub port.
-
#setIsLocal(is_local) ⇒ Object
(also: #is_local=)
Set to true if the channel is to be opened locally, and not over a network.
-
#setIsRemote(is_remote) ⇒ Object
(also: #is_remote=)
Set to true if the channel is to be opened remotely, rather than locally.
-
#setOnAttachHandler(cb_proc = nil, &cb_block) ⇒ Object
(also: #on_attach)
call-seq: setOnAttachHandler(proc=nil, &block).
-
#setOnDetachHandler(cb_proc = nil, &cb_block) ⇒ Object
(also: #on_detach)
call-seq: setOnDetachHandler(proc=nil, &block).
-
#setOnErrorHandler(cb_proc = nil, &cb_block) ⇒ Object
(also: #on_error)
call-seq: setOnErrorHandler(proc=nil, &block).
-
#setOnPropertyChangeHandler(cb_proc = nil, &cb_block) ⇒ Object
(also: #on_property_change)
call-seq: setOnPropertyChangeHandler(proc=nil, &block).
-
#setServerName(server_name) ⇒ Object
(also: #server_name=)
Specifies that this channel will be opened remotely, on a Phidget network server with this name.
-
#writeDeviceLabel(label) ⇒ Object
(also: #write_device_label)
Writes a label to the device in the form of a string in the device flash memory.
Instance Method Details
#close ⇒ Object
Closes a Phidget channel that has been opened.
71 72 73 74 |
# File 'ext/phidgets/phidgets_common.c', line 71 VALUE ph_common_close(VALUE self) { ph_raise(Phidget_close(get_ph_handle(self))); return Qnil; } |
#getAttached ⇒ Object Also known as: attached?
Gets the attached status of channel. A Phidget is attached after it has been opened and the Phidget library finds and connects to the corresponding hardware device.
67 68 69 |
# File 'ext/phidgets/phidgets_common.c', line 67
VALUE ph_common_get_attached(VALUE self) {
return ph_get_bool(get_ph_handle(self), (phidget_get_bool_func)Phidget_getAttached);
}
|
#getChannel ⇒ Object Also known as: channel
Gets the channel index of the channel on the device.
129 130 131 |
# File 'ext/phidgets/phidgets_common.c', line 129 VALUE ph_common_get_channel(VALUE self) { return ph_get_int(get_ph_handle(self), Phidget_getChannel); } |
#getChannelClass ⇒ Object Also known as: channel_class
Gets the channel class of the channel.
142 143 144 |
# File 'ext/phidgets/phidgets_common.c', line 142
VALUE ph_common_get_channel_class(VALUE self) {
return ph_get_int(get_ph_handle(self), (phidget_get_int_func)Phidget_getChannelClass);
}
|
#getChannelClassName ⇒ Object Also known as: channel_class_name
Gets the name of the channel class the channel belongs to.
146 147 148 |
# File 'ext/phidgets/phidgets_common.c', line 146 VALUE ph_common_get_channel_class_name(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getChannelClassName); } |
#getChannelName ⇒ Object Also known as: channel_name
Gets the channel’s name. This name serves as a description of the specific nature of the channel.
138 139 140 |
# File 'ext/phidgets/phidgets_common.c', line 138 VALUE ph_common_get_channel_name(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getChannelName); } |
#getChannelSubclass ⇒ Object Also known as: channel_subclass
Gets the subclass for this channel. Allows for identifying channels with specific characteristics without needing to know the exact device and channel index.
150 151 152 |
# File 'ext/phidgets/phidgets_common.c', line 150
VALUE ph_common_get_channel_subclass(VALUE self) {
return ph_get_int(get_ph_handle(self), (phidget_get_int_func)Phidget_getChannelSubclass);
}
|
#getDataInterval ⇒ Object Also known as: data_interval
Gets the data interval for any channel that supports one. The DataInterval is the time that must elapse before the channel will fire another data event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between data events can also be affected by the specific change trigger for the channel.
154 155 156 |
# File 'ext/phidgets/phidgets_common.c', line 154 VALUE ph_common_get_data_interval(VALUE self) { return ph_get_uint(get_ph_handle(self), Phidget_getDataInterval); } |
#getDeviceChannelCount(channel_class) ⇒ Object Also known as: device_channel_count
Gets the number of channels of the specified channel class on the device. Pass Phidgets::CHCLASS_NOTHING to get the total number of channels.
76 77 78 79 80 |
# File 'ext/phidgets/phidgets_common.c', line 76
VALUE ph_common_get_device_channel_count(VALUE self, VALUE channel_class) {
uint32_t count;
ph_raise(Phidget_getDeviceChannelCount(get_ph_handle(self), NUM2INT(channel_class), &count));
return UINT2NUM(count);
}
|
#getDeviceClass ⇒ Object Also known as: device_class
Gets the device class for the Phidget which this channel is a part of.
82 83 84 |
# File 'ext/phidgets/phidgets_common.c', line 82
VALUE ph_common_get_device_class(VALUE self) {
return ph_get_int(get_ph_handle(self), (phidget_get_int_func)Phidget_getDeviceClass);
}
|
#getDeviceClassName ⇒ Object Also known as: device_class_name
Gets the name of the device class for the Phidget which this channel is a part of.
86 87 88 |
# File 'ext/phidgets/phidgets_common.c', line 86
VALUE ph_common_get_device_class_name(VALUE self) {
return ph_get_string(get_ph_handle(self), (phidget_get_string_func)Phidget_getDeviceClassName);
}
|
#getDeviceID ⇒ Object Also known as: device_id
Gets the DeviceID for the Phidget which this channel is a part of.
90 91 92 |
# File 'ext/phidgets/phidgets_common.c', line 90
VALUE ph_common_get_device_id(VALUE self) {
return ph_get_int(get_ph_handle(self), (phidget_get_int_func)Phidget_getDeviceID);
}
|
#getDeviceLabel ⇒ Object Also known as: device_label
Gets the label of the Phidget which this channel is a part of. A device label is a custom string used to more easily identify a Phidget. Labels are written to a Phidget using writeDeviceLabel().
115 116 117 |
# File 'ext/phidgets/phidgets_common.c', line 115 VALUE ph_common_get_device_label(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getDeviceLabel); } |
#getDeviceName ⇒ Object Also known as: device_name
Gets the name of the Phidget which this channel is a part of.
94 95 96 |
# File 'ext/phidgets/phidgets_common.c', line 94 VALUE ph_common_get_device_name(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getDeviceName); } |
#getDeviceSerialNumber ⇒ Object Also known as: device_serial_number
Gets the serial number of the Phidget which this channel is a part of. If the channel is part of a VINT device, this will be the serial number of the VINT Hub the device is attached to.
98 99 100 |
# File 'ext/phidgets/phidgets_common.c', line 98 VALUE ph_common_get_device_serial_number(VALUE self) { return ph_get_int(get_ph_handle(self), Phidget_getDeviceSerialNumber); } |
#getDeviceSKU ⇒ Object Also known as: device_sku
Gets the SKU (part number) of the Phidget which this channel is a part of.
107 108 109 |
# File 'ext/phidgets/phidgets_common.c', line 107 VALUE ph_common_get_device_sku(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getDeviceSKU); } |
#getDeviceVersion ⇒ Object Also known as: device_version
Gets the firmware version of the Phidget which this channel is a part of.
111 112 113 |
# File 'ext/phidgets/phidgets_common.c', line 111 VALUE ph_common_get_device_version(VALUE self) { return ph_get_int(get_ph_handle(self), Phidget_getDeviceVersion); } |
#getHubPort ⇒ Object Also known as: hub_port
Gets the hub port index of the VINT Hub port that the channel is attached to.
163 164 165 |
# File 'ext/phidgets/phidgets_common.c', line 163 VALUE ph_common_get_hub_port(VALUE self) { return ph_get_int(get_ph_handle(self), Phidget_getHubPort); } |
#getHubPortCount ⇒ Object Also known as: hub_port_count
Gets the number of VINT ports present on the VINT Hub that the channel is attached to.
172 173 174 |
# File 'ext/phidgets/phidgets_common.c', line 172 VALUE ph_common_get_hub_port_count(VALUE self) { return ph_get_int(get_ph_handle(self), Phidget_getHubPortCount); } |
#getIsChannel ⇒ Object Also known as: is_channel?
Returns true if it is a channel. Mostly for use alongside getParent() to distinguish channel handles from device handles.
176 177 178 |
# File 'ext/phidgets/phidgets_common.c', line 176 VALUE ph_common_get_is_channel(VALUE self) { return ph_get_bool(get_ph_handle(self), Phidget_getIsChannel); } |
#getIsHubPortDevice ⇒ Object Also known as: is_hub_port_device?
Gets whether this channel is a VINT Hub port channel, or part of a VINT device attached to a hub port.
180 181 182 |
# File 'ext/phidgets/phidgets_common.c', line 180 VALUE ph_common_get_is_hub_port_device(VALUE self) { return ph_get_bool(get_ph_handle(self), Phidget_getIsHubPortDevice); } |
#getIsLocal ⇒ Object Also known as: is_local?
Returns true when this channel is attached directly on the local machine, or false otherwise.
189 190 191 |
# File 'ext/phidgets/phidgets_common.c', line 189 VALUE ph_common_get_is_local(VALUE self) { return ph_get_bool(get_ph_handle(self), Phidget_getIsLocal); } |
#getIsRemote ⇒ Object Also known as: is_remote?
Returns true when this channel is attached via a Phidget network server, or false otherwise.
198 199 200 |
# File 'ext/phidgets/phidgets_common.c', line 198 VALUE ph_common_get_is_remote(VALUE self) { return ph_get_bool(get_ph_handle(self), Phidget_getIsRemote); } |
#getServerHostname ⇒ Object Also known as: server_hostname
Gets the hostname of the Phidget network server for network attached Phidgets. Fails if the channel is not connected to a Phidget network server.
207 208 209 |
# File 'ext/phidgets/phidgets_common.c', line 207 VALUE ph_common_get_server_hostname(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getServerHostname); } |
#getServerName ⇒ Object Also known as: server_name
Gets the name of the Phidget network server the channel is attached to, if any. Fails if the channel is not connected to a Phidget network server.
211 212 213 |
# File 'ext/phidgets/phidgets_common.c', line 211 VALUE ph_common_get_server_name(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getServerName); } |
#getServerPeerName ⇒ Object Also known as: server_peer_name
Gets the peer name (address and port) of the Phidget server for network attached Phidgets, formatted as: address:port Fails if the channel is not connected to a Phidget network server.
220 221 222 |
# File 'ext/phidgets/phidgets_common.c', line 220 VALUE ph_common_get_server_peer_name(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getServerPeerName); } |
#getServerUniqueName ⇒ Object Also known as: server_unique_name
Gets the unique name for the server the channel is attached to, if any. This is either a unique mDNS name, or the name specified in addServer Fails if the channel is not connected to a Phidget network server.
224 225 226 |
# File 'ext/phidgets/phidgets_common.c', line 224 VALUE ph_common_get_server_unique_name(VALUE self) { return ph_get_string(get_ph_handle(self), Phidget_getServerUniqueName); } |
#open ⇒ Object
Opens the Phidget channel. The specific channel to be opened can be specified by setting any of the following properties:
DeviceSerialNumber
DeviceLabel
Channel
HubPort
IsHubPortDevice
ServerName
IsLocal
IsRemote
open will return immediately, with the attachment process proceeding asynchronously. Use the Attach event or Attached property to determine when the channel is ready to use.
57 58 59 60 |
# File 'ext/phidgets/phidgets_common.c', line 57 VALUE ph_common_open(VALUE self) { ph_raise(Phidget_open(get_ph_handle(self))); return Qnil; } |
#openWaitForAttachment(milliseconds) ⇒ Object Also known as: open_wait_for_attachment
Opens the Phidget channel and waits a defined amount of time for the device to attach.The specific channel to be opened can be specified by setting any of the following properties:
DeviceSerialNumber
DeviceLabel
Channel
HubPort
IsHubPortDevice
ServerName
IsLocal
IsRemote
openWaitForAttachment will block until the channel is attached or a timeout occurs. A timeout value of 0 will wait forever.
62 63 64 65 |
# File 'ext/phidgets/phidgets_common.c', line 62
VALUE ph_common_open_wait_for_attachment(VALUE self, VALUE milliseconds) {
ph_raise(Phidget_openWaitForAttachment(get_ph_handle(self), NUM2UINT(milliseconds)));
return Qnil;
}
|
#setChannel(channel) ⇒ Object Also known as: channel=
Specifies the channel index to be opened. The default channel is 0. Set to PHIDGET_CHANNEL_ANY to open any channel on the specified device. If setting this property, it must be set before the channel is opened. The behaviour of setting this property while the channel is open is undefined.
133 134 135 136 |
# File 'ext/phidgets/phidgets_common.c', line 133
VALUE ph_common_set_channel(VALUE self, VALUE channel) {
ph_raise(Phidget_setChannel(get_ph_handle(self), NUM2INT(channel)));
return Qnil;
}
|
#setDataInterval(data_interval) ⇒ Object Also known as: data_interval=
Sets the data interval for any channel that supports one. The DataInterval is the time that must elapse before the channel will fire another data event. The data interval is bounded by MinDataInterval and MaxDataInterval. The timing between data events can also be affected by the specific change trigger for the channel.
158 159 160 161 |
# File 'ext/phidgets/phidgets_common.c', line 158
VALUE ph_common_set_data_interval(VALUE self, VALUE interval) {
ph_raise(Phidget_setDataInterval(get_ph_handle(self), NUM2UINT(interval)));
return Qnil;
}
|
#setDeviceLabel(label) ⇒ Object Also known as: device_label=
Specifies the label of the Phidget to be opened. Leave un-set to open any label. A device label is a custom string used to more easily identify a Phidget. Labels are written to a Phidget using writeDeviceLabel().
124 125 126 127 |
# File 'ext/phidgets/phidgets_common.c', line 124
VALUE ph_common_write_device_label(VALUE self, VALUE label) {
ph_raise(Phidget_writeDeviceLabel(get_ph_handle(self), StringValueCStr(label)));
return Qnil;
}
|
#setDeviceSerialNumber(serial_number) ⇒ Object Also known as: device_serial_number=
Specifies the serial number of the Phidget to be opened. Leave un-set, or set to Phidgets::SERIALNUMBER_ANY to open any serial number. If the channel is part of a VINT device, this will be the serial number of the VINT Hub the device is attached to.
If setting this property, it must be set before the channel is opened. The behaviour of setting this property while the channel is open is undefined.
102 103 104 105 |
# File 'ext/phidgets/phidgets_common.c', line 102
VALUE ph_common_set_device_serial_number(VALUE self, VALUE serial_number) {
ph_raise(Phidget_setDeviceSerialNumber(get_ph_handle(self), NUM2INT(serial_number)));
return Qnil;
}
|
#setHubPort(hub_port) ⇒ Object Also known as: hub_port=
Specifies the hub port index of the VINT Hub port to open this channel on. Leave un-set, or set to Phidgets::HUBPORT_ANY to open the channel on any VINT Hub port.
167 168 169 170 |
# File 'ext/phidgets/phidgets_common.c', line 167
VALUE ph_common_set_hub_port(VALUE self, VALUE hub_port) {
ph_raise(Phidget_setHubPort(get_ph_handle(self), NUM2INT(hub_port)));
return Qnil;
}
|
#setIsHubPortDevice(is_hub_port_device) ⇒ Object Also known as: is_hub_port_device=
Specifies whether this channel should be opened on a VINT Hub port directly, or on a VINT device attached to a hub port.
184 185 186 187 |
# File 'ext/phidgets/phidgets_common.c', line 184
VALUE ph_common_set_is_hub_port_device(VALUE self, VALUE is_hub_port_device) {
ph_raise(Phidget_setIsHubPortDevice(get_ph_handle(self), TYPE(is_hub_port_device) == T_TRUE ? PTRUE : PFALSE));
return Qnil;
}
|
#setIsLocal(is_local) ⇒ Object Also known as: is_local=
Set to true if the channel is to be opened locally, and not over a network. If both this and IsRemote are set to False (the default), the channel will be opened either locally or remotely, on whichever matching channel is found first.
193 194 195 196 |
# File 'ext/phidgets/phidgets_common.c', line 193
VALUE ph_common_set_is_local(VALUE self, VALUE is_local) {
ph_raise(Phidget_setIsLocal(get_ph_handle(self), TYPE(is_local) == T_TRUE ? PTRUE : PFALSE));
return Qnil;
}
|
#setIsRemote(is_remote) ⇒ Object Also known as: is_remote=
Set to true if the channel is to be opened remotely, rather than locally. If both this and IsLocal are set to False (the default), the channel will be opened either locally or remotely, on whichever matching channel is found first.
202 203 204 205 |
# File 'ext/phidgets/phidgets_common.c', line 202
VALUE ph_common_set_is_remote(VALUE self, VALUE is_remote) {
ph_raise(Phidget_setIsRemote(get_ph_handle(self), TYPE(is_remote) == T_TRUE ? PTRUE : PFALSE));
return Qnil;
}
|
#setOnAttachHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_attach
call-seq:
setOnAttachHandler(proc=nil, &block)
Assigns a handler that will be called when the Attach event occurs.
10 11 12 13 14 |
# File 'lib/phidgets/common.rb', line 10 def setOnAttachHandler(cb_proc = nil, &cb_block) @on_attach_thread.kill if defined? @on_attach_thread callback = cb_proc || cb_block @on_attach_thread = Thread.new {ext_setOnAttachHandler(callback)} end |
#setOnDetachHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_detach
call-seq:
setOnDetachHandler(proc=nil, &block)
Assigns a handler that will be called when the Detach event occurs.
21 22 23 24 25 |
# File 'lib/phidgets/common.rb', line 21 def setOnDetachHandler(cb_proc = nil, &cb_block) @on_detach_thread.kill if defined? @on_detach_thread callback = cb_proc || cb_block @on_detach_thread = Thread.new {ext_setOnDetachHandler(callback)} end |
#setOnErrorHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_error
call-seq:
setOnErrorHandler(proc=nil, &block)
Assigns a handler that will be called when the Error event occurs.
32 33 34 35 36 |
# File 'lib/phidgets/common.rb', line 32 def setOnErrorHandler(cb_proc = nil, &cb_block) @on_error_thread.kill if defined? @on_error_thread callback = cb_proc || cb_block @on_error_thread = Thread.new {ext_setOnErrorHandler(callback)} end |
#setOnPropertyChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_property_change
call-seq:
setOnPropertyChangeHandler(proc=nil, &block)
Assigns a handler that will be called when the PropertyChange event occurs.
43 44 45 46 47 |
# File 'lib/phidgets/common.rb', line 43 def setOnPropertyChangeHandler(cb_proc = nil, &cb_block) @on_property_change_thread.kill if defined? @on_property_change_thread callback = cb_proc || cb_block @on_property_change_thread = Thread.new {ext_setOnPropertyChangeHandler(callback)} end |
#setServerName(server_name) ⇒ Object Also known as: server_name=
Specifies that this channel will be opened remotely, on a Phidget network server with this name. This function should only be used if you want your Phidget to be found on a specific server, and does not need to be specified if the Phidget can be on any any available server. In order for your program to have access to remote Phidgets, you must use the Networking API to EnableServerDiscovery or AddServer. If setting this property, it must be set before the channel is opened. The behaviour of setting this property while the channel is open is undefined.
215 216 217 218 |
# File 'ext/phidgets/phidgets_common.c', line 215
VALUE ph_common_set_server_name(VALUE self, VALUE server_name) {
ph_raise(Phidget_setServerName(get_ph_handle(self), StringValueCStr(server_name)));
return Qnil;
}
|
#writeDeviceLabel(label) ⇒ Object Also known as: write_device_label
Writes a label to the device in the form of a string in the device flash memory. This label can then be used to identify the device, and will persist across power cycles.
124 125 126 127 |
# File 'ext/phidgets/phidgets_common.c', line 124
VALUE ph_common_write_device_label(VALUE self, VALUE label) {
ph_raise(Phidget_writeDeviceLabel(get_ph_handle(self), StringValueCStr(label)));
return Qnil;
}
|