0
RXTX 라이브러리가있는 java에서 COM 포트를 읽으려고합니다. AT 명령에서 char의 흐름을 인식하고 싶습니다.자바가 RXTX 라이브러리로 AT 명령을 인식합니다.
내 읽기 기능은 버퍼를 순환시키고 String var에 모두 저장합니다.
InputStream in; //var sent to function
byte[] buffer = new byte[1024];
int len = -1;
try{
while ((len = in.read(buffer)>-1){
String s = new String(buffer,0,len);
// I've think to save all string into a global var and ciclically
// read after delay che global string and analyze it for bring the
// AT commands
Global.__GLstring += s;
System.out.print(s);
/* Example sout:
AT
OK
BLABLABLA
ERROR
*/
}
} catch (IOException e){
syserr("Exception"+e);
}
백그라운드에서 타이머를 만들려면 어떻게해야합니까? 이미 만들어진 더 나은 솔루션이나 기능이 있습니까?
나 자신을 설명 할 수 있기를 바랍니다. 모두에게 감사드립니다!