How to Writelock impinj monza6 rfid tags with mercury API

The mercury api has a problem write locking impinj's monza6 rfid tags.

Here is a datasheet on the monza6 tag. You'll notice that the tag has a manufacture header of: 100000000001 in bits 0x08->0x14, and that to permalock lock the chip you need to send a payload of 0xFFFF. Also you can only permalock all memory banks.

Identifying if you have a monza6 tag

Here is a java code snippet which determines if a given tag has a monza6 chip.

this.reader = ... // create a reader instance

public boolean isMonza6Tag(int[] antennas, String targetEPC) throws Exception {  
    try {
      Gen2.TagData filter =
         new Gen2.TagData(targetEPC);

      // Read the TID from the specified tag
      TagOp op = new Gen2.ReadData(Gen2.Bank.TID, 0, (byte) 0);
      SimpleReadPlan plan = 
          new SimpleReadPlan(antennas, TagProtocol.GEN2, filter, op, 1000);

      // Set our read configuration to a read fast 
      // type of plan, with low tag hold time
      this.reader.paramSet("/reader/read/plan", plan);
      this.reader.paramSet("/reader/gen2/session", Gen2.Session.S0);
      this.reader.paramSet("/reader/gen2/target", Gen2.Target.AB);

      TagReadData[] tagReads =;

       * Monza6 tags have a manufacture header of: 
       * 100000000001  in bits 0x08->0x14
       * see:
       * us/article_attachments/201072527/
       * MonzaR6_TagChip_Datasheet_20141209_R3.pdf
      boolean isMonza6Tag = true;
      for (TagReadData tr : tagReads) {
        String tid = "";
        for (byte b : tr.getData()) {
          tid += String.format("%02x", b);
        tid = new BigInteger(tid, 16).toString(2);
        isMonza6Tag &&= tid.substring(0x08, 0x14).equals("100000000001");
      return isMonza6Tag && tagReads.length >= 1;
    } catch (ReaderException e) {
      throw new Exception(e);
Permalocking the monza6 tag
  public void permalockTag(Gen2.TagData filter) throws Exception {
    // Must perform op in S0, AB
    this.reader.paramSet("/reader/gen2/session", Gen2.Session.S0);
    this.reader.paramSet("/reader/gen2/target", Gen2.Target.AB);

    Gen2.LockAction lockaction;
    lockaction = new Gen2.LockAction(0xFFFF, 0xFFFF);

    try {
      this.reader.executeTagOp(new Gen2.Lock(0, lockaction), filter);
    } catch(Exception e) {
      throw new Exception(e);