Get Binary Data from external device on Android Phone
I'm looking for some input on how to go about a problem I have. We have a device that has binary data that it needs to send out (they are mainly just symbols, but in a custom binary format) over ethernet. I need to intercept this data on the phone and display the symbols over google maps. I'm just wondering the best way to go about this, I have a few ideas but am开发者_开发技巧 not sure if they are possible or feasable:
- Is it possible for the phone to connect directly to the device if the device had some sort of server running on it, then poll for new data? If so, what is the protocol needed to be able to direct connect like that?
- Perhaps modify the device software to send data to the phone(s) in SMS data message format? Im not sure if it is possible for software to "spoof" an SMS to a phone when it is not a phone itself?
- Have the device software upload all its binary data to a ftp/http server that is sitting out there somewhere, have the phone(s) connect to that server and poll for new data periodically?
I'm brand new to android development, basically all I want to do is grab this binary data from the device on my phone and parse/display it over google maps. How do any of those ideas sound, or is there a much easier way I am overlooking? Thanks!
Is it possible for the phone to connect directly to the device if the device had some sort of server running on it, then poll for new data?
Possibly, if they are both on the same WiFi LAN.
If so, what is the protocol needed to be able to direct connect like that?
You would have to ask the manufacturer of your device. We have no way to know.
Perhaps modify the device software to send data to the phone(s) in SMS data message format?
If it is a GSM phone or a CDMA phone, perhaps this would work.
Have the device software upload all its binary data to a ftp/http server that is sitting out there somewhere, have the phone(s) connect to that server and poll for new data periodically?
This has the advantage of working with the device over 3G, as the phone and device do not have to be on the same network -- they both just have to be able to reach that server. With Android 2.2, you could also use C2DM to tickle the phone to let it know there is data to be picked up.
For connection type, you can choose between Bluetooth, WiFi or GPRS/3G. What's best for your case depends on how close is the device to the phone and what connection capabilities it have.
You must also decide how connection will be initiated - by phone or by device. The only reliable option for a server on the Android phone is Bluetooth. Wifi is restricted for opening server sockets, and GPRS/3G is carrier dependent. If the device runs a server, you can access it via WiFi if it's on the LAN or Internet, for GPRS/3G it has to be on Internet.
Once you choose these things, you're left with the choice for protocol, but it's a long way to it for an answer at that stage.
精彩评论