/// <summary> /// Initializes a new instance of the <see cref="Receiver"/> class. /// </summary> /// <param name="Id">The id of this receiver</param> /// <param name="commPort">The recvr serial port (e.g. COM3)</param> /// <param name="courtNumber">The court number assigned to this receiver (e.g. 1)</param> public Receiver(string id, string commPort, byte courtNumber) { CheckCallerAccess(Assembly.GetCallingAssembly()); Trace.TraceInformation("{0}.Constructor: Id={1} CommPort={2} CourtNumber={3}", CLASSNAME, id, commPort, courtNumber); Trace.Indent(); this.Id = id; this.CourtNumber = Math.Min(courtNumber, (byte)1); _recvrComm = new ReceiverSerialComm(commPort); _recvrComm.DataPacketReceived += RecvrComm_PacketReceivedHandler; Trace.Unindent(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { Trace.TraceInformation("{0}.Dispose: Disposing={1}", CLASSNAME, disposing); Trace.Indent(); if (disposing) { if (_recvrComm != null) { _recvrComm.DataPacketReceived -= RecvrComm_PacketReceivedHandler; _recvrComm.Dispose(); _recvrComm = null; } } Trace.Unindent(); }