bmegli / ev3dev-mapping

The ev3dev-mapping project meta repository
http://www.ev3dev.org/projects/2016/08/07/Mapping/
16 stars 6 forks source link

Rewrite control module/component for TCP/IP #5

Closed bmegli closed 8 years ago

bmegli commented 8 years ago

This currently works on UDP. This protocol is not suitable for that. There are no guarantees that all the packets arrive. Protocol messages should have variable length. The connection should be monitored. Transition to TCP/IP is necessary.

bmegli commented 8 years ago

In proof-of-concept UDP implementation it works as:

enum Commands {ENABLE=0, DISABLE=1, DISABLE_ALL=3, ENABLED=4, DISABLED=5, FAILED=6 };

struct control_packet
{
    uint64_t timestamp_us;
    int16_t command;
    int16_t creation_delay_ms;
    char unique_name[MODULE_NAME_WITH0_MAX];
    char call[MODULE_CALL_WITH0_MAX];
};

With:

bmegli commented 8 years ago

The TCP/IP protocol proposal (v1) for control module/component:

Commands

Message Header

12 bytes with:

Message Payload

Attributes

Attribute Data Types:

enum Attributes {UNIQUE_NAME=0, CALL=1, CREATION_DELAY_MS=2, RETURN_VALUE=3}
// with types string, string, u16, i32

Messages (both ways)

KEEPALIVE

empty payload

Messages (component -> module)

ENABLE

DISABLE

DISABLE_ALL

empty payload

Messages (module -> component)

ENABLED

DISABLED

FAILED

Additional Info

bmegli commented 8 years ago

The module side was implented in tcp-control branch, not tested yet

bmegli commented 8 years ago

The component side was implented in tcp-control ant tested to work with module side

This only needs some final polishing now.

bmegli commented 8 years ago

Merged