Reputation: 1018
am working on a project where i run Raspberry Pi on Android(Gingerbread), what we are trying to do in this project is that we take readings(teperature and light) from a Zigbee(pikkerton) device,the Zigbee device sends the data to a dongle which is plugged in to raspberry pi, we should read the values on raspberry pi via dongle and display it on Android
Upvotes: 3
Views: 1931
Reputation: 40397
It sounds like your dongle provides a serial interface, so you have two broad types of choices:
1. You can let a linux-level driver create a serial interface
You will need to have whatever creates the serial device (/dev/ttyUSB0 or /dev/ttyACM0 or the like) set the permissions to allow all users access. Or you can set the permissions to allow only access to a hard-coded unix-level user group id, and modify your Android installation to add a new android permission which results in membership of the app's userid in that unix group so that it can access the port. (See how Internet and External Storage permissions are handled for an example of doing this in a way any app can utilize, or how the radio device is handled for a restricted example) You then use normal linux serial APIs to access the port from your NDK code, or Java serial APIs to do so from Java code.
2. You can disable any linux-level driver, and talk to the raw USB device from Android application code
First check if the release of Android you are using has the USB host APIs; if not you will need to upgrade it first. This method will require less customization of Android, but may require more understanding of the actual USB communication with the dongle. However you will likely be able to track down example code for talking to similar devices from an Android app.
Upvotes: 2