Tauri commands
The #[tauri::command] functions in src/commands.rs, which the JS package calls
with invoke('plugin:serialplugin|<name>', args). You normally use the SerialPort class
instead; this list is for calling commands directly or from Rust (see Rust).
Arguments are sent in camelCase; AppHandle and State parameters are injected by Tauri and not listed.
| Command | Description |
|---|---|
available_ports | Lists all available serial ports on the system |
managed_ports | Lists all currently managed serial ports |
cancel_read | Cancels an in-flight poll read on a serial port (does not stop an active watch). |
close | Closes a serial port |
close_all | Closes all open serial ports |
force_close | Forcefully closes a serial port |
open | Opens a serial port with the specified configuration |
write | Writes string data to a serial port |
write_binary | Writes binary data to a serial port |
read | Reads string data from a serial port |
read_binary | Reads binary data from a serial port |
capabilities | Returns runtime capabilities (transport, platform, version) without window probing. |
watch | |
unwatch | Stops a watch session by channel id. |
watch_ports | Streams available-port attach/detach events through a Tauri IPC channel. |
unwatch_ports | Stops a port-list watch session by channel id. |
set_baud_rate | Sets the baud rate for a serial port |
set_data_bits | Sets the number of data bits for a serial port |
set_flow_control | Sets the flow control mode for a serial port |
set_parity | Sets the parity checking mode for a serial port |
set_stop_bits | Sets the number of stop bits for a serial port |
set_timeout | Sets the read timeout for a serial port |
write_request_to_send | Sets the RTS (Request To Send) control signal |
write_data_terminal_ready | Sets the DTR (Data Terminal Ready) control signal |
read_clear_to_send | Reads the CTS (Clear To Send) control signal state |
read_data_set_ready | Reads the DSR (Data Set Ready) control signal state |
read_ring_indicator | Reads the RI (Ring Indicator) control signal state |
read_carrier_detect | Reads the CD (Carrier Detect) control signal state |
bytes_to_read | Gets the number of bytes available to read from the serial port |
bytes_to_write | Gets the number of bytes available to write to the serial port |
clear_buffer | Clears the specified buffer of the serial port |
set_break | Sets the break condition on the serial port |
clear_break | Clears the break condition on the serial port |
set_log_level | Sets the global log level for the plugin |
get_log_level | Gets the current global log level |
exchange | Write and read-until-response (AT-style exchange). |
cancel_exchange | Cancel an in-flight exchange on a port. |
at | Send one AT command with native session defaults and FIFO queue. |
at_phases | Multi-phase AT flow (e.g. CMGS) as one atomic queue job. |
send_sms_pdu | Built-in CMGS recipe through the native transaction queue. |
configure_at_session | Configure AT session defaults for native at on a port. |
exchange_binary | Binary write + read-until-response (e.g. CMGS PDU). |
enable_mux | Enter GSM 07.10 CMUX mode on a physical port (desktop). |
open_mux_channel | Open a virtual CMUX channel (returns composite path). |
disable_mux | Tear down CMUX and close virtual channels. |
ble_scan | Scan for Bluetooth LE devices advertising the Nordic UART Service. |
Commands
available_ports
Lists all available serial ports on the system
invoke('plugin:serialplugin|available_ports', { singlePortPerDevice })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
singlePortPerDevice | single_port_per_device | Option<bool> |
Returns HashMap<String, HashMap<String, String>>. Rust: async fn. Permission: serialplugin:allow-available-ports.
managed_ports
Lists all currently managed serial ports
invoke('plugin:serialplugin|managed_ports')
No arguments.
Returns Vec<String>. Rust: plain (sync) fn. Permission: serialplugin:allow-managed-ports.
cancel_read
Cancels an in-flight poll read on a serial port (does not stop an active watch).
invoke('plugin:serialplugin|cancel_read', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns (). Rust: async fn. Permission: serialplugin:allow-cancel-read.
close
Closes a serial port
invoke('plugin:serialplugin|close', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns (). Rust: async fn. Permission: serialplugin:allow-close.
close_all
Closes all open serial ports
invoke('plugin:serialplugin|close_all')
No arguments.
Returns (). Rust: async fn. Permission: serialplugin:allow-close-all.
force_close
Forcefully closes a serial port
invoke('plugin:serialplugin|force_close', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns (). Rust: async fn. Permission: serialplugin:allow-force-close.
open
Opens a serial port with the specified configuration
invoke('plugin:serialplugin|open', { path, baudRate, dataBits, flowControl, parity, stopBits, timeout, dtr, rts })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
baudRate | baud_rate | u32 |
dataBits | data_bits | Option<DataBits> |
flowControl | flow_control | Option<FlowControl> |
parity | parity | Option<Parity> |
stopBits | stop_bits | Option<StopBits> |
timeout | timeout | Option<u64> |
dtr | dtr | Option<bool> |
rts | rts | Option<bool> |
Returns String. Rust: async fn. Permission: serialplugin:allow-open.
write
Writes string data to a serial port
invoke('plugin:serialplugin|write', { path, value })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
value | value | String |
Returns usize. Rust: async fn. Permission: serialplugin:allow-write.
write_binary
Writes binary data to a serial port
invoke('plugin:serialplugin|write_binary', { path, value })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
value | value | Vec<u8> |
Returns usize. Rust: async fn. Permission: serialplugin:allow-write-binary.
read
Reads string data from a serial port
invoke('plugin:serialplugin|read', { path, timeout, size })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
timeout | timeout | Option<u64> |
size | size | Option<usize> |
Returns String. Rust: async fn. Permission: serialplugin:allow-read.
read_binary
Reads binary data from a serial port
invoke('plugin:serialplugin|read_binary', { path, timeout, size })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
timeout | timeout | Option<u64> |
size | size | Option<usize> |
Returns Vec<u8>. Rust: async fn. Permission: serialplugin:allow-read-binary.
capabilities
Returns runtime capabilities (transport, platform, version) without window probing.
invoke('plugin:serialplugin|capabilities')
No arguments.
Returns Capabilities. Rust: plain (sync) fn. Permission: serialplugin:allow-capabilities.
watch
invoke('plugin:serialplugin|watch', { path, options, parser, channel })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
options | options | WatchOptions |
parser | parser | Option<serial_codec::framing::FramerConfig> |
channel | channel | Channel<SerialEvent> |
Returns u32. Rust: async fn. Permission: serialplugin:allow-watch.
unwatch
Stops a watch session by channel id.
invoke('plugin:serialplugin|unwatch', { channelId })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
channelId | channel_id | u32 |
Returns (). Rust: async fn. Permission: serialplugin:allow-unwatch.
watch_ports
Streams available-port attach/detach events through a Tauri IPC channel.
invoke('plugin:serialplugin|watch_ports', { options, channel })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
options | options | Option<crate::events::WatchPortsOptions> |
channel | channel | tauri::ipc::Channel<crate::events::PortListEvent> |
Returns u32. Rust: async fn. Permission: serialplugin:allow-watch-ports.
unwatch_ports
Stops a port-list watch session by channel id.
invoke('plugin:serialplugin|unwatch_ports', { channelId })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
channelId | channel_id | u32 |
Returns (). Rust: async fn. Permission: serialplugin:allow-unwatch-ports.
set_baud_rate
Sets the baud rate for a serial port
invoke('plugin:serialplugin|set_baud_rate', { path, baudRate })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
baudRate | baud_rate | u32 |
Returns (). Rust: async fn. Permission: serialplugin:allow-set-baud-rate.
set_data_bits
Sets the number of data bits for a serial port
invoke('plugin:serialplugin|set_data_bits', { path, dataBits })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
dataBits | data_bits | DataBits |
Returns (). Rust: async fn. Permission: serialplugin:allow-set-data-bits.
set_flow_control
Sets the flow control mode for a serial port
invoke('plugin:serialplugin|set_flow_control', { path, flowControl })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
flowControl | flow_control | FlowControl |
Returns (). Rust: async fn. Permission: serialplugin:allow-set-flow-control.
set_parity
Sets the parity checking mode for a serial port
invoke('plugin:serialplugin|set_parity', { path, parity })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
parity | parity | Parity |
Returns (). Rust: async fn. Permission: serialplugin:allow-set-parity.
set_stop_bits
Sets the number of stop bits for a serial port
invoke('plugin:serialplugin|set_stop_bits', { path, stopBits })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
stopBits | stop_bits | StopBits |
Returns (). Rust: async fn. Permission: serialplugin:allow-set-stop-bits.
set_timeout
Sets the read timeout for a serial port
invoke('plugin:serialplugin|set_timeout', { path, timeout })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
timeout | timeout | u64 |
Returns (). Rust: async fn. Permission: serialplugin:allow-set-timeout.
write_request_to_send
Sets the RTS (Request To Send) control signal
invoke('plugin:serialplugin|write_request_to_send', { path, level })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
level | level | bool |
Returns (). Rust: async fn. Permission: serialplugin:allow-write-request-to-send.
write_data_terminal_ready
Sets the DTR (Data Terminal Ready) control signal
invoke('plugin:serialplugin|write_data_terminal_ready', { path, level })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
level | level | bool |
Returns (). Rust: async fn. Permission: serialplugin:allow-write-data-terminal-ready.
read_clear_to_send
Reads the CTS (Clear To Send) control signal state
invoke('plugin:serialplugin|read_clear_to_send', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns bool. Rust: async fn. Permission: serialplugin:allow-read-clear-to-send.
read_data_set_ready
Reads the DSR (Data Set Ready) control signal state
invoke('plugin:serialplugin|read_data_set_ready', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns bool. Rust: async fn. Permission: serialplugin:allow-read-data-set-ready.
read_ring_indicator
Reads the RI (Ring Indicator) control signal state
invoke('plugin:serialplugin|read_ring_indicator', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns bool. Rust: async fn. Permission: serialplugin:allow-read-ring-indicator.
read_carrier_detect
Reads the CD (Carrier Detect) control signal state
invoke('plugin:serialplugin|read_carrier_detect', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns bool. Rust: async fn. Permission: serialplugin:allow-read-carrier-detect.
bytes_to_read
Gets the number of bytes available to read from the serial port
invoke('plugin:serialplugin|bytes_to_read', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns u32. Rust: async fn. Permission: serialplugin:allow-bytes-to-read.
bytes_to_write
Gets the number of bytes available to write to the serial port
invoke('plugin:serialplugin|bytes_to_write', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns u32. Rust: async fn. Permission: serialplugin:allow-bytes-to-write.
clear_buffer
Clears the specified buffer of the serial port
invoke('plugin:serialplugin|clear_buffer', { path, bufferType })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
bufferType | buffer_type | ClearBuffer |
Returns (). Rust: async fn. Permission: serialplugin:allow-clear-buffer.
set_break
Sets the break condition on the serial port
invoke('plugin:serialplugin|set_break', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns (). Rust: async fn. Permission: serialplugin:allow-set-break.
clear_break
Clears the break condition on the serial port
invoke('plugin:serialplugin|clear_break', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns (). Rust: async fn. Permission: serialplugin:allow-clear-break.
set_log_level
Sets the global log level for the plugin
invoke('plugin:serialplugin|set_log_level', { level })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
level | level | crate::state::LogLevel |
Returns (). Rust: plain (sync) fn. Permission: serialplugin:allow-set-log-level.
get_log_level
Gets the current global log level
invoke('plugin:serialplugin|get_log_level')
No arguments.
Returns crate::state::LogLevel. Rust: plain (sync) fn. Permission: serialplugin:allow-get-log-level.
exchange
Write and read-until-response (AT-style exchange).
invoke('plugin:serialplugin|exchange', { path, value, options })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
value | value | String |
options | options | Option<ExchangeOptions> |
Returns crate::at::parse::ExchangeResponse. Rust: async fn. Permission: serialplugin:allow-exchange.
cancel_exchange
Cancel an in-flight exchange on a port.
invoke('plugin:serialplugin|cancel_exchange', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns (). Rust: async fn. Permission: serialplugin:allow-cancel-exchange.
at
Send one AT command with native session defaults and FIFO queue.
invoke('plugin:serialplugin|at', { path, command, options })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
command | command | String |
options | options | Option<crate::at::session::AtCommandOptions> |
Returns crate::at::parse::AtCommandResult. Rust: async fn. Permission: serialplugin:allow-at.
at_phases
Multi-phase AT flow (e.g. CMGS) as one atomic queue job.
invoke('plugin:serialplugin|at_phases', { path, phases })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
phases | phases | Vec<crate::at::session::AtPhase> |
Returns Vec<crate::at::parse::AtCommandResult>. Rust: async fn. Permission: serialplugin:allow-at-phases.
send_sms_pdu
Built-in CMGS recipe through the native transaction queue.
invoke('plugin:serialplugin|send_sms_pdu', { path, length, pdu, options })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
length | length | u32 |
pdu | pdu | Vec<u8> |
options | options | Option<crate::at::session::SendSmsPduOptions> |
Returns Vec<crate::at::parse::AtCommandResult>. Rust: async fn. Permission: serialplugin:allow-send-sms-pdu.
configure_at_session
Configure AT session defaults for native at on a port.
invoke('plugin:serialplugin|configure_at_session', { path, session })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
session | session | crate::at::session::AtSessionConfig |
Returns (). Rust: async fn. Permission: serialplugin:allow-configure-at-session.
exchange_binary
Binary write + read-until-response (e.g. CMGS PDU).
invoke('plugin:serialplugin|exchange_binary', { path, value, options })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
value | value | Vec<u8> |
options | options | Option<crate::events::ExchangeOptions> |
Returns crate::at::parse::ExchangeResponse. Rust: async fn. Permission: serialplugin:allow-exchange-binary.
enable_mux
Enter GSM 07.10 CMUX mode on a physical port (desktop).
invoke('plugin:serialplugin|enable_mux', { path, options })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
options | options | Option<EnableMuxOptions> |
Returns (). Rust: async fn. Permission: serialplugin:allow-enable-mux.
open_mux_channel
Open a virtual CMUX channel (returns composite path).
invoke('plugin:serialplugin|open_mux_channel', { path, dlci })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
dlci | dlci | u8 |
Returns String. Rust: async fn. Permission: serialplugin:allow-open-mux-channel.
disable_mux
Tear down CMUX and close virtual channels.
invoke('plugin:serialplugin|disable_mux', { path })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
path | path | String |
Returns (). Rust: async fn. Permission: serialplugin:allow-disable-mux.
ble_scan
Scan for Bluetooth LE devices advertising the Nordic UART Service.
Returns ble://<id> paths (open them like any port). Needs the ble feature.
invoke('plugin:serialplugin|ble_scan', { timeoutMs })
| Argument (JS) | Rust parameter | Type |
|---|---|---|
timeoutMs | timeout_ms | Option<u64> |
Returns HashMap<String, HashMap<String, String>>. Rust: async fn. Permission: serialplugin:allow-ble-scan.