Treehopper Java API
|
Discovers Treehopper boards attached to your device. More...
Public Member Functions | |
Context | getContext () |
void | setContext (Context context) |
ConnectionService () | |
HashMap< String, TreehopperUsb > | getBoards () |
(Android) Gets a HashMap of boards connected to this device More... | |
TreehopperUsb | getFirstDevice () |
Gets the first device attached. More... | |
void | addEventsListener (TreehopperEventsHandler listener) |
void | removeEventsListener (TreehopperEventsHandler listener) |
void | deviceAdded (UsbDevice device) |
void | deviceRemoved (UsbDevice device) |
void | onReceive (Context context, Intent intent) |
void | scan () |
ConnectionService () | |
void | updateBoards () |
List< TreehopperUsb > | getBoards () |
(Desktop) Gets a list of boards attached to this device More... | |
TreehopperUsb | getFirstDevice () |
Static Public Member Functions | |
static ConnectionService | getInstance () |
Gets the ConnectionService instance for use. More... | |
static ConnectionService | getInstance () |
Gets the ConnectionService instance for use. More... | |
Static Public Attributes | |
static final String | ActionUsbPermission = "io.treehopper.android.USB_PERMISSION" |
Protected Member Functions | |
void | finalize () throws Throwable |
Discovers Treehopper boards attached to your device.
This documentation set covers the ConnectionService class found in both Treehopper.Desktop, and Treehopper.Android packages.
There are two ways to access discovered boards. If you simply want to wait until the first Treehopper board is attached to the computer, the getFirstDevice() method will return an awaitable task with a result that contains the board:
For simple applications, you can retrieve a board instance with getFirstDevice(), however, if you'd like to present the user with a list of devices from which to choose, you can reference the getBoards() property.
io.treehopper.ConnectionService.ConnectionService | ( | ) |
io.treehopper.ConnectionService.ConnectionService | ( | ) |
void io.treehopper.ConnectionService.addEventsListener | ( | TreehopperEventsHandler | listener | ) |
void io.treehopper.ConnectionService.deviceAdded | ( | UsbDevice | device | ) |
void io.treehopper.ConnectionService.deviceRemoved | ( | UsbDevice | device | ) |
|
protected |
List<TreehopperUsb> io.treehopper.ConnectionService.getBoards | ( | ) |
(Desktop) Gets a list of boards attached to this device
HashMap<String, TreehopperUsb> io.treehopper.ConnectionService.getBoards | ( | ) |
(Android) Gets a HashMap of boards connected to this device
Context io.treehopper.ConnectionService.getContext | ( | ) |
TreehopperUsb io.treehopper.ConnectionService.getFirstDevice | ( | ) |
TreehopperUsb io.treehopper.ConnectionService.getFirstDevice | ( | ) |
Gets the first device attached.
This function will block until a device is attached
|
static |
Gets the ConnectionService instance for use.
|
static |
Gets the ConnectionService instance for use.
void io.treehopper.ConnectionService.onReceive | ( | Context | context, |
Intent | intent | ||
) |
void io.treehopper.ConnectionService.removeEventsListener | ( | TreehopperEventsHandler | listener | ) |
void io.treehopper.ConnectionService.scan | ( | ) |
void io.treehopper.ConnectionService.setContext | ( | Context | context | ) |
void io.treehopper.ConnectionService.updateBoards | ( | ) |
|
static |