![]() |
Flower Power for Android... an open source library for Parrot's Flower Power sensor platform. It is 100% pure Java. |
Class DiagramThis class digram depicts the most important classes to be used by developers.
As you can see, there are 3 interfaces ( IFlowerPowerServiceManager: This class handles the management of individual flower power instances. You mainly use it to bind (and unbind) the communication service and to connect (and disconnect) a flower power sensor. It provides method which must be called upon specific lifecycle stages of your application (see Lifecycle). Moreover, you need to register your application as an IFlowerPowerServiceListener with the manager. As such a listener, you'll receive lifecycle events, such as when the communication service is ready (or not), when the flower power sensor is connected (or disconnects) and most importantly when data is available. In order to receive such events, your application needs provide implementations for all those methods (see the example, that ships with the distribution). Once a Flower Power sensor is connected, you probably want to read some values or be notified periodically about updated values. The IFlowerPowerSensor is the be used for that. It provides methods for triggering reads of all kinds of values and for enabling (and disabling) notifications (i.e. periodic reads). Note: all these methods return noting, because reads and notifications are executed asynchronously. Once a result is available, it is passed via the IFlowerPowerListener callback (see above) to your application.
This Finally, the FlowerPowerService realizes most of the Bluetooth LE handling. It connects via Bluetooth to your Flower Power, it offers methods to read characteristics and to handle notifications. Internally, it is realized as a job queue, so commands are executed sequentially in order not to overwrite previously issues commands. But these internals are only of interest to those who want to work on the library's internals. |
|