Permalink
Browse files

added graphs exaplaining recursive acknowledgment pattern

  • Loading branch information...
gioblu committed Dec 22, 2016
1 parent 3539d61 commit fb0b16193929a5ede350431bc02759d3d2daaa7e
Showing with 38 additions and 11 deletions.
  1. +38 −11 specification/PJON-protocol-acknowledge-specification-v0.1.md
@@ -62,32 +62,59 @@ Channel analysis Transmission
_____ _______________________________________________________________________________ _____
| C-A | | ID | HEADER | LENGTH | BUS ID | BUS ID | ID | PACKET ID | CONTENT | CRC | | ACK |
|-----|< >|----|----------|--------|------------|--------|----|-----------|---------|-----|> <|-----|
| 0 | | 0 | 00001111 | 18 | 0002 | 0001 | 0 | 99 | 64 | | | 6 |
| 0 | | 0 | 00001111 | 16 | 0002 | 0001 | 0 | 99 | 64 | | | 6 |
|_____| |____|__________|________|____________|________|____|___________|_________|_____| |_____|
| RX INFO | TX INFO |
```
In the packet shown above device `0` of bus `0.0.0.1` sends `@` or `64` to device `0` of bus `0.0.0.2` containing its packet id `99` that will be used by receiver to send back an asynchronous acknowledgement packet where header `00001000` bit up requests an asynchronous acknowledgement and `00000100` requests a synchronous acknowledgement. This precise case is used as an example to show both features used at the same time to obtain an efficient and secure way to transmit packets with correct transmission certainty.
In the packet shown above device `0` of bus `0.0.0.1` sends `@` (64) to device `0` of bus `0.0.0.2`. Being the header `00001000` bit up (asynchronous acknowledgement request) the packet is formatted containing the 2 bytes integer packet id `99` (used by receiver to send back an asynchronous acknowledgement packet) immediately after the sender information. Being header's `00000100` bit up (synchronous acknowledgement request) receiver will acknowledge synchronously with an `ACK` (6) in case of correct reception or `NAK` (21) in case of mistake. This precise case is used as an example to show both features used at the same time to obtain an efficient and secure way to transmit packets with correct transmission certainty.
```cpp
BUS 0.0.0.1 BUS 0.0.0.2
1 Packet tx 2 rx, sync ACK, packet tx 3 rx, sync ACK, async ACK tx
TX START--->0-00001111-18-0002-0001-0-99-@-CRC-><-ACK->0-00001111-18-0002-0001-0-99-@-CRC-><-ACK-|
TX START--->0-00001111-16-0002-0001-0-99-@-CRC-><-ACK->0-00001111-16-0002-0001-0-99-@-CRC-><-ACK-|
______ ______ ______ |
| | | | | | |
| ID 0 |______________________________________|ROUTER|__________________________________| ID 0 | |
|______| |______| |______| |
|
TX END-------ACK-><-0-00001111-14-0001-0002-0-99-CRC-<-ACK-><-0-00001111-14-0001-0002-0-99-CRC-<-|
TX END-------ACK-><-0-00001111-15-0001-0002-0-99-CRC-<-ACK-><-0-00001111-15-0001-0002-0-99-CRC-<-|
5 rx, sync ACK 4 rx, sync ACK, packet tx
/* If packet length - its overhead is 4, it is an asynchronous acknowledgement packet
containing only its packet id */
```
- Device `0` sends the packet, the router has a route to device `0` of bus `0.0.0.2` so responds with a synchronous acknowledgement
- Device `0` of bus `0.0.0.1` wait for an asynchronous acknowledgement of the packet sent
- Router sends to device id `0` of bus `0.0.0.2` and receives a synchronous acknowledgement
- Device `0` of bus `0.0.0.2` sends an asynchronous acknowledgement packet to device `0` of bus `0.0.0.1`
- Router has a route to device `0` of bus `0.0.0.1` so responds with a synchronous acknowledgement
- Device `0` of bus `0.0.0.2` ends the transaction after receiving a synchronous acknowledgement by the router
- Device `0` of bus `0.0.0.1` receives the asynchronous acknowledgement packet forwarded by the router and responds with a synchronous acknowledgement
1. Device `0` sends the packet, the router has a route to device `0` of bus `0.0.0.2` so responds with a synchronous acknowledgement
```cpp
_____ __________ ________ _________ _________ ____ ___________ _________ _______ _____
| ID | HEADER | LENGTH | BUS ID | BUS ID | ID | PACKET ID | CONTENT | CRC | | ACK |
>| 0 | 00001111 | 16 | 0.0.0.2 | 0.0.0.1 | 0 | 99 | 64 | |> <| 6 |
|_____|__________|________|_________|_________|____|___________|_________|_______| |_____|
| RX iNFO | TX INFO |
```
2. Device `0` of bus `0.0.0.1` wait for an asynchronous acknowledgement of the packet sent. Router sends to device id `0` of bus `0.0.0.2` and receives a synchronous acknowledgement
```cpp
_____ __________ ________ _________ _________ ____ ___________ _________ _______ _____
| ID | HEADER | LENGTH | BUS ID | BUS ID | ID | PACKET ID | CONTENT | CRC | | ACK |
>| 0 | 00001111 | 16 | 0.0.0.2 | 0.0.0.1 | 0 | 99 | 64 | |> <| 6 |
|_____|__________|________|_________|_________|____|___________|_________|_______| |_____|
| RX iNFO | TX INFO |
```
4. Device `0` of bus `0.0.0.2` sends an asynchronous acknowledgement packet to device `0` of bus `0.0.0.1`. Router has a route to device `0` of bus `0.0.0.1` so responds with a synchronous acknowledgement and device `0` of bus `0.0.0.2` ends the transaction after receiving a synchronous acknowledgement by the router
```cpp
_____ __________ ________ _________ _________ ____ ___________ _______ _____
| ID | HEADER | LENGTH | BUS ID | BUS ID | ID | PACKET ID | CRC | | ACK |
>| 0 | 00001111 | 15 | 0.0.0.1 | 0.0.0.2 | 0 | 99 | |> <| 6 |
|_____|__________|________|_________|_________|____|___________|_______| |_____|
| RX iNFO | TX INFO |
```
5. Device `0` of bus `0.0.0.2` ends the transaction after receiving a synchronous acknowledgement by the router. Device `0` of bus `0.0.0.1` receives the asynchronous acknowledgement packet forwarded by the router and responds with a synchronous acknowledgement.
```cpp
_____ __________ ________ _________ _________ ____ ___________ _______ _____
| ID | HEADER | LENGTH | BUS ID | BUS ID | ID | PACKET ID | CRC | | ACK |
>| 0 | 00001111 | 15 | 0.0.0.1 | 0.0.0.2 | 0 | 99 | |> <| 6 |
|_____|__________|________|_________|_________|____|___________|_______| |_____|
| RX iNFO | TX INFO |
```
This documents doesn't want to specif in any way the routing mechanism (still not officially specified), but uses routing as a necessary example to showcase clearly the power of the recursive acknowledgement pattern.

0 comments on commit fb0b161

Please sign in to comment.