API
Required dependencies
ArduinoJSON by Benoit Blanchon
PubSubClient by Nick O’Leary
ArduinoUniqueId by Luiz Henrique Cassettari
Function adaptation macros
Use the macros described below to add remote access to regular functions.
1. Global Functions
VRPC_GLOBAL_FUNCTION(<returnType>, <functionName>[, <argTypes>])
Example:
int foo () {
// [...]
}
void bar (String& s, bool b) {
// [...]
}
VRPC_GLOBAL_FUNCTION(int, foo)
VRPC_GLOBAL_FUNCTION(void, bar, String&, bool)
class VrpcAgent
VrpcAgent
The agent allows existing code to be called from remote.
Summary
public inline
VrpcAgent
(int maxBytesPerMessage)
Constructs an agent.
public template<>
inline void
begin
(T & netClient,const String & domain,const String & token)
Initializes the object using a client class for network transport.
public inline bool
connected
()
Reports the current connectivity status.
public inline void
connect
()
Connect the agent to the broker.
public inline void
loop
()
This function will send and receive VRPC packets.
Members
Constructs an agent.
Parameter
maxBytesPerMessage
[optional, default:1024
] Specifies the maximum size a single MQTT message may have
public template<typename T>
inline void
begin
(T& netClient, const String& domain, const String& token)
public template<typename T>
inline void
begin
(T& netClient, const String& domain, const String& token)
Initializes the object using a client class for network transport.
Parameter
netClient
A client class following the interface as described heredomain
[optional, default:"vrpc"
] The domain under which the agent-provided code is reachabletoken
[optional, default:""
] Access token as generated by Heisenware GmbH, or MQTT password if own broker is usedbroker
[optional, default:"vrpc.io"
] Address of the MQTT brokerusername
[optional] MQTT username (not needed when using the vrpc.io broker)
Reports the current connectivity status.
Returns
true when connected, false otherwise
Connect the agent to the broker.
The function will try to connect forever. Inspect the serial monitor to see the connectivity progress.
Send and receive VRPC packets.
Last updated