+++
title = "Serial Interface"
weight = 4
categories = "Serial"
+++

# Serial Interface

## Interfaces

### Serial

All components provide minimal introspection capabilities : info, debug and custom registered methods. Each method can be called via Serial, eg : ```<<1;2;64;printRegisters:1:0>>``` to call 'printRegisters' for component `1` (main application).

**Command construction** :

Command Syntax : `` <<COMPONENT ID ; VERB ; FLAGS ; PAYLOAD>> `` whereby `PAYLOAD` consists out of `METHOD:ARG-1:ARG-2`

**ID** : Component Id

**VERB** : Command Type | Default=EC_METHOD (Class Method)

```c++
enum ECALLS
{
    // global function
    EC_COMMAND = 1,
    // addon method
    EC_METHOD = 2,
    // external function
    EC_FUNC = 3,
    // user space
    EC_USER = 10

};
```

**FLAGS** : Flags being used for the call. Default = 64
```c++
    enum MessageFlags
    {
        NEW = 1 << 1,           // set on target when inbound
        // set on target
        PROCESSING = 1 << 2,
        // set on target when inbound
        PROCESSED = 1 << 3,
        // set on host, turn on debugging through the entire processing chain
        DEBUG = 1 << 4,
        RECEIPT = 1 << 5        // set on host, this will return the new state
    };
```

**PAYLOAD**: String, this string depends on the verb, Default = Class::Method(short,short)

## Modbus

-> [See more here](../modbus)
