I'm looking to use five android phones to take a photo simultaneously (from different angles).
I'd like to control the phones via a pc (linux or mac) and ideally they're all connected via USB/Ethernet.
I'm an EE, but I don't have much Android experience, so looking to get some feedback based on what I've read so far.
Looks like the Scrcpy library could work here, controlling the 5 devices via adb. I see it allows for multiple connections, have anyone tried this?
I could potentially create a PCB that integrates with the headphone jack of each device and control via push button and 470ohm resistor?
I could potentially build a client app on the Android devices, which connects to a server app on linux/mac (basic TCP/IP client server)
What routes/design would people take on architect-ing such a system?
Thanks for your help and reading this.
What do you mean by "simultaneous"? How much leeway do you have- seconds? Milliseconds? Somewhere in between? Because those can require different techniques.
The easiest thing is to use adb on all 5 devices (I think you can, but I've never personally done more than 2 at once). YOu can even use adb over wifi, so you don't need the cables. You can open the photo app on each (either manually or via adb) then send an input command down via db to each device to send a click of a CAMERA media button, which should cause them to take a photo (of course this is dependent on the camera app honoring this keycode).
The problem with that approach is that you're going to have to have a script that either sends commands to each device 1 at a time (they'll be off by seconds) or spawns N processes that each send a command. That obviously isn't going to be simultaneous either, although it would be closer.
If you really do need simultaneous, its better to write an app on the PC that sends a UDP multicast message. Write an Android app that listens for it. Then when the device receives the message, take the picture. This will assure each device gets the message at the same time, and the picture should be within milliseconds of each other. Of course, if you don't need ms resolution this is total overkill.
Related
I want to have one stationary device like an android phone that can use a standard local SIM card and forward all calls to a second device over some kind of VoIP protocol. When someone calls the phone number of the stationary device, I want my second device to ring and handle the call through something like linphone, element, or whatever. Ideally, it should be possible from the second device to initiate a call from the stationary device's phone number as well. Bridging SMS too would be nice, but I already have a solution for this on android.
There are many use cases like
when traveling abroad, being able to bring the latter device and receive/make calls via the stationary device at home
forwarding multiple phone numbers to a single device and e.g. switching off the work number when away from work
having privacy when the location of SIM cards is logged, by making calls over wifi from somewhere else than the stationary device
when traveling somewhere with bad mobile coverage but available wifi, without having to think about how the second device handles it
Are there any existing projects for doing this?
If not, then what would be necessary to make something myself? Is the best solution something like connected an android device by bluetooth to something running asterisk like was discussed here? Or has something changed in the past 11 years, maybe the existence of some working linux phones makes this possible on a dedicated purism or pinephone device?
I think you can achieve this with Brekeke SIP Server. I am using their solution to achieve something similar to what you want to do.
there are multiple ways to achieve it technically, but the most practical solution to your use case will be to use a VOIP Gateway device.
Actually we can not use a mobile phone as gateway between SIM and VOIP calls.
so you can buy a voip gateway example GOIP (single SIM) and put your sim, connect to your home internet and configure. your phones softphone (eg linphone) will be able to directly register on it and you will be able to make/receive calls and sms.
there will be a new problem as mobile OS platforms are more and more restrictive about power, your sip client will not be able to receive calls while in background for that you will need push, so you can use twillio's mobile sdk to make a client that works fine then forward your calls to twillio from gateway. since there is no number or telecom services involved, cost on twillio should be minimal.
A more common way to do this is with an operator service, rather than implementing it yourself.
The operator is able to see the routing to your number and simultaneously call multiple numbers you have set up. Different operators will have different names and details so you would need to speak to your local operator.
For example BT in the UK (who I have no affiliation to - just an example) provide a service called 'Follow ME': https://support.ringcentral.co.uk/s/article/9010?language=en_GB
If you do want to do it yourself than an open source PBC like Asterisk is indeed a good starting point.
I have opened 2 or more genymotion virtual devices on my computer. To be precise lets assume 5 named Devices A, B, C, D and E. What I am trying to achieve is, I want to send data from A to the other 4 (B,C,D and E). That is, A would act as a Central Unit or a "server" in an ad hoc sort of network enviroment.
Does genymotion provide such a service? Or, just I wrote above, I need to compromise one of the devices to do this task of sending and receiving?
If I am not using genymotion and would do this on real devices. Assume I know the IP addresses of the 4 devices. How can I make them ready 24/7 to listen to anything that I will be sending from device A?
There is nothing like this provided by Genymotion but it is not a problem because, you seems to be a developer and you should find a way to implement it yourself. There are tons of ways to achieve your goal, here are some of them:
Java Sockets, it allows you to share data quite simply between your devices
HTTP micro server (like Nanohttpd), it allows you to create rest base protocol between your devices
I am working on a dual application on android sdk and kinect sdk. I want to be able to have the kinect send data to a smartphone application. The smartphone application will then give notifications to the user based on the kinect data. The smartphone should be able (hopefully) to turn the kinect on/off and maybe a few other basic commands. How can I get the kinect and smartphone application communicate?
Cool concept, I'm a huge fan of the Kinect (when used on Windows; I think it's a gimmick for the Xbox).
For starters, you can't directly interface with the Kinect from a smartphone. Kinect needs a USB connection, external power, and a Windows 7 machine with a 2.6 GHz dual core processor. So now it becomes a question of connecting a server application running on the Windows 7 machine and a client application on the Android phone. There's a few ways you could do this (USB, WiFi, TCP), but all of them suffer somewhere. USB would tether you to the computer, making the smartphone app redundant (just use the computer since you're already connected to it). WiFi is probably the best choice if you intend to send serious amounts of data, but would only work in your house. TCP (or UDP) could work for some applications, but if you start trying to stream video your phone will hate you.
I'm going to assume you're not going for a data-heavy application (video streaming to phone). If you're just looking to send off notifications from the Kinect to the Android (for example, use the Kinect as a motion detector and send messages to the Android when someone enters the room), similar to a text message update, you could certainly pull off the TCP/IP solution, and probably quite easily. You'd set up a simple TCP server on the Windows 7 computer with the Kinect, and then connect to it with a TCP request (look at the Client side code). Once you've got that set up, it's easy to send messages between the Kinect and the smartphone app. For starters, just try to get a few quick messages sent over. Server says "HI THERE", Android replies "I HATE YOU WINDOWS", etc, and make sure the messages are making it to their destination (TCP pretty much guarantees they will). After you have that running, just build your apps up around it.
If you're willing to eschew the use of the official Microsoft SDK, the Point Cloud Library (built on top of OpenNI) has a framework and tutorial in place for streaming.
I send the text file to multiple devices using the following code,
ContentValues values = new ContentValues();
String filePath1 =Environment.getExternalStorageDirectory().toString()+"/filename.txt";
values.put(BluetoothShare.URI, Uri.fromFile(newFile(filePath1)).toString());
values.put(BluetoothShare.DESTINATION,itDevices.getAddress()); values.put(BluetoothShare.DIRECTION, BluetoothShare.DIRECTION_OUTBOUND);
Long ts = System.currentTimeMillis();
values.put(BluetoothShare.TIMESTAMP, ts);
Uri contentUri = getContentResolver().insert(BluetoothShare.CONTENT_URI, values);
I want the same type of code for sending a message. By using the Bluetooth API application when i try to send the message to multiple devices first i connect to a device and send message to that device and again disconnect and connect to another device and send message to another device in this way this goes.
Is it possible to send a message to multiple devices one by one without disconnect the communication ?
Yes, I believe it is possible to exchange messages with multiple Android Bluetoooth devices simultaneously - without disconnecting and reconnecting.
Leaving the Android API aside for starters, Bluetooth definitely allows you to connect to and communicate with multiple devices simultaneously. All Bluetooth connections happen in piconets which include a master and up to 7 slaves. A device can be part of more then one piconet but this is inefficient (the timing of the two piconets isn't coordinated) and can be unreliable, so if you want to connect to multiple other devices you must make sure you are the master.
I've done this sort of thing with BlueZ (the Bluetooth stack on most Linux and Android devices including AOSP) so I can verify that it is fairly straight-forward and works reliably.
However, I've only done one-to-one connections on Android, so I can't say for sure how you control the master-slave assignment there. Android provides much less power and control compared to regular Linux, and it provides no way to directly read or change the master slave role assignment.
In theory, you should be able to control the roles based on the rule that which-ever side initiates the connection will be the master, but I would want to do some testing to see what else might be going on. My concern comes mainly from the possibility that one of the client devices (that you expect to be a slave) might already have a connection to e.g. a headset or keyboard, so when it receives the incoming connection request it might request to switch to master role so it can add your server to its piconet.
What I would suggest is, when you are testing, get access to hcitool on one of your devices (e.g. a Linux box or a rooted Android) and do 'hcitool con' and it will give you a list of the current connections and I think this includes the role. (hcitool is a standard tool on Linux and is included in AOSP.) I guess you could also just use the empirical approach: if you are able to create a bunch of simultaneous connections that work reliably then it doesn't matter much how it works - just make sure you test situations where some of the devices have existing connections to other devices.
Sorry about going on, but I think this is a good question and would be interested to hear from people who have done this on Android. I think I've heard of multi-player Bluetooth games for Android - I wonder if those work reliably.
Simple Answer, It is not possible to send to multiple devices without disconnecting from the current one. Bluetooth API uses One-To-One Connection, which is synchronized itself. So you can not achieve multiple sending using Bluetooth API.
I require a fast reliable method of sending control commands (simple data, possibly only a few dozen possible commands) to a remote system which is using a smartphone* as its onboard computer. I have deemed standard data packages used for mobile internet data transfer as too unreliable of control purposes, however I have noticed that once a voice call is initiated it is much more reliable. Has there been any development into sending data between phones across a connected call, and if not are there any known reasons a modified dialup modem in software form couldn't be used?
Furthermore, could this protocol be robust enough to send back low res video and other simple numeric data?
*Smartphone - A phone with significant processing power and ability to run custom programs (most likely with an Android based OS however am open to suggestions)
Have you tried SMS? while you won't get video data it may work for small chunks of data. Also if the small chunks are from the phone to a server, you may try sending DTMF down the line (however I've yet to see that working.
Other than that it's customised hardware.
Hmmm...this reminds me of those old TV games like Hugo...there you had a voice connection and I think the commands were given by the different tone of the key pressed from 0-9. Maybe you should try something similar.