本文整理汇总了Java中com.rapplogic.xbee.api.XBee.sendAtCommand方法的典型用法代码示例。如果您正苦于以下问题:Java XBee.sendAtCommand方法的具体用法?Java XBee.sendAtCommand怎么用?Java XBee.sendAtCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rapplogic.xbee.api.XBee
的用法示例。
在下文中一共展示了XBee.sendAtCommand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureEndDevice
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
private void configureEndDevice(XBee xbee) throws XBeeException {
// basic end device configuration (assumes ZNet radio flashed with end device API firmware)
XBeeResponse response = null;
// reset to factory settings
response = xbee.sendAtCommand(new AtCommand("RE"));
log.debug("RE is " + response);
// set PAN id to arbitrary value
response = xbee.sendAtCommand(new AtCommand("ID", new int[] {0x1a, 0xaa}));
log.debug("ID is " + response);
// set NI -- can be any arbitrary sequence of chars
response = xbee.sendAtCommand(new AtCommand("NI", new int[] {'E','N','D','_','D','E','V','I','C','E','_','2' }));
log.debug("NI is " + response);
// set API mode to 2. factory setting is 1
response = xbee.sendAtCommand(new AtCommand("AP", 2));
log.debug("AP is " + response);
// save to settings to survive power cycle
response = xbee.sendAtCommand(new AtCommand("WR"));
log.debug("WR is " + response);
// software reset
response = xbee.sendAtCommand(new AtCommand("FR"));
log.debug("FR is " + response);
}
示例2: configureCoordinator
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
private void configureCoordinator(XBee xbee) throws XBeeException {
// basic coordinator configuration (assumes ZNet radio flashed with COORDINATOR API firmware)
XBeeResponse response = null;
// reset to factory settings
response = xbee.sendAtCommand(new AtCommand("RE"));
log.debug("RE is " + response);
// set PAN id to arbitrary value
response = xbee.sendAtCommand(new AtCommand("ID", new int[] {0x1a, 0xaa}));
log.debug("RE is " + response);
// set NI
response = xbee.sendAtCommand(new AtCommand("NI", new int[] {'C','O','O','R','D','I','N','A','T','O','R' }));
log.debug("NI is " + response);
// set API mode to 2. factory setting is 1
response = xbee.sendAtCommand(new AtCommand("AP", 2));
log.debug("AP is " + response);
// save to settings to survive power cycle
response = xbee.sendAtCommand(new AtCommand("WR"));
log.debug("WR is " + response);
// software reset
response = xbee.sendAtCommand(new AtCommand("FR"));
log.debug("FR is " + response);
}
示例3: configureIOSamples
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
/**
* This assumes an end device that is already has the configureEndDevice configuration
* Does not save configuration! -- use WR if you want this configure to survive power on/off.
*
* @param xbee
* @throws XBeeException
*/
private void configureIOSamples(XBee xbee) throws XBeeException {
// basic coordinator configuration (assumes ZNet radio flashed with COORDINATOR API firmware)
XBeeResponse response = null;
// set IR to 1 sample every 10 seconds. Set to 0 to disable
response = xbee.sendAtCommand(new AtCommand("IR", new int[] {0x27, 0x10}));
log.debug("IR is " + response);
// set pin 20 to monitor digital input
response = xbee.sendAtCommand(new AtCommand("DO", 0x3));
log.debug("DO is " + response);
// set pin 19 to monitor analog input
response = xbee.sendAtCommand(new AtCommand("D1", 0x2));
log.debug("D1 is " + response);
// set pin 18 to monitor analog input
response = xbee.sendAtCommand(new AtCommand("D2", 0x2));
log.debug("D2 is " + response);
// set pin 16 to monitor digital input
response = xbee.sendAtCommand(new AtCommand("D6", 0x3));
log.debug("D6 is " + response);
// optionally configure DH + DL; if set to zero (default), samples will be sent to coordinator
}
示例4: associationStatus
import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
private void associationStatus(XBee xbee) throws XBeeException {
// get association status - success indicates it is associated to another XBee
AtCommandResponse response = (AtCommandResponse) xbee.sendAtCommand(new AtCommand("AI"));
log.debug("Association Status is " + AssociationStatus.get(response));
}