Comments (10)
The example code in this repo doesn't use
serialPort.open
. I tried puttingserialPort.configure
afterfinal port = SerialPort(address);
but still ran into the same issue. What's weird is refreshing the app made it sometimes work, but most of the time threw the same error. I'll keep playing around on my end though.
Try this
final port = SerialPort(address);
port.open(...);
port.configure =...
from flutter_libserialport.
Hi, thanks so much for this package and the example!
Forgive me for being thick:
port.open(...);
port.configure =...
Can someone point me at a tutorial to help me learn what the obvious replacement is here for the '...' ellipsis?
Stay safe out there :-)
from flutter_libserialport.
I got the same issues. Failed to open port,and it return –2.
from flutter_libserialport.
I have found the solution, set serialPort.configure
after serialPort.open
from flutter_libserialport.
@lvsecoto Thanks for spending the time to figure it out! Sounds like that an assertion could help to catch the problem.
from flutter_libserialport.
The example code in this repo doesn't use serialPort.open
. I tried putting serialPort.configure
after final port = SerialPort(address);
but still ran into the same issue. What's weird is refreshing the app made it sometimes work, but most of the time threw the same error. I'll keep playing around on my end though.
from flutter_libserialport.
══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following SerialPortError was thrown while handling a gesture:
Invalid argument, errno = 22
When the exception was thrown, this was the stack:
#0 Util.call (package:libserialport/src/util.dart:39:7)
#1 Util.toInt (package:libserialport/src/util.dart:77:16)
#2 _SerialPortImpl.busNumber (package:libserialport/src/port.dart:284:17)
#3 new SerialPortDataSource.<anonymous closure> (package:vt_meter_app/sections/meters/meters.dart:301:40)
#4 MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
#5 ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
#6 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#7 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#8 new List.of (dart:core-patch/array_patch.dart:50:28)
#9 ListIterable.toList (dart:_internal/iterable.dart:212:44)
#10 new SerialPortDataSource (package:vt_meter_app/sections/meters/meters.dart:303:10)
#11 masterPaneMeters.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:vt_meter_app/sections/meters/meters.dart:166:60)
#12 State.setState (package:flutter/src/widgets/framework.dart:1088:30)
#13 masterPaneMeters.<anonymous closure>.<anonymous closure> (package:vt_meter_app/sections/meters/meters.dart:161:53)
#14 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21)
#15 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
#16 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:607:11)
#17 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5)
#18 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267:7)
#19 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27)
#20 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:443:20)
#21 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#22 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:287:11)
#23 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#24 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#25 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#26 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#30 _invoke1 (dart:ui/hooks.dart:182:10)
#31 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282:7)
#32 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
(elided 3 frames from dart:async)
I am still getting this error. What I want to do is just tor refresh the serial port list with
availablePorts = SerialPort.availablePorts;
from flutter_libserialport.
The example code in this repo doesn't use
serialPort.open
. I tried puttingserialPort.configure
afterfinal port = SerialPort(address);
but still ran into the same issue. What's weird is refreshing the app made it sometimes work, but most of the time threw the same error. I'll keep playing around on my end though.Try this
final port = SerialPort(address); port.open(...); port.configure =...
thanks a lot, it works for me. I try it on MacOS, 11.4
from flutter_libserialport.
SerialPortConfig? config=_serialPort?.config;
config?.baudRate=hdevice.baudRate;//波特率
config?.stopBits = 1;//停止位
config?.bits=8;//数据位
config?.parity=0;//校验位
config?.parity=0;
if(config!=null){
LogUtil.d(" config ${config}", tag: TAG);
_serialPort?.config=config;
}
这个方式可以。不报错
from flutter_libserialport.
@jiangchunyu
谢谢你。您能否分享您的代码,以便我看看我的代码有什么不同?
from flutter_libserialport.
Related Issues (20)
- Support for Gradle 8.3.0: Define namespace HOT 2
- Problème lecture et écriture
- android support HOT 5
- Windwos Incomplete writing HOT 1
- read not working on Windows HOT 4
- Cant open port on MacOS HOT 2
- Cant open port on Windows
- Failed to load dynamic library 'libserialport.so' HOT 3
- Android: Namespace not specified
- SerialPortError: Input/output error, errno = 5
- Multiple instances of serial port reader in call stack
- Android support
- It does not send hex numbers 11 and 13 HOT 1
- IOS problem HOT 1
- How to set the baud rate ? HOT 3
- How to read serial data HOT 2
- No running
- Can't read buffer that was not empty before opening serial port (Windows) HOT 3
- How to configure baudrate and port HOT 2
- Can't run android app HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_libserialport.