本文整理汇总了Java中com.rapplogic.xbee.api.XBee.initProviderConnection方法的典型用法代码示例。如果您正苦于以下问题:Java XBee.initProviderConnection方法的具体用法?Java XBee.initProviderConnection怎么用?Java XBee.initProviderConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rapplogic.xbee.api.XBee
的用法示例。
在下文中一共展示了XBee.initProviderConnection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testJSSCStartup
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
public void testJSSCStartup() throws Exception {
// create the JSSCSerialComm object, this is the replacement object for the default RxTx one used internally.
JSSCSerialComm serial = new JSSCSerialComm();
// connect to COM7 at 115200 baud. 8 bits, 1 stop bit, 0 parity is assumed
serial.openSerialPort("COM7", 115200);
// xbee object that we will connect up too
XBee xbee = new XBee();
// replaces xbee.open() which uses the RxTx model
xbee.initProviderConnection(serial);
// test we are connected (This is a jUnit test after all)
assertTrue(xbee.isConnected());
// close the xBee
xbee.close();
}
示例2: ZBIOSampleReceiveExample
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
public ZBIOSampleReceiveExample() throws SerialPortException, XBeeException, InterruptedException {
LOG.info(String.format("Will use port %s", portName));
try {
xbee = new XBee();
xbee.initProviderConnection(new JSSCXBeeConnection(portName));
LOG.info("Connection to XBee initialised successfully");
receive(10);
} finally {
// Ensure xbee is always closed otherwise port will be in use the next time we try to use it
LOG.info("Closing XBee connection");
xbee.close();
}
}
示例3: ConnectionInitialisationExample
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
public ConnectionInitialisationExample() throws SerialPortException, XBeeException {
LOG.info(String.format("Will use port %s", portName));
try {
xbee = new XBee();
xbee.initProviderConnection(new JSSCXBeeConnection(portName));
LOG.info("Connection to XBee initialised successfully");
} finally {
// Ensure xbee is always closed otherwise port will be in use the next time we try to use it
LOG.info("Closing XBee connection");
xbee.close();
}
}
示例4: testJSSCGetAddress
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
public void testJSSCGetAddress() throws Exception {
JSSCSerialComm serial = new JSSCSerialComm();
serial.openSerialPort("COM7", 115200);
XBee xbee = new XBee();
xbee.initProviderConnection(serial);
assertTrue(xbee.isConnected());
// xbee.sendRequest();
xbee.close();
}