How to play with devices like accelerometer and camera using C/C++?
As you can see in architecture diagram below android platform has been built using different layers.开发者_运维问答
Application
are developed inJava
Application Framework
is written usingJava
(according to my understanding)Libraries
are inC/C++
For some insane reason I have to play/deal with devices like accelerometer
, compass
and camera
using C/C++
which means directly accessing them in 3rd layer i.e. Libraries
. According to my understanding the Application Framework
itself would be consuming Libraries
for accessing these devices and then providing APIs
for Applications
.
I am looking for any documentation/tutorials/demo which can help me in this regard i.e how to access and use these devices like camera, accelerometer and compass from C/C++
code or in other words how to play with these devices directly from Libraries
layer.
My last option would be to get the android source code and dig deep into it to find out what I am looking for but I would like some easy way in form of a documentation/demo/tutorial/anything that can make this a bit easy for me.
I am looking for any documentation/tutorials/demo which can help me in this regard i.e how to access and use these devices like camera, accelerometer and compass from C/C++ code or in other words how to play with these devices directly from Libraries layer.
You don't. You access them from Java code. Reorganize your C/C++ code to support your Java code.
For the camera, you can use opencv to access the frames with a c++ library. For the Accelerometer, I'm looking for how to access using c++.
精彩评论