本文整理汇总了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();
}
}
}
示例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();
}
}
示例3: createPayload
import com.rapplogic.xbee.util.ByteUtils; //导入方法依赖的package包/类
private int[] createPayload(String requestString) {
return ByteUtils.stringToIntArray(requestString);
}