API

Required dependencies

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

The agent allows existing code to be called from remote.

Summary

Members
Descriptions

public inline VrpcAgentarrow-up-right(int maxBytesPerMessage)

Constructs an agent.

public template<> inline void beginarrow-up-right(T & netClient,const String & domain,const String & token)

Initializes the object using a client class for network transport.

public inline bool connectedarrow-up-right()

Reports the current connectivity status.

public inline void connectarrow-up-right()

Connect the agent to the broker.

public inline void looparrow-up-right()

This function will send and receive VRPC packets.

Members

public inline VrpcAgentarrow-up-right(int maxBytesPerMessage)

Constructs an agent.

Parameter

  • maxBytesPerMessage [optional, default: 1024] Specifies the maximum size a single MQTT message may have


public template<typename T> inline void beginarrow-up-right(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 herearrow-up-right

  • domain [optional, default: "vrpc"] The domain under which the agent-provided code is reachable

  • token [optional, default: ""] Access token as generated by Heisenware GmbH, or MQTT password if own broker is used

  • broker [optional, default: "vrpc.io"] Address of the MQTT broker

  • username [optional] MQTT username (not needed when using the vrpc.io broker)


public inline bool connectedarrow-up-right()

Reports the current connectivity status.

Returns

true when connected, false otherwise


public inline void connectarrow-up-right()

Connect the agent to the broker.

The function will try to connect forever. Inspect the serial monitor to see the connectivity progress.


public inline void looparrow-up-right()

Send and receive VRPC packets.

circle-info

NOTE

This function should be called in every loop

Last updated