I want to create a project where a mobile Android device is connecting via BLE to a USB dongle inserted in a normal PC (Windows and Linux).
For Android I see good support in the API to establish this connection.
It's not clear for me how to read the data sent from Android on the PC (from a C/Java/Anything program).
At the first look there is no easy way to start a "server" on the PC to listen for BLE connections.
Can you point me in the right direction?
For BLE, you'll need to decide which side is the peripheral and which is the master.
On the PC side, I know of the good old bluez library (http://www.bluez.org), written in C and readily available on Linux. For windows, I suspect that there are similar toolkits.
bluez-tools can help you run test at the command line: https://unix.stackexchange.com/questions/96693/connect-to-a-bluetooth-device-via-terminal
Require a method of connecting an android app with a C++ program on PC via USB, which would allow the android app to send a constant stream of real time data (mostly integer values) to a c++ program on PC via USB and carry out actions accordingly. I know it is easier to do this by wifi or bluetooth, but I want to carry out the connection using USB.
I have searched the net alot for similar questions, and tried many code, but non of them have worked for me. I would greatly appreciate an example code for the c++ portion, and it's android counterpart that allow for this to be done easily.
You could use the USB Tethering option on the phone. This should work with Android 4.4 and the most popular Linux Distributions out of the box. Then you are able use TCP/IP between Android and the PC. You could use an UDP multicast based protocol for service discovery (e.g. Multicast DNS, NSD or SSDP) if you need to avoid entering IP addresses on one side.
One way of doing this is to setup your pc application to talk to the android device as an android accessory. http://developer.android.com/guide/topics/connectivity/usb/accessory.html
This will allow both applications to send whatever data they want over usb, Google do provide source code for doing this with the accessory development kit http://developer.android.com/tools/adk/index.html
I don't have any example source code but there might be some out there if you search.
You can use ADB and call custom commands on your Android device. This commands should just type integers to stdout. As an option, you can use standard shell commands like cat and make your Android app write output integers to files in some directory where ADB can read it.
You can have Android behave like a USB device with a USB CDC (ACM) interface, which is seen as a serial port on the PC (COMx on Windows, /dev/ttyXXX on Linux). On C++ (PC) side, this would be "regular" serial port handling, while on Android there are several libraries for such purposes, though I never used one so I can't recommend any.
I need some guidance..
I have an application (.net) on my PC (windows) that needs to send some data or file (JSON format) through USB to android tablet (4.4.2). I want to design a new app which could accept this data.
I did some research over internet and found some options to implement this but still all of it is not so clear for me:
My first option to do this is – port forwarding by adb shell. My PC need to have adb installed and some drivers. Is it right? Is it possible that .net exe will use this way on pc side?
Second option – my PC should be "USB host" and android tablet should be "USB accessory". Is it better way? And again, is it possible that .net application will implement it?
Last option is use WPD api.. https://github.com/geersch/WPD/blob/master/src/part-3/README.md
Which one is better?
I'll be glad to hear some clarifications on this subject or any recommendations or if there is some other way to do this.
Thanks a lot
How to transfer data between Android phone and PC via USB?
As far as I know there is USB Host/Accessory support for Android devices, but will that work for Windows/Linux?
You can also use Sockets. For that you need forward packets via ADB, so how to connect Android app to both Windows and Linux PC?
Is there a way how to make this communication platform independent?
I am wonder to use my android device to control Pc by USB like a Joystick,but i have no idea about it.Is there any suggestions to do this ?
Thanks!
First, you need to make a Socket connection between you android device and you PC.
ADB is a find choice, send your command to your pc Clinet.Parse it, and deal with it.