I am trying to read a message from serialport. I am reading it as bytes of data. I have a byte array which holding all the data bytes i read from serial port. My byte array holds a message string like this after converting into string.
\u0006\u0001\0d\o?\"\0$?##STA\r\nSystemLevel:Run\r\nstatus:1\r\nSensor Value:12.45\r\n................\r\nSTOP##
I look for certain byte pattern (for example start byte)from byte array once it matches converting everything to char string from that point of index to certain index length. since i know the length of the message i want convert. for example byte[25] to byte[185].
I just want to know which is the best way to read result values from the message string?? result values for example byte[28] to byte[32],byte[42] to byte[49]...etc.
Is it better to convert all required bytes to string and parse it?? or is it better to use several byte patterns to get the characters. which is the best method.