/// <summary> /// Registers the device. /// </summary> /// <param name="registration">The registration.</param> /// <returns></returns> public void RegisterDevice(RegistrationSettings registration) { if (_recvrComm == null) throw new InvalidOperationException("Receiver communications port is null"); if (registration.GameNumber < 1) throw new InvalidOperationException("Match Number must be between 1-255"); if (registration.MinimumPressure < 10) throw new InvalidOperationException("Minimum Pressure Setting range is 10-255"); Trace.TraceInformation("{0}.RegisterDevice: OpCode={1} Match={2} Court={3} RegSeq={4} MinPressure={5} Touch={6}", CLASSNAME, registration.OpCode, registration.GameNumber, CourtNumber, _registrationSeq, registration.MinimumPressure, registration.TouchSensorMode); Trace.Indent(); // Send registration command to receiver _recvrComm.SendDataPacket(new byte[6] { registration.GameNumber, (byte)registration.OpCode, CourtNumber, _registrationSeq, registration.MinimumPressure, (byte)registration.TouchSensorMode }); // Increment the registration sequence number with wrap around _registrationSeq = (byte)(_registrationSeq + 1 % 0xFF); Trace.Unindent(); }
/// <summary> /// Registers the device. /// </summary> /// <param name="registration">The registration.</param> public void RegisterDevice(RegistrationSettings registration) { if (this.receiverComm == null) { throw new InvalidOperationException("Receiver communications port is null"); } if (registration.GameNumber < 1) { throw new InvalidOperationException("Game Number must be between 1-255"); } if (registration.MinimumPressure < 30) { throw new InvalidOperationException("Minimum Pressure Setting range is 30-255"); } Trace.TraceInformation( "{0}.RegisterDevice: OpCode={1} Match={2} Court={3} RegSeq={4} MinPressure={5} Touch={6}", CLASSNAME, registration.OperationCode, registration.GameNumber, this.CourtNumber, registration.RegistrationSequence, registration.MinimumPressure, registration.TouchSensorMode); Trace.Indent(); // Send registration command to receiver this.receiverComm.SendDataPacket(new byte[6] { registration.GameNumber, (byte)registration.OperationCode, this.CourtNumber, registration.RegistrationSequence, registration.MinimumPressure, (byte)registration.TouchSensorMode }); Trace.Unindent(); }