当前位置: 首页>>代码示例>>Java>>正文


Java ByteUtils.stringToIntArray方法代码示例

本文整理汇总了Java中com.rapplogic.xbee.util.ByteUtils.stringToIntArray方法的典型用法代码示例。如果您正苦于以下问题:Java ByteUtils.stringToIntArray方法的具体用法?Java ByteUtils.stringToIntArray怎么用?Java ByteUtils.stringToIntArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rapplogic.xbee.util.ByteUtils的用法示例。


在下文中一共展示了ByteUtils.stringToIntArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BroadcastSenderExample

import com.rapplogic.xbee.util.ByteUtils; //导入方法依赖的package包/类
private BroadcastSenderExample() throws XBeeException {
	
	XBee xbee = new XBee();
	
	try {
		// replace with your com port and baud rate. this is the com port of my coordinator		
		xbee.open("/dev/ttyUSB0", 9600);
		
		while (true) {
			// put some arbitrary data in the payload
			int[] payload = ByteUtils.stringToIntArray("the\nquick\nbrown\nfox");
			
			ZNetTxRequest request = new ZNetTxRequest(XBeeAddress64.BROADCAST, payload);
			// make it a broadcast packet
			request.setOption(ZNetTxRequest.Option.BROADCAST);

			log.info("request packet bytes (base 16) " + ByteUtils.toBase16(request.getXBeePacket().getPacket()));
			
			xbee.sendAsynchronous(request);
			// we just assume it was sent.  that's just the way it is with broadcast.  
			// no transmit status response is sent, so don't bother calling getResponse()
				
			try {
				// wait a bit then send another packet
				Thread.sleep(15000);
			} catch (InterruptedException e) {
			}
		}
	} finally {
		if (xbee != null && xbee.isConnected()) {
			xbee.close();		
		}
	}
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:35,代码来源:BroadcastSenderExample.java

示例2: BroadcastSenderExample

import com.rapplogic.xbee.util.ByteUtils; //导入方法依赖的package包/类
private BroadcastSenderExample() throws XBeeException {
	
	XBee xbee = new XBee();
	
	try {
		// replace with your com port and baud rate. this is the com port of my coordinator		
		xbee.open("/dev/ttyUSB0", 9600);
		
		while (true) {
			// put some arbitrary data in the payload
			int[] payload = ByteUtils.stringToIntArray("the\nquick\nbrown\nfox");
			
			ZNetTxRequest request = new ZNetTxRequest(XBeeAddress64.BROADCAST, payload);
			// make it a broadcast packet
			request.setOption(ZNetTxRequest.Option.BROADCAST);

			log.info("request packet bytes (base 16) " + ByteUtils.toBase16(request.getXBeePacket().getPacket()));
			
			xbee.sendAsynchronous(request);
			// we just assume it was sent.  that's just the way it is with broadcast.  
			// no transmit status response is sent, so don't bother calling getResponse()
				
			try {
				// wait a bit then send another packet
				Thread.sleep(15000);
			} catch (InterruptedException e) {
			}
		}
	} finally {
		xbee.close();
	}
}
 
开发者ID:allanlang,项目名称:xbee-api-jssc,代码行数:33,代码来源:BroadcastSenderExample.java

示例3: createPayload

import com.rapplogic.xbee.util.ByteUtils; //导入方法依赖的package包/类
private int[] createPayload(String requestString) {
	return ByteUtils.stringToIntArray(requestString);
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:4,代码来源:DiyOnXBeeBinding.java


注:本文中的com.rapplogic.xbee.util.ByteUtils.stringToIntArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。