예제 #1
0
        public void UpdateScadaData(Dictionary <long, AnalogModbusData> scadaData)
        {
            Console.WriteLine("Hello from UpdateScadaData()");

            _scadaDipatcher.Connect();

            try
            {
                _scadaDipatcher.NotifyScadaDataUpdate(scadaData);
                Console.WriteLine($"Sent notification to SCADA Hub");
            }
            catch (Exception e)
            {
                // retry ?
                Console.WriteLine($"An exception occured during WebService.UpdateScadaData(): {e.Message}");
            }
        }
예제 #2
0
        public void Notify(IPublishableMessage message)
        {
            if (message is MultipleAnalogValueSCADAMessage analogValuesMessage)
            {
                Dictionary <long, AnalogModbusData> analogModbusData = new Dictionary <long, AnalogModbusData>(analogValuesMessage.Data);

                _dispatcher.Connect();

                try
                {
                    _dispatcher.NotifyScadaDataUpdate(analogModbusData);
                }
                catch (Exception)
                {
                    //log error
                    // retry ?
                }
            }
            else
            {
                //todo: if anything?
            }
        }