增加天线切换

merge-requests/5/merge
yiming 4 years ago
parent 4a3dfd7009
commit 552cc4f1aa

@ -179,38 +179,27 @@ public class RFIDSocket {
if(!running){
break;
}
byte []antChanges = new byte[6];
antChanges[0] = (byte)0xa0;
antChanges[1] = (byte)0x04;
antChanges[2] = (byte)0x22;
antChanges[3] = (byte)0x74;
if(i % 2 == 0){
//切换天线 使用天线0
byte[]bytes = new byte[6];
bytes[0] = (byte)0xa0;
bytes[1] = (byte)0x04;
bytes[2] = (byte)0x22;
bytes[3] = (byte)0x74;
bytes[4] = (byte)0x00;
bytes[5] = (byte)0xc6;
try {
os.write(bytes);
Thread.sleep(70);
} catch (InterruptedException | IOException e) {
log.error("send cmd error:{}",e);
}
antChanges[4] = (byte)0x00;
antChanges[5] = (byte)0xc6;
}else {
//切换天线 使用天线1
byte[]bytes = new byte[6];
bytes[0] = (byte)0xa0;
bytes[1] = (byte)0x04;
bytes[2] = (byte)0x22;
bytes[3] = (byte)0x74;
bytes[4] = (byte)0x01;
bytes[5] = (byte)0xc5;
try {
os.write(bytes);
Thread.sleep(70);
} catch (InterruptedException | IOException e) {
log.error("send cmd error:{}",e);
}
antChanges[4] = (byte)0x01;
antChanges[5] = (byte)0xc5;
}
i++;
try {
os.write(antChanges);
Thread.sleep(10);
} catch (InterruptedException | IOException e) {
log.error("send cmd error:{}",e);
}
byte[]bytes = new byte[5];
bytes[0] = (byte)0xa0;
bytes[1] = (byte)0x03;

Loading…
Cancel
Save