I have an application made of a device I made to connect through USB emulating a Serial port. Now, I need to connect the same device via bluetooth so I'm using a RN-42 (Bluetooth to serial port) in my device to send the data over RF.
Then I pair my device in Windows with the laptop's internal BT module which creates to COM ports a Outgoing and a Incoming one. Then if I connect using Br#ay's terminal I receive the expected data when I connect to the Outgoing COM port.
The problem is that when I use my Java app where I am using the last RXTX libraries, I can discover the COM port (which is the problem that everyone has, at least thats all what i found in forums) and it seems to connect but then I don't receive no data. Using the same exact program but connecting using a cable it works just fine as the terminal does.
I also tried to use the BlueCove libraries, I can find the bluetooth devices but I don't really know how to discover it services and then connect to it using RFComm. I can't find a complete example of how to do that.
Any help will be appreciated!
I'm getting similar problem with default Windows Bluetooth stack.
With Toshiba stack communication is ok.
Related
I would like to ask how to get and detect the USB.
The red one wire connect to usb to have 2 connections
The second wire connect to CPU to debug using Android Studio
Connect to terminal like printer(this one i want to connect but i cant figure it out how to detect and send data from this).
because I'm trying to send data from the serial port, but the thing here is that the device has 3 usb ports. Its similar to COM PORTS in windows.
I'm using Java and Android Studio.
I am using Java with RXTX library and I have a problem. I want to read data from a Serial Port that is the bluetooth. If I use a normal COM port (usb arduino for example)and JAVA with RXTX, it works. If I use PUTTY, i can read the data from the bluetooth port.
If I use Java + RXTX and the bluetooth port, it doesn't work. If I use putty, and after that I want to display all ports, it works but only for one time, after that I cannot find the port anymore, like it break it. (not even in putty it doesn't work).
If I do not start PUTTY beforehand, It cannot even see the port. After the port is "broken" I have to turn off/on multiple times my bluetooth device. What seem to be the problem?
I did try the things listed here and it did not work : \
http://neophob.com/2011/05/serial-library-rxtx-v2-2pre5/
https://github.com/processing/processing/issues/1374.html
Any other thoughts?
Something is strange. Do you know what do I need to do so that the right rxtxSerial.dll is used? I have deleted every instance of rxtxSerial.dll from my PC and it still works???
I add some detail to my question.
I receive on my Xbee device a flow of GPS coordinates but I'm unable to read and stock these data on a buffer.
My Xbee device is connected to my laptop on a usb serial port, that's why I want to create a program java to read and use my data flow sending by the serial port.
I'm searching on internet some code example or tutorials , without enought advices for my understanding, or I just find some dead projects.
I found that it's possible to use jssc library or javax.comm (but I can't download the javax.zip on sun). Do you know an other better USB API ? Could you help me to understand how I can manage to read and stock my Flow of GPS cordinate ?
Forget abut USB, it acts as transparent bridge. What you need is a way to read from the serial port. javax.comm is not (officially) available any more. I have been successfull dealing with the arduino serial port with the RXTX library.
First make sure you see the serial port on your dev machine. This might require to install a driver. Then use a terminal program to connect to the serial port.
Once this is working go on and get RXTX working.
Just in case: You can have only one connection at a time. Make sure that only one of IDE, terminal programm and RXTX is connecting to the serial port at the same time.
I recently developed an Android application with which the Android device can communicate with another Android device running the application.
The communication works over sockets, therefore I developed a server which i run on my computer.
Here is my problem:
The communication between the devices over the Server running on my PC works fine, as long as all devices as well as the PC are in the same LAN (connected over the same Router for example).
Now I want to get the server online, so that the Android devices can connect to the "online" server and communicate with each other over the server from anywhere.
I simply have no idea of how to get the server online and running. How can I do that?
The main issue is, that I know about Client/Server communication locally, but have no experience in the "online" sector.
It is more a network problem than a programming one. Your server open a socket and therefore is available to anyone able to reach that socket.
You have to do a redirection on your router. The problem is that your machine doesn't have a public IP, only your router has one. So when your router receive a packet on port 21 for example, it doesn't know what to do with it. You have to configure it to say "the port 21 has to redirected to the local IP XXX"
Also the public IP of your modem/router can change, depending on your ISP. If your have a fixed IP, it won't change, otherwise you will have to install a software like dyndns to have a domain name associated with your IP.
I am trying to create a P2P network of android(V3.2) devices to share information like news,updates between them .
Been trying TomP2P, how ever am not able to find a solution of how to debug these . For example I would like to run two different instances either in emulator or AVD Manager and to get these messages shared in between them.
Have also tried port forwarding,how ever yet to see how to communicate between these two emulators.
Any suggestion will be much appreciated.
You need to setup port redirection as described here. Lets assume you have two emulators listening on the default port 5554 and 5556:
Since TomP2P uses UDP and TCP, you need to redirect both on both emulators:
telnet localhost 5554
redir add udp:5001:4001
redir add tcp:5001:4001
and
telnet localhost 5556
redir add udp:6001:4001
redir add tcp:6001:4001
This will redirect from your developer machine (10.0.2.2) port 6001 resp. 5001 to your Android device to port 4001. To connect from one Android device to an other Android device you have to use the IP 10.0.2.2! Further details with a working example can be found on the TomP2P documentation site.