예제 #1
0
 /// <summary>
 /// 以纯数组构造APDU
 /// </summary>
 /// <param name="buffer"></param>
 public APDUClass(byte[] buffer)
 {
     this.SetApci(APCIClass.GetApci(buffer));
     if (buffer.Length > 6)
     {
         byte[] data = new byte[buffer.Length - 6];
         if (data.Length < buffer.Length - 6)
         {
             throw new Exception("初始化数据长度出错");
         }
         try
         {
             Array.Copy(buffer, 6, data, 0, data.Length);
             ASDUClass temp = new ASDUClass();
             _res = temp.UnPack(buffer, 6, buffer.Length - 6);
             this.SetAsdu(temp);
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex);
         }
     }
 }
예제 #2
0
 /// <summary>
 /// 以APCI+数据构造APDU
 /// </summary>
 /// <param name="apci"></param>
 /// <param name="data"></param>
 public APDUClass(APCIClass apci, ASDUClass asdu)
 {
     this.SetApci(apci);
     this.SetAsdu(asdu);
 }
예제 #3
0
 /// <summary>
 /// 设置Apci部分数据
 /// </summary>
 /// <param name="control"></param>
 /// <returns></returns>
 public bool SetApci(APCIClass control)
 {
     this.apci = control;
     return(true);
 }