Mobile Sensors application for Android platform demonstrates how mobile phone can be used as sensors. The reference application samples built-in sensors on the phone and sends the values to Generic Gateway via Internet connection. The architecture and main view of the application are shown below.
The client can measure acceleration, luminance, magnetic field, temperature, orientation and proximity. The communication uses the XML version of the OpenAPI data format.
First, the Android device must be enabled to allow the installation of applications outside the Android Market. This can be done by allowing installation from unknown sources from the application settings that can be found in the settings menu on the Android device. Next, install sensors.apk application package by transferring it to the device and using device's file manager (Note that all Android devices do not include file manager by default. You can find one from the Android Market.), or by downloading and installing application from the project's web page with device's web browser.
Application's main view comprises an icon grid that opens other sensor views.
Application interface comprises following views:
- Physical sensors - displays node's internal sensors.
- Derived sensors - displays logical sensors that are derived from the physical sensors.
- Alert - alert button to send an alert message to the OpenAPI gateway and a call button to open a phone call to a predetermined phone number (configurable via application settings).
- Camera - takes a picture with devices camera and sends it to the gateway.
- Barcode - captures and decodes barcode with device's camera and sends it to the gateway.
- Active sensors - determines which sensors are captured and transmitted to the gateway.
You can return to the main view from other views with device's back button.Note: You can return to the main view from other views with device's back button.
Physical and derived sensor views show a grid of current sensor values. Clicking a sensor element opens a chart view.
Active sensor selection
Normally, the application sends sensor measurements only on user's action, e.g. when alert button is pressed. Active sensors view is used to select the sensors that are sampled actively. These sensors values will be sent periodically to the gateway. Note that the gateway connection must be configured before the application can send sensor measurements to the gateway. Open application preferences to configure the connection.
The sampling interval can be changed from the preferences menu at the main view. Open application preferences from application menu by pressing the menu button on the Android device.
Following settings can be adjusted:
- Update interval - determining how often sensor measurements are transmitted to a OpenAPI gateway.
- Connection settings - that describe the target gateway address and required connection parameters.
- Call number - used in the alert view to open an alert call.
At minimum, connection settings must be configured to allow the application to send sensor data to remote OpenAPI gateway.
Connection settings comprise
- OpenAPI gateway server DNS or IP address (e.g. server.mycompany.com or 192.168.11.11) and port.
- Network name describing the logical network to which the sensor device belongs.
- Node identifier used to identify the source node.
- Login information, comprising username and password used to authenticate to the gateway server.