• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XBeeTimeoutException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.rapplogic.xbee.api.XBeeTimeoutException的典型用法代码示例。如果您正苦于以下问题:Java XBeeTimeoutException类的具体用法?Java XBeeTimeoutException怎么用?Java XBeeTimeoutException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XBeeTimeoutException类属于com.rapplogic.xbee.api包,在下文中一共展示了XBeeTimeoutException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeData

import com.rapplogic.xbee.api.XBeeTimeoutException; //导入依赖的package包/类
@Override
protected void writeData(int[] data, Map<String,Object> context) throws Exception {
	Series series = (Series) context.get("series");
	XBeeAddress64 address = (XBeeAddress64) context.get("xbeeAddress");

	try {
		// TODO make configurable timeout
		if (series == Series.SERIES1) {
			xbee.sendSynchronous(new TxRequest64(address, data), xbeeTxAckTimeoutMs);
		} else {
			//xbee.sendAsynchronous(new ZNetTxRequest(address, data));
			xbee.sendSynchronous(new ZNetTxRequest(address, data), xbeeTxAckTimeoutMs);
		}
	} catch (XBeeTimeoutException e) {
		// TODO interrupt ack thread
		// the ack will timeout so no need to do anything with this error
		System.out.println("No tx ack from receiving XBee after " + xbeeTxAckTimeoutMs + "ms");
	}
}
 
开发者ID:andrewrapp,项目名称:arduino-remote-uploader,代码行数:20,代码来源:XBeeSketchUploader.java


示例2: SleepTestCoordinator

import com.rapplogic.xbee.api.XBeeTimeoutException; //导入依赖的package包/类
public SleepTestCoordinator(String args[]) throws XBeeTimeoutException, XBeeException, InterruptedException {
	
	PropertyConfigurator.configure("log4j.properties");
	
	XBee xbee = new XBee(new XBeeConfiguration().withStartupChecks(false));
	
	//coord
	xbee.open("/dev/tty.usbserial-A6005uRz", 9600);
	
	// replace with end device's 64-bit address (SH + SL)
	// router (firmware 23A7)
	XBeeAddress64 addr64 = new XBeeAddress64(0, 0x13, 0xa2, 0, 0x40, 0x0a, 0x3e, 0x02);

	if (args.length == 1 && (args[0].equals("on") || args[0].equals("off"))) {
		
		log.info("Turning D0 " + args[0]);
		
		RemoteAtRequest request = new RemoteAtRequest(addr64, "D0", new int[] {args[0].equals("on") ? 5 : 4});
		
		RemoteAtResponse response = (RemoteAtResponse) xbee.sendSynchronous(request, 15000);
		
		if (response.isOk()) {
			log.info("Successfully turned " + args[0] + " pin 20 (D0)");	
		} else {
			log.warn("Failed to turn " + args[0] + " pin 20.  status is " + response.getStatus());
		}
		
		Thread.sleep(2000);
		
		if (xbee != null && xbee.isConnected()) {
			xbee.close();		
		}
	} else {
		System.err.println("arg should be on or off");
	}
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:37,代码来源:SleepTestCoordinator.java


示例3: ZBForceSampleExample

import com.rapplogic.xbee.api.XBeeTimeoutException; //导入依赖的package包/类
private ZBForceSampleExample() throws Exception {
	XBee xbee = new XBee();		

	try {			
		// replace with the com port of your XBee coordinator
		xbee.open("/dev/tty.usbserial-A6005v5M", 9600);
		
		while (true) {
			// All XBees allow you to request an I/O sample on a local XBee (serial connected), however this is not very interesting.
			// With ZNet/ZB Pro radios we can use Remote AT to force an I/O sample on an end device.
			// The following code issues a force sample on a XBee end device and parses the io sample.
			
			// replace with your end device 64-bit address
			XBeeAddress64 addr64 = new XBeeAddress64(0, 0x13, 0xa2, 0, 0x40, 0x0a, 0x3e, 0x02);

			XBeeRequest request = new ZBForceSampleRequest(addr64);
			
			try {
				XBeeResponse response = xbee.sendSynchronous(request, 6000);
				RemoteAtResponse remoteAt = (RemoteAtResponse) response;
				
				if (remoteAt.isOk())  {
					// extract the i/o sample
					ZNetRxIoSampleResponse ioSample = ZNetRxIoSampleResponse.parseIsSample(remoteAt);
					// make sure you configured the remote XBee to D1=2 (analog input) or you will get an error
					log.info("10 bit analog1 sample is " + ioSample.getAnalog1());
				} else {
					log.info("Remote AT request failed: " + response);
				}		
			} catch (XBeeTimeoutException e) {
				log.info("request timed out");	
			}

			// wait a bit
			Thread.sleep(2000);
		}
	} finally {
		xbee.close();
	}
}
 
开发者ID:allanlang,项目名称:xbee-api-jssc,代码行数:41,代码来源:ZBForceSampleExample.java


示例4: AP2

import com.rapplogic.xbee.api.XBeeTimeoutException; //导入依赖的package包/类
private void AP2(XBee target) throws XBeeTimeoutException, XBeeException, IOException {
    
    XBeeResponse rsp = target.sendSynchronous(new AtCommand("AP", 2), XBeeConstants.TIMEOUT_AP_MILLIS);
    
    if (rsp.isError()) {
        throw new IOException("Can't set AP=2, response: " + rsp);
    }
}
 
开发者ID:home-climate-control,项目名称:dz,代码行数:9,代码来源:XBeeDeviceFactory.java


示例5: ZBForceSampleExample

import com.rapplogic.xbee.api.XBeeTimeoutException; //导入依赖的package包/类
private ZBForceSampleExample() throws Exception {
	XBee xbee = new XBee();		

	try {			
		// replace with the com port of your XBee coordinator
		xbee.open("/dev/tty.usbserial-A6005v5M", 9600);
		
		while (true) {
			// All XBees allow you to request an I/O sample on a local XBee (serial connected), however this is not very interesting.
			// With ZNet/ZB Pro radios we can use Remote AT to force an I/O sample on an end device.
			// The following code issues a force sample on a XBee end device and parses the io sample.
			
			// replace with your end device 64-bit address
			XBeeAddress64 addr64 = new XBeeAddress64(0, 0x13, 0xa2, 0, 0x40, 0x0a, 0x3e, 0x02);

			XBeeRequest request = new ZBForceSampleRequest(addr64);
			
			try {
				XBeeResponse response = xbee.sendSynchronous(request, 6000);
				RemoteAtResponse remoteAt = (RemoteAtResponse) response;
				
				if (remoteAt.isOk())  {
					// extract the i/o sample
					ZNetRxIoSampleResponse ioSample = ZNetRxIoSampleResponse.parseIsSample(remoteAt);
					// make sure you configured the remote XBee to D1=2 (analog input) or you will get an error
					log.info("10 bit analog1 sample is " + ioSample.getAnalog1());
				} else {
					log.info("Remote AT request failed: " + response);
				}		
			} catch (XBeeTimeoutException e) {
				log.info("request timed out");	
			}

			// wait a bit
			Thread.sleep(2000);
		}
	} finally {
		if (xbee != null && xbee.isConnected()) {
			xbee.close();		
		}
	}
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:43,代码来源:ZBForceSampleExample.java


示例6: main

import com.rapplogic.xbee.api.XBeeTimeoutException; //导入依赖的package包/类
public static void main(String args[]) throws XBeeTimeoutException, XBeeException, InterruptedException {
	new SleepTestCoordinator(args);
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:4,代码来源:SleepTestCoordinator.java


示例7: SleepTestCoordinator

import com.rapplogic.xbee.api.XBeeTimeoutException; //导入依赖的package包/类
public SleepTestCoordinator(String args[]) throws XBeeTimeoutException, XBeeException, InterruptedException {
	
	PropertyConfigurator.configure("log4j.properties");
	
	XBee xbee = new XBee(new XBeeConfiguration().withStartupChecks(false));
	
	//coord
	xbee.open("/dev/tty.usbserial-A6005uRz", 9600);
	
	// replace with end device's 64-bit address (SH + SL)
	// router (firmware 23A7)
	XBeeAddress64 addr64 = new XBeeAddress64(0, 0x13, 0xa2, 0, 0x40, 0x0a, 0x3e, 0x02);

	if (args.length == 1 && (args[0].equals("on") || args[0].equals("off"))) {
		
		log.info("Turning D0 " + args[0]);
		
		RemoteAtRequest request = new RemoteAtRequest(addr64, "D0", new int[] {args[0].equals("on") ? 5 : 4});
		
		RemoteAtResponse response = (RemoteAtResponse) xbee.sendSynchronous(request, 15000);
		
		if (response.isOk()) {
			log.info("Successfully turned " + args[0] + " pin 20 (D0)");	
		} else {
			log.warn("Failed to turn " + args[0] + " pin 20.  status is " + response.getStatus());
		}
		
		Thread.sleep(2000);
		
		xbee.close();
	} else {
		System.err.println("arg should be on or off");
	}
}
 
开发者ID:allanlang,项目名称:xbee-api-jssc,代码行数:35,代码来源:SleepTestCoordinator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OrderRoot类代码示例发布时间:1970-01-01
下一篇:
Java InprocMessaging类代码示例发布时间:1970-01-01
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap