當前位置: 首頁>>代碼示例>>Java>>正文


Java Source類代碼示例

本文整理匯總了Java中org.fosstrak.reader.rp.proxy.Source的典型用法代碼示例。如果您正苦於以下問題:Java Source類的具體用法?Java Source怎麽用?Java Source使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Source類屬於org.fosstrak.reader.rp.proxy包,在下文中一共展示了Source類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: poll

import org.fosstrak.reader.rp.proxy.Source; //導入依賴的package包/類
/**
 * polls the rp-proxy for all tags available.
 * @throws RPProxyException when the polling failed
 */
public void poll() throws RPProxyException {
	
	//LOG.debug("Polling the rp-proxy");
	
	// get all the sources from the device
	Source[] sources = readerDevice.getAllSources();
	if (sources != null) {
		for (Source source : sources) {
			// remove all data-selectors on the source 
			// this is important !!!!!!!!!!!!! 
			// otherwise you will not get any tags
			source.removeAllTagSelectors();
			
			// read all ids on the source
			// just for safety pass an empty dataSelector
			ReadReport readReport = source.rawReadIDs(null);

			
			if (readReport != null) {
				// get the readReport holding the sourceReports
				ReadReportType report = readReport.getReport();
				// get the sourceReports
				List<SourceReport> sourceReports = report.getSourceReport();
				
				List<Tag> tagsToNotify = new LinkedList<Tag>();
				// for each sourceReport process the tags
				for (SourceReport sourceReport : sourceReports) {
					List<TagType> tags = sourceReport.getTag();
					if (tags != null) {
						// for each tag create a new reader api tag
						for (TagType tag : tags) {
							List<TagEventType> tagEvents = tag.getTagEvent();
							if (tagEvents != null) {
								for (TagEventType tagEvent : tagEvents) {
									String eventType = tagEvent.getEventType();
									//LOG.debug("Tag '" + tag.getTagIDAsPureURI() + "' fired Event of type '" + eventType + "'");
									if (EventType.EV_OBSERVED.equals(eventType)) {
										// somehow rp delivers binary instead 
										// pure uri
										String binary = tag.getTagIDAsPureURI();
										Tag nt = new Tag(
												adaptor.getName(), 
												tag.getTagID(), 
												TagHelper.convert_to_PURE_IDENTITY(
														"64",
														"1",
														"7",
														binary), 
												System.currentTimeMillis());

										nt.setTagAsBinary(binary);
										tagsToNotify.add(nt);
									}
								}
							}
						}
					}
				}
				
				if (tagsToNotify.size() > 0) {
					adaptor.addTags(tagsToNotify);
				}
				
			} else {
				LOG.debug("readReport null");
			}
		}
	} else {
		LOG.debug("sources null");
	}
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:76,代碼來源:InputGenerator.java


注:本文中的org.fosstrak.reader.rp.proxy.Source類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。