phidgets_native 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.lock +12 -0
  3. data/README.rdoc +176 -0
  4. data/Rakefile +31 -0
  5. data/examples/gps.rb +25 -0
  6. data/examples/interface_kit.rb +61 -0
  7. data/examples/lib/common.rb +51 -0
  8. data/examples/lib/console_table.rb +38 -0
  9. data/examples/list_all.rb +16 -0
  10. data/examples/spatial.rb +53 -0
  11. data/ext/phidgets_native/accelerometer_ruby.c +36 -0
  12. data/ext/phidgets_native/advancedservo_ruby.c +33 -0
  13. data/ext/phidgets_native/analog_ruby.c +34 -0
  14. data/ext/phidgets_native/bridge_ruby.c +32 -0
  15. data/ext/phidgets_native/device.c +68 -0
  16. data/ext/phidgets_native/device_ruby.c +404 -0
  17. data/ext/phidgets_native/encoder_ruby.c +34 -0
  18. data/ext/phidgets_native/extconf.rb +18 -0
  19. data/ext/phidgets_native/frequencycounter_ruby.c +32 -0
  20. data/ext/phidgets_native/gps.c +102 -0
  21. data/ext/phidgets_native/gps_ruby.c +212 -0
  22. data/ext/phidgets_native/interfacekit.c +203 -0
  23. data/ext/phidgets_native/interfacekit_ruby.c +507 -0
  24. data/ext/phidgets_native/ir_ruby.c +33 -0
  25. data/ext/phidgets_native/led_ruby.c +33 -0
  26. data/ext/phidgets_native/motorcontrol_ruby.c +32 -0
  27. data/ext/phidgets_native/phidgets_native.c +197 -0
  28. data/ext/phidgets_native/phidgets_native.h +320 -0
  29. data/ext/phidgets_native/phidgets_native_ruby.c +468 -0
  30. data/ext/phidgets_native/phsensor_ruby.c +32 -0
  31. data/ext/phidgets_native/rfid_ruby.c +31 -0
  32. data/ext/phidgets_native/servo_ruby.c +31 -0
  33. data/ext/phidgets_native/spatial.c +168 -0
  34. data/ext/phidgets_native/spatial_ruby.c +533 -0
  35. data/ext/phidgets_native/stepper_ruby.c +32 -0
  36. data/ext/phidgets_native/temperaturesensor_ruby.c +31 -0
  37. data/ext/phidgets_native/textlcd_ruby.c +31 -0
  38. data/ext/phidgets_native/textled_ruby.c +31 -0
  39. data/ext/phidgets_native/weightsensor_ruby.c +32 -0
  40. data/phidgets_native.gemspec +21 -0
  41. metadata +96 -0
@@ -0,0 +1,32 @@
1
+ #include "phidgets_native.h"
2
+
3
+ /*
4
+ * Document-class: PhidgetsNative::Stepper < PhidgetsNative::Device
5
+ *
6
+ * This class is a stub, and is currently in need of an actual implementation.
7
+ * Nonetheless, all of the methods from its parent class PhidgetsNative::Device are
8
+ * available.
9
+ */
10
+ void Init_phidgets_native_stepper(VALUE m_Phidget) {
11
+ VALUE c_Device = rb_const_get(m_Phidget, rb_intern("Device"));
12
+
13
+ VALUE c_Stepper = rb_define_class_under(m_Phidget, "Stepper", c_Device);
14
+
15
+ /*
16
+ * Document-method: new
17
+ * call-seq:
18
+ * new(serial_number)
19
+ *
20
+ * All phidget objects are created from the device serial number. Serial numbers
21
+ * are required to be Fixnums (aka "unsigned integers").
22
+ */
23
+ rb_define_method(c_Stepper, "initialize", stepper_initialize, 1);
24
+ }
25
+
26
+ VALUE stepper_initialize(VALUE self, VALUE serial) {
27
+ PhidgetInfo *info = device_info(self);
28
+ CPhidgetStepperHandle stepper = 0;
29
+ ensure(CPhidgetStepper_create(&stepper));
30
+ info->handle = (CPhidgetHandle)stepper;
31
+ return rb_call_super(1, &serial);
32
+ }
@@ -0,0 +1,31 @@
1
+ #include "phidgets_native.h"
2
+
3
+ /*
4
+ * Document-class: PhidgetsNative::TemperatureSensor < PhidgetsNative::Device
5
+ *
6
+ * This class is a stub, and is currently in need of an actual implementation.
7
+ * Nonetheless, all of the methods from its parent class PhidgetsNative::Device are
8
+ * available.
9
+ */
10
+ void Init_phidgets_native_temperaturesensor(VALUE m_Phidget) {
11
+ VALUE c_Device = rb_const_get(m_Phidget, rb_intern("Device"));
12
+ VALUE c_TemperatureSensor = rb_define_class_under(m_Phidget, "TemperatureSensor", c_Device);
13
+
14
+ /*
15
+ * Document-method: new
16
+ * call-seq:
17
+ * new(serial_number)
18
+ *
19
+ * All phidget objects are created from the device serial number. Serial numbers
20
+ * are required to be Fixnums (aka "unsigned integers").
21
+ */
22
+ rb_define_method(c_TemperatureSensor, "initialize", temperaturesensor_initialize, 1);
23
+ }
24
+
25
+ VALUE temperaturesensor_initialize(VALUE self, VALUE serial) {
26
+ PhidgetInfo *info = device_info(self);
27
+ CPhidgetTemperatureSensorHandle temperaturesensor = 0;
28
+ ensure(CPhidgetTemperatureSensor_create(&temperaturesensor));
29
+ info->handle = (CPhidgetHandle)temperaturesensor;
30
+ return rb_call_super(1, &serial);
31
+ }
@@ -0,0 +1,31 @@
1
+ #include "phidgets_native.h"
2
+
3
+ /*
4
+ * Document-class: PhidgetsNative::TextLCD < PhidgetsNative::Device
5
+ *
6
+ * This class is a stub, and is currently in need of an actual implementation.
7
+ * Nonetheless, all of the methods from its parent class PhidgetsNative::Device are
8
+ * available.
9
+ */
10
+ void Init_phidgets_native_textlcd(VALUE m_Phidget) {
11
+ VALUE c_Device = rb_const_get(m_Phidget, rb_intern("Device"));
12
+ VALUE c_TextLCD = rb_define_class_under(m_Phidget, "TextLCD", c_Device);
13
+
14
+ /*
15
+ * Document-method: new
16
+ * call-seq:
17
+ * new(serial_number)
18
+ *
19
+ * All phidget objects are created from the device serial number. Serial numbers
20
+ * are required to be Fixnums (aka "unsigned integers").
21
+ */
22
+ rb_define_method(c_TextLCD, "initialize", textlcd_initialize, 1);
23
+ }
24
+
25
+ VALUE textlcd_initialize(VALUE self, VALUE serial) {
26
+ PhidgetInfo *info = device_info(self);
27
+ CPhidgetTextLCDHandle textlcd = 0;
28
+ ensure(CPhidgetTextLCD_create(&textlcd));
29
+ info->handle = (CPhidgetHandle)textlcd;
30
+ return rb_call_super(1, &serial);
31
+ }
@@ -0,0 +1,31 @@
1
+ #include "phidgets_native.h"
2
+
3
+ /*
4
+ * Document-class: PhidgetsNative::TextLED < PhidgetsNative::Device
5
+ *
6
+ * This class is a stub, and is currently in need of an actual implementation.
7
+ * Nonetheless, all of the methods from its parent class PhidgetsNative::Device are
8
+ * available.
9
+ */
10
+ void Init_phidgets_native_textled(VALUE m_Phidget) {
11
+ VALUE c_Device = rb_const_get(m_Phidget, rb_intern("Device"));
12
+ VALUE c_TextLED = rb_define_class_under(m_Phidget, "TextLED", c_Device);
13
+
14
+ /*
15
+ * Document-method: new
16
+ * call-seq:
17
+ * new(serial_number)
18
+ *
19
+ * All phidget objects are created from the device serial number. Serial numbers
20
+ * are required to be Fixnums (aka "unsigned integers").
21
+ */
22
+ rb_define_method(c_TextLED, "initialize", textled_initialize, 1);
23
+ }
24
+
25
+ VALUE textled_initialize(VALUE self, VALUE serial) {
26
+ PhidgetInfo *info = device_info(self);
27
+ CPhidgetTextLEDHandle textled = 0;
28
+ ensure(CPhidgetTextLED_create(&textled));
29
+ info->handle = (CPhidgetHandle)textled;
30
+ return rb_call_super(1, &serial);
31
+ }
@@ -0,0 +1,32 @@
1
+ #include "phidgets_native.h"
2
+
3
+ /*
4
+ * Document-class: PhidgetsNative::WeightSensor < PhidgetsNative::Device
5
+ *
6
+ * This class is a stub, and is currently in need of an actual implementation.
7
+ * Nonetheless, all of the methods from its parent class PhidgetsNative::Device are
8
+ * available.
9
+ */
10
+ void Init_phidgets_native_weightsensor(VALUE m_Phidget) {
11
+ VALUE c_Device = rb_const_get(m_Phidget, rb_intern("Device"));
12
+
13
+ VALUE c_WeightSensor = rb_define_class_under(m_Phidget, "WeightSensor", c_Device);
14
+
15
+ /*
16
+ * Document-method: new
17
+ * call-seq:
18
+ * new(serial_number)
19
+ *
20
+ * All phidget objects are created from the device serial number. Serial numbers
21
+ * are required to be Fixnums (aka "unsigned integers").
22
+ */
23
+ rb_define_method(c_WeightSensor, "initialize", weightsensor_initialize, 1);
24
+ }
25
+
26
+ VALUE weightsensor_initialize(VALUE self, VALUE serial) {
27
+ PhidgetInfo *info = device_info(self);
28
+ CPhidgetWeightSensorHandle weightsensor = 0;
29
+ ensure(CPhidgetWeightSensor_create(&weightsensor));
30
+ info->handle = (CPhidgetHandle)weightsensor;
31
+ return rb_call_super(1, &serial);
32
+ }
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "phidgets_native"
3
+ s.version = "0.1.0"
4
+ s.summary = "Native C-extension gem for the Phidgets library in ruby"
5
+ s.author = "Chris DeRose"
6
+ s.description = s.summary
7
+ s.author = "Chris DeRose, DeRose Technologies, Inc."
8
+ s.email = 'cderose@derosetechnologies.com'
9
+ s.homepage = 'http://www.derosetechnologies.com/community/phidgets_native'
10
+
11
+ s.files = Dir.glob("ext/**/*.{c,h,rb}") +
12
+ Dir.glob("examples/*.rb") +
13
+ Dir.glob("examples/lib/*.rb") +
14
+ Dir.glob("lib/**/*.rb")+
15
+ %w(Rakefile README.rdoc Gemfile Gemfile.lock phidgets_native.gemspec)
16
+
17
+ s.extensions << "ext/phidgets_native/extconf.rb"
18
+
19
+ s.add_development_dependency "rake-compiler"
20
+ end
21
+
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: phidgets_native
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chris DeRose, DeRose Technologies, Inc.
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake-compiler
16
+ requirement: &70343382636480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70343382636480
25
+ description: Native C-extension gem for the Phidgets library in ruby
26
+ email: cderose@derosetechnologies.com
27
+ executables: []
28
+ extensions:
29
+ - ext/phidgets_native/extconf.rb
30
+ extra_rdoc_files: []
31
+ files:
32
+ - ext/phidgets_native/accelerometer_ruby.c
33
+ - ext/phidgets_native/advancedservo_ruby.c
34
+ - ext/phidgets_native/analog_ruby.c
35
+ - ext/phidgets_native/bridge_ruby.c
36
+ - ext/phidgets_native/device.c
37
+ - ext/phidgets_native/device_ruby.c
38
+ - ext/phidgets_native/encoder_ruby.c
39
+ - ext/phidgets_native/frequencycounter_ruby.c
40
+ - ext/phidgets_native/gps.c
41
+ - ext/phidgets_native/gps_ruby.c
42
+ - ext/phidgets_native/interfacekit.c
43
+ - ext/phidgets_native/interfacekit_ruby.c
44
+ - ext/phidgets_native/ir_ruby.c
45
+ - ext/phidgets_native/led_ruby.c
46
+ - ext/phidgets_native/motorcontrol_ruby.c
47
+ - ext/phidgets_native/phidgets_native.c
48
+ - ext/phidgets_native/phidgets_native_ruby.c
49
+ - ext/phidgets_native/phsensor_ruby.c
50
+ - ext/phidgets_native/rfid_ruby.c
51
+ - ext/phidgets_native/servo_ruby.c
52
+ - ext/phidgets_native/spatial.c
53
+ - ext/phidgets_native/spatial_ruby.c
54
+ - ext/phidgets_native/stepper_ruby.c
55
+ - ext/phidgets_native/temperaturesensor_ruby.c
56
+ - ext/phidgets_native/textlcd_ruby.c
57
+ - ext/phidgets_native/textled_ruby.c
58
+ - ext/phidgets_native/weightsensor_ruby.c
59
+ - ext/phidgets_native/phidgets_native.h
60
+ - ext/phidgets_native/extconf.rb
61
+ - examples/gps.rb
62
+ - examples/interface_kit.rb
63
+ - examples/list_all.rb
64
+ - examples/spatial.rb
65
+ - examples/lib/common.rb
66
+ - examples/lib/console_table.rb
67
+ - Rakefile
68
+ - README.rdoc
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - phidgets_native.gemspec
72
+ homepage: http://www.derosetechnologies.com/community/phidgets_native
73
+ licenses: []
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 1.8.17
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: Native C-extension gem for the Phidgets library in ruby
96
+ test_files: []