/// <summary>
        /// Initialize State
        /// </summary>
        private void InitializeState()
        {
            if (_state == null)
            {
                _state = new TouchSensorState();
            }

            if (_state.PollingFrequencyMs == 0)
            {
                _state.PollingFrequencyMs = Contract.DefaultPollingFrequencyMs;
            }

            _state.TimeStamp     = DateTime.MinValue;
            _state.Connected     = false;
            _state.TouchSensorOn = false;

            if (_genericContactState == null)
            {
                _genericContactState = new contactsensor.ContactSensorArrayState();
            }
            if (_genericContactState.Sensors == null)
            {
                _genericContactState.Sensors = new List <contactsensor.ContactSensor>();
            }
            if (_genericContactState.Sensors.Count == 0)
            {
                _genericContactState.Sensors.Add(new contactsensor.ContactSensor(0, "Touch Sensor"));
            }
        }
        /// <summary>
        /// Post Configure Sensor Connection with body and return the response port.
        /// </summary>
        public virtual PortSet <DefaultUpdateResponseType, Fault> ConnectToBrick(TouchSensorState state)
        {
            ConnectToBrick op = new ConnectToBrick();

            op.Body      = new TouchSensorConfig(state.SensorPort);
            op.Body.Name = state.Name;
            op.Body.PollingFrequencyMs = state.PollingFrequencyMs;

            this.PostUnknownType(op);
            return(op.ResponsePort);
        }