Skip to content

Latest commit

 

History

History
102 lines (83 loc) · 1.61 KB

File metadata and controls

102 lines (83 loc) · 1.61 KB

Serial

Basic CRUD for serial port interacting with the JSON API's config resources.

Serial

List

Request

curl \
  -X GET \
  http://localhost:8090/serial

Response

{
  "ok": true,
  "message": "Serial port list",
  "ports": [
    {
      "path": "/dev/tty.Bluetooth-Incoming-Port"
    }
  ]
}

Open

Request

# open broadcast
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"path":"/dev/tty.Bluetooth-Incoming-Port", "baudRate": 115200}' \
  http://localhost:8090/serial/open

# open with websocket uid
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"path":"/dev/tty.Bluetooth-Incoming-Port", "baudRate": 115200, "websocket":"xBkRkQmGzJ"}' \
  http://localhost:8090/serial/open

Response

{
  "ok": true,
  "message": "Serial port open",
  "serial": {
    "open": {
      "path":"/dev/tty.Bluetooth-Incoming-Port",
      "baudRate":115200,
      "websocket":"xBkRkQmGzJ"
    },
    "state":"open"
  }
}

Close

Request

# close broadcast
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"path":"/dev/tty.Bluetooth-Incoming-Port"}' \
  http://localhost:8090/serial/close

# close with websocket uid
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"path":"/dev/tty.Bluetooth-Incoming-Port", "websocket":"xBkRkQmGzJ"}' \
  http://localhost:8090/serial/close

Response

{
  "ok": true,
  "message": "Serial port close",
  "serial": {
    "open": {
      "path":"/dev/tty.Bluetooth-Incoming-Port",
      "websocket":"xBkRkQmGzJ"
    },
    "state":"close"
  }
}