add default callback on read (just print bytes). fixed closing write stream after first write
This commit is contained in:
@@ -10,9 +10,10 @@ class McTransport() {
|
||||
private var callback: (bytes: ByteArray) -> Unit = {}
|
||||
|
||||
fun writeToFile(bytes: ByteArray) {
|
||||
println("writewrite uiii!")
|
||||
val bytesT = bytes
|
||||
writeStream.write(js("new Buffer(bytesT)"));
|
||||
writeStream.end();
|
||||
// writeStream.end();
|
||||
}
|
||||
|
||||
fun writeToFile(byte: Byte) {
|
||||
@@ -45,6 +46,7 @@ class McTransport() {
|
||||
}
|
||||
|
||||
fun closeStreams() {
|
||||
writeStream.end()
|
||||
writeStream = null
|
||||
readStream = null
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ class MicroController private constructor() {
|
||||
|
||||
this.transportFilePath = "./testTtyAcm"//todo need init
|
||||
mcTransport.initStreams(transportFilePath)
|
||||
mcTransport.setCallBack { bytes ->
|
||||
println("read: " + bytes.toString())
|
||||
}
|
||||
|
||||
setInterval({ this.car.refreshLocation(deltaTimeLocationRefresh) }, deltaTimeLocationRefresh);
|
||||
setInterval({
|
||||
|
||||
Reference in New Issue
Block a user