phidgets-ffi 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/LICENSE +1 -1
- data/README.rdoc +92 -42
- data/examples/accelerometer.rb +39 -0
- data/examples/advanced_servo.rb +94 -0
- data/examples/analog.rb +43 -0
- data/examples/bridge.rb +57 -0
- data/examples/dictionary.rb +46 -31
- data/examples/encoder.rb +59 -0
- data/examples/frequency_counter.rb +63 -0
- data/examples/gps.rb +91 -0
- data/examples/interface_kit_with_block.rb +68 -0
- data/examples/interface_kit_without_block.rb +60 -0
- data/examples/ir.rb +157 -0
- data/examples/led.rb +36 -0
- data/examples/manager.rb +16 -10
- data/examples/motor_control.rb +108 -0
- data/examples/{ffi → raw-ffi}/dictionary.rb +11 -1
- data/examples/{ffi → raw-ffi}/interface_kit.rb +19 -2
- data/examples/{ffi → raw-ffi}/library_version.rb +0 -0
- data/examples/{ffi → raw-ffi}/log.rb +0 -0
- data/examples/{ffi → raw-ffi}/manager.rb +6 -3
- data/examples/rfid.rb +63 -0
- data/examples/servo.rb +45 -30
- data/examples/spatial.rb +75 -0
- data/examples/stepper.rb +87 -0
- data/examples/temperature_sensor.rb +49 -0
- data/examples/text_lcd.rb +101 -0
- data/lib/phidgets-ffi.rb +34 -3
- data/lib/phidgets-ffi/accelerometer.rb +122 -0
- data/lib/phidgets-ffi/advanced_servo.rb +304 -0
- data/lib/phidgets-ffi/analog.rb +111 -0
- data/lib/phidgets-ffi/bridge.rb +167 -0
- data/lib/phidgets-ffi/common.rb +506 -103
- data/lib/phidgets-ffi/dictionary.rb +136 -23
- data/lib/phidgets-ffi/encoder.rb +196 -0
- data/lib/phidgets-ffi/error.rb +8 -3
- data/lib/phidgets-ffi/ffi/accelerometer.rb +30 -0
- data/lib/phidgets-ffi/ffi/advanced_servo.rb +73 -0
- data/lib/phidgets-ffi/ffi/analog.rb +29 -0
- data/lib/phidgets-ffi/ffi/bridge.rb +44 -0
- data/lib/phidgets-ffi/ffi/common.rb +51 -34
- data/lib/phidgets-ffi/ffi/constants.rb +3 -1
- data/lib/phidgets-ffi/ffi/dictionary.rb +25 -20
- data/lib/phidgets-ffi/ffi/encoder.rb +32 -0
- data/lib/phidgets-ffi/ffi/frequency_counter.rb +38 -0
- data/lib/phidgets-ffi/ffi/gps.rb +32 -0
- data/lib/phidgets-ffi/ffi/interface_kit.rb +26 -23
- data/lib/phidgets-ffi/ffi/ir.rb +50 -0
- data/lib/phidgets-ffi/ffi/led.rb +40 -0
- data/lib/phidgets-ffi/ffi/log.rb +7 -6
- data/lib/phidgets-ffi/ffi/manager.rb +35 -20
- data/lib/phidgets-ffi/ffi/motor_control.rb +66 -0
- data/lib/phidgets-ffi/ffi/rfid.rb +36 -0
- data/lib/phidgets-ffi/ffi/servo.rb +16 -15
- data/lib/phidgets-ffi/ffi/spatial.rb +40 -0
- data/lib/phidgets-ffi/ffi/stepper.rb +56 -0
- data/lib/phidgets-ffi/ffi/temperature_sensor.rb +42 -0
- data/lib/phidgets-ffi/ffi/text_lcd.rb +55 -0
- data/lib/phidgets-ffi/frequency_counter.rb +148 -0
- data/lib/phidgets-ffi/gps.rb +181 -0
- data/lib/phidgets-ffi/interface_kit.rb +205 -92
- data/lib/phidgets-ffi/ir.rb +290 -0
- data/lib/phidgets-ffi/led.rb +112 -0
- data/lib/phidgets-ffi/log.rb +14 -2
- data/lib/phidgets-ffi/manager.rb +143 -26
- data/lib/phidgets-ffi/motor_control.rb +497 -0
- data/lib/phidgets-ffi/phidgets-ffi.rb +15 -2
- data/lib/phidgets-ffi/rfid.rb +220 -0
- data/lib/phidgets-ffi/servo.rb +103 -61
- data/lib/phidgets-ffi/spatial.rb +306 -0
- data/lib/phidgets-ffi/stepper.rb +370 -0
- data/lib/phidgets-ffi/temperature_sensor.rb +157 -0
- data/lib/phidgets-ffi/text_lcd.rb +298 -0
- data/lib/phidgets-ffi/version.rb +1 -1
- data/phidgets-ffi.gemspec +2 -2
- metadata +89 -76
- data/examples/ffi/servo.rb +0 -67
- data/examples/interface_kit.rb +0 -20
@@ -0,0 +1,32 @@
|
|
1
|
+
module Phidgets
|
2
|
+
module FFI
|
3
|
+
attach_function :CPhidgetGPS_create, [:phid], :int
|
4
|
+
|
5
|
+
attach_function :CPhidgetGPS_getLatitude, [:phid, :pointer], :int
|
6
|
+
attach_function :CPhidgetGPS_getLongitude, [:phid, :pointer], :int
|
7
|
+
attach_function :CPhidgetGPS_getAltitude, [:phid, :pointer], :int
|
8
|
+
attach_function :CPhidgetGPS_getHeading, [:phid, :pointer], :int
|
9
|
+
attach_function :CPhidgetGPS_getVelocity, [:phid, :pointer], :int
|
10
|
+
attach_function :CPhidgetGPS_getTime, [:phid, :pointer], :int
|
11
|
+
attach_function :CPhidgetGPS_getDate, [:phid, :pointer], :int
|
12
|
+
attach_function :CPhidgetGPS_getPositionFixStatus, [:phid, :pointer], :int
|
13
|
+
|
14
|
+
callback :CPhidgetGPS_set_OnPositionFixStatusChange_Callback, [:phid, :user_ptr, :int], :int
|
15
|
+
attach_function :CPhidgetGPS_set_OnPositionFixStatusChange_Handler, [:phid, :CPhidgetGPS_set_OnPositionFixStatusChange_Callback, :user_ptr], :int
|
16
|
+
|
17
|
+
callback :CPhidgetGPS_set_OnPositionChange_Callback, [:phid, :user_ptr, :double, :double, :double], :int
|
18
|
+
attach_function :CPhidgetGPS_set_OnPositionChange_Handler, [:phid, :CPhidgetGPS_set_OnPositionChange_Callback, :user_ptr], :int
|
19
|
+
|
20
|
+
module CPhidgetGPS
|
21
|
+
def self.method_missing(method, *args, &block)
|
22
|
+
if ::Phidgets::FFI.respond_to?("CPhidgetGPS_#{method}".to_sym)
|
23
|
+
if (rs = ::Phidgets::FFI.send("CPhidgetGPS_#{method}".to_sym, *args, &block)) != 0
|
24
|
+
raise Phidgets::Error.exception_for(rs), Phidgets::FFI.error_description(rs)
|
25
|
+
end
|
26
|
+
else
|
27
|
+
super(method, *args, &block)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,29 +1,32 @@
|
|
1
1
|
module Phidgets
|
2
2
|
module FFI
|
3
|
-
attach_function :CPhidgetInterfaceKit_create, [:phid], :int
|
4
|
-
attach_function :CPhidgetInterfaceKit_getInputCount, [:phid, :pointer], :int
|
5
|
-
attach_function :CPhidgetInterfaceKit_getInputState, [:phid, :int, :pointer], :int
|
6
|
-
|
7
|
-
attach_function :
|
8
|
-
attach_function :
|
9
|
-
attach_function :
|
10
|
-
attach_function :
|
11
|
-
|
12
|
-
|
13
|
-
attach_function :
|
14
|
-
attach_function :
|
15
|
-
attach_function :
|
16
|
-
|
17
|
-
attach_function :
|
18
|
-
attach_function :
|
19
|
-
attach_function :
|
20
|
-
attach_function :CPhidgetInterfaceKit_getRatiometric, [:phid, :pointer], :int #int CPhidgetInterfaceKit_getRatiometric(CPhidgetInterfaceKitHandle phid, int *ratiometric);
|
21
|
-
attach_function :CPhidgetInterfaceKit_setRatiometric, [:phid, :int], :int #int CPhidgetInterfaceKit_setRatiometric(CPhidgetInterfaceKitHandle phid, int ratiometric);
|
22
|
-
attach_function :CPhidgetInterfaceKit_getDataRate, [:phid, :int, :pointer], :int #int CPhidgetInterfaceKit_getDataRate(CPhidgetInterfaceKitHandle phid, int index, int *milliseconds);
|
23
|
-
attach_function :CPhidgetInterfaceKit_setDataRate, [:phid, :int, :int], :int #int CPhidgetInterfaceKit_setDataRate(CPhidgetInterfaceKitHandle phid, int index, int milliseconds);
|
24
|
-
attach_function :CPhidgetInterfaceKit_getDataRateMax, [:phid, :int, :pointer], :int #int CPhidgetInterfaceKit_getDataRateMax(CPhidgetInterfaceKitHandle phid, int index, int *max);
|
25
|
-
attach_function :CPhidgetInterfaceKit_getDataRateMin, [:phid, :int, :pointer], :int #int CPhidgetInterfaceKit_getDataRateMin(CPhidgetInterfaceKitHandle phid, int index, int *min);
|
3
|
+
attach_function :CPhidgetInterfaceKit_create, [:phid], :int
|
4
|
+
attach_function :CPhidgetInterfaceKit_getInputCount, [:phid, :pointer], :int
|
5
|
+
attach_function :CPhidgetInterfaceKit_getInputState, [:phid, :int, :pointer], :int
|
6
|
+
attach_function :CPhidgetInterfaceKit_getOutputCount, [:phid, :pointer], :int
|
7
|
+
attach_function :CPhidgetInterfaceKit_getOutputState, [:phid, :int, :pointer], :int
|
8
|
+
attach_function :CPhidgetInterfaceKit_setOutputState, [:phid, :int, :int], :int
|
9
|
+
attach_function :CPhidgetInterfaceKit_getSensorCount, [:phid, :pointer], :int
|
10
|
+
attach_function :CPhidgetInterfaceKit_getSensorValue, [:phid, :int, :pointer], :int
|
11
|
+
attach_function :CPhidgetInterfaceKit_getSensorRawValue, [:phid, :int, :pointer], :int
|
12
|
+
attach_function :CPhidgetInterfaceKit_getSensorChangeTrigger, [:phid, :int, :pointer], :int
|
13
|
+
attach_function :CPhidgetInterfaceKit_setSensorChangeTrigger, [:phid, :int, :int], :int
|
14
|
+
attach_function :CPhidgetInterfaceKit_getRatiometric, [:phid, :pointer], :int
|
15
|
+
attach_function :CPhidgetInterfaceKit_setRatiometric, [:phid, :int], :int
|
16
|
+
attach_function :CPhidgetInterfaceKit_getDataRate, [:phid, :int, :pointer], :int
|
17
|
+
attach_function :CPhidgetInterfaceKit_setDataRate, [:phid, :int, :int], :int
|
18
|
+
attach_function :CPhidgetInterfaceKit_getDataRateMax, [:phid, :int, :pointer], :int
|
19
|
+
attach_function :CPhidgetInterfaceKit_getDataRateMin, [:phid, :int, :pointer], :int
|
26
20
|
|
21
|
+
callback :CPhidgetInterfaceKit_set_OnInputChange_Callback, [:phid, :user_ptr, :int, :int], :int
|
22
|
+
attach_function :CPhidgetInterfaceKit_set_OnInputChange_Handler, [:phid, :CPhidgetInterfaceKit_set_OnInputChange_Callback, :user_ptr], :int
|
23
|
+
|
24
|
+
callback :CPhidgetInterfaceKit_set_OnSensorChange_Callback, [:phid, :user_ptr, :int, :int], :int
|
25
|
+
attach_function :CPhidgetInterfaceKit_set_OnSensorChange_Handler, [:phid, :CPhidgetInterfaceKit_set_OnSensorChange_Callback, :user_ptr], :int
|
26
|
+
|
27
|
+
callback :CPhidgetInterfaceKit_set_OnOutputChange_Callback, [:phid, :user_ptr, :int, :int], :int
|
28
|
+
attach_function :CPhidgetInterfaceKit_set_OnOutputChange_Handler, [:phid, :CPhidgetInterfaceKit_set_OnOutputChange_Callback, :user_ptr], :int
|
29
|
+
|
27
30
|
module CPhidgetInterfaceKit
|
28
31
|
def self.method_missing(method, *args, &block)
|
29
32
|
if ::Phidgets::FFI.respond_to?("CPhidgetInterfaceKit_#{method}".to_sym)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Phidgets
|
2
|
+
module FFI
|
3
|
+
|
4
|
+
RAWDATA_LONGSPACE = 0x7fffffff
|
5
|
+
|
6
|
+
IREncoding = enum(
|
7
|
+
:encoding_unknown , 1,
|
8
|
+
:encoding_space,
|
9
|
+
:encoding_pulse,
|
10
|
+
:encoding_biphase,
|
11
|
+
:encoding_rc5,
|
12
|
+
:encoding_rc6
|
13
|
+
)
|
14
|
+
|
15
|
+
IRLength = enum(
|
16
|
+
:length_unknown , 1,
|
17
|
+
:length_constant,
|
18
|
+
:length_variable
|
19
|
+
)
|
20
|
+
|
21
|
+
attach_function :CPhidgetIR_create, [:phid], :int
|
22
|
+
attach_function :CPhidgetIR_Transmit, [:phid, :pointer, :pointer], :int
|
23
|
+
attach_function :CPhidgetIR_TransmitRepeat, [:phid], :int
|
24
|
+
attach_function :CPhidgetIR_TransmitRaw, [:phid, :pointer, :int, :int, :int, :int], :int
|
25
|
+
attach_function :CPhidgetIR_getRawData, [:phid, :pointer, :pointer], :int
|
26
|
+
attach_function :CPhidgetIR_getLastCode, [:phid, :pointer, :pointer, :pointer], :int
|
27
|
+
attach_function :CPhidgetIR_getLastLearnedCode, [:phid, :pointer, :pointer, :pointer], :int
|
28
|
+
|
29
|
+
callback :CPhidgetIR_set_OnCode_Callback, [:phid, :user_ptr, :pointer, :int, :int, :int], :int
|
30
|
+
attach_function :CPhidgetIR_set_OnCode_Handler, [:phid, :CPhidgetIR_set_OnCode_Callback, :user_ptr], :int
|
31
|
+
|
32
|
+
callback :CPhidgetIR_set_OnLearn_Callback, [:phid, :user_ptr, :pointer, :int, :pointer], :int
|
33
|
+
attach_function :CPhidgetIR_set_OnLearn_Handler, [:phid, :CPhidgetIR_set_OnLearn_Callback, :user_ptr], :int
|
34
|
+
|
35
|
+
callback :CPhidgetIR_set_OnRawData_Callback, [:phid, :user_ptr, :pointer, :int], :int
|
36
|
+
attach_function :CPhidgetIR_set_OnRawData_Handler, [:phid, :CPhidgetIR_set_OnRawData_Callback, :user_ptr], :int
|
37
|
+
|
38
|
+
module CPhidgetIR
|
39
|
+
def self.method_missing(method, *args, &block)
|
40
|
+
if ::Phidgets::FFI.respond_to?("CPhidgetIR_#{method}".to_sym)
|
41
|
+
if (rs = ::Phidgets::FFI.send("CPhidgetIR_#{method}".to_sym, *args, &block)) != 0
|
42
|
+
raise Phidgets::Error.exception_for(rs), Phidgets::FFI.error_description(rs)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
super(method, *args, &block)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Phidgets
|
2
|
+
module FFI
|
3
|
+
|
4
|
+
LEDCurrentLimit = enum(
|
5
|
+
:current_limit_20mA, 1,
|
6
|
+
:current_limit_40mA,
|
7
|
+
:current_limit_60mA,
|
8
|
+
:current_limit_80mA,
|
9
|
+
:invalid
|
10
|
+
)
|
11
|
+
|
12
|
+
LEDVoltage = enum(
|
13
|
+
:voltage_1_7V, 1,
|
14
|
+
:voltage_2_75V,
|
15
|
+
:voltage_3_9V,
|
16
|
+
:voltage_5_0V
|
17
|
+
)
|
18
|
+
|
19
|
+
attach_function :CPhidgetLED_create, [:phid], :int
|
20
|
+
attach_function :CPhidgetLED_getLEDCount, [:phid, :pointer], :int
|
21
|
+
attach_function :CPhidgetLED_getDiscreteLED, [:phid, :int, :pointer], :int
|
22
|
+
attach_function :CPhidgetLED_setDiscreteLED, [:phid, :int, :int], :int
|
23
|
+
attach_function :CPhidgetLED_getCurrentLimit, [:phid, :pointer], :int
|
24
|
+
attach_function :CPhidgetLED_setCurrentLimit, [:phid, LEDCurrentLimit], :int
|
25
|
+
attach_function :CPhidgetLED_getVoltage, [:phid, :pointer], :int
|
26
|
+
attach_function :CPhidgetLED_setVoltage, [:phid, LEDVoltage], :int
|
27
|
+
|
28
|
+
module CPhidgetLED
|
29
|
+
def self.method_missing(method, *args, &block)
|
30
|
+
if ::Phidgets::FFI.respond_to?("CPhidgetLED_#{method}".to_sym)
|
31
|
+
if (rs = ::Phidgets::FFI.send("CPhidgetLED_#{method}".to_sym, *args, &block)) != 0
|
32
|
+
raise Phidgets::Error.exception_for(rs), Phidgets::FFI.error_description(rs)
|
33
|
+
end
|
34
|
+
else
|
35
|
+
super(method, *args, &block)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/phidgets-ffi/ffi/log.rb
CHANGED
@@ -9,9 +9,9 @@ module Phidgets
|
|
9
9
|
:verbose
|
10
10
|
)
|
11
11
|
|
12
|
-
attach_function :CPhidget_enableLogging, [LogLevel, :string], :int
|
13
|
-
attach_function :CPhidget_disableLogging, [], :int
|
14
|
-
attach_function :CPhidget_log, [LogLevel, :string, :string, :varargs], :int
|
12
|
+
attach_function :CPhidget_enableLogging, [LogLevel, :string], :int
|
13
|
+
attach_function :CPhidget_disableLogging, [], :int
|
14
|
+
attach_function :CPhidget_log, [LogLevel, :string, :string, :varargs], :int
|
15
15
|
|
16
16
|
module Log
|
17
17
|
def self.log(loglevel, identifier, message, *args)
|
@@ -23,11 +23,12 @@ module Phidgets
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.method_missing(method, *args, &block)
|
26
|
+
|
26
27
|
if ::Phidgets::FFI.respond_to?("CPhidget_#{method}".to_sym)
|
27
|
-
|
28
|
-
|
28
|
+
if (rs = ::Phidgets::FFI.send("CPhidget_#{method}".to_sym, *args, &block)) != 0
|
29
|
+
raise Phidgets::Error.exception_for(rs), Phidgets::FFI.error_description(rs)
|
29
30
|
end
|
30
|
-
else
|
31
|
+
else
|
31
32
|
super(method, *args, &block)
|
32
33
|
end
|
33
34
|
end
|
@@ -1,27 +1,42 @@
|
|
1
1
|
module Phidgets
|
2
2
|
module FFI
|
3
|
-
typedef :pointer, :phidm
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
attach_function :CPhidgetManager_set_OnDetach_Handler, [:phidm, :CPhidgetManager_set_OnDetach_Callback, :user_ptr], :int #int CPhidgetManager_set_OnDetach_Handler(CPhidgetManagerHandle phidm, int ( *fptr)(CPhidgetHandle phid, void *userPtr), void *userPtr);
|
13
|
-
attach_function :CPhidgetManager_getAttachedDevices, [:phidm, :pointer, :pointer], :int #int CPhidgetManager_getAttachedDevices(CPhidgetManagerHandle phidm, CPhidgetHandle *phidArray[], int *count);
|
14
|
-
attach_function :CPhidgetManager_freeAttachedDevicesArray, [:pointer], :int #int CPhidgetManager_freeAttachedDevicesArray(CPhidgetHandle phidArray[]);
|
15
|
-
callback :CPhidgetManager_set_OnError_Callback, [:phidm, :user_ptr, :int, :string], :int
|
16
|
-
attach_function :CPhidgetManager_set_OnError_Handler, [:phidm, :CPhidgetManager_set_OnError_Callback, :user_ptr], :int #int CPhidgetManager_set_OnError_Handler(CPhidgetManagerHandle phidm, int( *fptr)(CPhidgetManagerHandle phidm, void *userPtr, int errorCode, const char *errorString), void *userPtr);
|
17
|
-
callback :CPhidgetManager_set_OnServerConnect_Callback, [:phidm, :user_ptr], :int
|
18
|
-
attach_function :CPhidgetManager_set_OnServerConnect_Handler, [:phidm, :CPhidgetManager_set_OnServerConnect_Callback, :user_ptr], :int #int CPhidgetManager_set_OnServerConnect_Handler(CPhidgetManagerHandle phidm, int ( *fptr)(CPhidgetManagerHandle phidm, void *userPtr), void *userPtr);
|
19
|
-
callback :CPhidgetManager_set_OnServerDisconnect_Callback, [:phidm, :user_ptr], :int
|
20
|
-
attach_function :CPhidgetManager_set_OnServerDisconnect_Handler, [:phidm, :CPhidgetManager_set_OnServerDisconnect_Callback, :user_ptr], :int #int CPhidgetManager_set_OnServerDisconnect_Handler(CPhidgetManagerHandle phidm, int ( *fptr)(CPhidgetManagerHandle phidm, void *userPtr), void *userPtr);
|
21
|
-
attach_function :CPhidgetManager_getServerID, [:phidm, :pointer], :int #int CPhidgetManager_getServerID(CPhidgetManagerHandle phidm, const char **serverID);
|
22
|
-
attach_function :CPhidgetManager_getServerAddress, [:phidm, :pointer, :pointer], :int#int CPhidgetManager_getServerAddress(CPhidgetManagerHandle phidm, const char **address, int *port);
|
4
|
+
if Config::CONFIG['target_os'] =~ /darwin/ #Mac OS X
|
5
|
+
FFI_POINTER_SIZE = 4
|
6
|
+
else #Linux
|
7
|
+
FFI_POINTER_SIZE = 8
|
8
|
+
end
|
9
|
+
|
10
|
+
typedef :pointer, :phidm
|
23
11
|
|
24
|
-
|
12
|
+
attach_function :CPhidgetManager_create, [:phidm], :int
|
13
|
+
attach_function :CPhidgetManager_open, [:phidm], :int
|
14
|
+
attach_function :CPhidgetManager_openRemote, [:phidm, :string, :string], :int
|
15
|
+
attach_function :CPhidgetManager_openRemoteIP, [:phidm, :string, :int, :string], :int
|
16
|
+
attach_function :CPhidgetManager_close, [:phidm], :int
|
17
|
+
attach_function :CPhidgetManager_delete, [:phidm], :int
|
18
|
+
attach_function :CPhidgetManager_getAttachedDevices, [:phidm, :pointer, :pointer], :int
|
19
|
+
attach_function :CPhidgetManager_freeAttachedDevicesArray, [:pointer], :int
|
20
|
+
attach_function :CPhidgetManager_getServerID, [:phidm, :pointer], :int
|
21
|
+
attach_function :CPhidgetManager_getServerAddress, [:phidm, :pointer, :pointer], :int
|
22
|
+
attach_function :CPhidgetManager_getServerStatus, [:phidm, :pointer], :int
|
23
|
+
|
24
|
+
callback :CPhidgetManager_set_OnAttach_Callback, [:phid, :user_ptr], :int
|
25
|
+
attach_function :CPhidgetManager_set_OnAttach_Handler, [:phidm, :CPhidgetManager_set_OnAttach_Callback, :user_ptr], :int
|
26
|
+
|
27
|
+
callback :CPhidgetManager_set_OnDetach_Callback, [:phid, :user_ptr], :int
|
28
|
+
attach_function :CPhidgetManager_set_OnDetach_Handler, [:phidm, :CPhidgetManager_set_OnDetach_Callback, :user_ptr], :int
|
29
|
+
|
30
|
+
callback :CPhidgetManager_set_OnError_Callback, [:phidm, :user_ptr, :int, :string], :int
|
31
|
+
attach_function :CPhidgetManager_set_OnError_Handler, [:phidm, :CPhidgetManager_set_OnError_Callback, :user_ptr], :int
|
32
|
+
|
33
|
+
callback :CPhidgetManager_set_OnServerConnect_Callback, [:phidm, :user_ptr], :int
|
34
|
+
attach_function :CPhidgetManager_set_OnServerConnect_Handler, [:phidm, :CPhidgetManager_set_OnServerConnect_Callback, :user_ptr], :int
|
35
|
+
|
36
|
+
callback :CPhidgetManager_set_OnServerDisconnect_Callback, [:phidm, :user_ptr], :int
|
37
|
+
attach_function :CPhidgetManager_set_OnServerDisconnect_Handler, [:phidm, :CPhidgetManager_set_OnServerDisconnect_Callback, :user_ptr], :int
|
38
|
+
|
39
|
+
module CPhidgetManager
|
25
40
|
def self.method_missing(method, *args, &block)
|
26
41
|
if ::Phidgets::FFI.respond_to?("CPhidgetManager_#{method}".to_sym)
|
27
42
|
if (rs = ::Phidgets::FFI.send("CPhidgetManager_#{method}".to_sym, *args, &block)) != 0
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Phidgets
|
2
|
+
module FFI
|
3
|
+
|
4
|
+
attach_function :CPhidgetMotorControl_create, [:phid], :int
|
5
|
+
attach_function :CPhidgetMotorControl_getMotorCount, [:phid, :pointer], :int
|
6
|
+
attach_function :CPhidgetMotorControl_getInputCount, [:phid, :pointer], :int
|
7
|
+
attach_function :CPhidgetMotorControl_getEncoderCount, [:phid, :pointer], :int
|
8
|
+
attach_function :CPhidgetMotorControl_getSensorCount, [:phid, :pointer], :int
|
9
|
+
attach_function :CPhidgetMotorControl_getVelocity, [:phid, :int, :pointer], :int
|
10
|
+
attach_function :CPhidgetMotorControl_setVelocity, [:phid, :int, :double], :int
|
11
|
+
attach_function :CPhidgetMotorControl_getAcceleration, [:phid, :int, :pointer], :int
|
12
|
+
attach_function :CPhidgetMotorControl_setAcceleration, [:phid, :int, :double], :int
|
13
|
+
attach_function :CPhidgetMotorControl_getAccelerationMax, [:phid, :int, :pointer], :int
|
14
|
+
attach_function :CPhidgetMotorControl_getAccelerationMin, [:phid, :int, :pointer], :int
|
15
|
+
attach_function :CPhidgetMotorControl_getCurrent, [:phid, :int, :pointer], :int
|
16
|
+
attach_function :CPhidgetMotorControl_getInputState, [:phid, :int, :pointer], :int
|
17
|
+
attach_function :CPhidgetMotorControl_getEncoderPosition, [:phid, :int, :pointer], :int
|
18
|
+
attach_function :CPhidgetMotorControl_setEncoderPosition, [:phid, :int, :int], :int
|
19
|
+
attach_function :CPhidgetMotorControl_getBackEMFSensingState, [:phid, :int, :pointer], :int
|
20
|
+
attach_function :CPhidgetMotorControl_setBackEMFSensingState, [:phid, :int, :int], :int
|
21
|
+
attach_function :CPhidgetMotorControl_getBackEMF, [:phid, :int, :pointer], :int
|
22
|
+
attach_function :CPhidgetMotorControl_getSupplyVoltage, [:phid, :pointer], :int
|
23
|
+
attach_function :CPhidgetMotorControl_getBraking, [:phid, :int, :pointer], :int
|
24
|
+
attach_function :CPhidgetMotorControl_setBraking, [:phid, :int, :double], :int
|
25
|
+
attach_function :CPhidgetMotorControl_getSensorValue, [:phid, :int, :pointer], :int
|
26
|
+
attach_function :CPhidgetMotorControl_getSensorRawValue, [:phid, :int, :pointer], :int
|
27
|
+
attach_function :CPhidgetMotorControl_getRatiometric, [:phid, :pointer], :int
|
28
|
+
attach_function :CPhidgetMotorControl_setRatiometric, [:phid, :int], :int
|
29
|
+
|
30
|
+
callback :CPhidgetMotorControl_set_OnVelocityChange_Callback, [:phid, :user_ptr, :int, :double], :int
|
31
|
+
attach_function :CPhidgetMotorControl_set_OnVelocityChange_Handler, [:phid, :CPhidgetMotorControl_set_OnVelocityChange_Callback, :user_ptr], :int
|
32
|
+
|
33
|
+
callback :CPhidgetMotorControl_set_OnCurrentChange_Callback, [:phid, :user_ptr, :int, :double], :int
|
34
|
+
attach_function :CPhidgetMotorControl_set_OnCurrentChange_Handler, [:phid, :CPhidgetMotorControl_set_OnCurrentChange_Callback, :user_ptr], :int
|
35
|
+
|
36
|
+
callback :CPhidgetMotorControl_set_OnInputChange_Callback, [:phid, :user_ptr, :int, :int], :int
|
37
|
+
attach_function :CPhidgetMotorControl_set_OnInputChange_Handler, [:phid, :CPhidgetMotorControl_set_OnInputChange_Callback, :user_ptr], :int
|
38
|
+
|
39
|
+
callback :CPhidgetMotorControl_set_OnEncoderPositionChange_Callback, [:phid, :user_ptr, :int, :int, :int], :int
|
40
|
+
attach_function :CPhidgetMotorControl_set_OnEncoderPositionChange_Handler, [:phid, :CPhidgetMotorControl_set_OnEncoderPositionChange_Callback, :user_ptr], :int
|
41
|
+
|
42
|
+
callback :CPhidgetMotorControl_set_OnEncoderPositionUpdate_Callback, [:phid, :user_ptr, :int, :int], :int
|
43
|
+
attach_function :CPhidgetMotorControl_set_OnEncoderPositionUpdate_Handler, [:phid, :CPhidgetMotorControl_set_OnEncoderPositionUpdate_Callback, :user_ptr], :int
|
44
|
+
|
45
|
+
callback :CPhidgetMotorControl_set_OnBackEMFUpdate_Callback, [:phid, :user_ptr, :int, :double], :int
|
46
|
+
attach_function :CPhidgetMotorControl_set_OnBackEMFUpdate_Handler, [:phid, :CPhidgetMotorControl_set_OnBackEMFUpdate_Callback, :user_ptr], :int
|
47
|
+
|
48
|
+
callback :CPhidgetMotorControl_set_OnSensorUpdate_Callback, [:phid, :user_ptr, :int, :int], :int
|
49
|
+
attach_function :CPhidgetMotorControl_set_OnSensorUpdate_Handler, [:phid, :CPhidgetMotorControl_set_OnSensorUpdate_Callback, :user_ptr], :int
|
50
|
+
|
51
|
+
callback :CPhidgetMotorControl_set_OnCurrentUpdate_Callback, [:phid, :user_ptr, :int, :double], :int
|
52
|
+
attach_function :CPhidgetMotorControl_set_OnCurrentUpdate_Handler, [:phid, :CPhidgetMotorControl_set_OnCurrentUpdate_Callback, :user_ptr], :int
|
53
|
+
|
54
|
+
module CPhidgetMotorControl
|
55
|
+
def self.method_missing(method, *args, &block)
|
56
|
+
if ::Phidgets::FFI.respond_to?("CPhidgetMotorControl_#{method}".to_sym)
|
57
|
+
if (rs = ::Phidgets::FFI.send("CPhidgetMotorControl_#{method}".to_sym, *args, &block)) != 0
|
58
|
+
raise Phidgets::Error.exception_for(rs), Phidgets::FFI.error_description(rs)
|
59
|
+
end
|
60
|
+
else
|
61
|
+
super(method, *args, &block)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Phidgets
|
2
|
+
module FFI
|
3
|
+
|
4
|
+
attach_function :CPhidgetRFID_create, [:phid], :int
|
5
|
+
attach_function :CPhidgetRFID_getOutputCount, [:phid, :pointer], :int
|
6
|
+
attach_function :CPhidgetRFID_getOutputState, [:phid, :int, :pointer], :int
|
7
|
+
attach_function :CPhidgetRFID_setOutputState, [:phid, :int, :int], :int
|
8
|
+
attach_function :CPhidgetRFID_getAntennaOn, [:phid, :pointer], :int
|
9
|
+
attach_function :CPhidgetRFID_setAntennaOn, [:phid, :int], :int
|
10
|
+
attach_function :CPhidgetRFID_getLEDOn, [:phid, :pointer], :int
|
11
|
+
attach_function :CPhidgetRFID_setLEDOn, [:phid, :int], :int
|
12
|
+
attach_function :CPhidgetRFID_getLastTag, [:phid, :pointer], :int
|
13
|
+
attach_function :CPhidgetRFID_getTagStatus, [:phid, :pointer], :int
|
14
|
+
|
15
|
+
callback :CPhidgetRFID_set_OnOutputChange_Callback, [:phid, :user_ptr, :int, :int], :int
|
16
|
+
attach_function :CPhidgetRFID_set_OnOutputChange_Handler, [:phid, :CPhidgetRFID_set_OnOutputChange_Callback, :user_ptr], :int
|
17
|
+
|
18
|
+
callback :CPhidgetRFID_set_OnTag_Callback, [:phid, :user_ptr, :pointer], :int
|
19
|
+
attach_function :CPhidgetRFID_set_OnTag_Handler, [:phid, :CPhidgetRFID_set_OnTag_Callback, :user_ptr], :int
|
20
|
+
|
21
|
+
callback :CPhidgetRFID_set_OnTagLost_Callback, [:phid, :user_ptr, :pointer], :int
|
22
|
+
attach_function :CPhidgetRFID_set_OnTagLost_Handler, [:phid, :CPhidgetRFID_set_OnTagLost_Callback, :user_ptr], :int
|
23
|
+
|
24
|
+
module CPhidgetRFID
|
25
|
+
def self.method_missing(method, *args, &block)
|
26
|
+
if ::Phidgets::FFI.respond_to?("CPhidgetRFID_#{method}".to_sym)
|
27
|
+
if (rs = ::Phidgets::FFI.send("CPhidgetRFID_#{method}".to_sym, *args, &block)) != 0
|
28
|
+
raise Phidgets::Error.exception_for(rs), Phidgets::FFI.error_description(rs)
|
29
|
+
end
|
30
|
+
else
|
31
|
+
super(method, *args, &block)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -18,23 +18,24 @@ module Phidgets
|
|
18
18
|
:firgelli_l12_50_210_06_r,
|
19
19
|
:firgelli_l12_100_50_06_r,
|
20
20
|
:firgelli_l12_100_100_06_r,
|
21
|
-
:
|
21
|
+
:user_defined
|
22
22
|
)
|
23
23
|
|
24
|
-
attach_function :CPhidgetServo_create, [:phid], :int
|
25
|
-
attach_function :CPhidgetServo_getMotorCount, [:phid, :pointer], :int
|
26
|
-
attach_function :CPhidgetServo_getPosition, [:phid, :int, :pointer], :int
|
27
|
-
attach_function :CPhidgetServo_setPosition, [:phid, :int, :double], :int
|
28
|
-
attach_function :CPhidgetServo_getPositionMax, [:phid, :int, :pointer], :int
|
29
|
-
attach_function :CPhidgetServo_getPositionMin, [:phid, :int, :pointer], :int
|
30
|
-
|
31
|
-
attach_function :
|
32
|
-
attach_function :
|
33
|
-
attach_function :
|
34
|
-
attach_function :
|
35
|
-
attach_function :CPhidgetServo_setServoType, [:phid, :int, ServoType], :int #int CPhidgetServo_setServoType(CPhidgetServoHandle phid, int index, CPhidget_ServoType servoType);
|
36
|
-
attach_function :CPhidgetServo_setServoParameters, [:phid, :int, :double, :double, :double], :int #int CPhidgetServo_setServoParameters(CPhidgetServoHandle phid, int index, double min_us,double max_us,double degrees);
|
24
|
+
attach_function :CPhidgetServo_create, [:phid], :int
|
25
|
+
attach_function :CPhidgetServo_getMotorCount, [:phid, :pointer], :int
|
26
|
+
attach_function :CPhidgetServo_getPosition, [:phid, :int, :pointer], :int
|
27
|
+
attach_function :CPhidgetServo_setPosition, [:phid, :int, :double], :int
|
28
|
+
attach_function :CPhidgetServo_getPositionMax, [:phid, :int, :pointer], :int
|
29
|
+
attach_function :CPhidgetServo_getPositionMin, [:phid, :int, :pointer], :int
|
30
|
+
attach_function :CPhidgetServo_getEngaged, [:phid, :int, :pointer], :int
|
31
|
+
attach_function :CPhidgetServo_setEngaged, [:phid, :int, :int], :int
|
32
|
+
attach_function :CPhidgetServo_getServoType, [:phid, :int, :pointer], :int
|
33
|
+
attach_function :CPhidgetServo_setServoType, [:phid, :int, ServoType], :int
|
34
|
+
attach_function :CPhidgetServo_setServoParameters, [:phid, :int, :double, :double, :double], :int
|
37
35
|
|
36
|
+
callback :CPhidgetServo_set_OnPositionChange_Callback, [:phid, :user_ptr, :int, :double], :int
|
37
|
+
attach_function :CPhidgetServo_set_OnPositionChange_Handler, [:phid, :CPhidgetServo_set_OnPositionChange_Callback, :user_ptr], :int
|
38
|
+
|
38
39
|
module CPhidgetServo
|
39
40
|
def self.method_missing(method, *args, &block)
|
40
41
|
if ::Phidgets::FFI.respond_to?("CPhidgetServo_#{method}".to_sym)
|
@@ -47,4 +48,4 @@ module Phidgets
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
50
|
-
end
|
51
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Phidgets
|
2
|
+
module FFI
|
3
|
+
|
4
|
+
attach_function :CPhidgetSpatial_create, [:phid], :int
|
5
|
+
attach_function :CPhidgetSpatial_getAccelerationAxisCount, [:phid, :pointer], :int
|
6
|
+
attach_function :CPhidgetSpatial_getGyroAxisCount, [:phid, :pointer], :int
|
7
|
+
attach_function :CPhidgetSpatial_getCompassAxisCount, [:phid, :pointer], :int
|
8
|
+
attach_function :CPhidgetSpatial_getAcceleration, [:phid, :int, :pointer], :int
|
9
|
+
attach_function :CPhidgetSpatial_getAccelerationMax, [:phid, :int, :pointer], :int
|
10
|
+
attach_function :CPhidgetSpatial_getAccelerationMin, [:phid, :int, :pointer], :int
|
11
|
+
attach_function :CPhidgetSpatial_getAngularRate, [:phid, :int, :pointer], :int
|
12
|
+
attach_function :CPhidgetSpatial_getAngularRateMax, [:phid, :int, :pointer], :int
|
13
|
+
attach_function :CPhidgetSpatial_getAngularRateMin, [:phid, :int, :pointer], :int
|
14
|
+
attach_function :CPhidgetSpatial_getMagneticField, [:phid, :int, :pointer], :int
|
15
|
+
attach_function :CPhidgetSpatial_getMagneticFieldMax, [:phid, :int, :pointer], :int
|
16
|
+
attach_function :CPhidgetSpatial_getMagneticFieldMin, [:phid, :int, :pointer], :int
|
17
|
+
attach_function :CPhidgetSpatial_zeroGyro, [:phid], :int
|
18
|
+
attach_function :CPhidgetSpatial_getDataRate, [:phid, :pointer], :int
|
19
|
+
attach_function :CPhidgetSpatial_setDataRate, [:phid, :int], :int
|
20
|
+
attach_function :CPhidgetSpatial_getDataRateMax, [:phid, :pointer], :int
|
21
|
+
attach_function :CPhidgetSpatial_getDataRateMin, [:phid, :pointer], :int
|
22
|
+
attach_function :CPhidgetSpatial_setCompassCorrectionParameters, [:phid, :double, :double, :double, :double, :double, :double, :double, :double, :double, :double, :double, :double, :double], :int
|
23
|
+
attach_function :CPhidgetSpatial_resetCompassCorrectionParameters, [:phid], :int
|
24
|
+
|
25
|
+
callback :CPhidgetSpatial_set_OnSpatialData_Callback, [:phid, :user_ptr, :pointer, :int], :int
|
26
|
+
attach_function :CPhidgetSpatial_set_OnSpatialData_Handler, [:phid, :CPhidgetSpatial_set_OnSpatialData_Callback, :user_ptr], :int
|
27
|
+
|
28
|
+
module CPhidgetSpatial
|
29
|
+
def self.method_missing(method, *args, &block)
|
30
|
+
if ::Phidgets::FFI.respond_to?("CPhidgetSpatial_#{method}".to_sym)
|
31
|
+
if (rs = ::Phidgets::FFI.send("CPhidgetSpatial_#{method}".to_sym, *args, &block)) != 0
|
32
|
+
raise Phidgets::Error.exception_for(rs), Phidgets::FFI.error_description(rs)
|
33
|
+
end
|
34
|
+
else
|
35
|
+
super(method, *args, &block)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|