ruby-xbee 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE +11 -0
- data/README.rdoc +232 -0
- data/Rakefile +38 -0
- data/agpl.txt +661 -0
- data/bin/apicontrol.rb +37 -0
- data/bin/apilisten.rb +14 -0
- data/bin/ruby-xbee.rb +27 -0
- data/bin/xbeeconfigure.rb +263 -0
- data/bin/xbeedio.rb +89 -0
- data/bin/xbeeinfo.rb +110 -0
- data/bin/xbeelisten.rb +114 -0
- data/bin/xbeesend.rb +81 -0
- data/lib/apimode/at_commands.rb +28 -0
- data/lib/apimode/frame/at_command.rb +34 -0
- data/lib/apimode/frame/at_command_response.rb +33 -0
- data/lib/apimode/frame/explicit_addressing_command.rb +7 -0
- data/lib/apimode/frame/explicit_rx_indicator.rb +6 -0
- data/lib/apimode/frame/frame.rb +123 -0
- data/lib/apimode/frame/modem_status.rb +32 -0
- data/lib/apimode/frame/receive_packet.rb +6 -0
- data/lib/apimode/frame/remote_command_request.rb +34 -0
- data/lib/apimode/frame/remote_command_response.rb +22 -0
- data/lib/apimode/frame/transmit_request.rb +7 -0
- data/lib/apimode/frame/transmit_status.rb +6 -0
- data/lib/apimode/xbee_api.rb +608 -0
- data/lib/legacy/command_mode.rb +553 -0
- data/lib/module_config.rb +77 -0
- data/lib/ruby_xbee.rb +134 -0
- data/test/ruby_xbee_test.rb +20 -0
- data/test/test_helper.rb +22 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2YwMDViM2UwZDVhODRmOTY5NTk0MTk5ZjlmYzlhMGQ1ZGEyZGFmZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTRhMGYwODc0MTVjN2ZiZTI3MjI0ODJmYTg0MjUwYWQwNjEwODdhNQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWRiNmE4NjFhNDQzNGJmNmY0ZGNhODJmY2ViYWE4ZjMxNTBmZjgxNmU0ODA1
|
10
|
+
YWEwOGMyMjE1MTk4MDhmMWE3Mjc5ZGVmZGQ3OTNjNzNhNTkyZmFkNjMzYTYw
|
11
|
+
NzYxZWY1MDlhZmQ1N2MzNGJjMWZiZDg4ZGFiZWUzMDQzYmJkYmE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTVmODU0MzllZjM4ZmNhYWI5ZGM5MDMyMGE1ZjJmYzJiNDJlMTc3YTYxYjhk
|
14
|
+
ZmQ1MmU5Y2QyYjJiN2YxNzdlMzJlM2JjMGQ0NmRmNGVhNmE2MWJjYThiMWNl
|
15
|
+
YmJkZTc3ZmNiYjRmOWMwYjEwYmUzOTY3MTQzZjBmNmFmM2M5Njc=
|
data/LICENSE
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
This program is free software: you can redistribute it and/or modify
|
2
|
+
it under the terms of the GNU Affero General Public License version 3 as
|
3
|
+
published by the Free Software Foundation.
|
4
|
+
|
5
|
+
This program is distributed in the hope that it will be useful,
|
6
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
7
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
8
|
+
GNU Affero General Public License version 3 for more details.
|
9
|
+
|
10
|
+
You should have received a copy of the GNU Affero General Public License ("agpl.txt") along with this program.
|
11
|
+
If not, see http://www.gnu.org/licenses/
|
data/README.rdoc
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
= ruby-xbee
|
2
|
+
{<img src="https://travis-ci.org/exsilium/ruby-xbee.png" />}[https://travis-ci.org/exsilium/ruby-xbee]
|
3
|
+
{<img src="https://coveralls.io/repos/exsilium/ruby-xbee/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/exsilium/ruby-xbee]
|
4
|
+
{<img src="https://gemnasium.com/exsilium/ruby-xbee.png" alt="Dependency Status" />}[https://gemnasium.com/exsilium/ruby-xbee]
|
5
|
+
{<img src="https://codeclimate.com/github/exsilium/ruby-xbee.png" />}[https://codeclimate.com/github/exsilium/ruby-xbee]
|
6
|
+
|
7
|
+
== Ruby::XBee - What is it?
|
8
|
+
Ruby::XBee lets you configure and access Digi XBee RF devices using ruby classes and ruby-based
|
9
|
+
command line utilities.
|
10
|
+
|
11
|
+
Current host platforms supported:
|
12
|
+
* Linux (Intel)
|
13
|
+
* Mac OS X (PPC or Intel)
|
14
|
+
|
15
|
+
== What is an XBee?
|
16
|
+
XBee devices are handy, low-cost RF data radios often used in embedded applications for
|
17
|
+
communicating with microcontrollers and sensors. The distance an XBee covers ranges from a
|
18
|
+
few hundred feet to 15 miles line of sight depending upon the XBee device type, frequency,
|
19
|
+
antenna type, and power ratings.
|
20
|
+
|
21
|
+
Some XBees can be configured to support the ZigBee standard. Other XBees support
|
22
|
+
various forms of proprietary mesh networking especially suited to scaling sensor networks.
|
23
|
+
|
24
|
+
To learn more about Digi's XBee modules, see Digi's web site at:
|
25
|
+
http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbee-mesh-module/
|
26
|
+
|
27
|
+
== Why use Ruby::XBee?
|
28
|
+
|
29
|
+
* Ruby::XBee is a convenient way to script the configuration of XBee especially if you have a lot of XBees to program.
|
30
|
+
* Ruby::XBee lends itself to building command line applications and deploying XBee networks.
|
31
|
+
* Ruby::XBee is a quick way to experiment with functionality of XBees.
|
32
|
+
* Ruby::XBee can alleviate the need to memorize lots of AT modem commands and their parameters.
|
33
|
+
* Since Digi has no configuration host support for Linux or OS X, if these are your native or preferred environments, Ruby::XBee may be for you.
|
34
|
+
* Ruby::XBee is open source and contributions are welcome.
|
35
|
+
|
36
|
+
== Ruby::XBee Documentation
|
37
|
+
|
38
|
+
See doc/index.html from the downloaded bundle for detailed documentation on Ruby XBee class and utilities.
|
39
|
+
This documentation is primarily RDoc generated from the actual code, so it should be complete and accurate.
|
40
|
+
If documentation mistakes are found, please report errors to landon att 360vl com.
|
41
|
+
|
42
|
+
Not all of the many XBee features are supported by Ruby::XBee, but many of the most common ones are. New features
|
43
|
+
will be supported as this software evolves. Complete XBee feature coverage represents a main project goal and is
|
44
|
+
a significant area of solicited contributions.
|
45
|
+
|
46
|
+
Example use of the core XBee ruby class can be found in the utilities themselves:
|
47
|
+
xbeeinfo.rb, xbeeconfigure.rb, xbeedio.rb, xbeelisten.rb, xbeesend.rb
|
48
|
+
|
49
|
+
== Quick Start
|
50
|
+
0. install ruby 1.9.3 or 2.0.0 for your platform (see http://www.ruby-lang.org)
|
51
|
+
1. download the ruby-xbee ( git clone https://github.com/exsilium/ruby-xbee )
|
52
|
+
2. determine your /dev string and configure that in bin/ruby-xbee.rb
|
53
|
+
3. try ./bin/xbeeinfo.rb
|
54
|
+
|
55
|
+
== Detailed Quick Start
|
56
|
+
=== clone the ruby-xbee repository.
|
57
|
+
|
58
|
+
git clone https://github.com/exsilium/ruby-xbee
|
59
|
+
|
60
|
+
=== Determine your /dev string and configure that in bin/ruby-xbee.rb
|
61
|
+
|
62
|
+
When you plug in your XBee using an USB explorer board such as the Sparkfun XBee explorer:
|
63
|
+
|
64
|
+
https://www.sparkfun.com/products/8687
|
65
|
+
|
66
|
+
a new device will appear in the /dev directory of your Mac or Linux machine. As a hint,
|
67
|
+
look for a device such as /dev/tty.usb* or /dev/ttyUSB*
|
68
|
+
|
69
|
+
If you use the Sparkfun XBee explorer board mentioned above as an example, you will see
|
70
|
+
a device such as:
|
71
|
+
|
72
|
+
ls -l /dev/tty.usbserial*-
|
73
|
+
crw-rw-rw- 1 root wheel 10, 14 Jan 2 11:03 /dev/tty.usbserial-A80081sF
|
74
|
+
|
75
|
+
Each USB device has a unique tag so your device will not be named exactly the same as
|
76
|
+
this example.
|
77
|
+
|
78
|
+
Once you determine the device name, edit the ruby-xbee/bin/ruby-xbee.rb file and
|
79
|
+
modify the @xbee_usbdev_str to match your device. Example:
|
80
|
+
|
81
|
+
@xbee_usbdev_str = "/dev/tty.usbserial-A80081sF"
|
82
|
+
|
83
|
+
save the ruby-xbee.rb file.
|
84
|
+
|
85
|
+
=== Build and install the RubyGem
|
86
|
+
|
87
|
+
If you are relying on rvm, please set the appropriate gemset prior
|
88
|
+
|
89
|
+
gem build ruby-xbee.gemspec
|
90
|
+
gem install ruby-xbee-<version>.gem
|
91
|
+
|
92
|
+
=== Try xbeeinfo.rb
|
93
|
+
|
94
|
+
Once the RubyGem is properly installed you can try to call one of the distributed scripts.
|
95
|
+
|
96
|
+
Insure your XBee device is plugged into your host and the device is enumerated
|
97
|
+
in /dev according to Step 2 above.
|
98
|
+
|
99
|
+
xbeeinfo.rb
|
100
|
+
|
101
|
+
If everything's configured correctly you will see output from xbeeinfo similar to
|
102
|
+
this (your output will vary):
|
103
|
+
|
104
|
+
cooper:ruby-xbee lcox$ ./xbeeinfo.rb
|
105
|
+
Attention: OK
|
106
|
+
Firmware: 10CD
|
107
|
+
Hardware: 180B
|
108
|
+
Baud: 9600
|
109
|
+
Parity: None
|
110
|
+
Neighbors:
|
111
|
+
[{:NI=>"BMW528", :MY=>"2", :SH=>"13A200", :SL=>"4008A642", :DB=>-36}]
|
112
|
+
Node ID: BaseStation
|
113
|
+
Channel: C
|
114
|
+
PAN ID: 1
|
115
|
+
MY: 1
|
116
|
+
SH: 13A200
|
117
|
+
SL: 4008A64E
|
118
|
+
DH: 0
|
119
|
+
DL: 2
|
120
|
+
Last received signal strength (dBm): -36
|
121
|
+
Port 0: Disabled
|
122
|
+
Port 1: DI
|
123
|
+
Port 2: Disabled
|
124
|
+
Port 3: Disabled
|
125
|
+
Port 4: Disabled
|
126
|
+
Port 5: Associated_Indicator
|
127
|
+
Port 6: Disabled
|
128
|
+
Port 7: CTS
|
129
|
+
Port 8: Disabled
|
130
|
+
|
131
|
+
== Troubleshooting
|
132
|
+
|
133
|
+
XBee won't respond:
|
134
|
+
* Refer to: http://www.faludi.com/projects/common-xbee-mistakes/
|
135
|
+
* Insure your XBee has the latest firmware flashed into the device (use Digi X-CTU)
|
136
|
+
* Insure your device's USB driver is enumerated in the /dev directory when you plug in USB
|
137
|
+
* Insure your XBee device and Ruby::XBee baud rate configuration is identical
|
138
|
+
* Digi's XBee development boards do not have USB drivers for OS X or Linux.
|
139
|
+
I recommend using SparkFun USB XBee Explorer board: https://www.sparkfun.com/products/8687
|
140
|
+
This board supports drivers that are compatible with OS X and Linux operating systems. This board
|
141
|
+
can be used with Digi's X-CTU windows configuration utility as well, so it's a great board to have
|
142
|
+
if you're working with XBee on various platforms.
|
143
|
+
* Insure your full device path is configured in conf/xbeeconfig.rb
|
144
|
+
* Insure you can "talk" to your device with Digi X-CTU on Windows
|
145
|
+
- make sure the device itself can be contacted before trying again with Ruby::XBee
|
146
|
+
* Try the Linux or OS X 'screen' command to contact the device:
|
147
|
+
screen /dev/tty.usbserial-A80081sF 9600
|
148
|
+
where you would replace the /dev/ string in the example above with the one for your USB XBee device.
|
149
|
+
When you plug in a USB serial device, Linux and OS X will enumerate that device automatically by adding
|
150
|
+
a new entry into the /dev directory.
|
151
|
+
* When you make contact with the device using 'screen', issue a +++ and wait for a second or two for an OK response
|
152
|
+
* Contact Digi. See: http://www.digi.com/support/productdetail?pid=3257 (S1) or http://www.digi.com/support/productdetail?pid=3430 (S2)
|
153
|
+
|
154
|
+
Other than these suggestions, sorry, I have no time to support connectivity problems to the XBee itself.
|
155
|
+
Google is your friend.
|
156
|
+
|
157
|
+
== Limitations
|
158
|
+
* Not all XBee Series 1 features are supported, though many are.
|
159
|
+
* New efforts are mostly aimed towards supporting Series 2. Efforts are made not to break Series 1
|
160
|
+
* No provision is made to flash new device firmware into the XBee from Ruby::XBee classes or utilities.
|
161
|
+
Reflashing firmware requires using Digi's X-CTU windows program. Code contributions in this area are welcome.
|
162
|
+
|
163
|
+
== See Also
|
164
|
+
There are several other utilties included with Ruby::XBee. See also:
|
165
|
+
|
166
|
+
* xbeedio.rb - A Ruby utility for configuring and manipulating XBee DIO ports
|
167
|
+
* xbeeinfo.rb - A Ruby utility for extracting XBee setup information using xbee ruby class (Ruby::XBee)
|
168
|
+
* xbeelisten.rb - A ruby utility for listening to data output from an XBee
|
169
|
+
* xbeesend.rb - A ruby utility for sending raw data to and through an XBee
|
170
|
+
|
171
|
+
== Contact and Contribute
|
172
|
+
Please feel to Fork the repository and create pull requests back.
|
173
|
+
|
174
|
+
== Synopsis
|
175
|
+
Ruby::XBee - Configure and access XBee using Ruby
|
176
|
+
|
177
|
+
Current host platforms supported:
|
178
|
+
Linux (Intel)
|
179
|
+
Mac OS X (PPC or Intel)
|
180
|
+
|
181
|
+
== Release Notes
|
182
|
+
2014-03-09 Ruby::XBee Version 1.1 - Requirements: Ruby 1.9.3; serialport 1.1.0
|
183
|
+
|
184
|
+
2009-01-02 Ruby::XBee Version 1.0 - Requirements: Ruby 1.8.7; ruby-serialport
|
185
|
+
|
186
|
+
== Prerequisites
|
187
|
+
* *Prerequisites* - SerialPort
|
188
|
+
A platform-specific version of the SerialPort is a prerequisite for Ruby::XBee. Please
|
189
|
+
refer to Rubygems ( http://rubygems.org/gems/serialport ) for package information.
|
190
|
+
|
191
|
+
* *Prerequisites* - Ruby 1.9.3
|
192
|
+
To date, all testing has been done using Ruby 1.9.3 (p194) & 2.0.0. There has been extensive
|
193
|
+
changes introduced to Ruby after 1.8.x branch and backwards compatibility is not esnured.
|
194
|
+
Please refer to earlier versions of this software.
|
195
|
+
|
196
|
+
== Bugs
|
197
|
+
I'm sure there are bugs. Please test and submit a detailed report to github issues.
|
198
|
+
Better yet, please submit a patch for a fix. Thanks.
|
199
|
+
|
200
|
+
== Feature Requests
|
201
|
+
|
202
|
+
Original author can be reached by checking http://www.esawdust.com/blog/ for updates and
|
203
|
+
sending feature requests to landon att 360vl com
|
204
|
+
|
205
|
+
Current maintainer can be reached by sending e-mail to exile att chamber ee or filing a issue via github.
|
206
|
+
|
207
|
+
== Generating Ruby::XBee RDoc
|
208
|
+
|
209
|
+
Ruby::XBee uses RDoc and the Hanna template. To generate documentation yourself, you need
|
210
|
+
to do a one-time install of the hanna template and dependencies:
|
211
|
+
|
212
|
+
sudo gem install hanna-nouveau
|
213
|
+
|
214
|
+
Then from within the ruby-xbee install directory run:
|
215
|
+
|
216
|
+
rdoc -f hanna
|
217
|
+
|
218
|
+
== Accessing/Obtaining earlier versions of Ruby::XBee
|
219
|
+
|
220
|
+
Original version of Ruby::XBee can be downloaded:
|
221
|
+
http://www.esawdust.com/ruby-xbee/releases/ruby-xbee-1.0/ruby-xbee-1.0.tar.gz
|
222
|
+
(2013-02-25 MD5 checksum MD5 (ruby-xbee-1.0.tar.gz) = 5f01b6af4cfc8719b601f354c627b6e8)
|
223
|
+
|
224
|
+
Mike Ashmore's version can be obtained via GitHub: https://github.com/motomike/ruby-xbee
|
225
|
+
|
226
|
+
== Copyright
|
227
|
+
|
228
|
+
Copyright (c) 2008-2009 360VL, Inc. and Landon Cox
|
229
|
+
Copyright (c) 2009 Mike Ashmore
|
230
|
+
Copyright (c) 2013-2014 Sten Feldman
|
231
|
+
|
232
|
+
See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require './lib/version.rb'
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |test|
|
7
|
+
test.libs << 'lib' << 'test'
|
8
|
+
test.pattern = 'test/**/*_test.rb'
|
9
|
+
test.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
begin
|
13
|
+
require 'rcov/task'
|
14
|
+
Rcov::RcovTask.new do |test|
|
15
|
+
test.libs << 'test'
|
16
|
+
test.pattern = 'test/**/*_test.rb'
|
17
|
+
test.verbose = true
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
task :rcov do
|
21
|
+
abort 'RCov is not available. In order to run rcov, you must: gem install rcov'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
task :default => :test
|
27
|
+
|
28
|
+
require 'rdoc/task'
|
29
|
+
RDoc::Task.new do |rdoc|
|
30
|
+
version = XBee::Version::STRING
|
31
|
+
|
32
|
+
rdoc.rdoc_dir = 'doc'
|
33
|
+
rdoc.title = "ruby-xbee #{version}"
|
34
|
+
rdoc.options << '-f' << 'hanna'
|
35
|
+
rdoc.rdoc_files.include('README*')
|
36
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
+
end
|
38
|
+
|