Beispiel #1
0
        void UpdateSensorConfiguration(int sensorID, string name, int type)
        {
            SensorConfiguration config = new SensorConfiguration();

            config.sensorID = sensorID;
            config.name     = name;
            config.type     = type;

            config.ResponsePort = new DsspResponsePort <DefaultUpdateResponseType>();

            _updatePort.Post(config);

            Activate(
                Arbiter.Choice(config.ResponsePort,
                               delegate(DefaultUpdateResponseType response)
            {
            },
                               delegate(Fault fault)
            {
                LogError("Failed to send notification");
            }
                               ));
        }
Beispiel #2
0
        /// <summary>
        /// Internal handler, not on public port
        /// </summary>
        /// <param name="sensorConfiguration"></param>
        void SensorConfigurationHandler(SensorConfiguration sensorConfiguration)
        {
            int            sensorID = sensorConfiguration.sensorID;
            string         name     = sensorConfiguration.name;
            Srv1SensorType type     = (Srv1SensorType)sensorConfiguration.type;

            if ((sensorID > 0) && (sensorID <= 4))
            {
                _state.Sensors[sensorID - 1].type = type;
                _state.Sensors[sensorID - 1].name = name;

                sensorConfiguration.ResponsePort.Post(new DefaultUpdateResponseType());
                _subMgrPort.Post(new submgr.Submit(_state, DsspActions.ReplaceRequest));
            }
            else
            {
                sensorConfiguration.ResponsePort.Post(
                    Fault.FromCodeSubcodeReason(FaultCodes.Receiver,
                                                DsspFaultCodes.OperationFailed,
                                                "Bad Index")
                    );
            }
        }