JavaME: how to connect an external sensor? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
开发者_运维技巧 Improve this questionI have an external sensor (personal, mobile). For example, a thermometer. I'd like to connect it to an ordinary mobile phone (no OS, just JavaME) and write JavaME application which reads data from that sensor and displays them on the screen.
My understanding was that I could connect sensor to phone using the audio jack (headphone jack), because every phone has that jack. But I didn't find any info how to read data through that jack.
So, my questions are:
1) Is it possible to connect an external sensor to phone's headphone jack and read data from it in JavaME application? How? Code example?
2) What are the other ways to connect an external sensor to JavaME phone? Bluetooth? Sms?
Thanks for your help!
JSR 256 Mobile Sensor API specification is targeted to handle functionality like you describe.
This specification will define a generic sensor API for the J2ME applications, delivered and licensed as an optional package. The API will offer unified way of managing sensors, connected to the mobile devices, and easy access to the sensor data. The J2ME applications will be able to configure and control sensors transparently from underlying connectivity protocols, e.g. activate, deactivate sensor, launch sensor discovery, start data sampling, etc...
...The number of the sensors embedded or connected to the mobile devices emerging very rapidly. A sensor can comprise of many kind of devices from microphone and camera with pattern recognition to heart rate monitor and thermometer. Sensors and the data they provide may differ greatly from each other. The communication model and protocol are usually different for different sensors as well.
The application that wishes to utilize sensor data typically performs following operations with a sensor: - Sensor detection (discovery).
- Sensor activation and calibration.
- Data capture (sampling initiation, data fetch, data processing (including e.g. filtering, calculations)).
- Sensor deactivation...
Above specification is in use since 2006; if memory serves a couple of mobile phone models support it - search the web for these if you're interested in more details.
AFAIK the J2ME Sensor API (JSR 256) does not provide such functionality. The Sensor Web specification by OGC (Open Geospatial Consortium) may be closer to what you're looking for.
精彩评论