Skip to content

vscp client common methods

Åke Hedman edited this page Jun 3, 2021 · 7 revisions

VSCP client base class

Files

Common methods

The following methods are common to all VSCP client objects/classes.


int connect(void)

Connect to remote server


int disconnect(void)

Disconnect from remote server.


bool isConnected(void)

Check if connected.


int send(vscpEvent &ev)

Send event to remote server.


int send(vscpEventEx &ex)

Send event ex to remote server.


int receive(vscpEvent &ev)

Receive one event if one is available.


int receive(vscpEventEx &ex)

Receive one event ex if one is available.


int setfilter(vscpEventFilter &filter)

Set filter for incoming traffic.


int getcount(uint16_t *pcount)

Get number of events waiting to be received.


int clear(void)

Clear the input queue


int getversion(uint8_t *pmajor, uint8_t *pminor, uint8_t *prelease, uint8_t *pbuild)

Get interface version.


int getwcyd(uint64_t &wcyd)

Get WCYD (What Can You Do) from remote host.


int setCallback(LPFNDLL_EV_CALLBACK evcallback, void *pData=nullptr);

Set callback that will receive incoming events.


int setCallback(LPFNDLL_EX_CALLBACK m_excallback, void *pData=nullptr)

Set callback that will receive incoming events (ex)


void setConnectionTimeout(uint32_t timeout)

Set connection timeout in milliseconds.


Get connection timeout

Get connection timeout in milliseconds.


void setResponseTimeout(uint32_t timeout)

Set response time in milliseconds.


uint32_t getResponseTimeout(void)

Get response time in milliseconds.


bool isEvCallback(void)

Check if an event callback is defined.


bool isExCallback(void)

Check if an event ex callback is defined.


std::string getConfigAsJson(void)

Get current configuration on JSON format.


bool initFromJson(const std::string& config)

Set configuration from JSON.


connType getType(void)

Get connection type. The connection types are defined in the vscp_client_base.h header file as

enum class connType {
        NONE=0, 
        LOCAL, 
        TCPIP, 
        CANAL, 
        SOCKETCAN, 
        WS1, 
        WS2, 
        MQTT, 
        UDP, 
        MULTICAST, 
        REST, 
        RS232, 
        RS485, 
        RAWCAN, 
        RAWMQTT
    };

check the header for the latest version.

vscp-client class types

  • NONE - Undefined
  • LOCAL - No connection, can handle files, logs etc
  • TCPIP - VSCP tcp/ip link protocol.
  • CANAL - The CANAL protocol. This is the same as a VSCP level I driver.
  • SOCKETCAN - VSCP events sent ovr socketcan.
  • WS1 - VSCP websocket ws1 protocol.
  • WS2 - VSCP websocket ws2 protocol.
  • MQTT - VSCP over MQTT.
  • UDP - VSCP over UDP.
  • MULTICAST - VSCP multicast protocol.
  • REST - VSCP REST interface.
  • RS232 - VSCP over serial link.
  • RS485 - VSCP over multidrop serial link.
  • RAWCAN - Handle standard CAN and CANFD.
  • RAWMQTT - Handle standard MQTT.

void setName(const std::string& name)

Set name for communication object


std::string getName(void)

Get current name for communication object.

Clone this wiki locally