Basic CRUD for serial port interacting with the JSON API's config resources.
curl \
-X GET \
http://localhost:8090/serial
{
"ok": true,
"message": "Serial port list",
"ports": [
{
"path": "/dev/tty.Bluetooth-Incoming-Port"
}
]
}
# 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
{
"ok": true,
"message": "Serial port open",
"serial": {
"open": {
"path":"/dev/tty.Bluetooth-Incoming-Port",
"baudRate":115200,
"websocket":"xBkRkQmGzJ"
},
"state":"open"
}
}
# 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
{
"ok": true,
"message": "Serial port close",
"serial": {
"open": {
"path":"/dev/tty.Bluetooth-Incoming-Port",
"websocket":"xBkRkQmGzJ"
},
"state":"close"
}
}