/// <summary>
        /// Post Configure Sensor Connection with body and return the response port.
        /// </summary>
        public virtual PortSet <DefaultUpdateResponseType, Fault> ConnectToBrick(SoundSensorState state)
        {
            ConnectToBrick op = new ConnectToBrick();

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

            this.PostUnknownType(op);
            return(op.ResponsePort);
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize State
        /// </summary>
        private void InitializeState()
        {
            if (_state == null)
            {
                _state = new SoundSensorState();
            }

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

            if (_genericState == null)
            {
                _genericState = new pxanalogsensor.AnalogSensorState();
            }

            _state.TimeStamp = DateTime.MinValue;
            _state.Connected = false;
            _state.Intensity = 0;

            _genericState.RawMeasurementRange = 255.0;
        }