Module: Phidgets::FFI

Extended by:
FFI::Library
Defined in:
lib/phidgets-ffi/common.rb,
lib/phidgets-ffi/ffi/ir.rb,
lib/phidgets-ffi/ffi/gps.rb,
lib/phidgets-ffi/ffi/led.rb,
lib/phidgets-ffi/ffi/log.rb,
lib/phidgets-ffi/version.rb,
lib/phidgets-ffi/ffi/rfid.rb,
lib/phidgets-ffi/ffi/servo.rb,
lib/phidgets-ffi/ffi/analog.rb,
lib/phidgets-ffi/ffi/bridge.rb,
lib/phidgets-ffi/ffi/common.rb,
lib/phidgets-ffi/ffi/encoder.rb,
lib/phidgets-ffi/ffi/manager.rb,
lib/phidgets-ffi/ffi/spatial.rb,
lib/phidgets-ffi/ffi/stepper.rb,
lib/phidgets-ffi/ffi/text_lcd.rb,
lib/phidgets-ffi/phidgets-ffi.rb,
lib/phidgets-ffi/ffi/constants.rb,
lib/phidgets-ffi/ffi/dictionary.rb,
lib/phidgets-ffi/ffi/accelerometer.rb,
lib/phidgets-ffi/ffi/interface_kit.rb,
lib/phidgets-ffi/ffi/motor_control.rb,
lib/phidgets-ffi/ffi/advanced_servo.rb,
lib/phidgets-ffi/ffi/frequency_counter.rb,
lib/phidgets-ffi/ffi/temperature_sensor.rb

Defined Under Namespace

Modules: CPhidgetAccelerometer, CPhidgetAdvancedServo, CPhidgetAnalog, CPhidgetBridge, CPhidgetDictionary, CPhidgetEncoder, CPhidgetFrequencyCounter, CPhidgetGPS, CPhidgetIR, CPhidgetInterfaceKit, CPhidgetLED, CPhidgetManager, CPhidgetMotorControl, CPhidgetRFID, CPhidgetServo, CPhidgetSpatial, CPhidgetStepper, CPhidgetTemperatureSensor, CPhidgetTextLCD, Common, Log Classes: Error

Constant Summary collapse

RAWDATA_LONGSPACE =
0x7fffffff
IREncoding =
enum(
  :encoding_unknown , 1,
  :encoding_space,
  :encoding_pulse,
	  :encoding_biphase,
	  :encoding_rc5,
	  :encoding_rc6
)
IRLength =
enum(
  :length_unknown , 1,
  :length_constant,
  :length_variable
)
LEDCurrentLimit =
enum(
  :current_limit_20mA, 1,
  :current_limit_40mA,
  :current_limit_60mA,
  :current_limit_80mA,
  :invalid
)
LEDVoltage =
enum(
  :voltage_1_7V, 1,
  :voltage_2_75V,
  :voltage_3_9V,
  :voltage_5_0V
)
LogLevel =
enum(
  :critical, 1,
  :error,
  :warning,
  :debug,
  :info,
  :verbose
)
VERSION =
"0.1.3"
RFIDTagProtocol =
enum(
  :EM4100, 1,
  :ISO11785_FDX_B,
  :PhidgetTAG
)
ServoType =
enum(
  :default, 1,
  :raw_us_mode,
  :hitec_hs322hd,
  :hitec_hS5245mg,
  :hitec_805bb,
  :hitec_hs422,
  :towerpro_mg90,
  :hitec_hsr1425cr,
  :hitec_hs785hb,
  :hitec_hs485hb,
  :hitec_hs645mg,
  :hitec_815bb,
  :firgelli_l12_30_50_06_r,
  :firgelli_l12_50_100_06_r,
  :firgelli_l12_50_210_06_r,
  :firgelli_l12_100_50_06_r,
  :firgelli_l12_100_100_06_r,
  :user_defined
)
BridgeGains =
enum(
  :gain_1, 1,
  :gain_8,
  :gain_16,
  :gain_32,
  :gain_64,
  :gain_128,
  :gain_unknown
)
FFI_POINTER_SIZE =

Linux

8
TextLCDScreenSizes =
enum(
  :screen_size_none, 1,
	  :screen_size_1x8,
  :screen_size_2x8,
  :screen_size_1x16,
	  :screen_size_2x16,
	  :screen_size_4x16,
	  :screen_size_2x20,
	  :screen_size_4x20,
	  :screen_size_2x24,
	  :screen_size_1x40,
	  :screen_size_2x40,
	  :screen_size_4x40,
	  :screen_size_unknown
)
ServerStatus =
enum(
  :disconnected, 0,
  :connected
)
DeviceStatus =
enum(
  :detached, 0,
  :attached
)
DeviceClass =
enum(
  :accelerometer, 2,
  :advanced_servo, 3,
  :encoder, 4,
  :analog, 22,
  :bridge, 23,
  :frequency_counter, 21,
  :gps, 5,
  :interface_kit, 7,
  :ir, 19,
  :led, 8,
  :motor_control, 9,
  :ph_sensor, 10,
  :rfid, 11,
  :servo, 12,
  :spatial, 20,
  :stepper, 13,
  :temperature_sensor, 14,
  :text_lcd, 15,
  :text_led, 16,
  :weight_sensor, 17
)
DeviceID =
enum(
  :accelerometer_3axis, 0x07E,
  :advanced_servo_1motor, 0x082,
  :advanced_servo_8motor, 0x03A,
  :analog_4output, 0x037,
  :bipolar_stepper_1motor, 0x07B,
  :bridge_4input, 0x03B,
  :encoder_1encoder_1input, 0x04B,
  :encoder_hs_1encoder, 0x080,
  :encoder_hs_4encoder_4input, 0x04F,
  :frequency_counter_2input, 0x035,
  :gps, 0x079,
  :interface_kit_0_0_4, 0x040,
  :interface_kit_0_0_8, 0x081,
  :interface_kit_0_16_16, 0x044,
  :interface_kit_2_2_2, 0x036,
  :interface_kit_8_8_8, 0x045,
  :interface_kit_8_8_8_w_lcd, 0x07D,
  :ir, 0x04D,
  :led_64_adv, 0x04C,
  :linear_touch, 0x076,
  :motor_control_1motor, 0x03E,
  :motor_control_hc_2motor, 0x059,
  :rfid_2output, 0x031,
  :rotary_touch, 0x077,
  :spatial_accel_3axis, 0x07F,
  :spatial_accel_gyro_compass, 0x033,
  :temperature_sensor, 0x070,
  :temperature_sensor_4, 0x032,
	  :temperature_sensor_ir, 0x03C,
  :textlcd_2x20_w_8_8_8, 0x17D,
  :textlcd_adapter, 0x03D,
  :unipolar_stepper_4motor, 0x07A,
  :accelerometer_2axis, 0x071,
  :interface_kit_0_8_8_w_lcd, 0x053,
  :interface_kit_4_8_8, 4,
  :led_64, 0x04A,
  :motorcontrol_LV_2motor_4input, 0x058,
  :ph_sensor, 0x074,
  :rfid, 0x030,
  :servo_1motor, 0x039,
  :servo_1motor_old, 2,
  :servo_4motor, 0x038,
  :servo_4motor_old, 3,
  :textlcd_2x20, 0x052,
  :textlcd_2x20_w_0_8_8, 0x153,
  :textled_1x8, 0x049,
  :textled_4x8, 0x048,
  :weight_sensor, 0x072
)
ErrorCodes =
enum(
  :ok, 0,
  :not_found,
  :no_memory,
  :unexpected,
  :invalid_arg,
  :not_attached,
  :interrupted,
  :invalid,
  :network,
  :unknown_val,
  :bad_password,
  :unsupported,
  :duplicate,
  :timeout,
  :out_of_bounds,
  :event,
  :network_not_connected,
  :wrong_device,
  :closed,
  :bad_version,
  :error_code_count
)
KeyChangeReason =
enum(
  :changed, 1,
  :added,
  :removed,
  :unchanged
)
AdvancedServoType =
enum(
  :default, 1,
  :raw_us_mode,
  :hitec_hs322hd,
  :hitec_hS5245mg,
  :hitec_805bb,
  :hitec_hs422,
  :towerpro_mg90,
  :hitec_hsr1425cr,
  :hitec_hs785hb,
  :hitec_hs485hb,
  :hitec_hs645mg,
  :hitec_815bb,
  :firgelli_l12_30_50_06_r,
  :firgelli_l12_50_100_06_r,
  :firgelli_l12_50_210_06_r,
  :firgelli_l12_100_50_06_r,
  :firgelli_l12_100_100_06_r,
  :user_defined
)
FrequencyCounterFilterTypes =
enum(
  :filter_type_zero_crossing, 1,
  :filter_type_logic_level,
  :filter_type_unknown
)
TemperatureSensorThermocoupleTypes =
enum(
  :thermocouple_type_k_type, 1,
  :thermocouple_type_j_type,
  :thermocouple_type_e_type,
	  :thermocouple_type_t_type
)

Class Method Summary collapse

Class Method Details

.error_description(code) ⇒ String

Gets the description for an error code.

Parameters:

  • code (Fixnum)

    The error code to get the description of.

Returns:

  • (String)


17
18
19
20
21
22
# File 'lib/phidgets-ffi/common.rb', line 17

def self.error_description(code)
  ptr = ::FFI::MemoryPointer.new(:string)
  Phidgets::FFI::Common.getErrorDescription(code, ptr)
  strPtr = ptr.get_pointer(0)
  strPtr.null? ? nil : strPtr.read_string
end

.library_versionString

Gets the library version. This contains a version number and a build date.

Returns:

  • (String)


6
7
8
9
10
11
# File 'lib/phidgets-ffi/common.rb', line 6

def self.library_version
  ptr = ::FFI::MemoryPointer.new(:string)
  Phidgets::FFI::Common.getLibraryVersion(ptr)
  strPtr = ptr.get_pointer(0)
  strPtr.null? ? nil : strPtr.read_string
end