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; } } }
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); } }
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(); } } }
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(); } } }
/// <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. } }
private static void ShowInfo(object sender, StorageEventArgs args) { logger.Debug($"All args: {args.Now.ToString()}, {args.Message}, {args.Adrs.City}, {args.Product.Name}"); }
private static void DisplayMessage(object sender, StorageEventArgs args) { logger.Debug($"Returned storage event: {args.Type}"); logger.Debug(args.Message); }