certabodriver

Creator: coderz1093

Last updated:

0 purchases

certabodriver Image
certabodriver Images

Languages

Categories

Add to Cart

Description:

certabodriver

certabodriver #
The certabodriver flutter package allows you to quickly get you certabo-board connected
to your Android application.
Getting Started with certabodriver + usb_serial #
Add dependencies to pubspec.yaml
dependencies:
certabodriver: ^0.0.4
usb_serial: ^0.2.4
copied to clipboard
include the package
import 'package:certabodriver/certabodriver.dart';
import 'package:usb_serial/usb_serial.dart';
copied to clipboard
add compileOptions to android\app\build.gradle
android {
...
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
...
}
copied to clipboard
you can do optional more steps to allow usb related features,
for that please take a look at the package we depend on:
usb_serial.
Connect to a connected board and listen to its events:
List<UsbDevice> devices = await UsbSerial.listDevices();
print(devices);
if (devices.length == 0) {
return;
}

List<UsbDevice> dgtDevices = devices.where((d) => d.vid == 4292).toList();
UsbPort usbDevice = await dgtDevices[0].create();
await usbDevice.open();

await usbDevice.setDTR(true);
await usbDevice.setRTS(true);

usbDevice.setPortParameters(38400, UsbPort.DATABITS_8, UsbPort.STOPBITS_1, UsbPort.PARITY_NONE);

CertaboCommunicationClient client = CertaboCommunicationClient(usbDevice.write);
usbDevice.inputStream.listen(client.handleReceive);

if (dgtDevices.length > 0) {
// connect to board and initialize
CertaboBoard nBoard = new CertaboBoard();
await nBoard.init(client);
print("CertaboBoard connected");

// set connected board
setState(() {
connectedBoard = nBoard;
});
}
copied to clipboard
In action #
To get a quick look, it is used in the follwoing project, which is not open source yet.
https://khad.im/p/white-pawn

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.