shellmatta_transport_layer.dox 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**
  2. @page shellmatta_transport_layer Shellmatta Transport Layer
  3. To be able to use the shellmatta directly on an unsecured interface like
  4. raw UART a simple connectionless transport layer has been implemented.
  5. The transport layer is optional and can be removed during compile time as
  6. well as deactivated during runtime.
  7. To enable it during compile time add the define ``SHELLMATTA_TRANSPORT``.
  8. The transport layer intends to be used in machine to machine interfaces.
  9. @warning As the transport layer is connectionless there is no way to
  10. determine wether a packet is received properly.
  11. To check if all packets have been received by the shellmatta
  12. the sequence counters included in any packet can be used.
  13. @section shellmatta_transport_layer_sequence Basic sequence
  14. @startuml
  15. loop until command is sent
  16. Host -> Shellmatta: send packet
  17. Shellmatta -> Shellmatta: validate packet
  18. end
  19. loop until response is sent
  20. Shellmatta -> Host: send return packet
  21. Host -> Host: validate packet
  22. end
  23. @enduml
  24. @section shellmatta_transport_layer_protocol Protocol
  25. | Offset | Length | Description |
  26. |--------|---------------|---------------------------------------------|
  27. | 0 | 1 | Start of header (\\SOH) |
  28. | 1 | 1 | Protocol version |
  29. | 2 | 1 | Packet type |
  30. | 3 | 1 | Payload Length |
  31. | 4 | 1 | Source |
  32. | 5 | 1 | Destination |
  33. | 6 | 1 | Sequence counter host to shellmatta |
  34. | 7 | 1 | Sequence counter shellmatta to host |
  35. | 8 | L1 = 0 .. 255 | Payload |
  36. |8 + L1 | 4 | CRC32 of header + payload without CRC32 |
  37. @subsection shellmatta_transport_layer_protocol_packet_Types Packet types
  38. The type codes are divided into request and respond codes using the MSB.
  39. The MSB indicates a response.
  40. | type | Description | Payload length | Payload |
  41. |------|--------------------------------|----------------|------------------------|
  42. | 0x00 | Plain Data | 0 .. 255 | User data |
  43. | 0x01 | Request Sequence counters | 0 | - |
  44. | 0x81 | Respond Sequence counters | 0 | - |
  45. | 0x02 | Request and set max buffersize | 1 | Hosts buffersize |
  46. | 0x82 | Respond max buffersize | 1 | Shellmattas buffersize |
  47. | 0x03 | Search device by unique ID | 32 | UUID Range 2x 16 byte |
  48. | 0x83 | Respond to search | 16 | UUID of Shellmatta |
  49. | 0x04 | Set address | 16 | UUID of Shellmatta |
  50. | 0x84 | Respond to set address | 16 | UUID of Shellmatta |
  51. @section shellmatta_transport_layer_sequence_counters Sequence counters
  52. The sequence counters are included in the header of every packet to enable
  53. the host to check for any dropped packets.
  54. This is a quite nasty workaround as the host has no chance to determine
  55. which packet has been dropped - but better than nothing.
  56. If no response is received from the shellmatta the sequence counters can be
  57. requested explicitly.
  58. The sequence counter host to shellmatta will increment on every successfully
  59. received packet.
  60. The sequence counter shellmatta to host will increment on every packet the
  61. shellmatta sends to the host.
  62. @section shellmatta_transport_layer_buffersize Buffer sizes
  63. @todo Not implemented yet
  64. @section shellmatta_transport_layer_addressing Addressing and Search
  65. @todo Not implemented yet
  66. @section shellmatta_transport_layer_crc CRC calculation
  67. @todo Not implemented yet
  68. @section shellmatta_transport_layer_control Controlling the transport layer
  69. @todo Not implemented yet
  70. */