Open MohammedMohiuddin1 opened 3 months ago
This is a good start 👍🏼 I think this can be abstracted (decoupled) a bit more.
I think we should consider splitting up into multiple abstract classes: Advertise
and Discover.
Helpful Resources:
I am using mermaid for diagramming.
classDiagram
Discover <|-- DiscoverBluetooth : implements
Discover <|-- DiscoverNearby : implements
class Discover {
<<Abstract>>
Duration elapsed
String displayName
start(): void
onConnect(): void
stop(): void
}
class DiscoverBluetooth {
String status
}
class DiscoverNearby {
String serviceId
}
PeerManager ..> Strategy: requires
PeerManager --> Discover: discover(strategy)
class Strategy {
<<Enumeration>>
Bluetooth
Nearby_Connections
WiFi
Echo Location
}
class PeerManager {
-Strategy strategy
discover(): Discover
}
Narrow down DiscoverBluetooth + DiscoverNearby methods + attributes
Draft 1 of full UML.
Rename AdvertiseManager
-> PeerManager
, as the manager has many actions including: advertise, broadcast, connect, disconnect.
Nomenclature for functions/variables are lowerCamelCase Advertise
while classes are UpperCamelCase see https://dart.dev/effective-dart/style
Concrete classes (UniversalBLE, NearbyConnections, WiFi) should align with the structure of an abstract class. For example, for NearbyConnections, how does startAdvertising()
differ from start()
?
An important aspect of the concrete classes is to be a bucket for data that is dependency specific. For example, UniversalBLE may store uuid
, isAvailabile
(may be useful for all classes), and add a new function enable()
. While Wifi
may store bssid
, ssid
, etc and add a new function init()
.
A pattern I'm seeing in these packages are asynchronous functions, https://dart.dev/codelabs/async-await, in example how can we support these async functions?
https://pub.dev/packages/nearby_connections
Description: The Nearby_Connections_Manager class is a part of the Nearby Connections API, which provides a high-level interface for managing connections between devices that are in close proximity to each other. This class was created to leverage the API and utilize the functions to manage these connections, allowing devices to communicate with each other directly when they are within close proximity of each other.
The class provides several methods for connection including but not limited to:
For the purpose of this project, we aim to utilize the class for establishing peer-to-peer file sharing.