roboflex.transport.mqtt


Nameroboflex.transport.mqtt JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/flexrobotics/roboflex_transport_mqtt
SummaryRoboflex Transport mqtt Library
upload_time2023-12-05 23:29:54
maintainer
docs_urlNone
authorColin Prepscius
requires_python>=3.6
licenseMIT
keywords mqtt robotics middleware flexbuffers python c++ c++20
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # roboflex.transport.mqtt

Rooboflex support for the MQTT transport.

See https://mqtt.org/ for details.

Using MQTT, nodes can connect to other nodes, even running on different computers. You must run your own MQTT broker - broker functionality is not wrapped in any way.

any node -> MQTTPublisher ==MQTT BROKER==> MQTTSubscriber -> any node

## Contents

* [Install](#install)
* [Import](#import)
* [Classes](#classes)
    * [MQTTContext](#mqttontext)
    * [MQTTNodeBase](#mqttnodebase)
    * [MQTTPublisher](#mqttpublisher)
    * [MQTTSubscriber](#mqttsubscriber)


## System Dependencies

    apt-get install mosquitto
    apt-get install libmosquitto-dev

    ... or on mac ...
    brew install mosquitto

## Build

    mkdir build && cd build
    cmake ..
    make

## Run Examples (see [examples](examples))

    pub_sub_0_cpp
    python pub_sub_0_py

## Import

    import roboflex.transport.mqtt as rtm

# Classes

Roboflex's support for MQTT is embodied in four classes:

1. MQTTContext, which you just have to instantiate somewhere
2. MQTTNodeBase, a base class which you don't use
3. MQTTPublisher, which can publish to an mqtt topic somewhere
4. MQTTSubscriber, which can subscribe to an mqtt topic somewhere


## MQTTContext

In order to use the other MQTT classes, you must instantiate an MQTTContext, and its lifetime must be >= the lifetime of all other MQTT node classes. You must pass an instance of this class to the constructors
of both MQTTPublisher and MQTTSubscriber.

    # instantiate like so:
    mqtt_context = rtm.MQTTContext()

## MQTTNodeBase

Do not instantiate directly. This is the base class for MQTTPublisher and MQTTSubscriber, and holds common functionality and properties.

    # the address of the broker
    mqtt_node.broker_address -> str

    # the port number of the broker
    mqtt_node.broker_port -> int

    # the number of seconds between keepalive messages
    mqtt_node.keepalive_seconds -> int

    # the topic to publish or subscribe to
    mqtt_node.topic_name -> str

    # the mqtt quality-of-service
    mqtt_node.qos -> int

    # whether to print out debug messages
    mqtt_node.debug -> bool

## MQTTPublisher

_**(inherits MQTTNodeBase)**_

Publishes any messages it receives to some topic, on some broker. When it receives an message, it publishes the binary representation on the given topic, and then propagages the message verbatim.

    mqtt_publisher = rtm.MQTTPublisher(
        mqtt_context: rtm.MQTTContext,
        broker_address: str,
        broker_port: int,
        keepalive_seconds: int,
        topic_name: str,

        # optional...
        name: str = "MQTTPublisher",
        qos: int = 0,
        retained: bool = false,
        debug: bool = false,
    )

    # additional properties:

    # See the MQTT documentation for what the retained feature does:
    # https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/
    mqtt_publisher.retained -> bool

    # If you have some message 'in hand' in some other function,
    # you can just use an MQTTPublisher to publish the message
    # directly. This is just an alias for 'signal_self' on core::Node.
    mqtt_publisher.publish({"key1": 32})


## MQTTSubscriber

_**(inherits MQTTNodeBase)**_

Suscribes to some topic from some broker. Expects only Roboflex encoded messages.

    mqtt_subscriber = rtm.MQTTSubscriber(
        mqtt_context: rtm.MQTTContext,
        broker_address: str,
        broker_port: int,
        keepalive_seconds: int,
        topic_name: str,

        # optional...
        name: str = "MQTTSubscriber",
        qos: int = 0,
        loop_timeout_milliseconds: int = 100,
        debug: bool = false,
    )

    # additional properties:

    # number of milliseconds, max, to wait in the mqtt message loop,
    # before checking whether to continue or not.
    mqtt_subscriber.loop_timeout_milliseconds -> int



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/flexrobotics/roboflex_transport_mqtt",
    "name": "roboflex.transport.mqtt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "mqtt,robotics,middleware,flexbuffers,python,c++,c++20",
    "author": "Colin Prepscius",
    "author_email": "colinprepscius@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cf/9f/ec9446f64ca05815b9d65b4270b9f7fd646ed8b9e52c6fa16ecb85357c04/roboflex.transport.mqtt-0.1.7.tar.gz",
    "platform": null,
    "description": "# roboflex.transport.mqtt\n\nRooboflex support for the MQTT transport.\n\nSee https://mqtt.org/ for details.\n\nUsing MQTT, nodes can connect to other nodes, even running on different computers. You must run your own MQTT broker - broker functionality is not wrapped in any way.\n\nany node -> MQTTPublisher ==MQTT BROKER==> MQTTSubscriber -> any node\n\n## Contents\n\n* [Install](#install)\n* [Import](#import)\n* [Classes](#classes)\n    * [MQTTContext](#mqttontext)\n    * [MQTTNodeBase](#mqttnodebase)\n    * [MQTTPublisher](#mqttpublisher)\n    * [MQTTSubscriber](#mqttsubscriber)\n\n\n## System Dependencies\n\n    apt-get install mosquitto\n    apt-get install libmosquitto-dev\n\n    ... or on mac ...\n    brew install mosquitto\n\n## Build\n\n    mkdir build && cd build\n    cmake ..\n    make\n\n## Run Examples (see [examples](examples))\n\n    pub_sub_0_cpp\n    python pub_sub_0_py\n\n## Import\n\n    import roboflex.transport.mqtt as rtm\n\n# Classes\n\nRoboflex's support for MQTT is embodied in four classes:\n\n1. MQTTContext, which you just have to instantiate somewhere\n2. MQTTNodeBase, a base class which you don't use\n3. MQTTPublisher, which can publish to an mqtt topic somewhere\n4. MQTTSubscriber, which can subscribe to an mqtt topic somewhere\n\n\n## MQTTContext\n\nIn order to use the other MQTT classes, you must instantiate an MQTTContext, and its lifetime must be >= the lifetime of all other MQTT node classes. You must pass an instance of this class to the constructors\nof both MQTTPublisher and MQTTSubscriber.\n\n    # instantiate like so:\n    mqtt_context = rtm.MQTTContext()\n\n## MQTTNodeBase\n\nDo not instantiate directly. This is the base class for MQTTPublisher and MQTTSubscriber, and holds common functionality and properties.\n\n    # the address of the broker\n    mqtt_node.broker_address -> str\n\n    # the port number of the broker\n    mqtt_node.broker_port -> int\n\n    # the number of seconds between keepalive messages\n    mqtt_node.keepalive_seconds -> int\n\n    # the topic to publish or subscribe to\n    mqtt_node.topic_name -> str\n\n    # the mqtt quality-of-service\n    mqtt_node.qos -> int\n\n    # whether to print out debug messages\n    mqtt_node.debug -> bool\n\n## MQTTPublisher\n\n_**(inherits MQTTNodeBase)**_\n\nPublishes any messages it receives to some topic, on some broker. When it receives an message, it publishes the binary representation on the given topic, and then propagages the message verbatim.\n\n    mqtt_publisher = rtm.MQTTPublisher(\n        mqtt_context: rtm.MQTTContext,\n        broker_address: str,\n        broker_port: int,\n        keepalive_seconds: int,\n        topic_name: str,\n\n        # optional...\n        name: str = \"MQTTPublisher\",\n        qos: int = 0,\n        retained: bool = false,\n        debug: bool = false,\n    )\n\n    # additional properties:\n\n    # See the MQTT documentation for what the retained feature does:\n    # https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/\n    mqtt_publisher.retained -> bool\n\n    # If you have some message 'in hand' in some other function,\n    # you can just use an MQTTPublisher to publish the message\n    # directly. This is just an alias for 'signal_self' on core::Node.\n    mqtt_publisher.publish({\"key1\": 32})\n\n\n## MQTTSubscriber\n\n_**(inherits MQTTNodeBase)**_\n\nSuscribes to some topic from some broker. Expects only Roboflex encoded messages.\n\n    mqtt_subscriber = rtm.MQTTSubscriber(\n        mqtt_context: rtm.MQTTContext,\n        broker_address: str,\n        broker_port: int,\n        keepalive_seconds: int,\n        topic_name: str,\n\n        # optional...\n        name: str = \"MQTTSubscriber\",\n        qos: int = 0,\n        loop_timeout_milliseconds: int = 100,\n        debug: bool = false,\n    )\n\n    # additional properties:\n\n    # number of milliseconds, max, to wait in the mqtt message loop,\n    # before checking whether to continue or not.\n    mqtt_subscriber.loop_timeout_milliseconds -> int\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Roboflex Transport mqtt Library",
    "version": "0.1.7",
    "project_urls": {
        "Homepage": "https://github.com/flexrobotics/roboflex_transport_mqtt"
    },
    "split_keywords": [
        "mqtt",
        "robotics",
        "middleware",
        "flexbuffers",
        "python",
        "c++",
        "c++20"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf9fec9446f64ca05815b9d65b4270b9f7fd646ed8b9e52c6fa16ecb85357c04",
                "md5": "3e0aed796ad474e434d942b5cdff6ec3",
                "sha256": "ebc4e870ff76ac85a72302c802b7084a76f2d805d1f677ac7be631790c8d3112"
            },
            "downloads": -1,
            "filename": "roboflex.transport.mqtt-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "3e0aed796ad474e434d942b5cdff6ec3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13947,
            "upload_time": "2023-12-05T23:29:54",
            "upload_time_iso_8601": "2023-12-05T23:29:54.614202Z",
            "url": "https://files.pythonhosted.org/packages/cf/9f/ec9446f64ca05815b9d65b4270b9f7fd646ed8b9e52c6fa16ecb85357c04/roboflex.transport.mqtt-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-05 23:29:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "flexrobotics",
    "github_project": "roboflex_transport_mqtt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "roboflex.transport.mqtt"
}
        
Elapsed time: 0.15656s