udooneorest 1.1.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f04356d8f0e7dca9c4a89942d4cc2c84cb1fc3a7
4
- data.tar.gz: ad3198e32c6d89e617623caaafa9314ad57bd5b7
3
+ metadata.gz: bcc58e5419a29f76098c1cb0bfb4dd294c4752e7
4
+ data.tar.gz: b7ddc7c54f0a13ee5088c9209a6e0db777df45cc
5
5
  SHA512:
6
- metadata.gz: 793aa4e19948c790121b0f9bb79ac91e40e271e6b45084abda99b72a9091a00d7edc71b9e02d5862a5f28f0704a6f5574072d88db6aa70393bb1bd6f0349b42d
7
- data.tar.gz: 283270ed5b59cec11d99ee89851c78665ff23fc03256e80eb363234436577c944c5d17fa3d3700d8d676b43b36e7412ba03ad66244308de027f794376a89ef3a
6
+ metadata.gz: a34c0aca59391a1af11f815c1649c0981c5cec1f519db55354ea7bc81f4699835beec447eac97f98671aafc815ce060db33ab5b9a4c24ccec6de01008d92a933
7
+ data.tar.gz: d5f785222117f710de228213c98d061c168eba287a6182824fb8b11ac1d8b01db38e09416469901837aedb129b9a2207880fc07550aab6899302c0d10a4dce0a
@@ -27,6 +27,8 @@ summarized what you need to do here:
27
27
  SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chmod -R g+rw /sys%p'"
28
28
  SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown -R root:ugpio /sys/class/gpio/export'"
29
29
  SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chmod -R g+w /sys/class/gpio/export'"
30
+ SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown -R root:ugpio /sys/class/gpio/unexport'"
31
+ SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chmod -R g+w /sys/class/gpio/unexport'"
30
32
 
31
33
  3) Make the following group/user changes:
32
34
 
@@ -21,19 +21,35 @@ module UdooNeoRest
21
21
  export_pin params[:pin]
22
22
  end
23
23
 
24
+ post '/gpio/:gpio/unexport' do
25
+ export_gpio params[:gpio], :unexport
26
+ end
27
+
28
+ post '/pin/:pin/unexport' do
29
+ export_pin params[:pin], :unexport
30
+ end
31
+
32
+ get '/lazyrest/gpio/:gpio/unexport' do
33
+ export_gpio params[:gpio], :unexport
34
+ end
35
+
36
+ get '/lazyrest/pin/:pin/unexport' do
37
+ export_pin params[:pin], :unexport
38
+ end
39
+
24
40
  #############################################################################
25
41
  # Export using the pin
26
42
  #
27
43
  # pin : the pin to be exported
28
44
  #
29
- def export_pin(pin)
45
+ def export_pin(pin, mode = :export)
30
46
 
31
47
  # Validate the pin
32
48
  pin_ = ValidatePin.new pin
33
49
  return pin_.error_message unless pin_.valid?
34
50
 
35
51
  # Export the value after translating to gpio
36
- export_gpio pin_.to_gpio
52
+ export_gpio pin_.to_gpio, mode
37
53
  end
38
54
 
39
55
  #############################################################################
@@ -41,14 +57,14 @@ module UdooNeoRest
41
57
  #
42
58
  # gpio : the gpio to be exported
43
59
  #
44
- def export_gpio(gpio)
60
+ def export_gpio(gpio, mode = :export)
45
61
 
46
62
  # lets make sure the gpio is good
47
63
  gpio_ = ValidateGpio.new gpio
48
64
  return gpio_.error_message unless gpio_.valid?
49
65
 
50
66
  # send the command
51
- result = UdooNeoRest::Base.echo gpio, "#{BASE_PATH}export"
67
+ result = UdooNeoRest::Base.echo gpio, "#{BASE_PATH}#{'un' if mode == :unexport}export"
52
68
 
53
69
  # return ok if all is well
54
70
  return UdooNeoRest::Base.status_ok if result.empty?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: udooneorest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Sullivan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-20 00:00:00.000000000 Z
11
+ date: 2015-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra