![Digi XGI-20CZ7-E00-W0 User Manual Download Page 58](http://html1.mh-extra.com/html/digi/xgi-20cz7-e00-w0/xgi-20cz7-e00-w0_user-manual_2496341058.webp)
Program XBee Industrial Gateway using
Python
XBee Industrial Gateway Python application and Remote
Manager
Digi XBee Industrial Gateway
58
1. The rci module includes the
process_request
function needed by the program.
2. A string representing the RCI request is needed. This sample uses the Python multi-line string
syntax to make it clear that the XML represents a request for the current IP address of the
Ethernet interface. Combining the lines into a single string on one line would work in the same
way.
3. The RCI XML is submitted for parsing, and the resulting string is returned. In this sample, the
result is simply printed.
Following example shows a simple RCI callback:
import rci
(1)
def cb(req):
(2)
print "Received request: " + req
(3)
r=rci.RciCallback()
(4)
r.register_callback('test', cb)
(5)
rci.process_request('<rci_request version="1.1"><do_command
target="test"><customxml/></do_command></rci_request>')(6)
Program notes
1. The RCI module includes the RciCallback class needed by the program.
2. Create a function to be called whenever a remote entity wants to communicate with this
script.
3. This simple function will simply demonstrate that it received a request that could be parsed
and handled however the application saw fit.
4. Create a callback object.
5. Assign the target “
test
” to the new callback object. If a remote entity issues a “
do_command
”
with the target “
test
”, the supplied callback function will be called.
6. This is simply an example that causes the callback to be called. This example could also have
been a remote SCI query through Remote Manager.
XBee functions
For a description of the XBee module and program samples, see the
XBee Industrial Gateway Python application and Remote Manager
The XBee Industrial Gateway Python application is an application that resides on XBee Industrial
Gateway. It allows you to connect your XBee modules to Remote Manager, enabling them to upload
data to Remote Manager and receive remote text and commands. The XBee Industrial Gateway
Python application is already installed in your XBee Industrial Gateway device and automatically starts
when the gateway is initialized.
For a complete explanation about Remote Manager, see the
. This
documentation is available from the
Documentation
link within the Remote Manager platform.