Code Monkey home page Code Monkey logo

Comments (2)

tthiery avatar tthiery commented on June 18, 2024

Hub Discovery

A central module PoweredUpHost handles the discovery of Hubs using the provided IPoweredUpBluetoothAdapter. The host instantiates the specific hub but does not perform a Hub.ConnectAsync. This decision is left with the invoking consumer (based on e.g. filtering by name/bt address of the hub).

Rationale: Discovery is required but specific to the LEGO protocol. Therefore, a module is required handling it independent of the utilized BT stack. The Hub provides a method ConnectWithBluetoothAdapter which allows alternatives to Bluetooth connections, e.g. for mocking etc.

Hub

A Hub is essentially a handler for ports. It manages a list of Ports which then can be used to retrieve the connected device. The hub itself has built-in devices exposed via known ports. Derived classes (e.g. TechnicMediumHub) of the base hub can be used to simplify access to known external ports (e.g. A-D). The hub does not understand or expose functionality for individual devices. This is outsourced to devices.

Rationale: To keep the Hub maintainable, the device logic is isolated into specific device classes.

Devices

Devices are convenience modules collecting conversions from and to protocol messages. It is connected to the rest of the library using the IPoweredUpProtocol (which may be filtered to the given port).

Devices have cached static information retrieved using PortInformation and PortModeInformation messages. These cached messages allow a much faster setup of the protocol decoding.

Rationale: Keep devices simple while at the same time keep the hub focused on managing ports and connection.

from powered-up.

tthiery avatar tthiery commented on June 18, 2024

Hub, Port and Device are virtual representations of physical object. This allows a simple mental transfer.

from powered-up.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.