Specifications

7. SNAPpy – The API
This section details the “built-in” functions available to all SNAPpy scripts, as well as through RPC
messaging. As of version 2.2, there are over 70 of these functions implemented by the SNAP “core”
firmware.
These functions will first be presented in detail alphabetically. They will then be summarized, by
category. Finally they will be categorized as immediate, blocking, or non-blocking.
Alphabetical SNAP API
bist() – Synapse internal use only
This function is for Synapse developer use only, and will likely be removed in a future release. User
scripts should not bother calling this function.
call(rawOpcodes, functionArgs…) – Call embedded C code
This function is for advanced users only, and is outside the scope of this manual.
There is a separate Application Note that covers how to use this advanced feature.
Parameter rawOpcodes is a string containing actual machine code that implements the function.
The remaining functionArgs parameters depend on the actual function implemented by rawOpcodes.
callback(callback, remoteFunction, remoteFunctionArgs…)
Using the built-in function rpc() it is easy to invoke functions on another node. However, to get data
back from that node, you either need to put a script in that node, or use the new callback() function.
Parameter callback specifies a function to invoke on the originating node with the return value of the
remote function. For example, imagine having a function like the following in SNAP Node “A.”
def showResult(obj):
print str(obj)
Invoking callback('showResult', ...) on Node B will cause function showResult() to get
called on Node A with the live data from remote Node B.
Parameter remoteFunction specifies which function to invoke on the remote node, for example
readAdc.
If the remote function takes any parameters, then the remoteFunctionArgs parameter of the callback()
function is where you put them.
SNAP Reference Manual Document Number 600-0007K Page 43 of 202