# Wirepas Mesh Messaging
This Python wheel contains the generated code to interact with Wirepas Mesh Network
through the Gateway to Backend API.
It offers an easy way to use the API in Python without the need to build the protobuf files yourself
## Installation
### Install from PyPi
This package is available from [PyPi][pypi].
```shell
pip install wirepas-mesh-messaging
```
### From the source
This wheel can be built from source directly.
Flow will be described here but can already be seen from this repository [Github action](.github/workflows/python-package.yml).
## Usage example
### Create a message to be sent to a Gateway in protobuf format
```python
>>> import wirepas_mesh_messaging as wmm
>>> downlink_message = wmm.SendDataRequest(dest_add=1234, src_ep=10, dst_ep=10, qos=0, payload=bytes.fromhex("0102ABCD"))
# downlink_message.payload can be published on right topic (protobuf formatted)
>>> downlink_message.payload
b'\n\x1e2\x1c\n\x0b\x08\x8e\xac\x9c\xbf\xab\x95\xbd\xf6\xfe\x01\x10\xd2\t\x18\n \n(\x002\x04\x01\x02\xab\xcd'
```
### Parse a Wirepas message received from a Gateway in protobuf format
```python
>>> import wirepas_mesh_messaging as wmm
# payload is the payload received from mqtt (protobuf formatted)
# Let's assume it was created like this on Gateway side:
# wmm.ReceivedDataEvent(gw_id="Gw1", sink_id="sink0", rx_time_ms_epoch=1608644981000, src=1234, dst=1, src_ep=10, dst_ep=10, travel_time_ms=128, qos=1).payload
>>> uplink_message = wmm.ReceivedDataEvent.from_payload(payload)
>>> print(uplink_message)
{'gw_id': 'Gw1', 'sink_id': 'sink0', 'event_id': 12527549978202166391, 'rx_time_ms_epoch': 1608644981000, 'source_address': 1234, 'destination_address': 1, 'source_endpoint': 10, 'destination_endpoint': 10, 'travel_time_ms': 128, 'qos': 1, 'data_payload': None, 'data_size': None, 'hop_count': 0}
```
## Services API documentation
Please refer to the [backend apis repository][github_backend_apis] for
documentation on the [Gateway to Backend API](https://github.com/wirepas/backend-apis/blob/scratchpad_target/gateway_to_backend/README.md).
## License
Licensed under the Apache License, Version 2.0.
See [LICENSE](LICENSE) for the full license text.
[pypi]: https://pypi.org/project/wirepas-messaging/
[github_backend_apis]: https://github.com/wirepas/backend-apis
Raw data
{
"_id": null,
"home_page": "https://github.com/wirepas/backend-apis/tree/master/gateway_to_backend",
"name": "wirepas-mesh-messaging",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "wirepas connectivity iot mesh gateway backend",
"author": "Wirepas Ltd",
"author_email": "opensource@wirepas.com",
"download_url": "https://files.pythonhosted.org/packages/30/cd/3063aa8c824ab88c60e933db44e0957d5671f30107aa24a6fa2ec76266b0/wirepas_mesh_messaging-1.2.5.tar.gz",
"platform": null,
"description": "# Wirepas Mesh Messaging\n\nThis Python wheel contains the generated code to interact with Wirepas Mesh Network\nthrough the Gateway to Backend API.\nIt offers an easy way to use the API in Python without the need to build the protobuf files yourself\n\n## Installation\n\n### Install from PyPi\n\nThis package is available from [PyPi][pypi].\n\n```shell\n pip install wirepas-mesh-messaging\n```\n\n### From the source\n\nThis wheel can be built from source directly.\nFlow will be described here but can already be seen from this repository [Github action](.github/workflows/python-package.yml).\n\n## Usage example\n\n### Create a message to be sent to a Gateway in protobuf format\n\n```python\n>>> import wirepas_mesh_messaging as wmm\n\n>>> downlink_message = wmm.SendDataRequest(dest_add=1234, src_ep=10, dst_ep=10, qos=0, payload=bytes.fromhex(\"0102ABCD\"))\n\n# downlink_message.payload can be published on right topic (protobuf formatted)\n>>> downlink_message.payload\nb'\\n\\x1e2\\x1c\\n\\x0b\\x08\\x8e\\xac\\x9c\\xbf\\xab\\x95\\xbd\\xf6\\xfe\\x01\\x10\\xd2\\t\\x18\\n \\n(\\x002\\x04\\x01\\x02\\xab\\xcd'\n\n\n```\n### Parse a Wirepas message received from a Gateway in protobuf format\n\n```python\n>>> import wirepas_mesh_messaging as wmm\n\n# payload is the payload received from mqtt (protobuf formatted)\n# Let's assume it was created like this on Gateway side:\n# wmm.ReceivedDataEvent(gw_id=\"Gw1\", sink_id=\"sink0\", rx_time_ms_epoch=1608644981000, src=1234, dst=1, src_ep=10, dst_ep=10, travel_time_ms=128, qos=1).payload\n\n>>> uplink_message = wmm.ReceivedDataEvent.from_payload(payload)\n\n>>> print(uplink_message)\n{'gw_id': 'Gw1', 'sink_id': 'sink0', 'event_id': 12527549978202166391, 'rx_time_ms_epoch': 1608644981000, 'source_address': 1234, 'destination_address': 1, 'source_endpoint': 10, 'destination_endpoint': 10, 'travel_time_ms': 128, 'qos': 1, 'data_payload': None, 'data_size': None, 'hop_count': 0}\n\n```\n\n## Services API documentation\n\nPlease refer to the [backend apis repository][github_backend_apis] for\ndocumentation on the [Gateway to Backend API](https://github.com/wirepas/backend-apis/blob/scratchpad_target/gateway_to_backend/README.md).\n\n\n## License\n\nLicensed under the Apache License, Version 2.0.\nSee [LICENSE](LICENSE) for the full license text.\n\n[pypi]: https://pypi.org/project/wirepas-messaging/\n\n[github_backend_apis]: https://github.com/wirepas/backend-apis\n\n\n",
"bugtrack_url": null,
"license": "Apache-2",
"summary": "Wrapper interfaces to interact with Backend to/from Gateway API.",
"version": "1.2.5",
"project_urls": {
"Homepage": "https://github.com/wirepas/backend-apis/tree/master/gateway_to_backend"
},
"split_keywords": [
"wirepas",
"connectivity",
"iot",
"mesh",
"gateway",
"backend"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5f9939032454d8a5019dfeaba476f67b2f37da2d8d107f86bb63aa7e0b20805f",
"md5": "454140f9e50c85fa40b5465cb6d90dc6",
"sha256": "628ff649a1d36841123dcafad4de245aac3219b4f78f349105509566e1985169"
},
"downloads": -1,
"filename": "wirepas_mesh_messaging-1.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "454140f9e50c85fa40b5465cb6d90dc6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 39081,
"upload_time": "2023-10-13T14:39:33",
"upload_time_iso_8601": "2023-10-13T14:39:33.288579Z",
"url": "https://files.pythonhosted.org/packages/5f/99/39032454d8a5019dfeaba476f67b2f37da2d8d107f86bb63aa7e0b20805f/wirepas_mesh_messaging-1.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "30cd3063aa8c824ab88c60e933db44e0957d5671f30107aa24a6fa2ec76266b0",
"md5": "92f68e005e601c3b39f10a4f5d75beb9",
"sha256": "abed2d30377a6efe8c61f6b17796f11fc17afc39a3a8aa9f6f2e39c7d12401c2"
},
"downloads": -1,
"filename": "wirepas_mesh_messaging-1.2.5.tar.gz",
"has_sig": false,
"md5_digest": "92f68e005e601c3b39f10a4f5d75beb9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25620,
"upload_time": "2023-10-13T14:39:34",
"upload_time_iso_8601": "2023-10-13T14:39:34.836816Z",
"url": "https://files.pythonhosted.org/packages/30/cd/3063aa8c824ab88c60e933db44e0957d5671f30107aa24a6fa2ec76266b0/wirepas_mesh_messaging-1.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-13 14:39:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wirepas",
"github_project": "backend-apis",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "wirepas-mesh-messaging"
}