-
Notifications
You must be signed in to change notification settings - Fork 1
Sample explanation
Code is the best documentation. In order to better navigate in the code, skim through Metaphors and buzz.
What are essential bits to get your application up and running with Sensor Lib? We will use example of ForaApp to tell you.
ForaApp uses the D40CachedSink Driver to collect and display data from Fora D40 blood pressure and glucose meter. Unfortunately, protocol of Fora D40 device is protected by NDA and thus we only supply the implementation of the Driver in foraLibrary.jar
1. Decide on the life-cycle. In the ForaApp, we start SensorSink, in Application.onCreate with
startService(IntentFactory.create(D40CachedSink.ACTION));
Note IntentFactory is helper class, which simply does the following:
Intent i = new Intent(); i.setAction(D40CachedSink.ACTION);
2. Bind to the service in the activity of your choice. We prefere onCreate and onDestroy methods to bind to the service. Use DriverConnection.bind(Context c)
and SensorSinkConnection.bind(Context c)
drivers.
3. Register a listener on the connection.
4. Enjoy :)