Skip to content

Network features#35

Open
jackss011 wants to merge 49 commits intodevelopfrom
feat/network-base
Open

Network features#35
jackss011 wants to merge 49 commits intodevelopfrom
feat/network-base

Conversation

@jackss011
Copy link
Copy Markdown
Owner

@jackss011 jackss011 commented Apr 20, 2017

New classes:

UdpSender:

  • Sends UDP packets to a specific address+port
  • Used to send unreliable data by WifiBridge

TcpConnection:

  • Manages a TcpConnection sending and receiving data.
  • Safe to use on the UI thread

NetBridge:

  • Abstract class providing an unitary interface to manage network connection (BT or LAN)

WifiBridge:

  • Implementation of NetBridge managing a wifi connection
  • Unreliable data is sent using UDP, while reliable data is sent using TCP
  • This class CANNOT receive UDP packets

NetAdapter:

  • High level connection manager
  • Similar to BluetoothAdapter
  • Accessed by the UI (main thread)

Using only sendData(data) function
Class name: TcpConnection
- Added port field to costructor
- Fixed mainHandler
- Created NetBridge class
- Created NetBridge implementation WifiBridge
- Added state determination to TcpConnection
mainHandler leaks
Added also NetworkTests activity
Broadcast packets on a multicast address, and receive responses back
- Added setter
- Calling onFailure in outer onError method
Create a thread factory for network threads
- Created ExpiringList class
- Show a list of discovered devices
- Added click behavior instead of select
- Added event listener for connection requests
- Removed useless class
`SocketInfo {address, name}`

ConnectionDialogFragment is displaying names instead of addresses
No longer throwing concurrent access exception
De-hardcoded `network` package
- Crashing when connecting
- Closing socket even if connected on ConnectTask exit
Devices are removed from the beacon device_list only through` Beacon#updateDevices()`.

If any device is removed, a callback `Beacon.OnEventListener#onDevicesTimeout(infoSet)` is called.

connection_fragment now modify his adapter only through these callbacks, avoiding  to clear the entire adapter each update.
- Class listener
- Initialize a wifi connection
- Tcp connection checks if can start connection
- NetAdapter and Wifibridge check if can start connection
- Renamed some symbols
NetAdapter.getSender() returns a Sender class which contains methods to send the desired data
Removing the name part after the first dot.
Example:  coolname.station.dunno  ->  coolname.
Beacon check if the PC response is valid or not. It also sends a string which will be checked by the PC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant