OllieDay / liborvibo

Library for controlling Orvibo Smart Wi-Fi Plug

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

liborvibo

Library for controlling Orvibo Smart Wi-Fi Plug

Installation

$ git clone https://github.com/OllieDay/liborvibo.git
$ cd liborvibo
$ mkdir build && cd build
$ cmake ..
$ make install clean

Usage

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);

About

Library for controlling Orvibo Smart Wi-Fi Plug

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C 96.1%Language:CMake 3.3%Language:C++ 0.6%