示例#1
0
        private void HoldingRegistersStorageOperationOccurred(object sender, StorageEventArgs <ushort> e)
        {
            string command = e.Points.ToASCII();

            _logger?.LogDebug($"KWLEC command: '{command}', operation: {e.Operation}");

            if (e.Operation == PointOperation.Write)
            {
                if (!_pending)
                {
                    // Check for write command.
                    if (command.Contains('='))
                    {
                        var commandparts = command.Split('=');

                        if (commandparts.Length == 2)
                        {
                            string property = _commands[commandparts[0]];
                            UpdateData(property, command);
                        }
                    }
                    // Read command received (variable name).
                    else
                    {
                        // Get property name using the variable name.
                        _property = _commands[command];
                        ReturnData(_property);
                    }
                }
                else
                {
                    _pending = false;
                }
            }
        }
示例#2
0
 private void OnLoadStorageData(EnumStoreHouse enumStoreHouse, int rowth)
 {
     if (this.eventLoadStorageData != null)
     {
         StorageEventArgs storeArgs = new StorageEventArgs();
         storeArgs.StoreHouse = enumStoreHouse;
         storeArgs.Rowth      = rowth;
         this.eventLoadStorageData.Invoke(this, storeArgs);
     }
 }
示例#3
0
        void CoilDiscreteOperation(object sender, StorageEventArgs <bool> e)
        {
            AddActivity("Discrete Coil", e.Operation, e.StartingAddress, e.Points);

            if (e.Operation == PointOperation.Write)
            {
                for (int index = 0; index < e.Points.Length; index++)
                {
                    _coilDiscretes[index + e.StartingAddress].OnValueChanged();
                }
            }
        }
示例#4
0
        void InputRegisterOperation(object sender, StorageEventArgs <ushort> e)
        {
            AddActivity("Input Register", e.Operation, e.StartingAddress, e.Points);

            if (e.Operation == PointOperation.Write)
            {
                for (int index = 0; index < e.Points.Length; index++)
                {
                    _inputRegisters[index + e.StartingAddress].OnValueChanged();
                }
            }
        }
示例#5
0
        /// <summary>
        /// Handler to update the holding register storage.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HoldingRegistersStorageOperationOccurred(object sender, StorageEventArgs <ushort> e)
        {
            _logger.LogDebug($"Holding registers: {e.Operation} starting at {e.StartingAddress} for {e.Points.Length} points.");

            if (e.Operation == PointOperation.Read)
            {
                // NoOp - timer updates only.
            }
            else if (e.Operation == PointOperation.Write)
            {
                // NoOp - timer updates only.
            }
        }
示例#6
0
 private static void ShowInfo(object sender, StorageEventArgs args)
 {
     logger.Debug($"All args: {args.Now.ToString()}, {args.Message}, {args.Adrs.City}, {args.Product.Name}");
 }
示例#7
0
 private static void DisplayMessage(object sender, StorageEventArgs args)
 {
     logger.Debug($"Returned storage event: {args.Type}");
     logger.Debug(args.Message);
 }