Treehopper C++ API
|
We have Getting Started guides for the following platforms:
Before you dive into the C++ API, you should familiarize yourself with some core concepts found in the API, along with the overall API philosophy. This will help you anticipate how to interact with the API so that you don't have to constantly consult the docs directly.
Treehopper property names directly translate to overloaded C++ class method. Leave the parameter blank to retrieve the current value, or pass a new value as the only parameter to the method.
For example, to get the status of the on-board LED:
auto ledState = board.led();
To set the state of the LED:
board.led(true); // turn on the LED
Each Treehopper board has a serial number and a name. Both of these properties can be set by the user. Note that these properties correspond to the ProductName and SerialNumber that are part of the USB specification, which means they'll be visible across your operating system.
All Treehopper's C++ API provides a static instance of the ConnectionService class that can be used to retrieve instances to attached Treehopper boards.
You can use multiple Treehopper boards simultaneously from a single application. Access these boards from the ConnectionService::instance().boards collection.
Only one application can connect to a Treehopper board at a time. This has some important repercussions: