Walkie-Talkie Architecture Overview

Walkie-Talkie Architecture Overview
The Walkie-Talkie architecture contains three layers: WiFi-Direct Layer, Walkie-Talkie
Layer and Manager Layer.
The WiFi-Direct Layer is used to handle the WiFi-Direct communication including
discovering peers, connecting peers and maintaining WiFi-Direct connection status.
The Walkie-Talkie Function Layer helps to handle the user interface and audio
communication between peers. Once the Walkie-Talkie application is turned on, it
will generate a signal to inform WiFi-Diret layer to discover and connect peers.
Moreover, there is a peer-device-list object which is used to maintain available peers
and store the peer information in the database. If WiFi-Direct layer has discovered
some peers, the WiFi-Direct layer will generate peer list information and pass this
information to the Walkie-Talkie layer.
The Manager Layer has two main functions: Node Manager and Frequency Manager.
For the function of Node Manager, it helps to construct sockets that send/receive
audio and beacon messages to/from peers. The Frequency Manager contains a
frequency map which is used to decide whom it should send message to. In our
Walkie-Talkie application on the android phone, user can only talk to another device
if they have same virtual frequency. This behavior is like the real Walkie-Talkie device
that uses the frequency to modulate the audio message. The receiver needs to know
the frequency to hear the audio message. Therefore, in our Walkie-Talkie, we
introduce this virtual frequency as a talk group ID that the audio message can only
transmit and receive if they are in the same group. As shown in bellow figure, A, C
and D has same virtual frequency. Therefore, A, C and D can talk to each other. B has
different virtual frequency. This means that B is not in the communication group.
Walkie-Talkie Flow Chart
The flow chart shows how our Walkie-Talkie works when the user turns on the
application. First of all, when the Walkie-Talkie on/off button is turned on, the
WiFi-Direct will start to discover peers and connect peers. After successfully
connecting, the Walkie-Talkie will create three objects: Frequency Manager, Node
Manager and Audio Player. Moreover, it will set the talker button valid to let user can
start to talk to each other. The next figure shows more details about these three
objects.
In our Walkie-Talkie, after connection is set up, we will have two kinds of flows:
Beacon Flow (control message) and Audio Flow (audio message) to handle exchange
information between devices. First of all, when a WiFi-Direct group is formed, due to
the behavior of WiFi-Direct, each group has a group owner and rests of them are
group members. All devices in the group only know the owner’s IP address. This
means that in the beginning they can only send data to group owner. Therefore, we
have two steps registration mechanism to handle this issue. If the device is not a
group owner, it must registers its’ IP address to the group owner. After that the group
owner can help to disseminate members’ address to other devices. The bellow figure
shows that when the WiFi-Direct group is formed, A is the group owner and B/C is
the group member. At step 1, B/C needs to register to A to let A obtain the IP address
of B/C. After step 1, A will generate a control message and send to B/C to help B/C
obtain the IP address of group members.
For the Beacon Flow, the Beacon Broadcast Socket (Client) will keep broadcast the
control message which including the address and virtual frequency. If the user
updates the virtual frequency, this broadcast socket will help to send new beacon
message to peers. The Beacon Accept Socket (Server) helps to receive beacon
messages, extract the frequency information and inform the updated frequency to
upper layer. The bellow figure shows that the frequency of A/C/D is 1234Hz and the
frequency of B is 5678Hz. After the beacon exchanging, each device will receive the
control message from each other. Therefore, the Frequency Manager will generate a
table to maintain frequency of peers.
The second type of flow is Audio Flow which handles audio communication messages.
When the Walkie-Talkie is turned on, the Audio-Player Thread is created and is run in
the background. After received audio message, the Audio Accept Socket will send the
audio message to the Audio-Player Thread. Therefore, the user can hear the voice
played by the Audio-Player Thread. If the user pushes the talk button, the Audio
Recorder object will be created to record voice and send audio message to down
layer. The down layer Audio Msg Socket will help to send out the audio message.
Packet Format
Control Packet Format (Beacon Message)
Control Packet contains three fields: Source Device, Type and Message field.
•
•
Source Device
• Which device initiates this packet?
Type
• BEACON_ADDR
• If this beacon message is used to send IP address
•
•
BEACON_FREQID
• If this beacon message is used to send virtual frequency ID
Message
• If BEACON_FREQID, message contains: the device frequency number.
•
If BEACON_ADDR, message contains: DeviceName, IPAddress,
DeviceName, IPAddress, …
Audio Packet Format (Audio Message)
•
•
•
•
•
SeqNum(4 bytes)
• Sequence number to handle audio packet ordering
SourceDeviceNameLength(4byte)
• Indicate the length of source device name
SourceDeviceName
• The talker’s name
MessageLength(4byte)
• Audio message length
Message
• Audio message