static void Main(string[] args) { byte[] data = new byte[] {}; LockController lc = new LockController(); bool reply; byte[] epc1 = new byte[] { 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00 }; byte[] epc2 = new byte[] { 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB }; byte[] passwd_write = new byte[] { 0x56, 0x78, 0x12, 0x34 }; byte[] passwd_send = new byte[] { 0x12, 0x34, 0x56, 0x78 }; byte[] passwd_clear = new byte[] { 0x00, 0x00, 0x00, 0x00 }; //(from the gen2 spec) byte[] lock_epc = new byte[] { 0x00, 0x00, 0xC0, 0x20 }; byte[] lock_clear = new byte[] { 0x00, 0x00, 0x00, 0x00 }; //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank reply = lc.WriteEPC(epc1); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } //write password reply = lc.WritePassword(passwd_write); if (reply == true) { Console.Out.WriteLine("Write Password: PASS"); } else { Console.Out.WriteLine("Write Password: FAIL"); } //send password reply = lc.SendTagPassword(passwd_send); if (reply == true) { Console.Out.WriteLine("Send Password: PASS"); } else { Console.Out.WriteLine("Send Password: FAIL"); } //lock epc reply = lc.WriteLock(lock_epc); if (reply == true) { Console.Out.WriteLine("Lock EPC: PASS"); } else { Console.Out.WriteLine("Lock EPC: FAIL"); } //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank (should fail) reply = lc.WriteEPC(epc2); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //send password reply = lc.SendTagPassword(passwd_send); if (reply == true) { Console.Out.WriteLine("Send Password: PASS"); } else { Console.Out.WriteLine("Send Password: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank reply = lc.WriteEPC(epc2); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } //clear epc reply = lc.WriteLock(lock_clear); if (reply == true) { Console.Out.WriteLine("Clear EPC Lock: PASS"); } else { Console.Out.WriteLine("Clear EPC Lock: FAIL"); } //write password reply = lc.WritePassword(passwd_clear); if (reply == true) { Console.Out.WriteLine("Write Clear Password: PASS"); } else { Console.Out.WriteLine("Write Clear Password: FAIL"); } //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank reply = lc.WriteEPC(epc2); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } Console.In.ReadLine(); }
static void Main(string[] args) { byte[] data = new byte[]{}; LockController lc = new LockController(); bool reply; byte[] epc1 = new byte[] { 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00 }; byte[] epc2 = new byte[] { 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0xBB }; byte[] passwd_write = new byte[] { 0x56, 0x78, 0x12, 0x34 }; byte[] passwd_send = new byte[] { 0x12, 0x34, 0x56, 0x78 }; byte[] passwd_clear = new byte[] { 0x00, 0x00, 0x00, 0x00 }; //(from the gen2 spec) byte[] lock_epc = new byte[] { 0x00, 0x00, 0xC0, 0x20 }; byte[] lock_clear = new byte[] { 0x00, 0x00, 0x00, 0x00 }; //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank reply = lc.WriteEPC(epc1); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } //write password reply = lc.WritePassword(passwd_write); if (reply == true) { Console.Out.WriteLine("Write Password: PASS"); } else { Console.Out.WriteLine("Write Password: FAIL"); } //send password reply = lc.SendTagPassword(passwd_send); if (reply == true) { Console.Out.WriteLine("Send Password: PASS"); } else { Console.Out.WriteLine("Send Password: FAIL"); } //lock epc reply = lc.WriteLock(lock_epc); if (reply == true) { Console.Out.WriteLine("Lock EPC: PASS"); } else { Console.Out.WriteLine("Lock EPC: FAIL"); } //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank (should fail) reply = lc.WriteEPC(epc2); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //send password reply = lc.SendTagPassword(passwd_send); if (reply == true) { Console.Out.WriteLine("Send Password: PASS"); } else { Console.Out.WriteLine("Send Password: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank reply = lc.WriteEPC(epc2); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } //clear epc reply = lc.WriteLock(lock_clear); if (reply == true) { Console.Out.WriteLine("Clear EPC Lock: PASS"); } else { Console.Out.WriteLine("Clear EPC Lock: FAIL"); } //write password reply = lc.WritePassword(passwd_clear); if (reply == true) { Console.Out.WriteLine("Write Clear Password: PASS"); } else { Console.Out.WriteLine("Write Clear Password: FAIL"); } //select tag reply = lc.Select(); if (reply == true) { Console.Out.WriteLine("Select: PASS"); } else { Console.Out.WriteLine("Select: FAIL"); } //read EPC memory bank data = lc.ReadEPC(); if (data.Length > 0) { Console.Out.WriteLine("Read EPC: PASS"); } else { Console.Out.WriteLine("Read EPC: FAIL"); } //write EPC memory bank reply = lc.WriteEPC(epc2); if (reply == true) { Console.Out.WriteLine("Write EPC: PASS"); } else { Console.Out.WriteLine("Write EPC: FAIL"); } Console.In.ReadLine(); }