Skip to content

Does not support multiple serial ports working at the same time(Because of the singleton pattern?) #6

@sanxianlee

Description

@sanxianlee

Serial serialPortA = await FlutterSerialPort.createSerialPort( Device("deviceNameA", "/your/device/path"), 9600);
Serial serialPortB = await FlutterSerialPort.createSerialPort( Device("deviceNameB", "/your/device/path"), 115200);

bool openResultA = await serialPortA.open();
print(serialPortA.isConnected) // true

bool openResultB = await serialPortB.open();
print(serialPortB.isConnected) // false

serialPortA.receiveStream.listen((recv) {
print("Receive: $recv");
});

serialPortB.receiveStream.listen((recv) {
print("Receive: $recv");
});

你可以参照:
https://github.com/Marcello168/react-native-multi-serial-port

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions