0 Replies Latest reply on Apr 11, 2018 7:18 AM by Jan Korff

    RFD8500 APIV3Lib - TagLocationing.Perform

    Jan Korff

      Hello,

       

      if got some problems with your samplecode devmanual page 5 - 29.

       

      I am using RFD8500 APIV3Lib Androidstudio (lastest). My inventory is working quite fine.

      ReaderCapabilities.isTagLocationingSupported() = true is my indicator that the RFD should support taglocationing.

       

      Some Code

       

      >>>>>> Connection is working fine ... for inventory  <<<<<

       

      Readers readers = new Readers();

      ArrayList<ReaderDevice> availableRFIDReaderList =

        readers.GetAvailableRFIDReaderList();

      ReaderDevice readerDevice = availableRFIDReaderList.get(0);

      myReader = readerDevice.getRFIDReader();

       

      try {

         myReader.connect();

       

        Antennas.AntennaRfConfig antennaRfConfig = myReader.Config.Antennas.getAntennaRfConfig(1);

        antennaRfConfig.setrfModeTableIndex(4);

        antennaRfConfig.setTari(300);

        antennaRfConfig.setTransmitPowerIndex(300);

         myReader.Config.Antennas.setAntennaRfConfig(1,antennaRfConfig);

       

       

      } catch (InvalidUsageException e) {

        e.printStackTrace();

      } catch (OperationFailureException e) {

        e.printStackTrace();

      }

       

      eventHandler = new EventHandler();

      try {

         myReader.Events.addEventsListener(eventHandler);

      } catch (InvalidUsageException e) {

        e.printStackTrace();

      } catch (OperationFailureException e) {

        e.printStackTrace();

      }

       

      myReader.Events.setInventoryStartEvent(true);
      myReader.Events.setInventoryStopEvent(true);
      myReader.Events.setTagReadEvent(true);

      myReader.Events.setReaderDisconnectEvent(true);

      myReader.Events.setAntennaEvent(true);

      myReader.Events.setAccessStartEvent(true);

      myReader.Events.setAccessStopEvent(true);

      myReader.Events.setAttachTagDataWithReadEvent(true);

      myReader.Events.setGPIEvent(true);

       

      TriggerInfo triggerInfo = new TriggerInfo();

      triggerInfo.StartTrigger.setTriggerType(START_TRIGGER_TYPE.START_TRIGGER_TYPE_HANDHELD);

      triggerInfo.StartTrigger.Handheld.setHandheldTriggerEvent(HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_PRESSED);

      triggerInfo.StopTrigger.setTriggerType(STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_HANDHELD_WITH_TIMEOUT);

      triggerInfo.StopTrigger.Handheld.setHandheldTriggerEvent(HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_RELEASED);

      triggerInfo.StopTrigger.Handheld.setHandheldTriggerTimeout(0);

       

      try {

        TagStorageSettings tagStorageSettings = null;

        tagStorageSettings = myReader.Config.getTagStorageSettings();

        tagStorageSettings.setTagFields(TAG_FIELD.ALL_TAG_FIELDS);

       

         myReader.Config.setTagStorageSettings(tagStorageSettings);

         myReader.Config.setDPOState(DYNAMIC_POWER_OPTIMIZATION.DISABLE);

         myReader.Config.setBatchMode( BATCH_MODE.DISABLE );

         myReader.Config.setStartTrigger(triggerInfo.StartTrigger);

         myReader.Config.setStopTrigger(triggerInfo.StopTrigger);

      } catch (InvalidUsageException e) {

        e.printStackTrace();

      } catch (OperationFailureException e) {

        e.printStackTrace();

      }

       

      try {

         myReader.Config.saveConfig();

      } catch (InvalidUsageException e) {

        e.printStackTrace();

      } catch (OperationFailureException e) {

        e.printStackTrace();

      }

       

      try {

         myReader.Actions.Inventory.perform(null, null, null);

      } catch (InvalidUsageException e) {

        e.printStackTrace();

      } catch (OperationFailureException e) {

        e.printStackTrace();

      }

       

      >>>>> I am listing all tags found inside a listview. OnItemClick i do something like this (your sample code) <<<<<

       

      try {

         myReader.Actions.Inventory.stop();

         myReader.Actions.TagLocationing.Perform(Locate, null, null);

      } catch (InvalidUsageException e) {

        e.printStackTrace();

      } catch (OperationFailureException e) {

        e.printStackTrace();

      }

      try {

        Thread.sleep(5000);

      } catch (InterruptedException e) {

         // e.printStackTrace();
      }

      try {

         myReader.Actions.TagLocationing.Stop();

         myReader.Actions.Inventory.perform(null, null, null);

      } catch (InvalidUsageException e) {

        e.printStackTrace();

      } catch (OperationFailureException e) {

        e.printStackTrace();

      }

       

      >>>>> But the event isnt triggered, what i am missing? <<<<

       

      class EventHandler implements RfidEventsListener {

         // Read Event Notification
         public void eventReadNotify(RfidReadEvents e){

        TagData[] myTags = myReader.Actions.getReadTags(100);

         if (myTags != null)

        {

         for (int index = 0; index < myTags.length; index++)

        {

        Log.d("Tag:", myTags[index].getTagID().toString());

       

         if(!Locate.equals("")) {

        Short Reichw = myTags[index].LocationInfo.getRelativeDistance();

        String Reichweite = String.valueOf(Reichw);

        Log.d("TagR:", myTags[index].getTagID().toString() + " " + Reichweite);

         Locate = "";

        }else {

       

         if (myTags[index].isContainsLocationInfo()) {

         int tag = index;

        System.out.println("Tag locationing distance " +

        myTags[tag].LocationInfo.getRelativeDistance());

        }

       

        String TID = myTags[index].getTagID().toString();

        String EPC = "";

       

       

        }

          }

        }

       

      }

       

      BR J. Korff