Пример #1
0
        public void ExecuteWriteCommand(RegisterType type, uint index, uint value)
        {
            DNP3WriteCommandParameters dnp3CommandParam = new DNP3WriteCommandParameters(GetApplicationSequence(), (byte)DNP3FunctionCode.DIRECT_OPERATE, GetTypeField(type, true),
                                                                                         (byte)Qualifier.PREFIX_2_OCTET_COUNT_OF_OBJECTS_2_OCTET, 1, index, value, GetTransportSequence());
            IDNP3Function dnp3Fn = DNP3FunctionFactory.CreateWriteFunction(dnp3CommandParam);

            this.functionExecutor.EnqueueCommand(dnp3Fn);

            var point = storage.GetSingle(type, (int)index).GetAwaiter().GetResult();

            if (point != null && point.RegisterType == RegisterType.BINARY_OUTPUT)
            {
                dom.AddOrUpdate(new SCADA.Common.Models.DomDbModel()
                {
                    Mrid = point.Mrid, TimeStamp = DateTime.Now.ToString()
                }).GetAwaiter().GetResult();
            }
        }