當前位置: 首頁>>代碼示例>>Java>>正文


Java IntArrayOutputStream類代碼示例

本文整理匯總了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();
}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:28,代碼來源:ZNetExplicitTxRequest.java

示例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();	
}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:18,代碼來源:TxRequest16.java

示例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();	
}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:22,代碼來源:TxRequest64.java

示例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();
}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:24,代碼來源:AtCommand.java

示例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();
	}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:39,代碼來源:RemoteAtRequest.java

示例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;
	}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:31,代碼來源:ZNetTxRequest.java


注:本文中的com.rapplogic.xbee.util.IntArrayOutputStream類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。