flucto-gmbh / motion-sensor-box

Creative Commons Attribution Share Alike 4.0 International
4 stars 1 forks source link

Refactor networking #128

Closed pacjac closed 1 year ago

pacjac commented 1 year ago

Mostly directory structure and convenience refactoring.

  1. Implemented Publisher and Subscriber abstract base class for the sake of type hints.
  2. Moved mqtt, zmq and serial wrappers to msb/networking to not clutter msb/ too much
  3. Added get_publisher and get_subscriber factory functions. Use with

zmq_pub = get_publisher("zmq")
mqtt_sub = get_subscriber("mqtt", "/sensor/temp")```

4. msb/mqtt and msb/zmq have NOT been deleted but are considered deprecated.
5. Added serial pub/sub draft
6. Added msb/network/packer which provides a common interface for serializing and deserializing. Not fully tested.
7. Started work on unittests with Mock objects.
pacjac commented 1 year ago

Addressed comments. Added functionality to import types from msb.network

e.g.

from msb.network import Subscriber
from msb.network import ZMQ_Publisher
from msb.network import MQTT_Subscriber