|
| 1 | +Handle SCI Requests Sample Application |
| 2 | +====================================== |
| 3 | + |
| 4 | +This sample Python application shows how to use the Cellular Router or XBee |
| 5 | +Gateway to receive and handle requests from Digi Remote Manager cloud. |
| 6 | + |
| 7 | +The example registers a callback to process device requests with a specific |
| 8 | +target ID coming from the cloud and prints their value. |
| 9 | + |
| 10 | +Requirements |
| 11 | +------------ |
| 12 | +To run this example you will need: |
| 13 | + |
| 14 | +* A Digi Cellular router or XBee gateway device. |
| 15 | +* A Digi Remote Manager account with your Digi device added to it. |
| 16 | + Go to https://myaccount.digi.com/ to create it if you do not have one. |
| 17 | + |
| 18 | +Setup |
| 19 | +----- |
| 20 | +1. Make sure that the Digi Device is connected to Internet and it is registered |
| 21 | + in your Digi Remote Manager account. |
| 22 | + |
| 23 | +Run |
| 24 | +--- |
| 25 | +1. The example is already configured, so all you need to do is to build and |
| 26 | + launch the **Handle SCI Requests** application in the Digi device. The |
| 27 | + application prints the following message: |
| 28 | + |
| 29 | + - Waiting for Digi Remote Manager requests... |
| 30 | + |
| 31 | +2. In your Digi Remote Manager account, go to **Documentation > API Explorer**. |
| 32 | + Then, select the example **Examples > SCI > Data Service > Send Request** to |
| 33 | + generate the URL and template of the send request. Complete the request as |
| 34 | + follows: |
| 35 | + |
| 36 | + <sci_request version="1.0"> |
| 37 | + <data_service> |
| 38 | + <targets> |
| 39 | + <device id="00000000-00000000-XXXXXXXX-XXXXXXXX"/> |
| 40 | + </targets> |
| 41 | + <requests> |
| 42 | + <device_request target_name="myTarget"> |
| 43 | + Hello from Digi Remote Manager! |
| 44 | + </device_request> |
| 45 | + </requests> |
| 46 | + </data_service> |
| 47 | + </sci_request> |
| 48 | + |
| 49 | + where: |
| 50 | + |
| 51 | + - `00000000-00000000-XXXXXXXX-XXXXXXXX` is the device ID of your Cellular |
| 52 | + Router or XBee Gateway device. |
| 53 | + - `myTarget` is the target name of the Digi Remote Manager requests |
| 54 | + handler you configured in the Python script. Both target names (the one |
| 55 | + from the Python script and the request one) must be the same. So, if |
| 56 | + you modified it in the script, update it in the request too. |
| 57 | + - `Hello from Digi Remote Manager!` is the content of the request. |
| 58 | + |
| 59 | +3. Click the **Send** button to send the request to the device. |
| 60 | + |
| 61 | +4. Verify that a new line is printed out in the console with the following |
| 62 | + message: |
| 63 | + |
| 64 | + - Received request 'Hello from Digi Remote Manager!' for target 'myTarget' |
| 65 | + |
| 66 | + Verify also that the **Response** tab of the **API Explorer** displays a |
| 67 | + response similar to: |
| 68 | + |
| 69 | + <sci_reply version="1.0"> |
| 70 | + <data_service> |
| 71 | + <device id="00000000-00000000-XXXXXXXX-XXXXXXXX"> |
| 72 | + <requests> |
| 73 | + <device_request target_name="myTarget" status="0">OK</device_request> |
| 74 | + </requests> |
| 75 | + </device> |
| 76 | + </data_service> |
| 77 | + </sci_reply> |
| 78 | + |
| 79 | + where: |
| 80 | + |
| 81 | + - `00000000-00000000-XXXXXXXX-XXXXXXXX` is the device ID of your Cellular |
| 82 | + Router or XBee Gateway device. |
| 83 | + - `myTarget` is the target name of the Digi Remote Manager requests |
| 84 | + handler you configured in the Python script. |
| 85 | + - `OK` is the answer to the request reported by the Python script. |
| 86 | + |
| 87 | +5. Press any key to halt the application execution. |
| 88 | + |
| 89 | +Supported platforms |
| 90 | +------------------- |
| 91 | +* AnywhereUSBPlus |
| 92 | +* ConnectEZMini |
| 93 | +* ConnectEZ2 |
| 94 | +* ConnectEZ4 |
| 95 | +* ConnectEZ8 |
| 96 | +* ConnectEZ1632 |
| 97 | +* ConnectITMini |
| 98 | +* ConnectIT4 |
| 99 | +* ConnectIT1648 |
| 100 | +* EX12 |
| 101 | +* EX15 |
| 102 | +* EX50 |
| 103 | +* IX10 |
| 104 | +* IX15 |
| 105 | +* IX20 |
| 106 | +* IX30 |
| 107 | +* LR54 |
| 108 | +* TX54 |
| 109 | +* TX64 |
| 110 | +* TX64Rail |
| 111 | + |
| 112 | +License |
| 113 | +------- |
| 114 | +Copyright (c) 2023, Digi International, Inc. |
| 115 | + |
| 116 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 117 | +of this software and associated documentation files (the "Software"), to deal |
| 118 | +in the Software without restriction, including without limitation the rights |
| 119 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 120 | +copies of the Software, and to permit persons to whom the Software is |
| 121 | +furnished to do so, subject to the following conditions: |
| 122 | + |
| 123 | +The above copyright notice and this permission notice shall be included in all |
| 124 | +copies or substantial portions of the Software. |
| 125 | + |
| 126 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 127 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 128 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 129 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 130 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 131 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 132 | +SOFTWARE. |
0 commit comments