ReadLine class
1 min readApr 15, 2020
Now I’m working on serial port with android. Read and write data by ByteArray. Bad thing is I cannot find serial.readline
function like python :/ So I shoud write it by myself.
Example:
val r = ReadLine()
p(r.feed(byteArrayOf(0x1, 0x2))) // null
p(r.feed(byteArrayOf(0x3, 0x4, 0x5))) // null
p(r.feed(byteArrayOf(0xD))) // null
p(r.feed(byteArrayOf(0xA))) // 1 2 3 4 5 13 10
p(r.feed(byteArrayOf(0xF, 0xD, 0xC))) // null
p(r.feed(byteArrayOf(0xD, 0xA))) // 15 13 12 13 10
p(r.feed(byteArrayOf(0xA))) // null
p(r.feed(byteArrayOf(0x3, 0xD))) // null
p(r.feed(byteArrayOf(0xA))) // 10 3 13 10
In Covid era, take care 👋
and Happy coding 👋👋👋