Redpine Signals, Inc.
Page 43
R
R
S
S
-
-
W
W
C
C
-
-
3
3
0
0
1
1
E
E
v
v
a
a
l
l
u
u
a
a
t
t
i
i
o
o
n
n
B
B
o
o
a
a
r
r
d
d
U
U
s
s
e
e
r
r
G
G
u
u
i
i
d
d
e
e
V
V
e
e
r
r
s
s
i
i
o
o
n
n
2
2
.
.
5
5
1
1
9.
Exchanging Data with the Module
In the following descriptions it is assumed for illustrative purposes
that the module‟s IP address is
192.168.100.76
and the remote peer
(phone) IP address is
192.168.100.77
.
Running Ping Application
A ping application can be run from the Wi-Fi Direct Phone, with the
destination address as 192.168.100.76. The module will send the ping
response. Ping based applications are freely available for Android
phones.
Exchanging data through sockets
For exchanging data between the module and the Wi-Fi Direct Phone,
an application may be written by the user at the mobile phone to
open sockets and transmit or receive data. At the module side,
sockets can be opened by using the below commands:
a.
To open a server TCP socket in the module, issue the below
command.
at+rsi_ltcp=5001
5001 is the example port number of the socket opened. Once
the socket is opened, a client socket should be opened at the
remote peer (phone) to connect to this socket and establish a
TCP connection. The module responds with
OK<socket_type><socket_handle><lport><module_ipaddr>.
The
socket_handle
parameter will be used in the subsequent
sections to send data.
b.
After the TCP connection is established, data can be exchanged
between the two nodes. To send data from the module, issue
the following command can be typed in Hyperterminal or
Teraterm:
at+rsi_snd=<socket_handle>,0,0,0,abcdefgh
where
abcdefgh is the data stream to be transmitted to the remote
Peer.
Socket_handle
is the parameter returned when the TCP
socket is opened in the module. Refer to the programming
reference manual for more details.
If the remote peer sends data to the module, the module
would receive it and show the data in the terminal with the
message
AT+RSI_READ
<socket handle><size><Source
IP><Source port><data stream>
10.
HTTP server access: To access the HTTP server, the step #7 in section
Configuration and Test Procedure
should be used. The URL
http://<module‟s IP Address> should be opened in the connected
phone.