Digi Connect IT Mini User Manual page 363

Hide thumbs Also See for Connect IT Mini:
Table of Contents

Advertisement

Applications
<targets>
<device id="00000000-00000000-0000FFFF-A83CF6A3"/>
</targets>
<requests>
<device_request target_name="myTarget">
my payload string
</device_request>
</requests>
</data_service>
</sci_request>
Note
The value of the target_name parameter in the device_request element must
correspond to the target parameter of the device_request.register function in the Python
script. In this example, the two are the same.
4. Click Send.
Once that the request has been sent to the device, the handler on the device is executed.
On the device, you will receive the following output:
n
>>> received request
for target myTarget
In Remote Manager, you will receive a response similar to the following:
n
<sci_reply version="1.0">
<data_service>
<device id="00000000-00000000-0000FFFF-A83CF6A3"/>
<requests>
</requests>
</device>
</data_service>
</sci_request>
Example: Use digidevice.cli with digidevice.device_request
In this example, we will use the digidevice.cli module in conjunction with the digidevice.device_
request module to return information about multiple devices to Remote Manager.
1. Create a Python application, called showsystem.py, that uses the digidevice.cli module to
create a response containing information about device and the device_request module to
respond with this information to a request from Remote Manager:
from digidevice import device_request
from digidevice import cli
import time
def handler(target, request):
return cli.execute("show system verbose")
def status_cb(error_code, error_description):
Digi Connect IT® Mini User Guide
my payload string
<device_request target_name="myTarget" status="0">OK</device_request>
Digidevice module
363

Advertisement

Table of Contents
loading

Table of Contents