EPaper-Central C API

_images/banner.png

Defines

ECTR_POLL_NOTHING
ECTR_POLL_ACK
ECTR_POLL_AVAILABLE_DATA_REQUEST
ECTR_POLL_BLOCK_REQUEST
ECTR_POLL_TRANSFER_COMPLETE

Functions

int ectr_init(const char *dev)

Initializes the station library and opens a serial connection to the CC2531 ZigBee stick.

Parameters:

dev – Name of the ZigBee device (e.g. COM1 on Windows or /dev/ttyACM0 on UNIX)

Returns:

0 on success, !0 otherwise. Populates ectr_error in case of failure.

int ectr_poll()

Listens for a single ZigBee packet from an EPaper tag and handles it.

To be used in a loop.

Returns:

The type of the received ZigBee packet as ECTR_POLL_[..].

void ectr_pixmap_free(struct EctrPixmap *pixmap)

Frees the memory allocated by a given pixmap.

Parameters:

pixmap – The pixmap that should be freed.

struct EctrPixmap *ectr_pixmap_from_rgb(unsigned char *rgb, unsigned int length, unsigned int w)

Creates a new EctrPixmap from an 8-bit (1byte per color) rgb pixel array.

Parameters:
  • rgb – Pointer to the rgb pixel array.

  • length – Size of the rgb pixel array data in bytes.

  • w – Width of the image, height is calculated auotmatically based on length.

Returns:

struct EctrPixmap* Pointer to a new EctrPixmap consisting of the input pixels.

Variables

const char *ectr_error

Human-friendly description of the latest error thrown by the library or NULL if no error was thrown.

struct EctrPixmap *(*ectr_pixmap_for_tag_callback)(uint64_t tag_macaddr)

Callback invoked by the library to retrieve the pixmap that should be sent to a tag from the user.

This method is called every time a tag checks in and for each individual chunk of the transfer; so heavy generated pixmaps should be cached before being accessed in this method.

However, there’s also onboard-caching on the tag-side: This means the library-user does not need to keep track of changes to pixmaps. In other words: Once a pixmap has been fully received, by a tag, this method will only be called a single-time for each check-in until the data changes.

Param tag_macaddr:

The mac address of the tag that just checked in for new data.

Return:

The pixmap that should be sent to the tag.

struct EctrPixmap
#include <epaper-central.h>

Struct holding a black-and-red pixmap for EPaper tags.

Pixmaps can be created using the ectr_pixmap_from_* methods.

Public Members

unsigned char *pixels
unsigned int len