iot_firmware.communications.schema

Module with the schemas related with the communications package.

Classes

Message(type, data, id, timestamp, ...)

Message for external communications.

Version(major, minor, patch)

Semantic Versioning following https://semver.org.

class iot_firmware.communications.schema.Version(major: int, minor: int, patch: int)[source]

Semantic Versioning following https://semver.org.

Parameters
  • major – incompatible API changes

  • minor – new functionality (backwards compatible)

  • patch – bug fixes (backwards compatible)

Usage:

>>> ver = Version(major=1, minor=2, patch=3)
>>> ver
1.2.3
major: int
minor: int
patch: int
class iot_firmware.communications.schema.Message(type: str, data: Any, id: int, timestamp: float, api_version: Version, msg_id: int)[source]

Message for external communications.

Basic usage.

>>> message = Message.load({"type": MessageType.READING, "data": {"temp": 24.3}})
>>> message.api_version
0.0.1
>>> message.data
{'temp': 24.3}
type: str
data: Any
id: int
timestamp: float
api_version: Version
msg_id: int
classmethod load(message: Dict) Message[source]

Loads a dict to a Message class and creates an instance of it.

Parameters

message – dict of the data