doc/help/API-Reference.md
The Serial Studio API Server is a TCP server that listens on port 7777 (default) and accepts JSON-formatted commands to control Serial Studio programmatically. It provides programmatic control over Serial Studio through a TCP socket connection.
The API Server is available in both Serial Studio GPL and Serial Studio Pro builds:
Legend:
Launch Serial Studio
Enable the API Server:
Test the connection using curl (or any TCP client):
echo '{"type":"command","id":"1","command":"api.getCommands"}' | nc localhost 7777
Download the Python test client (optional):
examples/API Test/ in the Serial Studio repositorypython test_api.py send io.manager.getStatusThe API Server starts immediately and will remember your preference across restarts.
Test the API is running:
# Linux/macOS
nc -zv 127.0.0.1 7777
# Or test with the Python client
cd examples/API\ Test
python test_api.py send io.manager.getStatus
Expected output:
{
"isConnected": false,
"paused": false,
"busType": 0,
"configurationOk": false
}
Currently, the API Server uses port 7777 by default. This port is:
Note: Future versions may support custom ports and authentication.
The API Server only accepts connections from 127.0.0.1 (localhost). It is:
The API server binds exclusively to 127.0.0.1 (localhost) and is not accessible from the network. This is by design for security.
Currently, the API Server has no authentication mechanism:
Implications:
Important:
For production or multi-user systems:
Ensure your firewall does not expose port 7777 externally:
Linux:
# Check if port is listening externally
netstat -tuln | grep 7777
# Should show: 127.0.0.1:7777 (not 0.0.0.0:7777)
Windows:
netstat -an | findstr 7777
macOS:
netstat -an | grep 7777
# Good: Validate inputs before sending to API
python validate_config.py && python configure_device.py
# Bad: Blindly forwarding untrusted data to API
curl http://external-source/config.json | python send_to_api.py
# Good: Use local scripts with known behavior
./scripts/connect_uart.py
# Bad: Running unknown scripts with API access
wget http://example.com/script.py && python script.py
Best Practices:
Planned security features (not yet implemented):
The API is designed for:
# Automated hardware-in-the-loop testing using test_api.py
import subprocess
import time
# Configure device
subprocess.run(["python", "test_api.py", "send", "io.manager.setBusType", "-p", "busType=0"])
subprocess.run(["python", "test_api.py", "send", "io.driver.uart.setBaudRate", "-p", "baudRate=115200"])
subprocess.run(["python", "test_api.py", "send", "io.driver.uart.setPortIndex", "-p", "portIndex=0"])
subprocess.run(["python", "test_api.py", "send", "io.manager.connect"])
# Your test code here - e.g., send test commands, read responses, etc.
# Export data for later analysis
subprocess.run(["python", "test_api.py", "send", "csv.export.setEnabled", "-p", "enabled=true"])
time.sleep(10) # Let it record data
subprocess.run(["python", "test_api.py", "send", "csv.export.close"])
# Your analysis code here - e.g., parse CSV, validate data ranges, etc.
# Production line testing using the API client
import json
import socket
def send_command(command, params=None):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1", 7777))
msg = {"type": "command", "id": "qa", "command": command}
if params:
msg["params"] = params
sock.sendall((json.dumps(msg) + "\n").encode())
response = json.loads(sock.recv(65536).decode())
sock.close()
return response
# Example: Test 100 units in production
for unit_id in range(100):
send_command("io.manager.connect")
# Your testing logic here - e.g., send test commands,
# read sensor values, validate against specifications
send_command("io.manager.disconnect")
# Your logging/reporting logic here
#!/bin/bash
# Example: Multi-device coordination using shell scripts
# Setup device connection
python test_api.py send io.manager.setBusType -p busType=0
python test_api.py send io.driver.uart.setBaudRate -p baudRate=115200
python test_api.py send io.manager.connect
python test_api.py send csv.export.setEnabled -p enabled=true
# Monitor connection for extended experiment (e.g., 24 hours)
for i in {1..1440}; do # 1440 = 24 hours * 60 minutes
STATUS=$(python test_api.py send io.manager.getStatus --json)
IS_CONNECTED=$(echo $STATUS | jq -r '.result.isConnected')
if [ "$IS_CONNECTED" != "true" ]; then
echo "$(date): Connection lost, reconnecting..." >> experiment.log
python test_api.py send io.manager.connect
fi
sleep 60 # Check every minute
done
python test_api.py send csv.export.close
echo "$(date): Experiment complete" >> experiment.log
# Example: Raspberry Pi sensor gateway
import subprocess
import json
import time
while True:
result = subprocess.run(
["python", "test_api.py", "send", "io.manager.getStatus", "--json"],
capture_output=True, text=True
)
status = json.loads(result.stdout)
# Your cloud upload logic here - e.g., HTTP POST, MQTT publish, etc.
# Example data to send:
# {
# "connected": status["result"]["isConnected"],
# "bus_type": status["result"]["busType"],
# "timestamp": time.time()
# }
time.sleep(300) # Check every 5 minutes
# Example: GitLab CI / GitHub Actions workflow
jobs:
hardware_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Start Serial Studio
run: |
# Start Serial Studio in background (assuming it's installed)
serial-studio &
sleep 5
- name: Configure Device via API
run: |
cd examples/API\ Test
python test_api.py send io.manager.setBusType -p busType=0
python test_api.py send io.driver.uart.setBaudRate -p baudRate=115200
python test_api.py send io.manager.connect
- name: Run Your Hardware Tests
run: |
# Your test commands here
# e.g., send test data, verify responses, etc.
python test_api.py send io.manager.getStatus
#!/bin/bash
# Example: Classroom demonstration automation
# Step 1: Connect to Arduino
python test_api.py send io.manager.setBusType -p busType=0
python test_api.py send io.driver.uart.setBaudRate -p baudRate=9600
python test_api.py send io.driver.uart.setPortIndex -p portIndex=0
python test_api.py send io.manager.connect
sleep 2
# Step 2: Enable CSV logging
python test_api.py send csv.export.setEnabled -p enabled=true
echo "Recording data for 30 seconds..."
sleep 30
# Step 3: Stop recording
python test_api.py send csv.export.close
echo "Data saved to CSV file"
# Analyze the data with your own tools (e.g., Python, Excel, MATLAB, etc.)
127.0.0.1 (localhost only)7777 (default)\n)Client Serial Studio API Server
| |
|-- Connect to 127.0.0.1:7777 --------->|
| |
|-- Send JSON command + \n ------------>|
| |
| Process
| |
|<----- JSON response + \n -------------|
| |
|-- (keep connection open for more)---->|
| |
|-- Close connection ------------------>|
127.0.0.1:7777\n)The API server accepts multiple concurrent client connections. Each client operates independently:
# Multiple clients can connect simultaneously
client1 = connect_to_api() # Control connection
client2 = connect_to_api() # Monitoring connection
client3 = connect_to_api() # Data export control
# All clients receive the same responses
status = client1.send("io.manager.getStatus")
# All changes are visible to all clients
Connection lifecycle:
127.0.0.1:7777gRPC: The entire API is also available via gRPC on port 8888, with high-performance binary streaming. See the gRPC Server documentation.
All messages are JSON objects terminated by a newline (\n). The server processes one command per connection or multiple commands in sequence.
The API supports two message types:
{
"type": "command",
"id": "unique-request-id",
"command": "io.manager.getStatus",
"params": {
"key": "value"
}
}
Fields:
type (string, required): Always "command" for single commandsid (string, optional): Unique identifier for this request (echoed in response)command (string, required): Command name (e.g., "io.manager.connect")params (object, optional): Parameters for the command{
"type": "batch",
"id": "batch-request-id",
"commands": [
{
"command": "io.manager.setBusType",
"id": "cmd-1",
"params": {"busType": 0}
},
{
"command": "io.driver.uart.setBaudRate",
"id": "cmd-2",
"params": {"baudRate": 115200}
}
]
}
Fields:
type (string, required): Always "batch" for batch requestsid (string, optional): Unique identifier for the entire batchcommands (array, required): Array of command objects{
"type": "response",
"id": "unique-request-id",
"success": true,
"result": {
"isConnected": false,
"paused": false
}
}
Fields:
type (string): Always "response"id (string): Matches the request IDsuccess (boolean): true if command succeededresult (object): Command-specific result data{
"type": "response",
"id": "unique-request-id",
"success": false,
"error": {
"code": "INVALID_PARAM",
"message": "Invalid port: 70000. Valid range: 1-65535"
}
}
Error Codes:
| Code | Description | Example |
|---|---|---|
INVALID_JSON | Malformed JSON message | Missing closing brace, invalid syntax |
INVALID_MESSAGE_TYPE | Unknown or missing message type | "type": "unknown" or missing type field |
UNKNOWN_COMMAND | Command not recognized | "command": "invalid.command" |
INVALID_PARAM | Parameter value out of range or invalid | Port 70000, negative baud rate |
MISSING_PARAM | Required parameter not provided | Missing baudRate for setBaudRate |
EXECUTION_ERROR | Command failed during execution | Disconnect when not connected |
OPERATION_FAILED | Operation could not be completed | File I/O error, hardware error |
{
"type": "response",
"id": "batch-request-id",
"success": false,
"results": [
{
"id": "cmd-1",
"success": true,
"result": {"busType": 0}
},
{
"id": "cmd-2",
"success": false,
"error": {"code": "INVALID_PARAM", "message": "..."}
}
]
}
Notes:
success is false if any command failsresults arrayThe API provides 165 total commands across multiple modules:
GPL Build (93 commands):
Pro Build Additional (72 commands):
api.getCommandsGet list of all available API commands with descriptions.
Parameters: None
Returns:
{
"commands": [
{"name": "api.getCommands", "description": "Get list of all available commands"},
{"name": "io.manager.connect", "description": "Connect to the currently configured device"}
]
}
Example:
python test_api.py send api.getCommands
Connection and bus management:
io.manager.getStatusGet current connection status and configuration.
Parameters: None
Returns:
{
"isConnected": false,
"paused": false,
"busType": 0,
"configurationOk": true,
"readOnly": false,
"readWrite": true,
"busTypeName": "Serial Port"
}
io.manager.getAvailableBusesGet list of supported bus types.
Parameters: None
Returns:
{
"buses": [
{"index": 0, "name": "Serial Port"},
{"index": 1, "name": "Network Socket"},
{"index": 2, "name": "Bluetooth LE"}
]
}
io.manager.setBusTypeSet the active bus/driver type.
Parameters:
busType (int): 0=UART, 1=Network, 2=BLE, 3=Audio, 4=Modbus, 5=CAN, 6=MQTTExample:
python test_api.py send io.manager.setBusType -p busType=0
io.manager.setPausedPause or resume data processing.
Parameters:
paused (bool): true to pause, false to resumeExample:
python test_api.py send io.manager.setPaused -p paused=true
io.manager.setStartSequenceSet start delimiter sequence for frame detection.
Parameters:
sequence (string): Start sequence (supports escape sequences)Example:
python test_api.py send io.manager.setStartSequence -p sequence="/*"
io.manager.setFinishSequenceSet end delimiter sequence for frame detection.
Parameters:
sequence (string): End sequence (supports escape sequences)Example:
python test_api.py send io.manager.setFinishSequence -p sequence="*/"
io.manager.connectOpen connection to the configured device.
Parameters: None
Returns:
{
"connected": true
}
Errors:
EXECUTION_ERROR: Already connected or configuration invalidExample:
python test_api.py send io.manager.connect
io.manager.disconnectClose current device connection.
Parameters: None
Returns:
{
"connected": false
}
Errors:
EXECUTION_ERROR: Not connectedExample:
python test_api.py send io.manager.disconnect
io.manager.toggleConnectionToggle connection state (connect if disconnected, disconnect if connected).
Parameters: None
Example:
python test_api.py send io.manager.toggleConnection
io.manager.writeDataSend data to the connected device.
Parameters:
data (string): Base64-encoded data to sendReturns:
{
"bytesWritten": 12
}
Example:
# Send "Hello World" (SGVsbG8gV29ybGQ= in Base64)
echo -n "Hello World" | base64 # SGVsbG8gV29ybGQ=
python test_api.py send io.manager.writeData -p data=SGVsbG8gV29ybGQ=
Errors:
EXECUTION_ERROR: Not connectedMISSING_PARAM: Missing data parameterINVALID_PARAM: Invalid base64 encodingio.manager.getFrameDetectionModeGet current frame detection mode.
Parameters: None
Returns:
{
"mode": 0
}
io.manager.setFrameDetectionModeSet frame detection mode.
Parameters:
mode (int): 0=EndDelimiterOnly, 1=StartAndEnd, 2=NoDelimiters, 3=StartOnlyExample:
python test_api.py send io.manager.setFrameDetectionMode -p mode=1
Serial port configuration:
io.driver.uart.getConfigurationGet current UART configuration.
Parameters: None
Returns:
{
"port": "/dev/ttyUSB0",
"baudRate": 115200,
"dataBits": 8,
"parity": "None",
"stopBits": 1,
"flowControl": "None",
"dtrEnabled": true,
"autoReconnect": false,
"parityIndex": 0,
"dataBitsIndex": 3,
"stopBitsIndex": 0,
"flowControlIndex": 0,
"isOpen": false
}
io.driver.uart.getPortListGet list of available serial ports.
Parameters: None
Returns:
{
"portList": [
{"index": 0, "name": "COM1"},
{"index": 1, "name": "COM3"}
],
"currentPortIndex": 0,
"ports": [
{"index": 0, "name": "None"},
{"index": 1, "name": "/dev/ttyUSB0"}
]
}
io.driver.uart.getBaudRateListGet list of common baud rates.
Parameters: None
Returns:
{
"baudRateList": ["110", "300", "1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200"],
"currentBaudRate": 9600,
"baudRates": [
{"index": 0, "value": 1200},
{"index": 1, "value": 2400}
]
}
io.driver.uart.setDeviceRegister a custom serial port device name.
Parameters:
device (string): Device name (e.g., "COM3", "/dev/ttyUSB0")Example:
python test_api.py send io.driver.uart.setDevice -p device=COM3
io.driver.uart.setPortIndexSelect serial port by index from port list.
Parameters:
portIndex (int): Index from getPortListExample:
python test_api.py send io.driver.uart.setPortIndex -p portIndex=0
io.driver.uart.setBaudRateSet baud rate.
Parameters:
baudRate (int): Baud rate (e.g., 9600, 115200)Example:
python test_api.py send io.driver.uart.setBaudRate -p baudRate=115200
io.driver.uart.setParitySet parity mode.
Parameters:
parityIndex (int): 0=None, 1=Even, 2=Odd, 3=Space, 4=MarkExample:
python test_api.py send io.driver.uart.setParity -p parityIndex=0
io.driver.uart.setDataBitsSet data bits.
Parameters:
dataBitsIndex (int): 0=5 bits, 1=6 bits, 2=7 bits, 3=8 bitsExample:
python test_api.py send io.driver.uart.setDataBits -p dataBitsIndex=3
io.driver.uart.setStopBitsSet stop bits.
Parameters:
stopBitsIndex (int): 0=1 bit, 1=1.5 bits, 2=2 bitsExample:
python test_api.py send io.driver.uart.setStopBits -p stopBitsIndex=0
io.driver.uart.setFlowControlSet flow control mode.
Parameters:
flowControlIndex (int): 0=None, 1=Hardware, 2=SoftwareExample:
python test_api.py send io.driver.uart.setFlowControl -p flowControlIndex=0
io.driver.uart.setDtrEnabledEnable or disable DTR signal.
Parameters:
dtrEnabled (bool): true to enable, false to disableenabled (bool): Alternative parameter nameExample:
python test_api.py send io.driver.uart.setDtrEnabled -p dtrEnabled=false
io.driver.uart.setAutoReconnectSet auto-reconnect behavior.
Parameters:
autoReconnect (bool): true to enable, false to disableenabled (bool): Alternative parameter nameExample:
python test_api.py send io.driver.uart.setAutoReconnect -p autoReconnect=true
TCP/UDP configuration:
io.driver.network.getConfigurationGet current network configuration.
Parameters: None
Returns:
{
"socketType": 0,
"socketTypeName": "TCP Client",
"remoteAddress": "192.168.1.1",
"tcpPort": 8080,
"udpLocalPort": 0,
"udpRemotePort": 8081,
"socketTypeIndex": 0,
"udpMulticast": false,
"isOpen": false
}
io.driver.network.getSocketTypesGet list of available socket types.
Parameters: None
Returns:
{
"socketTypes": [
{"index": 0, "name": "TCP Client"},
{"index": 1, "name": "TCP Server"},
{"index": 2, "name": "UDP"}
]
}
io.driver.network.setRemoteAddressSet remote host address.
Parameters:
address (string): IP address or hostnameExample:
python test_api.py send io.driver.network.setRemoteAddress -p address=192.168.1.100
io.driver.network.setTcpPortSet TCP port number.
Parameters:
port (int): Port number (1-65535)Example:
python test_api.py send io.driver.network.setTcpPort -p port=8080
io.driver.network.setUdpLocalPortSet UDP local port.
Parameters:
port (int): Port number (0-65535, 0=any available port)Example:
python test_api.py send io.driver.network.setUdpLocalPort -p port=9000
io.driver.network.setUdpRemotePortSet UDP remote port.
Parameters:
port (int): Port number (1-65535)Example:
python test_api.py send io.driver.network.setUdpRemotePort -p port=9001
io.driver.network.setSocketTypeSet socket type.
Parameters:
socketTypeIndex (int): 0=TCP Client, 1=TCP Server, 2=UDPExample:
python test_api.py send io.driver.network.setSocketType -p socketTypeIndex=0
io.driver.network.setUdpMulticastEnable or disable UDP multicast.
Parameters:
enabled (bool): true to enable, false to disableExample:
python test_api.py send io.driver.network.setUdpMulticast -p enabled=false
io.driver.network.lookupPerform DNS lookup for a hostname.
Parameters:
host (string): Hostname to resolveReturns:
{
"host": "example.com",
"addresses": ["93.184.216.34"]
}
Example:
python test_api.py send io.driver.network.lookup -p host=google.com
BLE device management:
io.driver.ble.getStatusGet Bluetooth adapter status.
Parameters: None
Returns:
{
"operatingSystemSupported": true,
"adapterAvailable": true,
"isOpen": false,
"deviceCount": 0,
"scanning": false,
"connected": false
}
io.driver.ble.getConfigurationGet current BLE configuration.
Parameters: None
Returns:
{
"deviceIndex": -1,
"characteristicIndex": -1,
"isOpen": false,
"configurationOk": false,
"deviceName": "Arduino BLE",
"serviceName": "Environmental Sensing",
"characteristicName": "Temperature"
}
io.driver.ble.getDeviceListGet list of discovered BLE devices.
Parameters: None
Returns:
{
"deviceList": [
{"index": 0, "name": "My BLE Device"},
{"index": 1, "name": "Heart Rate Monitor"}
],
"currentDeviceIndex": -1,
"devices": [
{"index": 0, "name": "Arduino BLE", "address": "00:11:22:33:44:55"}
]
}
io.driver.ble.getServiceListGet list of services for selected device.
Parameters: None
Returns:
{
"serviceList": [
{"index": 0, "name": "Generic Access"},
{"index": 1, "name": "Heart Rate"}
],
"services": [
{"index": 0, "name": "Environmental Sensing", "uuid": "181A"}
]
}
io.driver.ble.getCharacteristicListGet list of characteristics for selected service.
Parameters: None
Returns:
{
"characteristicList": [
{"index": 0, "name": "Heart Rate Measurement"}
],
"currentCharacteristicIndex": -1,
"characteristics": [
{"index": 0, "name": "Temperature", "uuid": "2A6E"}
]
}
io.driver.ble.startDiscoveryStart scanning for BLE devices.
Parameters: None
Example:
python test_api.py send io.driver.ble.startDiscovery
io.driver.ble.stopDiscoveryStop scanning for BLE devices.
Parameters: None
Example:
python test_api.py send io.driver.ble.stopDiscovery
io.driver.ble.selectDeviceSelect a discovered BLE device.
Parameters:
deviceIndex (int): Device index from getDeviceListExample:
python test_api.py send io.driver.ble.selectDevice -p deviceIndex=0
io.driver.ble.selectServiceSelect a BLE service.
Parameters:
serviceIndex (int): Service index from getServiceListExample:
python test_api.py send io.driver.ble.selectService -p serviceIndex=0
io.driver.ble.setCharacteristicIndexSelect a BLE characteristic.
Parameters:
characteristicIndex (int): Characteristic index from getCharacteristicListExample:
python test_api.py send io.driver.ble.setCharacteristicIndex -p characteristicIndex=0
CSV file export control:
csv.export.getStatusGet CSV export status.
Parameters: None
Returns:
{
"enabled": false,
"isOpen": false,
"filePath": ""
}
csv.export.setEnabledEnable or disable CSV export.
Parameters:
enabled (bool): true to enable, false to disableExample:
python test_api.py send csv.export.setEnabled -p enabled=true
csv.export.closeClose current CSV file.
Parameters: None
Example:
python test_api.py send csv.export.close
CSV file playback control:
csv.player.openOpen a CSV file for playback.
Parameters:
filePath (string): Path to CSV fileExample:
python test_api.py send csv.player.open -p filePath=/path/to/data.csv
csv.player.closeClose current CSV file.
Parameters: None
csv.player.playStart playback.
Parameters: None
csv.player.pausePause playback.
Parameters: None
csv.player.toggleToggle play/pause state.
Parameters: None
csv.player.nextFrameAdvance to next frame.
Parameters: None
csv.player.previousFrameGo to previous frame.
Parameters: None
csv.player.setProgressSeek to position in file.
Parameters:
progress (double): Position from 0.0 to 1.0Example:
python test_api.py send csv.player.setProgress -p progress=0.5
csv.player.getStatusGet player status.
Parameters: None
Returns:
{
"isOpen": true,
"isPlaying": false,
"frameCount": 1000,
"framePosition": 500,
"progress": 0.5,
"timestamp": "00:05:23.456",
"filename": "data.csv"
}
Console/terminal control:
console.setEchoEnable or disable echo mode.
Parameters:
enabled (bool): true to enable, false to disableconsole.setShowTimestampShow or hide timestamps.
Parameters:
enabled (bool): true to show, false to hideconsole.setDisplayModeSet display mode.
Parameters:
modeIndex (int): 0=PlainText, 1=Hexadecimalconsole.setDataModeSet data mode.
Parameters:
modeIndex (int): 0=UTF8, 1=Hexadecimalconsole.setLineEndingSet line ending mode.
Parameters:
endingIndex (int): 0=None, 1=LF, 2=CR, 3=CRLFconsole.setFontFamilySet console font.
Parameters:
fontFamily (string): Font nameconsole.setFontSizeSet console font size.
Parameters:
fontSize (int): Font size in pointsconsole.setChecksumMethodSet checksum method.
Parameters:
methodIndex (int): Checksum method indexconsole.clearClear console output.
Parameters: None
console.sendSend data to device.
Parameters:
data (string): Data to sendconsole.getConfigurationGet console configuration.
Parameters: None
Returns:
{
"echo": false,
"showTimestamp": true,
"displayMode": 0,
"dataMode": 0,
"lineEnding": 1,
"fontFamily": "Courier New",
"fontSize": 10,
"checksumMethod": 0
}
Dashboard settings and visualization control:
dashboard.getStatusGet all dashboard configuration settings.
Parameters: None
Returns:
{
"operationMode": 0,
"operationModeName": "ProjectFile",
"fps": 24,
"points": 500
}
Example:
python test_api.py send dashboard.getStatus
dashboard.setOperationModeSet the dashboard operation mode.
Parameters:
mode (int): 0=ProjectFile, 1=DeviceSendsJSON, 2=QuickPlotReturns:
{
"mode": 0,
"modeName": "ProjectFile"
}
Example:
python test_api.py send dashboard.setOperationMode -p mode=1
Operation Modes:
0 - ProjectFile: Use a JSON project file to define dashboard layout1 - DeviceSendsJSON: Device sends JSON-formatted data directly2 - QuickPlot: Automatic plotting of incoming numeric datadashboard.getOperationModeGet the current dashboard operation mode.
Parameters: None
Returns:
{
"mode": 0,
"modeName": "ProjectFile"
}
Example:
python test_api.py send dashboard.getOperationMode
dashboard.setFPSSet the visualization refresh rate.
Parameters:
fps (int): Refresh rate in frames per second (1-240 Hz)Returns:
{
"fps": 60
}
Example:
python test_api.py send dashboard.setFPS -p fps=60
Notes:
dashboard.getFPSGet the current visualization refresh rate.
Parameters: None
Returns:
{
"fps": 24
}
Example:
python test_api.py send dashboard.getFPS
dashboard.setPointsSet the number of data points displayed per plot.
Parameters:
points (int): Number of data points (minimum 1)Returns:
{
"points": 500
}
Example:
python test_api.py send dashboard.setPoints -p points=1000
Notes:
dashboard.getPointsGet the current number of data points per plot.
Parameters: None
Returns:
{
"points": 500
}
Example:
python test_api.py send dashboard.getPoints
Project file and configuration management:
project.file.newCreate new project.
Parameters: None
project.file.openOpen project file.
Parameters:
filePath (string): Path to project JSON fileExample:
python test_api.py send project.file.open -p filePath=/path/to/project.json
project.file.saveSave current project.
Parameters:
askPath (bool, optional): true to prompt for save locationproject.getStatusGet project info.
Returns:
{
"title": "My Project",
"filePath": "/path/to/project.json",
"modified": false,
"groupCount": 3,
"datasetCount": 12
}
project.group.addAdd new group.
Parameters:
title (string): Group titlewidgetType (int): Widget type (0-6)project.group.deleteDelete current group.
Parameters: None
project.group.duplicateDuplicate current group.
Parameters: None
project.dataset.addAdd new dataset.
Parameters:
options (int): Dataset options (bit flags 0-63)project.dataset.deleteDelete current dataset.
Parameters: None
project.dataset.duplicateDuplicate current dataset.
Parameters: None
project.dataset.setOptionToggle dataset option.
Parameters:
option (int): Option flagenabled (bool): Enable or disableproject.action.addAdd new action.
Parameters: None
project.action.deleteDelete current action.
Parameters: None
project.action.duplicateDuplicate current action.
Parameters: None
project.parser.setCodeSet frame parser code.
Parameters:
code (string): JavaScript parser codeproject.parser.getCodeGet frame parser code.
Returns:
{
"code": "function parse(frame) { ... }",
"codeLength": 256
}
project.groups.listList all groups.
Returns:
{
"groups": [
{
"groupId": 0,
"title": "Sensors",
"widget": "MultiPlot",
"datasetCount": 5
}
],
"groupCount": 1
}
project.datasets.listList all datasets.
Returns:
{
"datasets": [
{
"groupId": 0,
"groupTitle": "Sensors",
"index": 0,
"title": "Temperature",
"units": "°C",
"widget": "bar",
"value": "25.3"
}
],
"datasetCount": 5
}
project.actions.listList all actions.
Returns:
{
"actions": [],
"actionCount": 0
}
Note: These commands require a Serial Studio Pro license.
io.driver.modbus.getConfigurationGet current Modbus configuration.
Parameters: None
io.driver.modbus.getProtocolListGet list of supported Modbus protocols.
Returns:
{
"protocolList": [
{"index": 0, "name": "Modbus RTU"},
{"index": 1, "name": "Modbus TCP"}
]
}
io.driver.modbus.setProtocolIndexSet Modbus protocol.
Parameters:
protocolIndex (int): 0=RTU, 1=TCPio.driver.modbus.setSlaveAddressSet Modbus slave address.
Parameters:
address (int): Slave address (1-247)io.driver.modbus.setPollIntervalSet polling interval.
Parameters:
intervalMs (int): Interval in milliseconds (minimum 10)io.driver.modbus.setHostSet Modbus TCP host address.
Parameters:
host (string): IP address or hostnameio.driver.modbus.setPortSet Modbus TCP port.
Parameters:
port (int): Port number (1-65535)io.driver.modbus.setSerialPortIndexSet RTU serial port.
Parameters:
portIndex (int): Serial port indexio.driver.modbus.setBaudRateSet RTU baud rate.
Parameters:
baudRate (int): Baud rateio.driver.modbus.setParityIndexSet RTU parity.
Parameters:
parityIndex (int): Parity indexio.driver.modbus.setDataBitsIndexSet RTU data bits.
Parameters:
dataBitsIndex (int): Data bits indexio.driver.modbus.setStopBitsIndexSet RTU stop bits.
Parameters:
stopBitsIndex (int): Stop bits indexio.driver.modbus.addRegisterGroupAdd a register group to poll.
Parameters:
type (int): Register type (0=Coils, 1=Discrete, 2=Holding, 3=Input)startAddress (int): Starting register address (0-65535)count (int): Number of registers to read (1-125)Example:
python test_api.py send io.driver.modbus.addRegisterGroup -p type=2 startAddress=0 count=10
io.driver.modbus.removeRegisterGroupRemove a register group.
Parameters:
groupIndex (int): Group index to removeio.driver.modbus.clearRegisterGroupsClear all register groups.
Parameters: None
io.driver.modbus.getSerialPortListio.driver.modbus.getParityListio.driver.modbus.getDataBitsListio.driver.modbus.getStopBitsListio.driver.modbus.getBaudRateListio.driver.modbus.getRegisterTypeListio.driver.modbus.getRegisterGroupsNote: These commands require a Serial Studio Pro license.
io.driver.canbus.getConfigurationGet current CAN bus configuration.
Parameters: None
io.driver.canbus.getPluginListGet list of available CAN plugins.
Returns:
{
"pluginList": [
{"index": 0, "name": "socketcan", "displayName": "SocketCAN"},
{"index": 1, "name": "peakcan", "displayName": "PEAK PCAN"}
]
}
io.driver.canbus.getInterfaceListGet list of available CAN interfaces.
Returns:
{
"interfaceList": [
{"index": 0, "name": "can0"},
{"index": 1, "name": "can1"}
]
}
io.driver.canbus.getBitrateListGet list of supported bitrates.
Returns:
{
"bitrateList": ["10000", "20000", "50000", "125000", "250000", "500000", "1000000"]
}
io.driver.canbus.getInterfaceErrorGet interface error message if any.
Parameters: None
io.driver.canbus.setPluginIndexSelect CAN plugin.
Parameters:
pluginIndex (int): Plugin index from getPluginListio.driver.canbus.setInterfaceIndexSelect CAN interface.
Parameters:
interfaceIndex (int): Interface index from getInterfaceListio.driver.canbus.setBitrateSet CAN bitrate.
Parameters:
bitrate (int): Bitrate in bits/second (e.g., 250000)io.driver.canbus.setCanFDEnable or disable CAN FD.
Parameters:
enabled (bool): true to enable CAN FD, false for standard CANNote: These commands require a Serial Studio Pro license.
mqtt.getConfigurationGet current MQTT configuration.
Parameters: None
mqtt.getConnectionStatusGet MQTT connection status.
Returns:
{
"isConnected": false,
"isPublisher": false,
"isSubscriber": true
}
mqtt.getModesGet available MQTT modes.
Returns:
{
"modes": [
{"index": 0, "name": "Publisher"},
{"index": 1, "name": "Subscriber"}
]
}
mqtt.setModeSet MQTT mode.
Parameters:
modeIndex (int): 0=Publisher, 1=Subscribermqtt.setHostnameSet MQTT broker hostname.
Parameters:
hostname (string): Broker hostname or IPmqtt.setPortSet MQTT broker port.
Parameters:
port (int): Port number (1-65535)mqtt.setClientIdSet MQTT client ID.
Parameters:
clientId (string): Client IDmqtt.setUsernameSet MQTT username.
Parameters:
username (string): Usernamemqtt.setPasswordSet MQTT password.
Parameters:
password (string): Passwordmqtt.setTopicSet MQTT topic filter.
Parameters:
topic (string): Topic (e.g., "sensors/temperature" or "sensors/#")mqtt.setCleanSessionSet clean session flag.
Parameters:
enabled (bool): true for clean session, false for persistentmqtt.setMqttVersionSet MQTT protocol version.
Parameters:
versionIndex (int): MQTT version indexmqtt.setKeepAliveSet keep-alive interval.
Parameters:
seconds (int): Keep-alive interval in secondsmqtt.setAutoKeepAliveEnable or disable auto keep-alive.
Parameters:
enabled (bool): true to enable, false to disablemqtt.setWillQoSSet will message QoS.
Parameters:
qos (int): QoS level (0, 1, or 2)mqtt.setWillRetainSet will message retain flag.
Parameters:
enabled (bool): true to retain, false otherwisemqtt.setWillTopicSet will message topic.
Parameters:
topic (string): Will topicmqtt.setWillMessageSet will message payload.
Parameters:
message (string): Will messagemqtt.setSslEnabledEnable or disable SSL/TLS.
Parameters:
enabled (bool): true to enable SSL, false to disablemqtt.setSslProtocolSet SSL/TLS protocol.
Parameters:
protocolIndex (int): SSL protocol indexmqtt.setPeerVerifyModeSet SSL peer verification mode.
Parameters:
modeIndex (int): Verify mode indexmqtt.setPeerVerifyDepthSet SSL peer verification depth.
Parameters:
depth (int): Verification depthmqtt.connectOpen MQTT connection.
Parameters: None
mqtt.disconnectClose MQTT connection.
Parameters: None
mqtt.toggleConnectionToggle MQTT connection state.
Parameters: None
mqtt.regenerateClientIdGenerate new random client ID.
Parameters: None
mqtt.getMqttVersionsmqtt.getSslProtocolsmqtt.getPeerVerifyModesNote: These commands require a Serial Studio Pro license.
mdf4.export.getStatusGet MDF4 export status.
Parameters: None
Returns:
{
"enabled": false,
"isOpen": false
}
mdf4.export.setEnabledEnable or disable MDF4 export.
Parameters:
enabled (bool): true to enable, false to disablemdf4.export.closeClose current MDF4 file.
Parameters: None
MDF4 file playback control (same interface as CSV Player):
mdf4.player.openOpen MDF4/MF4 file for playback.
Parameters:
filePath (string): Path to MDF4 fileExample:
python test_api.py send mdf4.player.open -p filePath=/path/to/data.mf4
mdf4.player.closeClose current MDF4 file.
Parameters: None
mdf4.player.playStart playback.
Parameters: None
mdf4.player.pausePause playback.
Parameters: None
mdf4.player.toggleToggle play/pause state.
Parameters: None
mdf4.player.nextFrameAdvance to next frame.
Parameters: None
mdf4.player.previousFrameGo to previous frame.
Parameters: None
mdf4.player.setProgressSeek to position in file.
Parameters:
progress (double): Position from 0.0 to 1.0Example:
python test_api.py send mdf4.player.setProgress -p progress=0.25
mdf4.player.getStatusGet player status.
Returns:
{
"isOpen": true,
"isPlaying": true,
"frameCount": 5000,
"framePosition": 1250,
"progress": 0.25,
"timestamp": "00:01:15.678",
"filename": "data.mf4"
}
Note: These commands require a Serial Studio Pro license.
io.driver.audio.setInputDeviceSelect audio input device.
Parameters:
deviceIndex (int): Device indexio.driver.audio.setOutputDeviceSelect audio output device.
Parameters:
deviceIndex (int): Device indexio.driver.audio.setSampleRateSet sample rate.
Parameters:
rateIndex (int): Sample rate indexio.driver.audio.setInputSampleFormatSet input sample format.
Parameters:
formatIndex (int): Format indexio.driver.audio.setInputChannelConfigSet input channel configuration.
Parameters:
channelIndex (int): Channel config indexio.driver.audio.setOutputSampleFormatSet output sample format.
Parameters:
formatIndex (int): Format indexio.driver.audio.setOutputChannelConfigSet output channel configuration.
Parameters:
channelIndex (int): Channel config indexio.driver.audio.getInputDevicesGet list of input devices.
Returns:
{
"devices": ["Microphone", "Line In"],
"selectedIndex": 0
}
io.driver.audio.getOutputDevicesGet list of output devices.
Returns:
{
"devices": ["Speakers", "Headphones"],
"selectedIndex": 0
}
io.driver.audio.getSampleRatesGet list of sample rates.
Returns:
{
"sampleRates": ["8000 Hz", "44100 Hz", "48000 Hz"],
"selectedIndex": 2
}
io.driver.audio.getInputFormatsGet list of input sample formats.
Returns:
{
"formats": ["16-bit", "24-bit", "32-bit float"],
"selectedIndex": 0
}
io.driver.audio.getOutputFormatsGet list of output sample formats.
Returns:
{
"formats": ["16-bit", "24-bit", "32-bit float"],
"selectedIndex": 0
}
io.driver.audio.getConfigurationGet complete audio configuration.
Returns:
{
"selectedInputDevice": 0,
"selectedOutputDevice": 0,
"selectedSampleRate": 2,
"selectedInputSampleFormat": 0,
"selectedInputChannelConfig": 0,
"selectedOutputSampleFormat": 0,
"selectedOutputChannelConfig": 0
}
Request:
{
"type": "command",
"id": "status-1",
"command": "io.manager.getStatus"
}
Response:
{
"type": "response",
"id": "status-1",
"success": true,
"result": {
"isConnected": false,
"paused": false,
"busType": 0,
"configurationOk": false
}
}
Request (Batch):
{
"type": "batch",
"id": "uart-setup",
"commands": [
{"command": "io.manager.setBusType", "id": "1", "params": {"busType": 0}},
{"command": "io.driver.uart.setBaudRate", "id": "2", "params": {"baudRate": 115200}},
{"command": "io.driver.uart.setParity", "id": "3", "params": {"parityIndex": 0}},
{"command": "io.driver.uart.setDataBits", "id": "4", "params": {"dataBitsIndex": 3}},
{"command": "io.driver.uart.setStopBits", "id": "5", "params": {"stopBitsIndex": 0}},
{"command": "io.driver.uart.setPortIndex", "id": "6", "params": {"portIndex": 0}},
{"command": "io.manager.connect", "id": "7"}
]
}
First, Base64-encode your data:
echo -n "Hello World" | base64
# Output: SGVsbG8gV29ybGQ=
Request:
{
"type": "command",
"id": "send-1",
"command": "io.manager.writeData",
"params": {
"data": "SGVsbG8gV29ybGQ="
}
}
{
"type": "batch",
"id": "network-setup",
"commands": [
{"command": "io.manager.setBusType", "id": "1", "params": {"busType": 1}},
{"command": "io.driver.network.setSocketType", "id": "2", "params": {"socketTypeIndex": 0}},
{"command": "io.driver.network.setRemoteAddress", "id": "3", "params": {"address": "192.168.1.100"}},
{"command": "io.driver.network.setTcpPort", "id": "4", "params": {"port": 8080}},
{"command": "io.manager.connect", "id": "5"}
]
}
{
"type": "command",
"id": "csv-1",
"command": "csv.export.setEnabled",
"params": {
"enabled": true
}
}
Request (Batch):
{
"type": "batch",
"id": "dashboard-setup",
"commands": [
{"command": "dashboard.setOperationMode", "id": "1", "params": {"mode": 1}},
{"command": "dashboard.setFPS", "id": "2", "params": {"fps": 60}},
{"command": "dashboard.setPoints", "id": "3", "params": {"points": 1000}},
{"command": "dashboard.getStatus", "id": "4"}
]
}
Shell Example:
python test_api.py send dashboard.setOperationMode -p mode=1
python test_api.py send dashboard.setFPS -p fps=60
python test_api.py send dashboard.setPoints -p points=1000
python test_api.py send dashboard.getStatus
{
"type": "command",
"id": "list-1",
"command": "api.getCommands"
}
Returns:
{
"type": "response",
"id": "list-1",
"success": true,
"result": {
"commands": [
{"name": "api.getCommands", "description": "Get list of all available commands"},
{"name": "io.manager.connect", "description": "Open connection to device"}
]
}
}
Configure UART Connection:
python test_api.py send io.manager.setBusType -p busType=0
python test_api.py send io.driver.uart.setBaudRate -p baudRate=115200
python test_api.py send io.driver.uart.setPortIndex -p portIndex=0
python test_api.py send io.manager.connect
Configure Network (TCP) Connection:
python test_api.py send io.manager.setBusType -p busType=1
python test_api.py send io.driver.network.setSocketType -p socketTypeIndex=0
python test_api.py send io.driver.network.setRemoteAddress -p address=192.168.1.100
python test_api.py send io.driver.network.setTcpPort -p port=8080
python test_api.py send io.manager.connect
Enable Data Export:
python test_api.py send csv.export.setEnabled -p enabled=true
Configure Dashboard Settings:
python test_api.py send dashboard.setOperationMode -p mode=1
python test_api.py send dashboard.setFPS -p fps=60
python test_api.py send dashboard.setPoints -p points=1000
python test_api.py send dashboard.getStatus
The examples/API Test/test_api.py script provides a full-featured client.
Location: examples/API Test/test_api.py
Features:
Usage:
# Single command
python test_api.py send io.manager.getStatus
# With parameters
python test_api.py send io.driver.uart.setBaudRate -p baudRate=115200
# Interactive mode
python test_api.py interactive
# Run tests
python test_api.py test
# List all commands
python test_api.py list
Installation:
cd examples/API\ Test/
python test_api.py --help
#!/usr/bin/env python3
import socket
import json
import time
class SerialStudioAPI:
def __init__(self, host="127.0.0.1", port=7777):
self.host = host
self.port = port
def send_command(self, command, params=None):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.host, self.port))
msg = {
"type": "command",
"id": f"cmd-{time.time()}",
"command": command
}
if params:
msg["params"] = params
sock.sendall((json.dumps(msg) + "\n").encode())
response = json.loads(sock.recv(65536).decode())
sock.close()
return response
def connect_uart(self, baud=115200, port_index=0):
self.send_command("io.manager.setBusType", {"busType": 0})
self.send_command("io.driver.uart.setBaudRate", {"baudRate": baud})
self.send_command("io.driver.uart.setPortIndex", {"portIndex": port_index})
return self.send_command("io.manager.connect")
# Usage
api = SerialStudioAPI()
status = api.send_command("io.manager.getStatus")
print(f"Connected: {status['result']['isConnected']}")
const net = require('net');
class SerialStudioAPI {
constructor(host = '127.0.0.1', port = 7777) {
this.host = host;
this.port = port;
}
sendCommand(command, params = {}) {
return new Promise((resolve, reject) => {
const client = net.createConnection({ host: this.host, port: this.port });
const msg = {
type: 'command',
id: `cmd-${Date.now()}`,
command: command,
params: params
};
client.on('connect', () => {
client.write(JSON.stringify(msg) + '\n');
});
client.on('data', (data) => {
const response = JSON.parse(data.toString());
client.end();
resolve(response);
});
client.on('error', (err) => {
reject(err);
});
});
}
}
// Usage
const api = new SerialStudioAPI();
api.sendCommand('io.manager.getStatus')
.then(response => console.log(response))
.catch(err => console.error(err));
#!/bin/bash
API_HOST="127.0.0.1"
API_PORT="7777"
send_command() {
local command=$1
local params=${2:-"{}"}
local msg=$(cat <<EOF
{
"type": "command",
"id": "bash-cmd",
"command": "$command",
"params": $params
}
EOF
)
echo "$msg" | nc $API_HOST $API_PORT
}
# Usage
send_command "io.manager.getStatus"
send_command "io.driver.uart.setBaudRate" '{"baudRate": 115200}'
# Using netcat
echo '{"type":"command","id":"1","command":"io.manager.getStatus"}' | nc localhost 7777
# Using curl (if supported)
curl -X POST http://localhost:7777 \
-H "Content-Type: application/json" \
-d '{"type":"command","id":"1","command":"io.manager.getStatus"}'
import socket
import json
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1", 7777))
request = {
"type": "command",
"id": "test-1",
"command": "io.manager.getStatus"
}
sock.sendall((json.dumps(request) + "\n").encode())
response = json.loads(sock.recv(65536).decode())
print(response)
sock.close()
using System;
using System.Net.Sockets;
using System.Text;
using System.Text.Json;
var client = new TcpClient("127.0.0.1", 7777);
var stream = client.GetStream();
var request = new {
type = "command",
id = "test-1",
command = "io.manager.getStatus"
};
var json = JsonSerializer.Serialize(request) + "\n";
var data = Encoding.UTF8.GetBytes(json);
stream.Write(data, 0, data.Length);
var buffer = new byte[65536];
var bytes = stream.Read(buffer, 0, buffer.Length);
var response = Encoding.UTF8.GetString(buffer, 0, bytes);
Console.WriteLine(response);
client.Close();
✅ DO:
❌ DON'T:
Good:
status = api.send_command("io.manager.getStatus")
if not status["result"]["isConnected"]:
api.send_command("io.manager.connect")
# Bad - assuming connection state
api.send_command("io.manager.writeData", {"data": "..."})
Use batch commands when executing multiple related operations:
Good (Batch):
{
"type": "batch",
"commands": [
{"command": "io.manager.setBusType", "id": "1", "params": {"busType": 0}},
{"command": "io.driver.uart.setBaudRate", "id": "2", "params": {"baudRate": 115200}},
{"command": "io.manager.connect", "id": "3"}
]
}
Less Efficient (Sequential):
# Three separate TCP connections
send_command("io.manager.setBusType", {"busType": 0})
send_command("io.driver.uart.setBaudRate", {"baudRate": 115200})
send_command("io.manager.connect")
Always check for errors in responses:
# Good
response = api.send_command("io.manager.connect")
if not response.get("success"):
error = response.get("error", {})
code = error.get("code")
message = error.get("message")
if code == "EXECUTION_ERROR":
# Handle connection failure
print(f"Connection failed: {message}")
else:
# Handle other errors
print(f"Error {code}: {message}")
else:
print("Connected successfully")
# Bad - ignoring errors
api.send_command("io.manager.connect")
# Continue without checking...
Validate parameters before sending:
# Good
def set_baud_rate(rate):
valid_rates = [1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200]
if rate not in valid_rates:
raise ValueError(f"Invalid baud rate: {rate}")
return api.send_command("io.driver.uart.setBaudRate", {"baudRate": rate})
# Bad - sending unchecked values
set_baud_rate(user_input) # Could be anything!
Track connection state in your client:
class SerialStudioClient:
def __init__(self):
self.connected = False
self.bus_type = None
def connect(self):
response = self.send_command("io.manager.connect")
if response.get("success"):
self.connected = True
return response
def disconnect(self):
response = self.send_command("io.manager.disconnect")
if response.get("success"):
self.connected = False
return response
# Good
try:
api.send_command("io.manager.connect")
api.send_command("csv.export.setEnabled", {"enabled": True})
# Do work...
finally:
api.send_command("csv.export.close")
api.send_command("io.manager.disconnect")
# Bad - leaving resources open
api.send_command("io.manager.connect")
# Exit without cleanup
# Good - keep connection open for monitoring
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1", 7777))
while monitoring:
msg = {"type": "command", "command": "io.manager.getStatus"}
sock.sendall((json.dumps(msg) + "\n").encode())
response = sock.recv(65536)
# Process response
time.sleep(1)
sock.close()
# Bad - reconnecting every time
while monitoring:
response = api.send_command("io.manager.getStatus") # New connection each time!
time.sleep(1)
Problem: Connection refused or timeout
Solutions:
telnet localhost 7777 or nc localhost 7777Problem: UNKNOWN_COMMAND or INVALID_PARAM
Solutions:
python test_api.py listgetBaudRateList, getPortList, etc. to see valid valuesProblem: All commands in batch fail
Solutions:
id fieldcommands is an arrayProblem: Connection closes unexpectedly
Solutions:
Problem: Response ID differs from request ID
Solutions:
Problem: UNKNOWN_COMMAND for Modbus/CAN/MQTT commands
Solutions:
Problem: EXECUTION_ERROR when command fails
Solutions:
Connection Pooling:
class ConnectionPool:
def __init__(self, size=5):
self.connections = [create_connection() for _ in range(size)]
self.available = self.connections.copy()
def get(self):
return self.available.pop() if self.available else None
def release(self, conn):
self.available.append(conn)
Pipelining Commands:
# Send multiple commands without waiting for responses
for cmd in commands:
send_async(cmd)
# Then collect all responses
responses = [receive() for _ in commands]
LabVIEW Integration: Use LabVIEW's TCP/IP VIs to communicate with the API Server.
MATLAB Integration:
% Connect to Serial Studio
t = tcpclient('127.0.0.1', 7777);
% Send command
request = struct('type', 'command', 'id', 'matlab-1', 'command', 'io.manager.getStatus');
json = jsonencode(request);
write(t, [json, newline]);
% Read response
response = read(t);
data = jsondecode(char(response));
% Close
clear t;
Docker/Container Usage:
# Expose host's Serial Studio to container
docker run -it --network host my-automation-script
# Inside container, connect to 127.0.0.1:7777
Build language-specific wrappers for easier use:
class SerialStudio:
def __init__(self, host='127.0.0.1', port=7777):
self.api = SerialStudioAPI(host, port)
def uart(self):
return UARTDriver(self.api)
def network(self):
return NetworkDriver(self.api)
class UARTDriver:
def __init__(self, api):
self.api = api
def set_baud_rate(self, rate):
return self.api.send("io.driver.uart.setBaudRate", {"baudRate": rate})
def get_ports(self):
response = self.api.send("io.driver.uart.getPortList")
return response.get("result", {}).get("portList", [])
# Usage
ss = SerialStudio()
ss.uart().set_baud_rate(115200)
ports = ss.uart().get_ports()
Serial Studio includes a built-in MCP (Model Context Protocol) server that exposes the API Server functionality to AI models such as Claude and ChatGPT. This allows AI assistants to directly control Serial Studio — connecting to devices, reading sensor data, sending commands, and managing exports — through natural language instructions.
The MCP handler wraps the Serial Studio TCP API (port 7777) in an MCP-compliant interface. Any MCP-capable AI client can discover and call Serial Studio's 182+ API commands as tools.
See the MCP Client example in the examples directory for a complete working client implementation.
examples/API Test/ directoryexamples/API Test/API_REFERENCE.mdexamples/API Test/test_api.py testexamples/MCP Client/ directorydashboard.getStatus - Get all dashboard settingsdashboard.setOperationMode / dashboard.getOperationMode - Control operation modedashboard.setFPS / dashboard.getFPS - Control visualization refresh ratedashboard.setPoints / dashboard.getPoints - Control plot data pointsThe Serial Studio API Server is dual-licensed:
See the main LICENSE file for details.
Found a bug or have a suggestion?
For security issues, please contact privately rather than creating a public issue.
Total Commands: 165
Made with ❤️ by the Serial Studio team
For questions and support, visit the Serial Studio GitHub repository.