Skip to content

Commit 46d82c0

Browse files
committed
Added license, setup.py and docs for Github.
1 parent 62880ef commit 46d82c0

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2014 Bas Stottelaar
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# python-tinylink
2+
Frame-based streaming protocol for embedded applications.
3+
4+
## Introduction
5+
This is a Python module to provide a bi-directional frame-based streaming protocol for low-speed embedded applications, such as serial connected devices. It allowes the receiver to 'jump into' a stream of data frames. Every frame starts with a preamble, so the receiver can synchronize. Any mismatch in checksum will the receiver.
6+
7+
A payload is optional. A reserved `RESET` flag can be used to indicate that the link should be reset, for instance when the receiver is ready and the sender restart.
8+
9+
The format of the frame is as follows:
10+
11+
```
12+
| 0xAA 0x55 0xAA 0x55 | AA AA BB BB CC | XX XX .. .. .. .. XX XX YY YY YY YY |
13+
| Preamble | Header | Body (optional) |
14+
15+
Fields:
16+
A = Length
17+
B = Flags
18+
C = XOR checksum over header
19+
X = Body payload (max. 65536 bytes)
20+
Y = CRC32 checksum over header + body
21+
```
22+
23+
Error correction is not implemented by this protocol and the bytes are not aligned. The endianness is customizable.
24+
25+
## Statechart diagram
26+
Below is a simplified statechart diagram of the protocol.
27+
![Alt text](docs/statechart.png)
28+
29+
## Installation
30+
The latest development version can be installed via `pip install git+https://github.com/basilfx/python-tinylink`.
31+
32+
## Tests
33+
Tests can be executed with `nose`. Check the `tests/` folder for more information.
34+
35+
## License
36+
See the `LICENSE` file (MIT license).

docs/statechart.dot

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
digraph G {
2+
rankdir=TD
3+
edge[fontsize="11" arrowhead=open]
4+
5+
start[shape=circle, style=filled, label=""]
6+
7+
waiting_for_preamble[shape=box, style=rounded, label="Waiting for\npreamble"]
8+
receiving_header[shape=box, style=rounded, label="Receiving\nheader"]
9+
receiving_body[shape=box, style=rounded, label="Receiving\nbody"]
10+
11+
output_reset_frame[shape=box, style=rounded, label="Output\nreset frame"]
12+
output_data_frame[shape=box, style=rounded, label="Output\ndata frame"]
13+
14+
start -> waiting_for_preamble
15+
16+
waiting_for_preamble -> waiting_for_preamble[label="Byte received"]
17+
waiting_for_preamble -> receiving_header[label="Preamble detected"]
18+
19+
receiving_header -> receiving_header[label="Byte received"]
20+
receiving_header -> receiving_body[label="Header complete,\nbody expected"]
21+
receiving_header -> waiting_for_preamble[label="Header invalid"]
22+
23+
receiving_header -> output_reset_frame[label="Header complete,\nreset frame"]
24+
output_reset_frame -> waiting_for_preamble
25+
26+
receiving_body -> receiving_body[label="Byte received"]
27+
receiving_body -> waiting_for_preamble[label="Body invalid"]
28+
29+
receiving_body -> output_data_frame[label="Body complete,\ndata frame"]
30+
output_data_frame -> waiting_for_preamble
31+
}

docs/statechart.png

53.4 KB
Loading

setup.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from setuptools import setup
2+
3+
# Setup definitions
4+
setup(
5+
name="python-tinylink",
6+
version="1.0",
7+
description="Streaming frame protocol library for embedded applications.",
8+
author="Bas Stottelaar",
9+
author_email="basstottelaar@gmail.com",
10+
py_modules=["tinylink"],
11+
license = "MIT",
12+
keywords = "python embedded arm tinylink streaming serial",
13+
test_suite="tests",
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: MIT License",
18+
"Topic :: System :: Networking",
19+
"Topic :: Software Development :: Embedded Systems",
20+
"Programming Language :: Python :: 2",
21+
"Programming Language :: Python :: 2.7",
22+
],
23+
)

0 commit comments

Comments
 (0)