Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML File decoding to LlrpMessage #4

Closed
clementfumey opened this issue Mar 22, 2016 · 5 comments
Closed

XML File decoding to LlrpMessage #4

clementfumey opened this issue Mar 22, 2016 · 5 comments

Comments

@clementfumey
Copy link

When I try to open and decode an XML file containing an LLRP Message I always get an java.lang.NumberFormatException exception from the ctx.xmlDecoder().decodeMessage();

For example here is the beginning of the SET_READER_CONFIG message :

<?xml version="1.0" encoding="UTF-8"?>
<SET_READER_CONFIG xmlns="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0" Version="1" MessageID="3">
  <ResetToFactoryDefault>0</ResetToFactoryDefault>
  <ReaderEventNotificationSpec>
    <EventNotificationState>
      <EventType>Upon_Hopping_To_Next_Channel</EventType>

And I got java.lang.NumberFormatException: For input string: "Upon_Hopping_To_Next_Channel"

But when I replace Upon_Hopping_To_Next_Channel by its value 1, it seems to work.

Maybe related to #1

@kenwenzel
Copy link
Member

Was this XML file produced with the LLRP toolkit for Java?
I was not aware that enumeration values are represented by their name and not by their ordinal number.
Can you check if the former is correct?
Are you also able to provide a fix?

@kenwenzel
Copy link
Member

Another question: Can you provide us some of your XML messages for testing purposes?

@clementfumey
Copy link
Author

It was not produced with LLRP toolkit for Java but they were working smoothly with it. Files are from IMPINJ documentation to use their readers with LLRP toolkit.

Here are some files I am using:

<?xml version="1.0" encoding="UTF-8"?>
<SET_READER_CONFIG xmlns="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0" Version="1" MessageID="3">
  <ResetToFactoryDefault>0</ResetToFactoryDefault>
  <ReaderEventNotificationSpec>
    <EventNotificationState>
      <EventType>Upon_Hopping_To_Next_Channel</EventType>
      <NotificationState>0</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>GPI_Event</EventType>
      <NotificationState>0</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>ROSpec_Event</EventType>
      <NotificationState>1</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>Report_Buffer_Fill_Warning</EventType>
      <NotificationState>0</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>Reader_Exception_Event</EventType>
      <NotificationState>0</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>RFSurvey_Event</EventType>
      <NotificationState>0</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>AISpec_Event</EventType>
      <NotificationState>1</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>AISpec_Event_With_Details</EventType>
      <NotificationState>0</NotificationState>
    </EventNotificationState>
    <EventNotificationState>
      <EventType>Antenna_Event</EventType>
      <NotificationState>0</NotificationState>
    </EventNotificationState>
  </ReaderEventNotificationSpec>
  <ROReportSpec>
    <ROReportTrigger>Upon_N_Tags_Or_End_Of_ROSpec</ROReportTrigger>
    <N>1</N>
    <TagReportContentSelector>
      <EnableROSpecID>1</EnableROSpecID>
      <EnableSpecIndex>1</EnableSpecIndex>
      <EnableInventoryParameterSpecID>1</EnableInventoryParameterSpecID>
      <EnableAntennaID>1</EnableAntennaID>
      <EnableChannelIndex>1</EnableChannelIndex>
      <EnablePeakRSSI>1</EnablePeakRSSI>
      <EnableFirstSeenTimestamp>1</EnableFirstSeenTimestamp>
      <EnableLastSeenTimestamp>1</EnableLastSeenTimestamp>
      <EnableTagSeenCount>1</EnableTagSeenCount>
      <EnableAccessSpecID>1</EnableAccessSpecID>
    </TagReportContentSelector>
  </ROReportSpec>
  <AccessReportSpec>
    <AccessReportTrigger>End_Of_AccessSpec</AccessReportTrigger>
  </AccessReportSpec>
  <KeepaliveSpec>
    <KeepaliveTriggerType>Periodic</KeepaliveTriggerType>
    <PeriodicTriggerValue>5000</PeriodicTriggerValue>
  </KeepaliveSpec>
  <EventsAndReports>
    <HoldEventsAndReportsUponReconnect>0</HoldEventsAndReportsUponReconnect>
  </EventsAndReports>
</SET_READER_CONFIG>
<?xml version="1.0" encoding="UTF-8"?>
<llrp:ADD_ROSPEC xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0" xmlns:Impinj="http://developer.impinj.com/ltk/schema/encoding/xml/1.0" Version="1" MessageID="4">
  <llrp:ROSpec>
    <llrp:ROSpecID>1</llrp:ROSpecID>
    <llrp:Priority>0</llrp:Priority>
    <llrp:CurrentState>Disabled</llrp:CurrentState>
    <llrp:ROBoundarySpec>
      <llrp:ROSpecStartTrigger>
        <llrp:ROSpecStartTriggerType>Null</llrp:ROSpecStartTriggerType>
      </llrp:ROSpecStartTrigger>
      <llrp:ROSpecStopTrigger>
        <llrp:ROSpecStopTriggerType>Null</llrp:ROSpecStopTriggerType>
        <llrp:DurationTriggerValue>0</llrp:DurationTriggerValue>
      </llrp:ROSpecStopTrigger>
    </llrp:ROBoundarySpec>
    <llrp:AISpec>
      <llrp:AntennaIDs>0</llrp:AntennaIDs>
      <llrp:AISpecStopTrigger>
        <llrp:AISpecStopTriggerType>Null</llrp:AISpecStopTriggerType>
        <llrp:DurationTrigger>0</llrp:DurationTrigger>
      </llrp:AISpecStopTrigger>
      <llrp:InventoryParameterSpec>
        <llrp:InventoryParameterSpecID>9</llrp:InventoryParameterSpecID>
        <llrp:ProtocolID>EPCGlobalClass1Gen2</llrp:ProtocolID>
      </llrp:InventoryParameterSpec>
    </llrp:AISpec>
  </llrp:ROSpec>
</llrp:ADD_ROSPEC>

@kenwenzel
Copy link
Member

Thank you!
Do you provide a PR or should I fix this issue?

@clementfumey
Copy link
Author

I am not able to provide a fix right now. Would be great if you can fix it.

enilink-git pushed a commit that referenced this issue Mar 24, 2016
This change fixes issue #4.

Change-Id: I020637c66359c8ae609188619257f20f4ef9ac21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants