예제 #1
0
 public Gen2LockArgs(TagFilter target, Gen2.LockAction action)
 {
     Target = target;
     Action = action;
 }
예제 #2
0
 /// <summary>
 /// Apply selected lock actions on the tag
 /// </summary>
 /// <param name="filter"></param>
 private void ApplyLock(TagFilter filter)
 {
     try
     {
         statusLockActions.Clear();
         objReader.ParamSet("/reader/tagop/protocol", TagProtocol.GEN2);
         foreach (string lck in selectedLockActions)
         {
             Gen2.LockAction lockAction = null;
             try
             {                       
                 switch (lck)
                 {
                     case "Gen2.LockAction.ACCESS_LOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.ACCESS_LOCK);
                         break;
                     case "Gen2.LockAction.ACCESS_PERMALOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.ACCESS_PERMALOCK);
                         break;
                     case "Gen2.LockAction.ACCESS_UNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.ACCESS_UNLOCK);
                         break;
                     case "Gen2.LockAction.EPC_LOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.EPC_LOCK);
                         break;
                     case "Gen2.LockAction.EPC_PERMALOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.EPC_PERMALOCK);
                         break;
                     case "Gen2.LockAction.EPC_UNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.EPC_UNLOCK);
                         break;
                     case "Gen2.LockAction.KILL_LOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.KILL_LOCK);
                         break;
                     case "Gen2.LockAction.KILL_PERMALOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.KILL_PERMALOCK);
                         break;
                     case "Gen2.LockAction.KILL_UNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.KILL_UNLOCK);
                         break;
                     case "Gen2.LockAction.TID_LOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.TID_LOCK);
                         break;
                     case "Gen2.LockAction.TID_PERMALOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.TID_PERMALOCK);
                         break;
                     case "Gen2.LockAction.TID_UNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.TID_UNLOCK);
                         break;
                     case "Gen2.LockAction.USER_LOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.USER_LOCK);
                         break;
                     case "Gen2.LockAction.USER_PERMALOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.USER_PERMALOCK);
                         break;
                     case "Gen2.LockAction.USER_UNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.USER_UNLOCK);
                         break;
                     case "Gen2.LockAction.KILL_PERMAUNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.KILL_PERMAUNLOCK);
                         break;
                     case "Gen2.LockAction.TID_PERMAUNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.TID_PERMAUNLOCK);
                         break;
                     case "Gen2.LockAction.USER_PERMAUNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.USER_PERMAUNLOCK);
                         break;
                     case "Gen2.LockAction.ACCESS_PERMAUNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.ACCESS_PERMAUNLOCK);
                         break;
                     case "Gen2.LockAction.EPC_PERMAUNLOCK":
                         lockAction = new Gen2.LockAction(Gen2.LockAction.EPC_PERMAUNLOCK);
                         break;
                 }                        
                 objReader.ExecuteTagOp(new Gen2.Lock(ByteConv.ToU32(ByteFormat.FromHex(txtbxAccesspaasword.Text.Replace(" ","")), 0), lockAction), filter);
                 statusLockActions.Add("Success");
                 txtblkErrorAccessPassword.Text = "";
                 txtblkErrorAccessPassword.Visibility = System.Windows.Visibility.Collapsed;
             }
             catch (Exception ex)
             {
                 statusLockActions.Add("Error: "+ex.Message);                        
             }
         }                
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }