Question

I'm looking for tutorials, and guidance and not code.

I'm developing a project and the core of the work has been written in C++ and I need to build a user-interface for the Andriod platform. The Android application will work like this:

Problem 1:

There will be a button in which a user can "press" in which they can speak, this is then converted into a .wav file (setting the sample rate etc..) This will then be sent to the library (which is written in C++) and then the result from this is then send back to the interface.

Problem 2:

I need a way to send a small piece of data (after the event of the above) to a Raspberry Pi in which it will trigger some LEDS. (I have completed the LEDS part).

I was thinking that maybe it may be possible to use sockets. In that, the Raspberry Pi is "listening" for data to be sent (it will just be either 1, or 0) and then if "1" is received it then triggers an event. Does this sound like a good method to take?

Would it therefore be a lot better to develop this application using the SDK (Java) or should I just complete the whole project in C++?

Any help, advice and/or tutorials would be greatly appreciated

Was it helpful?

Solution

The Socket solution sounds complicated enough, in that I'm not sure if you are refering to unix domain socket, or the tcp internet socket. unix socket vs tcp. Plus you have to figure out a way as how you define the communication protocol for that socket so that the Pi can distinguish the actual signal from random spam/bombardment.

An alternative + Quick&Dirty solution would be

  • write your android app normally, with official sdk and so on. send the signal over internet wrapped by a simple HTTP get method
  • setup a lightweight and dead-simple http daemon on Pi, with a cgi socket binding. You can write your socket program the same way you have planned.

Of course. if your environment is strictly controlled. you can just use unix domain socket to solve the problem.

OTHER TIPS

Okay for the basics of Androidprogramming this is a good start i guess.

To your first problem it seems that this Tutorial might help you.
For your second problem I would use Bluetooth - Serial Communication. The Bluetooth-API has good Tutorials on the DeveloperPage, so you can send whatever you want via Bluetooth which is already included into Android. The Serial Part is supported by the Pi by default.

Then you need a Bluetooth-RS232 Dongle like this one which you could connect to your Raspberry (I have the same BT-Dongle and it is quite easy to use). Connect the Bluetooth-Serial-Dongle to your RXD and TXD Pin on your Raspberry (see attached pic) enter image description here
and you can send whatever you want to your Pi (you receive your data over on the Pi on /dev/ttyACM0 or something similar).


I hope this helps you a little. Seems to be a big Project so far. Good luck with it

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top