本文整理匯總了Java中org.fosstrak.reader.rp.proxy.Source.removeAllTagSelectors方法的典型用法代碼示例。如果您正苦於以下問題:Java Source.removeAllTagSelectors方法的具體用法?Java Source.removeAllTagSelectors怎麽用?Java Source.removeAllTagSelectors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fosstrak.reader.rp.proxy.Source
的用法示例。
在下文中一共展示了Source.removeAllTagSelectors方法的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");
}
}