Skip to content

[connectivity_plus] Refactor the C++ code #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

swift-kim
Copy link
Member

@swift-kim swift-kim commented Apr 11, 2022

Part of the code refactoring project. This change is an analogue of #351.

  • Extract the Connection class from ConnectivityPlusTizenPlugin for better separation of the platform channel communication and the device API usage. (I referred to the connectivity_plus_windows implementation.)
    • Create an enum ConnectionType to indicate the current connectivity type or an error status.
    • RegisterObserver/ClearObserverStartListen/StopListen
    • StartListen takes ConnectionTypeCallback as an argument.
    • Create a new method GetType.
    • Remove EnsureConnectionHandle. The connection handle is now created and managed by the Connection class.
  • Create typedefs of long commonly-used types.
  • Create an explicit ConnectivityStreamHandler class. Now the lifecycle of EventSink is solely managed by this class.
  • Minor cleanups.
    • Remove SetupChannels and combine with RegisterWithRegistrar.
    • Style log messages and error codes in a consistent manner.
    • Wrap the non-public implementation with an anonymous namespace.

Additional note: The connectivity type "bluetooth" has been added to the platform interface and will be implemented in a later PR.

@swift-kim swift-kim force-pushed the refactor-connectivity-plus branch from 983b2a3 to 42244d9 Compare April 14, 2022 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants