Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

Expand
titleTable of Contents
Table of Contents
minLevel1
maxLevel

...

4

...

Gumband Properties API

Functions to interact with Gumband properties. Gumband properties are end points which are used to control individual elements of the hardware system either from the debug dashboard or from exhibit software via the SDK.

...

Info

A property does not get created on the remote server until gumbandSubscribe() is called.

Syntax:

GumbandProp gumbandCreate(const char peripheral, const char property, gmbnd_type_t type)

Example Usage:
Code Block
languagecpp
GumbandProp motor_start_prop = gumbandCreate("Motor", "Spin", gmbnd_bool);
GumbandProp motor_speed_prop = gumbandCreate("Motor", "Speed", gmbnd_int32);

...

Attach a callback function to a Gumband property. This function will be called when a read request is sent from a remote server (the Exhibit or Cloud server).

Syntax:

int8_t gumbandSetReadCallback(GumbandProp handle, callback_func read_callback);

Example Usage:
Code Block
languagecpp
GumbandProp motor_start = gumbandCreate("Motor", "Spin", gmbnd_bool);

void motorStartCallbackmotorSpeedReadCallback(uint16_t length, void* data) {
  gumbandPublishInt(motor_speed_prop,  // Do something
}current_motor_speed);
}
...
gumbandSetReadCallback(motor_speed_prop, motorSpeedReadCallback);

gumbandSetWriteCallback()

Attach a callback function to a Gumband property. This function will be called when data is written to this property on the hardware from a remote server (the Exhibit or Cloud server).

Syntax:

int8_t gumbandSetWriteCallback(GumbandProp handle, callback_func write_callback);

Example Usage:
Code Block
languagecpp
void motorSpeedWriteCallback(uint16_t length, void* data) {
  if(length == 0) return;
  int32_t new_speed = *((gmbnd_int32_t*)data);
}
...
gumbandSetWriteCallback(motor_speed_prop, motorSpeedWriteCallback);

gumbandSetDescription()

Assign a text description to a Gumband property (visible on the Gumband cloud dashboard). Max text length is 128 characters.

Syntax:

int8_t gumbandSetDescription(GumbandProp handle, const char* description);

Example Usage:
Code Block
languagecpp
gumbandSetDescription(motor_speed_prop, "This property controls the speed of the motor.")

gumbandSetHidden()

Set the property as hidden to prevent it from being displayed on the Gumband Cloud dashboard. This has no affect on the Exhibit server.

Syntax:

int8_t gumbandSetHidden(GumbandProp handle);

Example Usage:
Code Block
languagecpp
gumbandSetHidden(motor_speed_prop); // Hide the motor speed property from the dashboard

gumbandClearHidden()

Set the property as visible to allow it to be shown on the Gumband Cloud dashboard.

Syntax:

int8_t gumbandClearHidden(GumbandProp handle)

Example Usage:
Code Block
languagecpp
gumbandClearHidden(motor_speed_prop); // Show the motor speed prop on the dashboard again

gumbandSubscribe()

Complete the hardware registration with all remote servers (both Cloud and Exhibit if connected). The registration sends all of the information for the initialised properties and creates the properties on the remote server.

Info

gumbandSubscribe() must be called before publishing or sending log messages

Syntax:

void gumbandSubscribe(void);

Example Usage:
Code Block
languagecpp
// Create all peripherals and their properties
GumbandProp first_prop = gumbandCreate("My Peripheral", "First", gmbnd_byte);
GumbandProp second_prop = gumbandCreate("My Peripheral", "Second", gmbnd_byte);
...
// Register the peripherals and properties with the broker
gumbandSubscribe();

gumbandPublish()

TBD on the implementation of this, but the intent is to be a type agnostic way to publish.

Syntax:

void gumbandPublish();

Example Usage:
Code Block
languagecpp
// TBD

gumbandPublishByte()

Publish a single byte to a property of type gmbnd_byte.

Syntax:

void gumbandPublishByte(GumbandProp handle, uint8_t data);

Example Usage:
Code Block
languagecpp
GumbandProp my_prop = gumbandCreate("My Peripheral", "My Property", gmbnd_byte);
...
uint8_t data_val = 100;
gumbandPublishByte(my_prop, data_val); // Publish the value of 100 to "My Property"

gumbandPublishByteArray()

Publish an array of bytes to a property of type gmbnd_byte and length >1.

Syntax:

gumbandPublishByteArray(GumbandProp handle, uint8_t* data, uint8_t len);

Example Usage:
Code Block
languagecpp
GumbandProp my_prop = gumbandCreate("My Peripheral", "Sequence", gmbnd_byte);
...
uint8_t data_arr[] = { 0, 1, 2, 3 };
gumbandPublishByteArray(my_prop, data_arr, sizeof(data_arr)); // Publish 0 to 3 to "Sequence"

gumbandPublishInt()

Publish a single uint32 to a property of type gmbnd_int32.

Syntax:

void gumbandPublishInt(GumbandProp handle, uint32_t data);

Example Usage:
Code Block
languagecpp
GumbandProp my_prop = gumbandCreate("My Peripheral", "My Integer", gmbnd_byte);
...
int32_t data_val = -1000;
gumbandPublishInt(my_prop, data_val); // Publish the value of -1000 to "My Integer"

gumbandPublishIntArray()

Publish an array of uint32 to a property of type gmbnd_int32 and length > 1.

Syntax:

void gumbandPublishIntArray(GumbandProp handle, uint32_t* data, uint8_t len);

Example Usage:
Code Block
languagecpp
GumbandProp my_prop = gumbandCreate("My Peripheral", "List", gmbnd_int32);
...
#define ARRAY_SIZE 7
uint8_t data_arr[ARRAY_SIZE] = { -3, -2, -1, 0, 1, 2, 3 };
gumbandPublishByteArray(my_prop, data_arr, ARRAY_SIZE); //Publish -3 to 3 to "List"

...

Gumband Logging API

Functions to send informational messages to the Gumband Cloud dashboard.

Info

Logs are limited to 10 messages per second and are currently not sent to Exhibits.

gumbandDebug()

Syntax:

void gumbandDebug(const char* text, ...);

Example Usage:
Code Block
languagecpp
gumbandDebug("Hello Gumband! I am a debug message.");
Code Block
languagecpp
uint8_t test_data = 100;
gumbandDebug("Sending data value of %d...", test_data);

gumbandLog()

Syntax:

void gumbandDebug(const char* text, ...);

Example Usage:
Code Block
// TBD

gumbandError()

Syntax:

void gumbandError(const char* text, ...);

Parameters:

text

A text string of the Error message, up to 127 characters allowed.

Variables…

A optional series of formatting variables

Example Usage:
Code Block
languagecpp
gumbandError("Hello Gumband! I am an error log message.");
Code Block
languagecpp
const char* error_string = "Example Error";
gumbandError("Warning! Encountered an error with message: %s", error_string);

gumbandNotify()

Send a notification message to the Cloud. Anyone who is subscribed to notification messages for this hardware will immediately receive an email notification with the message. <Link to details for how to subscribe to notifications>

Syntax:

void gumbandNotify(const char* text, ...);

Parameters:

text

A message associated with the notification, up to 127 characters allowed.

Example Usage:
Code Block
languagecpp
gumbandNotify("Hello Gumband! I am a notification in your e-mail that something happened.");

gumbandEvent()

Send an “Event” to the Cloud. These Events are plotted on a graph and can be viewed in realtime on the dashboard. The data can be viewed either as frequency of named Events over time or Event values over time.

Syntax:

void gumbandEvent(const char* text, uint32_t val);

Parameters:

text

A text string name for the Event. Events are grouped by matching name.

val

An optional value for the event.

Example Usage:
Code Block
languagecpp
gumbandEvent("My Event");
Code Block
languagecpp
gumbandEvent("My Event", 100);

...

Gumband Configuration API

...

This sets the version number for the user firmware. This is separate from the Gumband version and is an optional value that is visible from the overview dashboard on the Cloud server and available to the Exhibit. This can be any integer and allows you to keep track of the current firmware on the device. This must be called before gumbandSubscribe().

Syntax:

void gumbandSetUserFirmwareVer(uint8_t fw);

Parameters:

fw

A byte value (0-255) indicating the current firmware version.

Code Block
languagecpp
#define FW_VERSION 53
gumbandSetUserFirmwareVer(FW_VERSION);

Note

In most cases it is not recommended to use any of the following 4 functions to configure the hardware, these changes should be made via the configuration interface (link)

gumbandSetAuthToken()

Syntax:

void gumbandSetAuthToken(const char* text);

gumbandSetHardwareID()

Syntax:

void gumbandSetHardwareID(const char* text);

gumbandSetCloudServer()

Syntax:

void gumbandSetCloudServer(const char* addr);

...

Set the IP of the exhibit server, the static_flag variable can be set to the version number for the user firmware. This is separate from the Gumband version and is an optional value that is visible from the overview dashboard on the Cloud server and available to the Exhibit. This can be any integer and allows you to keep track of the current firmware on the device. This must be called before gumbandSubscribe().

Syntax:

void gumbandSetExhibitServer(const char* addr, uint8_t static_flag);

...

Functions to monitor the status of the Gumband hardware external connections.

gumbandConnected()

Syntax:

uint8_t gumbandConnected(void);

gumbandCloudConnected()

Syntax:

uint8_t gumbandCloudConnected(void);

gumbandExhibitConnected()

Syntax:

uint8_t gumbandExhibitConnected(void);

gumbandUSBConnected()

Syntax:

uint8_t gumbandUSBConnected(void);

...

Gumband Hardware API

Functions to control specific aspects of the physical Gumband hardware, support for these functions may vary depending on platform.

gumbandWriteUserData()

void gumbandWriteUserData(uint8_t index, uint8_t data);

gumbandReadUserData()


uint8_t gumbandReadUserData(uint8_t index);

gumbandLedSetBrightness()

void gumbandLedSetBrightness(uint8_t pwm);

gumbandLedOn()


void gumbandLedOn(void);

gumbandLedOff()


void gumbandLedOff(void);

gumbandLedToggle()


void gumbandLedToggle(void);

gumbandLedOut()


void gumbandLedOut(uint8_t state);

gumbandLedPWM()


void gumbandLedPWM(uint8_t pwm);

gumbandButtonPressed()

uint8_t gumbandButtonPressed(void);