本文整理汇总了Java中com.rapplogic.xbee.util.IntArrayOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java IntArrayOutputStream类的具体用法?Java IntArrayOutputStream怎么用?Java IntArrayOutputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntArrayOutputStream类属于com.rapplogic.xbee.util包,在下文中一共展示了IntArrayOutputStream类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFrameData
import com.rapplogic.xbee.util.IntArrayOutputStream; //导入依赖的package包/类
/**
* Gets frame data from tx request (super) and inserts necessary bytes
*/
public int[] getFrameData() {
// get frame id from tx request
IntArrayOutputStream frameData = this.getFrameDataAsIntArrayOutputStream();
// overwrite api id
frameData.getInternalList().set(0, this.getApiId().getValue());
// insert explicit bytes
// source endpoint
frameData.getInternalList().add(12, this.getSourceEndpoint());
// dest endpoint
frameData.getInternalList().add(13, this.getDestinationEndpoint());
// cluster id msb
frameData.getInternalList().add(14, this.getClusterId().getMsb());
// cluster id lsb
frameData.getInternalList().add(15, this.getClusterId().getLsb());
// profile id
frameData.getInternalList().add(16, this.getProfileId().getMsb());
frameData.getInternalList().add(17, this.getProfileId().getLsb());
return frameData.getIntArray();
}
示例2: getFrameData
import com.rapplogic.xbee.util.IntArrayOutputStream; //导入依赖的package包/类
public int[] getFrameData() {
// 3/6/10 fixed bug -- broadcast address is used with broadcast option, not no ACK
IntArrayOutputStream out = new IntArrayOutputStream();
// api id
out.write(this.getApiId().getValue());
// frame id (arbitrary byte that will be sent back with ack)
out.write(this.getFrameId());
// destination address (broadcast is 0xFFFF)
out.write(remoteAddr16.getAddress());
// options byte disable ack = 1, send pan id = 4
out.write(this.getOption().getValue());
out.write(this.getPayload());
return out.getIntArray();
}
示例3: getFrameData
import com.rapplogic.xbee.util.IntArrayOutputStream; //导入依赖的package包/类
public int[] getFrameData() {
// 3/6/10 fixed bug -- broadcast address is used with broadcast option, not no ACK
IntArrayOutputStream out = new IntArrayOutputStream();
// api id
out.write(this.getApiId().getValue());
// frame id (arbitrary byte that will be sent back with ack)
out.write(this.getFrameId());
// destination high (broadcast is 0xFFFF)
// add 64-bit dest address
out.write(remoteAddr64.getAddress());
// options byte disable ack = 1, send pan id = 4
out.write(this.getOption().getValue());
out.write(this.getPayload());
return out.getIntArray();
}
示例4: getFrameData
import com.rapplogic.xbee.util.IntArrayOutputStream; //导入依赖的package包/类
public int[] getFrameData() {
if (command.length() > 2) {
throw new IllegalArgumentException("Command should be two characters. Do not include AT prefix");
}
IntArrayOutputStream out = new IntArrayOutputStream();
// api id
out.write(this.getApiId().getValue());
// frame id
out.write(this.getFrameId());
// at command byte 1
out.write((int) command.substring(0, 1).toCharArray()[0]);
// at command byte 2
out.write((int) command.substring(1, 2).toCharArray()[0]);
// int value is up to four bytes to represent command value
if (value != null) {
out.write(value);
}
return out.getIntArray();
}
示例5: getFrameData
import com.rapplogic.xbee.util.IntArrayOutputStream; //导入依赖的package包/类
public int[] getFrameData() {
IntArrayOutputStream out = new IntArrayOutputStream();
// api id
out.write(this.getApiId().getValue());
// frame id (arbitrary byte that will be sent back with ack)
out.write(this.getFrameId());
out.write(remoteAddr64.getAddress());
// 16-bit address
out.write(remoteAddr16.getAddress());
// TODO S2B remote command options
// TODO 0x40 is a bit field, ugh
// 0x01 - Disable retries and route repair
// 0x02 - Apply changes.
// 0x20 - Enable APS encryption (if EE=1)
// 0x40 - Use the extended transmission timeout
if (applyChanges) {
out.write(2);
} else {
// queue changes -- don't forget to send AC command
out.write(0);
}
// command name ascii [1]
out.write((int) this.getCommand().substring(0, 1).toCharArray()[0]);
// command name ascii [2]
out.write((int) this.getCommand().substring(1, 2).toCharArray()[0]);
if (this.getValue() != null) {
out.write(this.getValue());
}
return out.getIntArray();
}
示例6: getFrameDataAsIntArrayOutputStream
import com.rapplogic.xbee.util.IntArrayOutputStream; //导入依赖的package包/类
protected IntArrayOutputStream getFrameDataAsIntArrayOutputStream() {
if (this.getMaxPayloadSize() > 0 && payload.length > this.getMaxPayloadSize()) {
throw new IllegalArgumentException("Payload exceeds user-defined maximum payload size of " + this.getMaxPayloadSize() + " bytes. Please package into multiple packets");
}
IntArrayOutputStream out = new IntArrayOutputStream();
// api id
out.write(this.getApiId().getValue());
// frame id (arbitrary byte that will be sent back with ack)
out.write(this.getFrameId());
// add 64-bit dest address
out.write(destAddr64.getAddress());
// add 16-bit dest address
out.write(destAddr16.getAddress());
// write broadcast radius
out.write(broadcastRadius);
// write options byte
out.write(option.getValue());
out.write(payload);
return out;
}