|
| Gui (unsigned int port, std::string address) |
|
int | setup (unsigned int port=5555, std::string address="gui") |
|
int | setup (std::string projectName, unsigned int port=5555, std::string address="gui") |
|
void | cleanup () |
|
bool | isConnected () |
|
unsigned int | setBuffer (char bufferType, unsigned int size) |
|
DataBuffer & | getDataBuffer (unsigned int bufferId) |
|
void | setControlDataCallback (std::function< bool(JSONObject &, void *)> callback, void *callbackArg=nullptr) |
|
void | setBinaryDataCallback (std::function< bool(const char *, unsigned int, void *)> callback, void *callbackArg=nullptr) |
|
int | sendControl (JSONValue *root) |
|
template<typename T , typename A > |
int | sendBuffer (unsigned int bufferId, std::vector< T, A > &buffer) |
|
template<typename T , size_t N> |
int | sendBuffer (unsigned int bufferId, T(&buffer)[N]) |
|
template<typename T > |
int | sendBuffer (unsigned int bufferId, T *ptr, size_t count) |
|
template<typename T > |
int | sendBuffer (unsigned int bufferId, T value) |
|
- Examples:
- Gui/ambient-ellipse/render.cpp, Gui/bela-to-gui/render.cpp, Gui/clock/render.cpp, Gui/empty-project/render.cpp, Gui/frequency-response/render.cpp, Gui/graph/render.cpp, Gui/gui-to-bela/render.cpp, Gui/mouse-track/render.cpp, Gui/sequencer/render.cpp, Gui/sliders/render.cpp, Trill/bar-visual/render.cpp, Trill/craft-visual/render.cpp, Trill/custom-slider/render.cpp, Trill/flex-default/render.cpp, Trill/flex-visual/render.cpp, Trill/general-settings/render.cpp, Trill/general-visual/render.cpp, Trill/hex-visual/render.cpp, Trill/multiple-devices/render.cpp, Trill/ring-sound/render.cpp, Trill/ring-visual/render.cpp, Trill/square-multitouch/render.cpp, and Trill/square-visual/render.cpp.
int Gui::setup |
( |
std::string |
projectName, |
|
|
unsigned int |
port = 5555 , |
|
|
std::string |
address = "gui" |
|
) |
| |
Sets the web socket communication between server and client. Two different web socket connections will be configured, one for control data and the other one for raw binary data.
- Parameters
-
port | Port on which to stablish the the web socket communication. |
address | Base address used to stalish the web socket communication. |
projectName | Project name to be sent to via the web-socket to the client. |
- Returns
- 0 if web sockets have been configured.
unsigned int Gui::setBuffer |
( |
char |
bufferType, |
|
|
unsigned int |
size |
|
) |
| |
DataBuffer & Gui::getDataBuffer |
( |
unsigned int |
bufferId | ) |
|
void Gui::setControlDataCallback |
( |
std::function< bool(JSONObject &, void *)> |
callback, |
|
|
void * |
callbackArg = nullptr |
|
) |
| |
|
inline |
void Gui::setBinaryDataCallback |
( |
std::function< bool(const char *, unsigned int, void *)> |
callback, |
|
|
void * |
callbackArg = nullptr |
|
) |
| |
|
inline |
Set callback to parse binary data received from the client.
- Parameters
-
callback | Callback to be called whenever new binary data is received. It takes a byte buffer, the size of the buffer and a pointer as parameters, returns true if the default callback should be called afterward or false otherwise. The first two parameters to the callback are a pointer to and the size of the data received on the web-socket. The third parameter is a user-defined opaque pointer. |
callbackArg | Pointer to be passed to the callback. |
template<typename T , typename A >
int Gui::sendBuffer |
( |
unsigned int |
bufferId, |
|
|
std::vector< T, A > & |
buffer |
|
) |
| |
Sends a buffer (a vector) through the web-socket to the client with a given ID.
- Parameters
-
bufferId | Given buffer ID |
buffer | Vector of arbitrary length and type |
- Examples:
- Gui/ambient-ellipse/render.cpp, Gui/bela-to-gui/render.cpp, Gui/clock/render.cpp, Gui/frequency-response/render.cpp, Gui/graph/render.cpp, Gui/sequencer/render.cpp, Trill/bar-visual/render.cpp, Trill/craft-visual/render.cpp, Trill/custom-slider/render.cpp, Trill/flex-default/render.cpp, Trill/flex-visual/render.cpp, Trill/general-settings/render.cpp, Trill/general-visual/render.cpp, Trill/hex-visual/render.cpp, Trill/multiple-devices/render.cpp, Trill/ring-sound/render.cpp, Trill/ring-visual/render.cpp, Trill/square-multitouch/render.cpp, and Trill/square-visual/render.cpp.
template<typename T , size_t N>
int Gui::sendBuffer |
( |
unsigned int |
bufferId, |
|
|
T(&) |
buffer[N] |
|
) |
| |
Sends a buffer (an array) through the web-socket to the client with a given ID.
- Parameters
-
bufferId | Given buffer ID |
buffer | Array of arbitrary size and type |
template<typename T >
int Gui::sendBuffer |
( |
unsigned int |
bufferId, |
|
|
T * |
ptr, |
|
|
size_t |
count |
|
) |
| |
Sends a buffer (pointer) of specified length through the websocket to the client with a given ID.
- Parameters
-
bufferId | Buffer ID |
buffer | Pointer to the location of memory to send |
count | number of elements to send |
template<typename T >
int Gui::sendBuffer |
( |
unsigned int |
bufferId, |
|
|
T |
value |
|
) |
| |
Sends a single value through the web-socket to the client with a given ID.
- Parameters
-
bufferId | Given buffer ID |
value | of arbitrary type |
The documentation for this class was generated from the following files:
- libraries/Gui/Gui.h
- libraries/Gui/Gui.cpp