|
|
| 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.
◆ setup()
| 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.
◆ setBuffer()
| unsigned int Gui::setBuffer |
( |
char | bufferType, |
|
|
unsigned int | size ) |
Sets the buffer type and size of the container.
- Parameters
-
| bufferType | type of the buffer, can be float (f), int (i) or char (c) |
| size | Maximum number of elements that the buffer can hold. |
- Returns
- Buffer ID, generated automatically based on the number of buffers and the order on which they have been created.
◆ getDataBuffer()
| DataBuffer & Gui::getDataBuffer |
( |
unsigned int | bufferId | ) |
|
Get the DataBuffer object corresponding to the identifier that was assigned to it during creation
- Parameters
-
◆ setControlDataCallback()
| void Gui::setControlDataCallback |
( |
std::function< bool(JSONObject &, void *)> | callback, |
|
|
void * | callbackArg = nullptr ) |
|
inline |
Set callback to parse control data received from the client.
- Parameters
-
| callback | Callback to be called whenever new control data is received. The callback takes a JSONObject, and an opaque pointer, which is passed at the moment of registering the callback. The callback should return true if the default callback should be called afterward or false otherwise. |
| callback | the function to be called upon receiving data on the control WebSocket |
| callbackArg | an opaque pointer that will be passed to the callback |
◆ setBinaryDataCallback()
| 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. |
◆ sendControl()
Sends a JSON value to the control websocket.
- Returns
- 0 on success, or an error code otherwise.
◆ sendBuffer() [1/4]
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 |
◆ sendBuffer() [2/4]
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 |
◆ sendBuffer() [3/4]
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 |
◆ sendBuffer() [4/4]
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