Digi ConnectPort Network Device Podręcznik Użytkownika Strona 92

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 95
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 91
Sample programs
92
Make an RCI request-example program
Following is a simple RCI callback example:
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 wishes 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 iDigi.
Przeglądanie stron 91
1 2 ... 87 88 89 90 91 92 93 94 95

Komentarze do niniejszej Instrukcji

Brak uwag