-------------段长
消息头 @ 1
消息长 5 1
会话ID 0x0101 2开 0x01 1
关 0x02
private byte at = 0x40;
private byte len=5;
private byte tel=(byte)0x0101;
private byte homeCmd=0;然后放到byteBuffer数组里,再放到STRING里,再转成toCharArray这么写对吗???应该怎么写?
消息头 @ 1
消息长 5 1
会话ID 0x0101 2开 0x01 1
关 0x02
private byte at = 0x40;
private byte len=5;
private byte tel=(byte)0x0101;
private byte homeCmd=0;然后放到byteBuffer数组里,再放到STRING里,再转成toCharArray这么写对吗???应该怎么写?
多谢火龙果,那我是不是应该这样改:
private byte at = 0x40;
private byte len=5;
private byte []tel={0x01,0x01};
private byte []homeCmd={0,0};
public void convertFromWebCommand(WebCommand webCommand) {
this.homeCmd[0] = webCommand.getNode();
this.homeCmd[1] = webCommand.getCmd();
}
public byte[] getBuffer(){
byte []buf=new byte[6];
buf[0]=at;
buf[1]=len;
buf[2]=tel[0];
buf[3]=tel[1];
buf[4]=homeCmd[1];
buf[5]=0;
return buf;
}
private byte[] tel= { 0x03, 0x02 };是不?