This library parses and constructs OSC messages. It is designed to minimize memory usage by providing a way to pre-allocate the internal buffers.
Bundles are supported via a simple container class.
Notable features of this library:
- Ability to control memory usage.
- Lightweight API.
The classes you'll need are in the qindesign::osc
namespace:
LiteOSCParser
and possibly OSCBundle
. A complete example of how to use
the parser is in the AllInOne
example.
The main class documentation can be found in src/LiteOSCParser.h
.
OSC bundles are managed using the simple OSCBundle
container class.
Not all the files in this project are necessary in an installed library. Only the following files and directories need to be there:
*.md
LICENSE
examples/
library.json
library.properties
src/
There are tests included in this project that rely on a project called ArduinoUnit.
Note that the code for ArduinoUnit is not included in this library and needs to be downloaded separately.
By default, if a value does not exist at a given index, a default value will be
returned. For example, getFloat(2)
will try to return a 32-bit float value at
index 2. If the index is out of range or if the value type at that index is not
a float then a value of 0.0f will be returned.
To avoid this scenario, the following code is useful:
if (isFloat(2)) {
float f = getFloat(2);
// Do something with the value
}
Internally, getFloat
also calls isFloat
with the same index, and so
isFloat
is actually called twice. To avoid two calls, there exist other getter
functions named getIfXXX
(replacing XXX with the appropriate type). For
example, getIfFloat
to retrieve a float. These functions return a bool
:
true
if the value exists and was retrieved, and false
otherwise.
For example:
float f;
if (getIfFloat(2, &f)) {
// Do something with 'f'
}
Code style for this project mostly follows the Google C++ Style Guide.
Copyright (c) 2018-2019 Shawn Silverman