Command Line RPC, and Multicast RPC Sender For Synapse SNAP Connect
I had a need to send Synapse RPC, and Multicast RPC calls from PHP to trigger events for my Home Automation System. The simplest option I could come up with was coding a command line utility (using the example Synapse code provided) that links to SNAP Connect via XML forwarding on RPC / Multicast RPC calls based on command line arguments that have been passed in.
RPC Example:
HomeAutomationController2CMD.exe "http://server:8080" "00.00.99" "rpc" "00.00.01" "myfunction" "B:1" "S:abc123" "I:33"
Example shows an RPC call using SNAP Connect server running on localhost port 8080 from local node address “00.00.99” to node “00.00.01” calling function “myfunction” passing in a boolean true on the first argument, string “abc123” on the second, and integer “33” on the third.
- Arg[0]: SNAP Connect Server URL
- Arg[1]: Local Node Address
- Arg[2]: Action (e.g. rpc, or mrpc)
- Arg[3]: Remote (destination) Node Address
- Arg[4]: RPC Function Name
- Arg[5]: RPC Function Argument 0 (Boolean: 0/1)
- Arg[6]: RPC Function Argument 1 (String)
- Arg[7]: RPC Function Argument 2 (Integer)
RPC function arguments can be added/removed as needed, the type of argument (Boolean/string/integer) can be specified by using the B/I/S prefixes.
Multicast RPC Example:
HomeAutomationController2CMD.exe "http://server:8080" "00.00.99" "mrpc" "myfunction" "B:1" "S:abc123" "I:33"
Example shows a Multicase RPC call using SNAP Connect server running on localhost port 8080 from local node address “00.00.99” calling function “myfunction” passing in a boolean true on the first argument, string “abc123” on the second, and integer “33” on the third.
Download