{ "info": { "author": "xlfe", "author_email": "", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# PJON-cython\n\nCall the PJON C++ library directly from Python 2 or Python 3 (via [Cython](http://cython.org/))\n\nPJON (Github: [PJON](https://github.com/gioblu/PJON/) ) is an open-source, multi-master, multi-media (one-wire, two-wires, radio) communication protocol available for various platforms (Arduino/AVR, ESP8266, Teensy).\n\nPJON is one of very few open-source implementations of multi-master communication protocols for microcontrollers.\n\n\n## PJON-cython vs PJON-python\n\n**PJON-cython** allows you to use the C++ PJON library from Python via Cython (C++ wrappers for Python) while\n**PJON-python** is a re-implementation of the PJON protocol in Python\n\n## Current status:\n\nSupport for PJON 12 and the following strategies :-\n- LocalUDP\n- GlobalUDP\n- ThroughSerial\n- ThroughSerialAsync\n\nNote\n\n- PJON-cython versions are aligned with PJON versions to indicate compatibility with C implementation for uC platforms.\n\n#### Python support\n\nPython 2.7, 3.4, 3.5, 3.6 and 3.7 are tested and considered supported\n\n#### Platform support\n\nLinux and Mac OS X are considered supported. Windows is not supported (sorry!).\n\n## Install from pip\n\nCurrent version is 12.0.0\n\n```bash\npip install pjon-cython\n```\n\n## Testing\n\n```bash\n$(which python) setup.py nosetests --with-doctest --doctest-extension=md\n```\n\n## GlobalUDP example\n\n```python\n>>> import pjon_cython as PJON\n>>> class GlobalUDP(PJON.GlobalUDP):\n... # you can overload __init__ if you want\n... def __init__(self, device_id):\n... PJON.GlobalUDP.__init__(self, device_id)\n... self.packets_received = 0\n... def receive(self, data, length, packet_info):\n... print (\"Recv ({}): {}\".format(length, data))\n... print (packet_info)\n... self.packets_received += 1\n... self.reply(b'P')\n\n>>> g = GlobalUDP(44)\n>>> idx = g.send(123, b'HELO')\n>>> # calling loop calls the PJON bus.update() and bus.receive()\n>>> # and the return is the results of those functions -\n>>> packets_to_send, receive_status = g.loop()\n>>> # packets_to_send is the Number of packets in the PJON buffer\n>>> packets_to_send\n1\n>>> #PJON constants are available too\n>>> receive_status == PJON.PJON_FAIL\nTrue\n>>> # When you're done with your PJON interface, you can cleanup the connection by deleting it\n>>> del g\n\n```\n\n## Through Serial example\n\n```python\n>>> import pjon_cython as PJON\n>>> #ThroughSerial Example\n>>> # Make sure you set self.bus.set_synchronous_acknowledge(false) on the other side\n>>> \n>>> class ThroughSerial(PJON.ThroughSerial):\n...\n... def receive(self, data, length, packet_info):\n... if data.startswith(b'H'):\n... print (\"Recv ({}): {} - REPLYING\".format(length, data))\n... self.reply(b'BONZA')\n... else:\n... print (\"Recv ({}): {}\".format(length, data))\n... print ('')\n...\n>>> # Put your actual serial device in here...\n>>> ts = ThroughSerial(44, b\"/dev/null\", 115200)\n>>> # Send returns the packet's index in the packet buffer\n>>> ts.send(100, b'PING 1')\n0\n>>> ts.send(100, b'PING 2')\n1\n>>> # Error handling happens through exceptions such as PJON.PJON_Connection_Lost\n>>> while True:\n... packets_to_send, receive_status = ts.loop()\nTraceback (most recent call last):\n ...\npjon_cython._pjon_cython.PJON_Connection_Lost\n\n```\n\n\n## Setting configurable properties\n\n```python\n>>> import pjon_cython as PJON\n>>> class GlobalUDP(PJON.GlobalUDP):\n... def receive(self, data, length, packet_info):\n... print (\"Recv ({}): {}\".format(length, data))\n\n>>> # GlobalUDP and LocalUDP both support set_port to configure their UDP listening port\n>>> g = GlobalUDP(99, 8821)\n>>> del g\n>>> #They return the class object, so you can \"chain them\"\n>>> pjon = GlobalUDP(100,8821).set_autoregistration(False)\n>>> pjon # doctest: +ELLIPSIS\n\n>>>\n>>> # These options affect packet overhead (in bytes)\n>>> pjon.packet_overhead()\n6\n>>> pjon.set_crc_32(True).packet_overhead()\n9\n>>> pjon.set_packet_id(True).packet_overhead()\n11\n>>> pjon.set_synchronous_acknowledge(True).packet_overhead()\n11\n>>> pjon.set_packet_id(False).set_asynchronous_acknowledge(False).packet_overhead()\n9\n>>> pjon.set_crc_32(False).include_sender_info(False).packet_overhead()\n5\n\n```\n\n#### Use serial based strategies with [pyserial_Asyncio](https://github.com/pyserial/pyserial-asyncio)\n\nInstead of passing a serial port string, you can pass a file descriptor to the ThroughSerial and ThroughSerialAsync \nmethods which allows other libraries to poll the serial port.\n\nFor examples, see the [reticul8](https://github.com/xlfe/reticul8/blob/master/python/reticul8/pjon_strategies.py#L27)\nproject.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/xlfe/PJON-cython", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "pjon-cython", "package_url": "https://pypi.org/project/pjon-cython/", "platform": "", "project_url": "https://pypi.org/project/pjon-cython/", "project_urls": { "Homepage": "https://github.com/xlfe/PJON-cython" }, "release_url": "https://pypi.org/project/pjon-cython/12.0.0/", "requires_dist": null, "requires_python": "", "summary": "Call the PJON C++ library directly from Python", "version": "12.0.0", "yanked": false, "yanked_reason": null }, "last_serial": 6045274, "releases": { "11.1.0": [ { "comment_text": "", "digests": { "md5": "19624aec2ba09d245a6cd6589a9d41b1", "sha256": "5aa8c7d109af85b01388c2988000e5898fb8eb5dae893675e523568aad3eb78c" }, "downloads": -1, "filename": "pjon_cython-11.1.0.tar.gz", "has_sig": false, "md5_digest": "19624aec2ba09d245a6cd6589a9d41b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 466669, "upload_time": "2018-08-31T00:35:14", "upload_time_iso_8601": "2018-08-31T00:35:14.177168Z", "url": "https://files.pythonhosted.org/packages/e3/b0/a151fa2ddfc63c38a481cd8a89d134f592e187bb195f6ca580d0f559fa3a/pjon_cython-11.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "11.1.1": [ { "comment_text": "", "digests": { "md5": "930747be56f0af7e5ccaf83c943ac3ee", "sha256": "ffcba7479dc8509a24060d0ded6d5d9b0403a845b322de4da19173811b4b9b6d" }, "downloads": -1, "filename": "pjon_cython-11.1.1.tar.gz", "has_sig": false, "md5_digest": "930747be56f0af7e5ccaf83c943ac3ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 466117, "upload_time": "2018-09-04T12:07:18", "upload_time_iso_8601": "2018-09-04T12:07:18.616675Z", "url": "https://files.pythonhosted.org/packages/b4/b0/dd097911cf51e7a38624489ce47390e37720630de669b154ac10ebda237f/pjon_cython-11.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "11.1.2": [ { "comment_text": "", "digests": { "md5": "d1d290e303e4d9eefd425735e626cc7c", "sha256": "96dec4013eaf730e9dc2da3054a47c0bb0558f3bc08077a969ed4b2819013bfc" }, "downloads": -1, "filename": "pjon_cython-11.1.2.tar.gz", "has_sig": false, "md5_digest": "d1d290e303e4d9eefd425735e626cc7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 466605, "upload_time": "2018-09-05T00:30:50", "upload_time_iso_8601": "2018-09-05T00:30:50.155486Z", "url": "https://files.pythonhosted.org/packages/9d/3a/728f1feae9940b468bce48fa82c63728fbaf48e1d880c233f51eecc028d5/pjon_cython-11.1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "11.1.3": [ { "comment_text": "", "digests": { "md5": "43ce06d1aa716002e3e073013fdbbd4a", "sha256": "037e2e6b0122b22a6e50a34791e71a8a2ef13a529d4a13ba6379b53a5908ebed" }, "downloads": -1, "filename": "pjon_cython-11.1.3.tar.gz", "has_sig": false, "md5_digest": "43ce06d1aa716002e3e073013fdbbd4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5442155, "upload_time": "2018-09-08T12:51:00", "upload_time_iso_8601": "2018-09-08T12:51:00.730487Z", "url": "https://files.pythonhosted.org/packages/f8/20/c127c9f66eb6b0bcc04f3e6eb34c07baa47f8dd60c920ae095558225de0d/pjon_cython-11.1.3.tar.gz", "yanked": false, "yanked_reason": null } ], "11.1.4": [ { "comment_text": "", "digests": { "md5": "66d7e842f541661c9c101d86cbb5612f", "sha256": "226ace7ca065e584860b0a74b7466282d7df0817878f08d423dff78dac6ae3ef" }, "downloads": -1, "filename": "pjon_cython-11.1.4.tar.gz", "has_sig": false, "md5_digest": "66d7e842f541661c9c101d86cbb5612f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5502219, "upload_time": "2018-09-25T09:42:17", "upload_time_iso_8601": "2018-09-25T09:42:17.388620Z", "url": "https://files.pythonhosted.org/packages/98/8f/8de7fd9695870646db11efa4386010693c9516fa9ecec288fc5d4825be64/pjon_cython-11.1.4.tar.gz", "yanked": false, "yanked_reason": null } ], "11.1.4.post1": [ { "comment_text": "", "digests": { "md5": "0a31054be9b66765250066ff27056a21", "sha256": "255b3b1d5c69b7c3df905cb6e7201071846b951bb4dbce03153b370e147fea22" }, "downloads": -1, "filename": "pjon_cython-11.1.4.post1.tar.gz", "has_sig": false, "md5_digest": "0a31054be9b66765250066ff27056a21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5596988, "upload_time": "2018-09-26T12:49:16", "upload_time_iso_8601": "2018-09-26T12:49:16.836226Z", "url": "https://files.pythonhosted.org/packages/a6/c3/6a43def02db6f1e8582d511fcb56f283fa55620136b18cbd840d936e3f81/pjon_cython-11.1.4.post1.tar.gz", "yanked": false, "yanked_reason": null } ], "11.1.5.post1": [ { "comment_text": "", "digests": { "md5": "a4523d801121f672d9eb03604c1b9668", "sha256": "0bcbd46d7221ad03c8f7ff4e9beb2958f101b203bc898536c9547a1dd5cb10ec" }, "downloads": -1, "filename": "pjon_cython-11.1.5.post1.tar.gz", "has_sig": false, "md5_digest": "a4523d801121f672d9eb03604c1b9668", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5611844, "upload_time": "2018-09-29T01:47:50", "upload_time_iso_8601": "2018-09-29T01:47:50.415292Z", "url": "https://files.pythonhosted.org/packages/e5/83/5d26f475450d8f85831c68aaff0ac3f304eca7d3563dd963587e2f60324f/pjon_cython-11.1.5.post1.tar.gz", "yanked": false, "yanked_reason": null } ], "11.1.6": [ { "comment_text": "", "digests": { "md5": "751832977ef228518faf6620a317e88f", "sha256": "83aaf3012a1a2c808a6b7be5377fc2e7424ae835e8fb965ac45812510e2006a6" }, "downloads": -1, "filename": "pjon_cython-11.1.6.tar.gz", "has_sig": false, "md5_digest": "751832977ef228518faf6620a317e88f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5570650, "upload_time": "2018-10-21T10:11:12", "upload_time_iso_8601": "2018-10-21T10:11:12.248375Z", "url": "https://files.pythonhosted.org/packages/ca/c3/d54c1380a4c733b5aaedf316998c01cd9925e900f385325b785e711a208e/pjon_cython-11.1.6.tar.gz", "yanked": false, "yanked_reason": null } ], "11.2.0": [ { "comment_text": "", "digests": { "md5": "e53e87eb8be9811814e7eb2076a3ca2f", "sha256": "7f86d1aec584e2de6a6470b2fe18c2705056faee4360330a1a4b65e73a779787" }, "downloads": -1, "filename": "pjon_cython-11.2.0.tar.gz", "has_sig": false, "md5_digest": "e53e87eb8be9811814e7eb2076a3ca2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6232041, "upload_time": "2019-02-15T23:19:29", "upload_time_iso_8601": "2019-02-15T23:19:29.715302Z", "url": "https://files.pythonhosted.org/packages/fc/88/e95c29346949e68a457bc17337c1ec13320743f0e383c546ebaff1f3a214/pjon_cython-11.2.0.tar.gz", "yanked": false, "yanked_reason": null } ], "12.0.0": [ { "comment_text": "", "digests": { "md5": "31148e1d72e603101c1611566ef3278e", "sha256": "8996584142f960e5a63dc2945cf41cb2b46b251382684b96577983186ad2f89f" }, "downloads": -1, "filename": "pjon_cython-12.0.0.tar.gz", "has_sig": false, "md5_digest": "31148e1d72e603101c1611566ef3278e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 495805, "upload_time": "2019-10-29T05:17:26", "upload_time_iso_8601": "2019-10-29T05:17:26.233472Z", "url": "https://files.pythonhosted.org/packages/7e/29/52c9711e3f616a4ae7d592dfa41feb4c48d0eed49430d58a8f467f3ce8bd/pjon_cython-12.0.0.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "31148e1d72e603101c1611566ef3278e", "sha256": "8996584142f960e5a63dc2945cf41cb2b46b251382684b96577983186ad2f89f" }, "downloads": -1, "filename": "pjon_cython-12.0.0.tar.gz", "has_sig": false, "md5_digest": "31148e1d72e603101c1611566ef3278e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 495805, "upload_time": "2019-10-29T05:17:26", "upload_time_iso_8601": "2019-10-29T05:17:26.233472Z", "url": "https://files.pythonhosted.org/packages/7e/29/52c9711e3f616a4ae7d592dfa41feb4c48d0eed49430d58a8f467f3ce8bd/pjon_cython-12.0.0.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }