HeaterBase.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Aitex.Core.Common.DeviceData;
  8. using Aitex.Core.RT.DataCenter;
  9. using Aitex.Core.RT.Device;
  10. using Aitex.Core.RT.Event;
  11. using Aitex.Core.RT.OperationCenter;
  12. namespace MECF.Framework.Common.Device.Bases
  13. {
  14. public abstract class HeaterBase : BaseDevice, IDevice
  15. {
  16. public virtual bool IsPowerOn { get; set; }
  17. public virtual float TempSetPoint { get; set; }
  18. public virtual float TempFeedback { get; set; }
  19. public virtual AITHeaterData DeviceData { get; set; }
  20. protected HeaterBase( ) : base( )
  21. {
  22. }
  23. protected HeaterBase(string module, string name) : base(module, name, name, name)
  24. {
  25. }
  26. public virtual bool Initialize()
  27. {
  28. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  29. DATA.Subscribe($"{Module}.{Name}.TempFeedback", () => TempFeedback);
  30. DATA.Subscribe($"{Module}.{Name}.TempSetPoint", () => TempSetPoint);
  31. DATA.Subscribe($"{Module}.{Name}.IsPowerOn", () => IsPowerOn);
  32. OP.Subscribe($"{Module}.{Name}.SetPowerOn", (function, args) =>
  33. {
  34. SetPowerOnOff(true);
  35. return true;
  36. });
  37. OP.Subscribe($"{Module}.{Name}.SetPowerOff", (function, args) =>
  38. {
  39. SetPowerOnOff(false);
  40. return true;
  41. });
  42. OP.Subscribe($"{Module}.{Name}.SetTemperature", (function, args) =>
  43. {
  44. SetTemperature((float)args[0]);
  45. return true;
  46. });
  47. return true;
  48. }
  49. public virtual void SetPowerOnOff(bool isOn)
  50. {
  51. }
  52. public virtual void SetTemperature(float temperature)
  53. {
  54. }
  55. public virtual void Terminate()
  56. {
  57. }
  58. public virtual void Monitor()
  59. {
  60. }
  61. public virtual void Reset()
  62. {
  63. }
  64. }
  65. }