Specifications
uploaded to SNAP devices. All SNAP devices are capable of running SNAPpy – it is the native
language of RPC calls.
SNAPpy Examples
On installation, Portal creates a folder under “My Documents” called “Portal\snappyImages”. Several
sample script files are installed here by default. These scripts are plain text files, which may be opened
and edited with Portal’s built-in editor. External text editors or even full-fledged Python Integrated
Development Environments (IDEs) may also be used. Feel free to copy and modify the sample scripts
(the installed copies are read-only), and create your own as you build custom network applications.
Portal Scripting
Similar to the SNAP nodes, Portal can also be extended through scripting. By loading a script, you can
add new functions to Portal, which you (and the other SNAP nodes) can call.
Python
Portal scripts are written in full Python (you are not limited to the embedded SNAPpy subset). Python
is a very powerful language, which finds use in a wide variety of application areas. Although the core
of Python is not a large language, it is well beyond the scope of this document to cover it in any detail.
You won’t have to search long to find an immense amount of information regarding Python on the
Web. Besides your favorite search engine, a good place to start looking for further information is
Python’s home site:
http://python.org/
The Documentation page on Python’s home site contains links to tutorials at various levels of
programming experience, from beginner to expert.
As mentioned earlier, Portal acts as a peer in the SNAP network, and can send and receive RPC calls
like any other Node. Like other nodes, Portal has a Device Image (script) which defines the functions
callable by incoming RPC messages. Since Portal runs on a PC, its script executes in a full Python
environment with access to the many libraries, services, and capabilities available there.
SNAPpy RPC Æ Portal : Gateway to Full Python…
Thanks to this capability, it is quite simple for a low-power device on
the network to (via an RPC call to Portal) send an email or update a
database in response to some monitored event.
SNAP Reference Manual Document Number 600-0007K Page 15 of 202