Send SCI request to xbee network with iDigi

I have idigi developer account. And a X4 ZB and a Xbee ZB pro as the test environment.

Now what I would like to realize is:

Send webservice request to X4 and X4 will send API frame to Xbee pro module. So that I can see the RF Data in Xbee pro module with X-CTU utility.

I assume that it will require run python scripts in X4. Is it right?

If so, what’s the best sample scripts that I can refer to?

Say I send SCI>data service>send request to my X4. How do I check what X4 would have got from iDigi?

You have a couple options.

1.) Try this example in the web services console: Examples -> SCI -> Python

Here is an example of the python code you’d run on the device to receive and respond to the request: http://www.digi.com/wiki/developer/index.php/Module:rci#Example_.231. Note that the call to rci.add_rci_callback is blocking, so if you need to perform other actions in your script you’ll need to spawn a thread.

import rci
 
def rci_callback(xml):
	print xml
	return "received: %s" % (xml)
 
rci.add_rci_callback("rci_callback_example", rci_callback)

2.) Use the Examples found at SCI -> Data Service -> Send Request/Send Binary Request

This one requires pretty recent firmware on your device. It has the benefit of transferring binary data without having to base64 decode it on the device, and the register call on the device doesn’t block.

The python code would look like this:

import idigidata

def my_callback(target, data):
    print data
    return "received %s from target %s" % (data, target)

idigidata.register_callback("myTarget", my_callback)