Class: PhidgetsNative::Device
- Inherits:
-
Object
- Object
- PhidgetsNative::Device
- Defined in:
- ext/phidgets_native/device_ruby.c,
ext/phidgets_native/device_ruby.c
Overview
This class is the base class from which all phidget devices will inherit. Basic functionality related to the management of any device can be found in here. These methods are all available to all phidgets.
Direct Known Subclasses
Analog, Bridge, FrequencyCounter, GPS, IR, LED, RFID, Servo, TemperatureSensor
Instance Method Summary collapse
-
#close ⇒ nil
This method will unregister the phidget event handlers, and free up all API resources associated with the phidget.
-
#device_class ⇒ String
Returns a string indicating the “class” of the device.
-
#device_id ⇒ String
Returns a string indicating the “identifier” of the device.
-
#new(serial_number) ⇒ Object
constructor
All phidget objects are created from the device serial number.
-
#is_attached? ⇒ Boolean
Returns true if the device is connected, false if otherwise.
-
#label ⇒ String
Returns a string which contains the device label.
-
#name ⇒ String
Returns a string indicating the “name” of the device.
-
#serial_number ⇒ FixNum
Returns a string which contains the device’s serial number.
-
#type ⇒ String
Returns a string indicating the “type” of the device.
-
#version ⇒ FixNum
Returns an FixNum containing the device firmware version.
-
#wait_for_attachment(timeout) ⇒ FixNum
Call CPhidget_waitForAttachment to execute wait_for_attachment.
Constructor Details
#new(serial_number) ⇒ Object
All phidget objects are created from the device serial number. Serial numbers are required to be Fixnums (aka “unsigned integers”).
Instance Method Details
#close ⇒ nil
This method will unregister the phidget event handlers, and free up all API resources associated with the phidget. This is an optional, but useful way to remove the object’s overhead before the GC kicks in and actually frees the resource.
#device_class ⇒ String
Returns a string indicating the “class” of the device. This string comes directly from the CPhidget_getDeviceClass function.
#device_id ⇒ String
Returns a string indicating the “identifier” of the device. Seemingly, this is the product name and part number. This string comes directly from the CPhidget_getDeviceID function.
#is_attached? ⇒ Boolean
Returns true if the device is connected, false if otherwise.
#label ⇒ String
Returns a string which contains the device label. This string comes directly from the CPhidget_getDeviceLabel function.
#name ⇒ String
Returns a string indicating the “name” of the device. This seems to be just the product name. This string comes directly from the CPhidget_getDeviceName function.
#serial_number ⇒ FixNum
Returns a string which contains the device’s serial number. This string comes from what was provided in the object initializer
#type ⇒ String
Returns a string indicating the “type” of the device. This doesn’t appear to differ much from the device_closs. This string comes directly from the CPhidget_getDeviceType function.
#version ⇒ FixNum
Returns an FixNum containing the device firmware version. This number comes from the CPhidget_getDeviceVersion function.
#wait_for_attachment(timeout) ⇒ FixNum
Call CPhidget_waitForAttachment to execute wait_for_attachment. Given a timeout, this method will pause execution until this device is attached, or timeout milliseconds expires. The method returns the provided timeout parameter.