l2cap_ble

Last updated:

0 purchases

l2cap_ble Image
l2cap_ble Images
Add to Cart

Description:

l2cap ble

L2CAP Flutter Package #


Effortlessly integrate L2CAP communication into your Flutter apps with the L2CAP Flutter package. Streamline Bluetooth device communication with a simplified and intuitive interface.
Table of Contents #

Installation
Usage
Examples
Contributing
License

Installation #
To use this package, add l2cap_ble as a dependency in your pubspec.yaml file:
dependencies:
l2cap_ble: ^latest_version
copied to clipboard
Usage #
Scan for Bluetooth Devices: Use your preferred Bluetooth scanning package to find and obtain the deviceId of the target device.
Initialize L2CAP Communication: #
final ble = L2capBle();
copied to clipboard
Monitor Connection State: #
Subscribe to the connection state stream to track L2CAP connection progress.
final connectionStream = ble.getConnectionState();
copied to clipboard
Connect to Device: #
Establish a connection to the device using connectToDevice, and await the 'connected' state.
await ble.connectToDevice(deviceId);
copied to clipboard
Create L2CAP Channel: #
Use createL2capChannel to establish the L2CAP channel, providing the required psm.
final channelCreated = await ble.createL2capChannel(psm);
copied to clipboard
Exchange Messages: #
Send and receive messages seamlessly via the L2CAP channel with sendMessage.
final response = await ble.sendMessage(myMessage);
copied to clipboard
Disconnect Gracefully: #
Disconnect using disconnectFromDevice. The L2CAP channel closes automatically.
ble.disconnectFromDevice(deviceId);
copied to clipboard
Example #
Explore the example directory for a complete usage scenario, demonstrating L2CAP communication.
Contributing #
Contributions are welcome! If you encounter issues, have feature suggestions, or want to improve the package, feel free to open an issue or submit a pull request. Please read our Contribution Guidelines for more information.
License #
This project is licensed under the MIT License.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.