本文整理汇总了Java中org.fosstrak.reader.rprm.core.msg.reply.ReadReportType类的典型用法代码示例。如果您正苦于以下问题:Java ReadReportType类的具体用法?Java ReadReportType怎么用?Java ReadReportType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReadReportType类属于org.fosstrak.reader.rprm.core.msg.reply包,在下文中一共展示了ReadReportType类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: poll
import org.fosstrak.reader.rprm.core.msg.reply.ReadReportType; //导入依赖的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");
}
}