### Setting Up Tauri Plugin Development Environment (Bash) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md These commands outline the steps to get the plugin's development environment ready. It involves cloning the repository, installing project dependencies using pnpm, building the project, and finally running the playground application for testing. ```bash git clone https://github.com/s00d/tauri-plugin-serialplugin.git cd tauri-plugin-serialplugin pnpm i pnpm run build pnpm run playground ``` -------------------------------- ### Starting Data Listening - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Starts listening for incoming data on the serial port. Returns a promise that resolves when listening begins. Throws an error if starting the listener fails or the port is not open. Example usage and how to listen for data events are provided. ```TypeScript /** * Starts listening for data on the serial port * @returns {Promise} A promise that resolves when listening starts * @throws {Error} If starting listener fails or port is not open * @example * await port.startListening(); * * // Listen for data events * port.listen((data) => { * console.log("Data received:", data); * }); */ async startListening(): Promise; ``` -------------------------------- ### Install JavaScript Bindings Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Installs the JavaScript/TypeScript bindings for the serial port plugin into your frontend project. You can use npm, yarn, or pnpm for this step, depending on your project's package manager. ```Bash npm add tauri-plugin-serialplugin # or yarn add tauri-plugin-serialplugin # or pnpm add tauri-plugin-serialplugin ``` -------------------------------- ### Listing Available Ports - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Lists all available serial ports on the system. Returns a promise resolving to a map of port names to port information. Example usage is provided. ```TypeScript /** * Lists all available serial ports on the system * @returns {Promise<{[key: string]: PortInfo}>} Map of port names to port information * @example * const ports = await SerialPort.available_ports(); * console.log(ports); */ static async available_ports(): Promise<{ [key: string]: PortInfo }>; ``` -------------------------------- ### Setting Up Data Listener - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Sets up a listener for incoming data on the serial port. Requires a callback function to handle received data. Optionally specifies whether to decode data as a string (default) or return raw bytes. Returns a promise that resolves when the listener is set up. Example usage is provided. ```TypeScript /** * Sets up a listener for incoming data * @param {(data: string | Uint8Array) => void} callback Function to handle received data * @param {boolean} [decode=true] Whether to decode data as string (true) or return raw bytes (false) * @returns {Promise} * @example * await port.listen((data) => { * console.log("Received:", data); * }); */ async listen(callback: (data: string | Uint8Array) => void, decode?: boolean): Promise; ``` -------------------------------- ### Listing Available Ports Directly - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Lists ports using platform-specific commands for enhanced detection. Returns a promise resolving to a map of port names to port information. Example usage is provided. ```TypeScript /** * Lists ports using platform-specific commands for enhanced detection * @returns {Promise<{[key: string]: PortInfo}>} Map of port names to port information * @example * const ports = await SerialPort.available_ports_direct(); */ static async available_ports_direct(): Promise<{ [key: string]: PortInfo }>; ``` -------------------------------- ### Reading Sensor Data via Serial Port in Tauri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This example shows how to initialize and open a serial port with specific parameters, then use the `listen` method to asynchronously receive data. The received data is parsed as a floating-point number, simulating reading sensor values. ```typescript const port = new SerialPort({ path: "COM1", baudRate: 9600 }); await port.open(); await port.listen((data) => { const sensorValue = parseFloat(data); console.log("Sensor reading:", sensorValue); }); ``` -------------------------------- ### Opening Serial Port Connection - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Opens the serial port with the specified configuration. Returns a promise that resolves when the port is open. Throws an error if the port is already open or the configuration is invalid. Example usage is provided. ```TypeScript /** * Opens the serial port with specified configuration * @returns {Promise} * @throws {Error} If port is already open or invalid configuration * @example * const port = new SerialPort({ path: "COM1", baudRate: 9600 }); * await port.open(); */ async open(): Promise; ``` -------------------------------- ### Sending Modbus Requests via Serial Port in Tauri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This example configures a serial port with typical Modbus settings (baud rate, data bits, stop bits, parity). It includes a helper function to create a Modbus read holding registers request and demonstrates sending this binary request using `writeBinary`. ```typescript const port = new SerialPort({ path: "COM1", baudRate: 9600, dataBits: DataBits.Eight, stopBits: StopBits.One, parity: Parity.None }); await port.open(); function createModbusRequest(address: number, length: number): Uint8Array { return new Uint8Array([ 0x01, // Device ID 0x03, // Function code: Read Holding Registers address >> 8, address & 0xFF, length >> 8, length & 0xFF ]); } // Send Modbus request const request = createModbusRequest(0x1000, 10); await port.writeBinary(request); ``` -------------------------------- ### Writing Binary Data - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Writes binary data to the serial port. Accepts data as a Uint8Array or number array. Returns a promise resolving to the number of bytes written. Throws an error if the write operation fails or the port is not open. Example usage is provided. ```TypeScript /** * Writes binary data to the serial port * @param {Uint8Array | number[]} data Binary data to write * @returns {Promise} Number of bytes written * @throws {Error} If write fails or port is not open * @example * const data = new Uint8Array([0x01, 0x02, 0x03]); * const bytesWritten = await port.writeBinary(data); */ async writeBinary(data: Uint8Array | number[]): Promise; ``` -------------------------------- ### Closing All Serial Ports - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Closes all currently open serial port connections managed by the application. Returns a promise that resolves when all ports are closed. Example usage is provided. ```TypeScript /** * Closes all open serial port connections * @returns {Promise} * @example * await SerialPort.closeAll(); */ static async closeAll(): Promise; ``` -------------------------------- ### Closing Serial Port Connection - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Closes the serial port connection. Returns a promise that resolves when the port is closed. Throws an error if the port is not open. Example usage is provided. ```TypeScript /** * Closes the serial port connection * @returns {Promise} * @throws {Error} If port is not open * @example * await port.close(); */ async close(): Promise; ``` -------------------------------- ### Forcing Serial Port Close - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Forces a serial port to close regardless of its current state. Requires the port path as a parameter. Returns a promise that resolves when the port is closed. Example usage is provided. ```TypeScript /** * Forces a serial port to close regardless of its state * @param {string} path Port path to force close * @returns {Promise} * @example * await SerialPort.forceClose("COM1"); */ static async forceClose(path: string): Promise; ``` -------------------------------- ### Stopping Data Listening - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Stops listening for incoming data on the serial port. Returns a promise that resolves when listening stops. Throws an error if stopping the listener fails or the port is not open. Example usage is provided. ```TypeScript /** * Stops listening for data on the serial port * @returns {Promise} A promise that resolves when listening stops * @throws {Error} If stopping listener fails or port is not open * @example * await port.stopListening(); */ async stopListening(): Promise; ``` -------------------------------- ### Writing String Data - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Writes string data to the serial port. Takes the string data as input. Returns a promise resolving to the number of bytes written. Throws an error if the write operation fails or the port is not open. Example usage is provided. ```TypeScript /** * Writes string data to the serial port * @param {string} data Data to write * @returns {Promise} Number of bytes written * @throws {Error} If write fails or port is not open * @example * const bytesWritten = await port.write("Hello"); */ async write(data: string): Promise; ``` -------------------------------- ### Permission Identifier: serialplugin:allow-start-listening Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the start_listening command without any pre-configured scope. ```Identifier serialplugin:allow-start-listening ``` -------------------------------- ### Implementing Binary Protocol Communication in Tauri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This snippet illustrates setting up a serial port for binary communication. It shows how to create a `Uint8Array` command, send it using `writeBinary`, and listen for raw binary responses, useful for custom or low-level protocols. ```typescript const port = new SerialPort({ path: "COM1", baudRate: 115200 }); await port.open(); // Send command const command = new Uint8Array([0x02, 0x01, 0x03]); await port.writeBinary(command); // Read response (raw bytes) await port.listen((data) => { const response = data instanceof Uint8Array ? data : new Uint8Array(); console.log("Response:", response); }, false); ``` -------------------------------- ### Permission Identifier: serialplugin:deny-start-listening Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the start_listening command without any pre-configured scope. ```Identifier serialplugin:deny-start-listening ``` -------------------------------- ### Configuring Android Gradle Repositories (Kotlin) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This snippet shows how to modify the build.gradle.kts file to add the JitPack repository. This is necessary to resolve dependencies for the Tauri plugin on the Android platform. The repository is added to both buildscript and allprojects blocks. ```kotlin buildscript { repositories { // ... maven { url = uri("https://jitpack.io") } } // ... } allprojects { repositories { // ... maven { url = uri("https://jitpack.io") } } } ``` -------------------------------- ### Basic Serial Port Operations in TypeScript Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Demonstrates a complete basic flow for interacting with a serial port from the frontend using the plugin. It includes listing available ports, opening a specific port, writing data, setting up a listener for incoming data, and closing the port. ```TypeScript import { SerialPort } from "tauri-plugin-serialplugin"; // List available ports const ports = await SerialPort.available_ports(); console.log("Available ports:", ports); // Open a port const port = new SerialPort({ path: "COM1", baudRate: 9600 }); await port.open(); // Write data await port.write("Hello, Serial Port!"); // Start port listening await port.startListening(); // Read data with event listener await port.listen((data) => { console.log("Received:", data); }); // Stop port listening await port.stopListening(); // Close port await port.close(); ``` -------------------------------- ### Configuring Serial Port Parameters in Tauri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This snippet defines methods within the `SerialPort` class for setting fundamental serial port configuration options such as baud rate, data bits, flow control, parity, and stop bits. These methods are asynchronous and return promises. ```typescript class SerialPort { /** * Sets the baud rate * @param {number} baudRate Speed in bits per second * @returns {Promise} * @example * await port.setBaudRate(115200); */ async setBaudRate(baudRate: number): Promise; /** * Sets the number of data bits * @param {DataBits} dataBits Number of bits per character (5-8) * @returns {Promise} * @example * await port.setDataBits(DataBits.Eight); */ async setDataBits(dataBits: DataBits): Promise; /** * Sets the flow control mode * @param {FlowControl} flowControl Flow control setting * @returns {Promise} * @example * await port.setFlowControl(FlowControl.Hardware); */ async setFlowControl(flowControl: FlowControl): Promise; /** * Sets the parity checking mode * @param {Parity} parity Parity checking mode * @returns {Promise} * @example * await port.setParity(Parity.None); */ async setParity(parity: Parity): Promise; /** * Sets the number of stop bits * @param {StopBits} stopBits Number of stop bits * @returns {Promise} * @example * await port.setStopBits(StopBits.One); */ async setStopBits(stopBits: StopBits): Promise; } ``` -------------------------------- ### Permission Identifier: serialplugin:allow-write-binary Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the write_binary command without any pre-configured scope. ```Identifier serialplugin:allow-write-binary ``` -------------------------------- ### Granting All Serial Plugin Permissions Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This JSON configuration snippet shows how to add all available permissions for the Tauri serial plugin to the `permissions` array in your Tauri application's configuration file (e.g., `tauri.conf.json`). This grants the frontend access to all serial port functionalities provided by the plugin. ```JSONC "permissions": [ "core:default", "serialplugin:default", "serialplugin:allow-available-ports", "serialplugin:allow-cancel-read", "serialplugin:allow-close", "serialplugin:allow-close-all", "serialplugin:allow-force-close", "serialplugin:allow-open", "serialplugin:allow-read", "serialplugin:allow-write", "serialplugin:allow-write-binary", "serialplugin:allow-available-ports-direct", "serialplugin:allow-set-baud-rate", "serialplugin:allow-set-data-bits", "serialplugin:allow-set-flow-control", "serialplugin:allow-set-parity", "serialplugin:allow-set-stop-bits", "serialplugin:allow-set-timeout", "serialplugin:allow-write-rts", "serialplugin:allow-write-dtr", "serialplugin:allow-read-cts", "serialplugin:allow-read-dsr", "serialplugin:allow-read-ri", "serialplugin:allow-read-cd", "serialplugin:allow-bytes-to-read", "serialplugin:allow-bytes-to-write", "serialplugin:allow-clear-buffer", "serialplugin:allow-set-break", "serialplugin:allow-clear-break", "serialplugin:allow-start-listening", "serialplugin:allow-stop-listening" ] ``` -------------------------------- ### Permission Identifier: serialplugin:deny-write-binary Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the write_binary command without any pre-configured scope. ```Identifier serialplugin:deny-write-binary ``` -------------------------------- ### Permission Identifier: serialplugin:allow-read-data-set-ready Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the read_data_set_ready command without any pre-configured scope. ```Identifier serialplugin:allow-read-data-set-ready ``` -------------------------------- ### Permission Identifier: serialplugin:allow-write Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the write command without any pre-configured scope. ```Identifier serialplugin:allow-write ``` -------------------------------- ### Permission Identifier: serialplugin:deny-read-data-set-ready Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the read_data_set_ready command without any pre-configured scope. ```Identifier serialplugin:deny-read-data-set-ready ``` -------------------------------- ### Permission Identifier: serialplugin:allow-set-parity Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the set_parity command without any pre-configured scope. ```Identifier serialplugin:allow-set-parity ``` -------------------------------- ### Permission Identifier: serialplugin:allow-set-baud-rate Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the set_baud_rate command without any pre-configured scope. ```Identifier serialplugin:allow-set-baud-rate ``` -------------------------------- ### Add Rust Dependency with Cargo Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Adds the `tauri-plugin-serialplugin` crate as a dependency to your Tauri project's `Cargo.toml` file. This command uses the Cargo package manager to fetch and include the necessary Rust code for the plugin. ```Bash cargo add tauri-plugin-serialplugin ``` -------------------------------- ### Allow write_rts Permission - Configuration Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the write_rts command without any pre-configured scope. ```Configuration serialplugin:allow-write-rts ``` -------------------------------- ### Permission Identifier: serialplugin:allow-write-data-terminal-ready Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the write_data_terminal_ready command without any pre-configured scope. ```Identifier serialplugin:allow-write-data-terminal-ready ``` -------------------------------- ### Permission Identifier: serialplugin:deny-set-parity Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the set_parity command without any pre-configured scope. ```Identifier serialplugin:deny-set-parity ``` -------------------------------- ### Permission Identifier: serialplugin:deny-write-data-terminal-ready Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the write_data_terminal_ready command without any pre-configured scope. ```Identifier serialplugin:deny-write-data-terminal-ready ``` -------------------------------- ### Allow write_dtr Permission - Configuration Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the write_dtr command without any pre-configured scope. ```Configuration serialplugin:allow-write-dtr ``` -------------------------------- ### Permission Identifier: serialplugin:deny-set-baud-rate Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the set_baud_rate command without any pre-configured scope. ```Identifier serialplugin:deny-set-baud-rate ``` -------------------------------- ### Permission Identifier: serialplugin:allow-read-ring-indicator Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the read_ring_indicator command without any pre-configured scope. ```Identifier serialplugin:allow-read-ring-indicator ``` -------------------------------- ### Allow available_ports_direct Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `available_ports_direct` command within the Tauri serial plugin. It grants direct access to list available serial ports without requiring specific scope configurations. ```Configuration serialplugin:allow-available-ports-direct ``` -------------------------------- ### Allow write_request_to_send Permission - Configuration Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the write_request_to_send command without any pre-configured scope. ```Configuration serialplugin:allow-write-request-to-send ``` -------------------------------- ### Listing Managed Ports - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Lists all managed serial ports (ports that are currently open and managed by the application). Returns a promise that resolves to an array of port paths (names). ```TypeScript /** * @description Lists all managed serial ports (ports that are currently open and managed by the application). * @returns {Promise} A promise that resolves to an array of port paths (names). */ static async managed_ports(): Promise; ``` -------------------------------- ### Allow bytes_to_write Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `bytes_to_write` command within the Tauri serial plugin. It allows querying the number of bytes waiting to be written to a serial port. ```Configuration serialplugin:allow-bytes-to-write ``` -------------------------------- ### Managing Serial Port Control Signals in Tauri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This snippet provides methods within the `SerialPort` class to manipulate and query the state of serial port control signals like RTS, DTR, CTS, DSR, RI, and CD. Both writing (setting) and reading signal states are supported asynchronously. ```typescript class SerialPort { /** * Sets the RTS (Request to Send) signal * @param {boolean} level Signal level (true = high, false = low) * @returns {Promise} * @example * await port.writeRequestToSend(true); */ async writeRequestToSend(level: boolean): Promise; /** * Sets the DTR (Data Terminal Ready) signal * @param {boolean} level Signal level (true = high, false = low) * @returns {Promise} * @example * await port.writeDataTerminalReady(true); */ async writeDataTerminalReady(level: boolean): Promise; /** * Reads the CTS (Clear to Send) signal state * @returns {Promise} Signal state * @example * const cts = await port.readClearToSend(); */ async readClearToSend(): Promise; /** * Reads the DSR (Data Set Ready) signal state * @returns {Promise} Signal state * @example * const dsr = await port.readDataSetReady(); */ async readDataSetReady(): Promise; /** * Reads the RI (Ring Indicator) signal state * @returns {Promise} Signal state * @example * const ri = await port.readRingIndicator(); */ async readRingIndicator(): Promise; /** * Reads the CD (Carrier Detect) signal state * @returns {Promise} Signal state * @example * const cd = await port.readCarrierDetect(); */ async readCarrierDetect(): Promise; } ``` -------------------------------- ### Configure SerialPort Permissions in Capability Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Adds the necessary permission (`serialplugin:default`) to your Tauri application's capability file. This grants the frontend access to the serial port plugin's functionality, ensuring proper security. ```JSON { "$schema": "../gen/schemas/desktop-schema.json", "identifier": "default", "description": "Capability for the main window", "windows": ["main"], "permissions": [ "core:default", "serialplugin:default" ] } ``` -------------------------------- ### Allow available_ports Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `available_ports` command within the Tauri serial plugin. It grants access to list available serial ports without requiring specific scope configurations. ```Configuration serialplugin:allow-available-ports ``` -------------------------------- ### Permission Identifier: serialplugin:deny-write Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the write command without any pre-configured scope. ```Identifier serialplugin:deny-write ``` -------------------------------- ### Permission Identifier: serialplugin:allow-set-data-bits Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the set_data_bits command without any pre-configured scope. ```Identifier serialplugin:allow-set-data-bits ``` -------------------------------- ### Permission Identifier: serialplugin:deny-set-timeout Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the set_timeout command without any pre-configured scope. ```Identifier serialplugin:deny-set-timeout ``` -------------------------------- ### Permission Identifier: serialplugin:allow-set-timeout Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the set_timeout command without any pre-configured scope. ```Identifier serialplugin:allow-set-timeout ``` -------------------------------- ### Permission Identifier: serialplugin:allow-read-dsr Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the read_dsr command without any pre-configured scope. ```Identifier serialplugin:allow-read-dsr ``` -------------------------------- ### Deny write_rts Permission - Configuration Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the write_rts command without any pre-configured scope. ```Configuration serialplugin:deny-write-rts ``` -------------------------------- ### Permission Identifier: serialplugin:deny-read-dsr Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the read_dsr command without any pre-configured scope. ```Identifier serialplugin:deny-read-dsr ``` -------------------------------- ### Permission Identifier: serialplugin:deny-set-data-bits Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the set_data_bits command without any pre-configured scope. ```Identifier serialplugin:deny-set-data-bits ``` -------------------------------- ### Permission Identifier: serialplugin:allow-write-dtr Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the write_dtr command without any pre-configured scope. ```Identifier serialplugin:allow-write-dtr ``` -------------------------------- ### Permission Identifier: serialplugin:deny-read-ring-indicator Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the read_ring_indicator command without any pre-configured scope. ```Identifier serialplugin:deny-read-ring-indicator ``` -------------------------------- ### Register SerialPort Plugin in Tauri App Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Initializes and registers the `tauri-plugin-serialplugin` within your Tauri application's main Rust function. This makes the plugin's commands and events available to the frontend. ```Rust // src-tauri/src/main.rs fn main() { tauri::Builder::default() .plugin(tauri_plugin_serialplugin::init()) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ``` -------------------------------- ### Permission Identifier: serialplugin:allow-read-ri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the read_ri command without any pre-configured scope. ```Identifier serialplugin:allow-read-ri ``` -------------------------------- ### Permission Identifier: serialplugin:deny-set-flow-control Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the set_flow_control command without any pre-configured scope. ```Identifier serialplugin:deny-set-flow-control ``` -------------------------------- ### Permission Identifier: serialplugin:deny-write-dtr Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the write_dtr command without any pre-configured scope. ```Identifier serialplugin:deny-write-dtr ``` -------------------------------- ### Allow bytes_to_read Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `bytes_to_read` command within the Tauri serial plugin. It allows querying the number of bytes available to be read from a serial port. ```Configuration serialplugin:allow-bytes-to-read ``` -------------------------------- ### Reading Binary Data - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Reads binary data from the serial port. Accepts optional read options. Returns a promise that resolves with the binary data as a Uint8Array. ```TypeScript /** * Reads binary data from the serial port * @param {ReadOptions} [options] Read options * @returns {Promise} A promise that resolves with binary data */ async readBinary(options?: ReadOptions): Promise; ``` -------------------------------- ### Deny write_dtr Permission - Configuration Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the write_dtr command without any pre-configured scope. ```Configuration serialplugin:deny-write-dtr ``` -------------------------------- ### Permission Identifier: serialplugin:deny-set-stop-bits Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the set_stop_bits command without any pre-configured scope. ```Identifier serialplugin:deny-set-stop-bits ``` -------------------------------- ### Deny bytes_to_write Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `bytes_to_write` command within the Tauri serial plugin. It prevents querying the number of bytes waiting to be written to a serial port. ```Configuration serialplugin:deny-bytes-to-write ``` -------------------------------- ### Reading String Data - Tauri SerialPort (TypeScript) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md Reads data from the serial port. Accepts optional read options. Returns a promise that resolves to the data as a string. ```TypeScript /** * Reads data from the serial port * @param {ReadOptions} [options] Read options * @returns {Promise} A promise that resolves to a string */ async read(options?: ReadOptions): Promise; ``` -------------------------------- ### Permission Identifier: serialplugin:allow-read-dtr Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the read_dtr command without any pre-configured scope. ```Identifier serialplugin:allow-read-dtr ``` -------------------------------- ### Permission Identifier: serialplugin:deny-set-break Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the set_break command without any pre-configured scope. ```Identifier serialplugin:deny-set-break ``` -------------------------------- ### Permission Identifier: serialplugin:allow-set-stop-bits Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the set_stop_bits command without any pre-configured scope. ```Identifier serialplugin:allow-set-stop-bits ``` -------------------------------- ### Permission Identifier: serialplugin:deny-read-ri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the read_ri command without any pre-configured scope. ```Identifier serialplugin:deny-read-ri ``` -------------------------------- ### Permission Identifier: serialplugin:allow-set-flow-control Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the set_flow_control command without any pre-configured scope. ```Identifier serialplugin:allow-set-flow-control ``` -------------------------------- ### Permission Identifier: serialplugin:allow-set-break Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the set_break command without any pre-configured scope. ```Identifier serialplugin:allow-set-break ``` -------------------------------- ### Permission Identifier: serialplugin:deny-read-dtr Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the read_dtr command without any pre-configured scope. ```Identifier serialplugin:deny-read-dtr ``` -------------------------------- ### Allow close_all Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `close_all` command within the Tauri serial plugin. It allows closing all open serial port connections managed by the plugin. ```Configuration serialplugin:allow-close-all ``` -------------------------------- ### Permission Identifier: serialplugin:deny-stop-listening Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the stop_listening command without any pre-configured scope. ```Identifier serialplugin:deny-stop-listening ``` -------------------------------- ### Deny available_ports_direct Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `available_ports_direct` command within the Tauri serial plugin. It prevents direct access to list available serial ports unless explicitly allowed by other means. ```Configuration serialplugin:deny-available-ports-direct ``` -------------------------------- ### Allow clear_buffer Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `clear_buffer` command within the Tauri serial plugin. It allows clearing the input and/or output buffers of a serial port. ```Configuration serialplugin:allow-clear-buffer ``` -------------------------------- ### Permission Identifier: serialplugin:allow-stop-listening Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Enables the stop_listening command without any pre-configured scope. ```Identifier serialplugin:allow-stop-listening ``` -------------------------------- ### Allow managed_ports Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `managed_ports` command within the Tauri serial plugin. It allows querying the list of currently managed (open) serial ports. ```Configuration serialplugin:allow-managed-ports ``` -------------------------------- ### Deny write_request_to_send Permission - Configuration Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the write_request_to_send command without any pre-configured scope. ```Configuration serialplugin:deny-write-request-to-send ``` -------------------------------- ### Managing Serial Port Buffers in Tauri Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/README.md This snippet defines methods within the `SerialPort` class for inspecting and clearing the serial port's input and output buffers. It allows checking the number of bytes available to read or waiting to be written, and clearing specific buffers. ```typescript class SerialPort { /** * Gets number of bytes available to read * @returns {Promise} Number of bytes in read buffer * @example * const available = await port.bytesToRead(); */ async bytesToRead(): Promise; /** * Gets number of bytes waiting to be written * @returns {Promise} Number of bytes in write buffer * @example * const pending = await port.bytesToWrite(); */ async bytesToWrite(): Promise; /** * Clears the specified buffer * @param {ClearBuffer} buffer Buffer to clear * @returns {Promise} * @example * await port.clearBuffer(ClearBuffer.Input); */ async clearBuffer(buffer: ClearBuffer): Promise; } ``` -------------------------------- ### Deny available_ports Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `available_ports` command within the Tauri serial plugin. It prevents access to list available serial ports unless explicitly allowed by other means. ```Configuration serialplugin:deny-available-ports ``` -------------------------------- ### Permission Identifier: serialplugin:allow-read-cts Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md Denies the read_cts command without any pre-configured scope. ```Identifier serialplugin:allow-read-cts ``` -------------------------------- ### Deny bytes_to_read Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `bytes_to_read` command within the Tauri serial plugin. It prevents querying the number of bytes available to be read from a serial port. ```Configuration serialplugin:deny-bytes-to-read ``` -------------------------------- ### Allow force_close Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `force_close` command within the Tauri serial plugin. It allows forcefully closing a specific serial port connection. ```Configuration serialplugin:allow-force-close ``` -------------------------------- ### Deny close_all Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `close_all` command within the Tauri serial plugin. It prevents closing all open serial port connections managed by the plugin. ```Configuration serialplugin:deny-close-all ``` -------------------------------- ### Deny clear_buffer Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `clear_buffer` command within the Tauri serial plugin. It prevents clearing the input and/or output buffers of a serial port. ```Configuration serialplugin:deny-clear-buffer ``` -------------------------------- ### Allow close Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `close` command within the Tauri serial plugin. It allows closing a specific serial port connection. ```Configuration serialplugin:allow-close ``` -------------------------------- ### Deny force_close Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `force_close` command within the Tauri serial plugin. It prevents forcefully closing a specific serial port connection. ```Configuration serialplugin:deny-force-close ``` -------------------------------- ### Deny close Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `close` command within the Tauri serial plugin. It prevents closing a specific serial port connection. ```Configuration serialplugin:deny-close ``` -------------------------------- ### Allow cancel_read Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `cancel_read` command within the Tauri serial plugin. It allows cancelling an ongoing read operation on a serial port. ```Configuration serialplugin:allow-cancel-read ``` -------------------------------- ### Allow clear_break Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier enables the `clear_break` command within the Tauri serial plugin. It allows clearing the break condition on a serial port. ```Configuration serialplugin:allow-clear-break ``` -------------------------------- ### Deny cancel_read Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `cancel_read` command within the Tauri serial plugin. It prevents cancelling an ongoing read operation on a serial port. ```Configuration serialplugin:deny-cancel-read ``` -------------------------------- ### Deny clear_break Permission (Configuration) Source: https://github.com/s00d/tauri-plugin-serialplugin/blob/main/permissions/autogenerated/reference.md This permission identifier denies the `clear_break` command within the Tauri serial plugin. It prevents clearing the break condition on a serial port. ```Configuration serialplugin:deny-clear-break ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.