Library for controlling Orvibo Smart Wi-Fi Plug
$ git clone https://github.com/OllieDay/liborvibo.git
$ cd liborvibo
$ mkdir build && cd build
$ cmake ..
$ make install clean
Include the header file:
#include <orvibo.h>
Define an event handler to receive notifications:
void event_handler(struct orvibo_socket *socket, enum orvibo_event event);
Create a socket from its MAC address:
struct orvibo_socket *socket = orvibo_socket_create("ac:cf:00:00:00:00");
Start the client:
orvibo_start(event_handler);
Discover the socket:
orvibo_socket_discover(socket);
Get info on the socket:
const char *mac = orvibo_socket_mac(socket);
const char *ip = orvibo_socket_ip(socket);
bool subscribed = orvibo_socket_subscribed(socket);
enum orvibo_state state = orvibo_socket_state(socket);
Subscribe the socket:
orvibo_socket_subscribe(socket);
Switch the socket off and on:
orvibo_socket_off(socket);
orvibo_socket_on(socket);
Unsubscribe the socket:
orvibo_socket_unsubscribe(socket);
Stop the client:
orvibo_stop();
Destroy the socket:
orvibo_socket_destroy(socket);