public void SendRdm(RdmPacket packet, RdmEndPoint targetAddress, UId targetId, UId sourceId) { //Queue this packet for sending. RegisterTransaction(packet, targetAddress, targetId); // socket.SendRdm(packet, targetAddress, targetId, sourceId); }
public Transaction(int transactionId, RdmPacket packet, RdmEndPoint address, UId id) { Id = transactionId; TransactionNumber = (byte)(transactionId % 255); Packet = packet; TargetAddress = address; TargetId = id; Attempts = 0; LastAttempt = DateTime.MinValue; }
private void RegisterTransaction(RdmPacket packet, RdmEndPoint address, UId id) { lock (transactionQueue) { if (packet.Header.Command == RdmCommands.Get || packet.Header.Command == RdmCommands.Set) { int transactionId = AllocateTransactionNumber(); Transaction transaction = new Transaction(transactionId, packet, address, id); transactionQueue.Add(transactionId, transaction); packet.Header.TransactionNumber = transaction.TransactionNumber; if (transactionQueue.Count == 1 && retryTimer != null) { retryTimer.Change(TransmitInterval, TimeSpan.Zero); } TransactionsStarted++; } } }