Gumband Hardware API (C/C++) - OLD

GumbandConnection

A Gumband communication instance (only one can exist per device). Functions for this class are listed below:

Example Usage:

GumbandConnection MyGumband;

begin()

Initiates the Gumband connection.

Syntax:

void begin()

void begin(uint8_t offline) //Begin in offline mode

Example Usage:

MyGumband.begin();

MyGumband.begin(1);

id()

Sets the Hardware ID of the Gumband Hardware. This is a unique identifier generated by the Gumband UI. Each separate registered Gumband Hardware device receives its own ID. This ID is required to link Hardware to a specific Exhibit in the Gumband UI.

Syntax:

void id(int id);

void id(const char* id);

 

Example Usage:

MyGumband.id(16);

MyGumband.id(“16”);

username()

Set the Gumband master control server username. This must match the username created for this device within the Gumband UI.

Syntax:

void username(char* text);

Example Usage:

MyGumband.username(“MarlonBando”);

password()

Set the Gumband master control server password. This must match the password created for this device within the Gumband UI.

Syntax:

void password(char* text);

Example Usage:

MyGumband.password(“P455W0RD!”);

connected()

Returns ‘1’ if the Hardware has a valid network connection.

Syntax:

uint8_t connected();

Example Usage:

if(MyGumband.connected() == 1) { //Connected to Network }

connectedMaster()

Returns ‘1’ if the Hardware has a valid master server connection.

Syntax:

uint8_t connectedMaster();

Example Usage:

if(MyGumband.connectedMaster() == 1) { //Connected to Master }

connectedExhibit()

Returns ‘1’ if the Hardware has a valid Exhibit server connection.

Syntax:

uint8_t connectedExhibit();

Example Usage:

if(MyGumband.connectedExhibit() == 1) { //Connected to Exhibit }

event()

Publish a text message to the ‘event’ log.

Syntax:

void event(char* text);

Example Usage:

MyGumband.event(“An event has occurred!”);

error()

Publish a text message to the ‘error’ log.

Syntax:

void error(char* text);

Example Usage:

MyGumband.error(“An error has occurred!”);

debug()

Publish a text message to the ‘debug’ log.

Syntax:

void debug(char* text);

Example Usage:

MyGumband.debug(“Something routine has occurred!”);

print()

Print data to the Hardware USB serial port.

Syntax:

void print(char* text);

void print(char byte);

Example Usage:

MyGumband.print(“Hello World!”);

MyGumband.print(25);

GumbandProperty

An instance of a Gumband property or endpoint. An individual instance must exist for every Gumband property in the Exhibit.

Example Usage:

GumbandProperty MyProperty;

begin()

This function creates a named property within a named peripheral container and registers it with the Gumband server so we can publish or subscribe to it. A Gumband instance must first exist before this function will succeed.

Syntax:

int8_t begin(const char* periph, const char* prop, gmbnd_prop_type);

Example Usage

MyProperty.begin(“PeripheralName”, “PropertyName”, gmbnd_button);

publish()

Publish data to the property endpoint.

Syntax:

void publish(int data);

void publish(uint8_t data);

void publish(uint32_t data);

void publish(uint8_t* data, uint8_t length);

Example Usage:

MyProperty.publish(234);

MyProperty.publish(values, 5); //values[5] = {3,5,8,1,0}