Components | Description |
NearByPeers | · Attributes: Management Sockets List, Data Sockets List, and Peer Record · Methods: Add new peer, connect to peer, prune peers, and remove duplicated sockets |
Main Activity | · Performs the service discovery announcement. · Finds nearby devices and adds them to a list. · Connects to a device, opens/connects to the required management sockets, and opens/connects to data exchange sockets. · Periodically sends peer info (GM) every millisecond/ peers list (GO) every 5 milliseconds. · Periodically decrease the TTL values for peers every millisecond. · Periodically prune peers every 5 milliseconds. · Handling messages from management sockets and add/update peers list, prune peers, remove duplicated socket connections, and reset TTL values accordingly. · Opens a data exchange connection if not already connected. |
Socket Manager Class | · Handles incoming data from the socket · Notifies the main activity about the data and its type (Management/data) · Handles outcoming data to the socket |
File Manager Fragment | · Registers incoming or outgoing Application Message intents · Checks where exactly the file is located in the device and returns an appropriate response · Sends a file request to peers |
Multi-hop Manager | · Stores and forwards messages · Have an intent register which registers the following intents: new Connection (when we have a new connection where in all the messages are forwarded; Message Received (when we have an incoming message and outgoing Application Message (when we receives an outgoing application message that needs to be forwarded to all peers. |
Setting Activity | · Allow the user to change the announced username |