LazGem 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -2
- data/lib/LazGem/device.rb +6 -4
- data/lib/LazGem/version.rb +1 -1
- data/lib/LazGem.rb +1 -1
- data/sample/sample_tx.rb +5 -6
- metadata +2 -3
- data/LICENSE +0 -7
data/README.md
CHANGED
@@ -22,7 +22,12 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
please try to execute sample program
|
26
|
+
tx: sample\sample_tx.rb
|
27
|
+
rx: sample\sample_rx.rb
|
28
|
+
|
29
|
+
document(Japanese only):
|
30
|
+
http://www.lapis-semi.com/lazurite-jp/contents/gateway/ruby/LazGem.html
|
26
31
|
|
27
32
|
## Development
|
28
33
|
|
@@ -32,7 +37,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
37
|
|
33
38
|
## Contributing
|
34
39
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/LAPIS-Lazurite/LazGem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
41
|
|
37
42
|
|
38
43
|
## License
|
data/lib/LazGem/device.rb
CHANGED
@@ -27,7 +27,7 @@ class LazGem::Device
|
|
27
27
|
# mode: must be 2
|
28
28
|
# return
|
29
29
|
# none
|
30
|
-
def device_open(ch=36, panid=0xabcd, pwr=20, rate=100, mode=2
|
30
|
+
def device_open(ch=36, panid=0xabcd, pwr=20, rate=100, mode=2)
|
31
31
|
if(ch < 24) || (ch > 61) then
|
32
32
|
puts "ch is invalid. it must be 24-61"
|
33
33
|
raise LAZURITE_ERROR
|
@@ -43,7 +43,7 @@ class LazGem::Device
|
|
43
43
|
raise LAZURITE_ERROR
|
44
44
|
return
|
45
45
|
end
|
46
|
-
cmd = "sudo insmod /home/pi/driver/
|
46
|
+
cmd = "sudo insmod /home/pi/driver/LazDriver/DRV_802154.ko ch=" +ch.to_s+" panid=0x"+panid.to_s(16)+ " pwr="+pwr.to_s+" rate="+rate.to_s + " mode="+mode.to_s(16)
|
47
47
|
result = system(cmd)
|
48
48
|
bp3596_dev = "/dev/bp3596"
|
49
49
|
sleep(0.1)
|
@@ -218,7 +218,8 @@ class LazGem::Device
|
|
218
218
|
#payload
|
219
219
|
payload =packet["payload"]
|
220
220
|
if payload.length > 235 then
|
221
|
-
|
221
|
+
puts "Payload size over. maximum length is less than 235"
|
222
|
+
raise LAZURITE_ERROR
|
222
223
|
return
|
223
224
|
end
|
224
225
|
|
@@ -228,7 +229,8 @@ class LazGem::Device
|
|
228
229
|
begin
|
229
230
|
len = @@device_wr.write(raw)
|
230
231
|
rescue
|
231
|
-
|
232
|
+
puts "Doesn't receive ACK"
|
233
|
+
raise LAZURITE_ERROR
|
232
234
|
end
|
233
235
|
return len
|
234
236
|
end
|
data/lib/LazGem/version.rb
CHANGED
data/lib/LazGem.rb
CHANGED
data/sample/sample_tx.rb
CHANGED
@@ -3,14 +3,10 @@
|
|
3
3
|
# Function:
|
4
4
|
# Lazurite Sub-GHz/Lazurite Pi Gateway Sample program
|
5
5
|
# SerialMonitor.rb
|
6
|
-
require '
|
6
|
+
require 'LazGem'
|
7
7
|
|
8
8
|
laz = LazGem::Device.new
|
9
9
|
|
10
|
-
#laz.open(ch=10)
|
11
|
-
#laz.open()
|
12
|
-
##laz.open(ch=24)
|
13
|
-
|
14
10
|
finish_flag=0
|
15
11
|
Signal.trap(:INT){
|
16
12
|
finish_flag=1
|
@@ -21,7 +17,10 @@ laz.device_open()
|
|
21
17
|
while finish_flag == 0 do
|
22
18
|
tx = Hash["rxAddr" => 0x902b]
|
23
19
|
tx["payload"] = "Welcome SubGHz\n"
|
24
|
-
|
20
|
+
begin
|
21
|
+
laz.write(tx)
|
22
|
+
rescue LAZURITE_ERROR
|
23
|
+
end
|
25
24
|
end
|
26
25
|
|
27
26
|
laz.device_close()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: LazGem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-03-
|
13
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -72,7 +72,6 @@ files:
|
|
72
72
|
- .travis.yml
|
73
73
|
- CODE_OF_CONDUCT.md
|
74
74
|
- Gemfile
|
75
|
-
- LICENSE
|
76
75
|
- LICENSE.txt
|
77
76
|
- LazGem.gemspec
|
78
77
|
- README.md
|
data/LICENSE
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
Copyright (c) <year> <copyright holders>
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
6
|
-
|
7
|
-
|