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")
Translang the above line of SNAPpy script into English:
Node A is asking node B to send a 1-hop mulcast that asks all nodes in mulcast group number 1 that hear it to
invoke their getLq() funcons (this answering the queson “how well did they hear node B’s mulcast
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 applicaons like “Network Topology
Explorers”.
Additional Reminder
You cannot invoke a funcon that a node does not have.
In the case of mcastRpc(), the unit will silently ignore the funcon 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 Operang System 37