BlueDUN +: Connect custom application to an external device with TCP / IP over bluetooth

1:44:00 PM
BlueDUN +: Connect custom application to an external device with TCP / IP over bluetooth -

app external server running a TCP


The external application performs a TCP server a specified port and acts as a normal application server: when the client requests a bluetooth connection with a particular IP address, BlueDUN Service directs data packets to the local port on localhost (127.0.0.1).






Application settings - " Extensions "category:
client application = unchecked
Redirect IP = special IP associated with the external application [ default: 192.168.0.0 ]
local Port = the port number linked to localhost TCP server running inside the external application [ default: 8001 ]



Taking action in external demand:

1. Start BlueDUN Service [if not automatically started on device boot]

intention intent = new intent ();
intent.setComponent (new ComponentName ( "com.bluedunx", "com .bluedunx.BlueDUNService"));
context.startService (intention);

2. Start the TCP server for a given number of local port



external app connected as client TCP


The external application connects to a TCP server running inside BlueDUN; BlueDUN the unit directs data packets to the TCP socket created with the external device on the Bluetooth channel, corresponding to the port numbers.
The TCP server starts as soon as you start the BlueDUN service on localhost (127.0.0.1) and opens the specified port.




Application settings - " Extensions " category:
client application = checked
Redirect IP = special IP associated with the external application [ default: 192.168.0.0 ]
local Port = the port number localhost related to the TCP server running inside BlueDUN [default: 8001] and equivalent to the port number on the external device




Actions to run in the external application:

1. Start BlueDUN Service [if not automatically started on device boot]

intention intent = new intent ();
intent.setComponent (new ComponentName ( "com.bluedunx") "bluedunx.BlueDUNService com.");
context.startService (intention);

2. Connect the TCP server for the given port number

Note: This configuration requires the external application to be reconnected if the external device closes a connection created before.




To test the service in both cases, you can download the source code TCPClientServer
[ Android external app example implementing a TCP client / server ]

You need to complete the modem [AT commands] negotiating with your external device because BlueDUN + also supports connections that begin directly with PPP (LCP + NCP) negotiation.



Previous
Next Post »
0 Komentar