Skip to content

Latest commit

 

History

History
264 lines (210 loc) · 2.97 KB

File metadata and controls

264 lines (210 loc) · 2.97 KB

WebSocket API Description

{
  "id": <string>,           // optional
  "type": <string>,         // info|command|ack|error
  "payload": { ... }        // optional, message specific data
}

Information Type

Request

{
  "id": "my_message_id",
  "type": "info"
}

Response

{
  "id": "my_message_id",
  "type": "ack",
  "payload": {
    "api_rev": 2,
    "model": "Melexis Compact Master LIN",
    "firmware_version": <string>
  }
}

Command Type

Request

{
  "id": "my_message_id",
  "type": "command",
  "payload": {
    "endpoint": <string>,
    "command": <string>,
    "params": { ... }
  }
}

Response

{
  "id": "my_message_id",
  "type": "ack",
  "payload": { ... }
}
{
  "id": "my_message_id",
  "type": "error",
  "payload": {
    "message": <string>
  }
}

Bootloader

Program Memory

Request

{
  "id": "my_message_id",
  "type": "command",
  "payload": {
    "endpoint": "bootloader",
    "command": "program",
    "params": {
      "hexfile": <string>,
      "memory": <string>,
      "manpow": <boolean>,
      "bitrate": <number>,
      "fullduplex": <boolean>,
      "txpin": <number>,
      "flashkeys": <array of numbers>
    }
  }
}

Memory key can have values flash, nvram or eeprom.

Response

{
  "id": "my_message_id",
  "type": "ack",
  "payload": { }
}

Verify Memory

Request

{
  "id": "my_message_id",
  "type": "command",
  "payload": {
    "endpoint": "bootloader",
    "command": "verify",
    "params": {
      "hexfile": <string>,
      "memory": <string>,
      "manpow": <boolean>,
      "bitrate": <number>,
      "fullduplex": <boolean>,
      "txpin": <number>,
      "flashkeys": <array of numbers>
    }
  }
}

Memory key can have values flash, nvram or eeprom.

Response

{
  "id": "my_message_id",
  "type": "ack",
  "payload": { }
}

Power Output

Control

Request

{
  "id": "my_message_id",
  "type": "command",
  "payload": {
    "endpoint": "power_out",
    "command": "control",
    "params": {
      "switch_enable": <boolean>
    }
  }
}

Response

{
  "id": "my_message_id",
  "type": "ack",
  "payload": { }
}

Status

Request

{
  "id": "my_message_id",
  "type": "command",
  "payload": {
    "endpoint": "power_out",
    "command": "status"
  }
}

Response

{
  "id": "my_message_id",
  "type": "ack",
  "payload": {
    "switch_enabled": <boolean>
  }
}

System

Wifi

Request

{
  "id": "my_message_id",
  "type": "command",
  "payload": {
    "endpoint": "system",
    "command": "wifi"
  }
}

Response

{
  "id": "my_message_id",
  "type": "ack",
  "payload": {
    "link_up": <boolean>,
    "ip": <number>,
    "netmask": <number>,
    "gateway": <number>,
  }
}

Identify

TBD

Reboot

TBD

LIN

TODO

Connection Alive Check

Request

{
  "__ping__": true
}

Response

{
  "__pong__": true
}