Exemplo n.º 1
0
 public Transaction(GattCharacteristic characteristic, TransactionHeader header, byte[] payload, bool isEncrypt = true)
 {
     IsEncrypt      = isEncrypt;
     Characteristic = characteristic;
     Status         = TransactionStatus.TransactionWait;
     Header         = new TransactionHeader(header.MessageType, header.Flags, header.TransactionId, header.PayloadSize);
     if (payload != null)
     {
         Payload = new byte[header.PayloadSize];
         Buffer.BlockCopy(payload, 0, Payload, 0, header.PayloadSize);
     }
     else
     {
         Payload = null;
     }
 }
Exemplo n.º 2
0
 public Transaction(Transaction transaction)
 {
     NoPackets = transaction.NoPackets;
     IsEncrypt = transaction.IsEncrypt;
     Status    = transaction.Status;
     Header    = new TransactionHeader(transaction.Header.MessageType, transaction.Header.Flags, transaction.Header.TransactionId, transaction.Header.PayloadSize);
     if (transaction.Payload != null)
     {
         Payload = new byte[transaction.Header.PayloadSize];
         Buffer.BlockCopy(transaction.Payload, 0, Payload, 0, transaction.Header.PayloadSize);
     }
     else
     {
         Payload = null;
     }
     Characteristic = transaction.Characteristic;
 }