User manual
For example, node A could ask node B to read his first analog input channel but tell node C what the answer
was. (Imagine for instance that node C has a graphical LCD display that the other nodes lack.)
rpc(node_b_address, "callout", node_c_address, "tellSensorReading", "readAdc", 0)
As another example, node A could ask node B to find out how well all the other nodes one hop away could hear
node B, but send the answers to node A by doing something like:
rpc(b_addr, "mcastRpc", 1, 1, "callout", a_addr, "tell_link_quality", "getLq")
Translang the above line of SNAPpy script into English:
Node A is asking node B to send a 1-hop mulcast that asks all nodes in mulcast group number 1 that hear it to
invoke their getLq() funcons (this answering the queson “how well did they hear node B’s mulcast
transmission?”) and send all of the results to node A.
Node A’s script would have a snippet like:
def tell_link_quality(lq):
who = rpcSourceAddr()
# do something with the address and the reported link quality
Clever use of mcastRpc(), rpc(), callback(), and callout() can let you create applicaons like “Network Topology
Explorers”.
Additional Reminder
You cannot invoke a funcon that a node does not have.
In the case of mcastRpc(), the unit will silently ignore the funcon it does not know how to call.
If sent via one of the unicast mechanisms (rpc(), callback() or callout()) the RPC packet will be acknowledged, but
then ignored.
SNAP® Network Operang System 37