EventDescriptor.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using Edge.Core.Database.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace Edge.Core.UniversalApi
  6. {
  7. /// <summary>
  8. /// litefcccore fire an event to notify outside clients.
  9. /// </summary>
  10. public class EventDescriptor
  11. {
  12. public string Name { get; set; }
  13. public object Data { get; set; }
  14. public IEnumerable<HubClient> ToClients { get; set; }
  15. }
  16. public class HubClient
  17. {
  18. }
  19. public enum GenericAlarmSeverity
  20. {
  21. Fatal,
  22. Error,
  23. Warning,
  24. Information
  25. }
  26. /// <summary>
  27. /// Used for send a simple and unified alarm data to UI.
  28. /// </summary>
  29. public class GenericAlarm
  30. {
  31. public const string UniversalApiEventName = "OnGenericAlarm";
  32. //public string Originator { get; set; }
  33. /// <summary>
  34. /// Gets or sets the alarm message title, LocalizedContent format is support.
  35. /// please keep this shorter for better user exp in UI, and fill with multiple languages string, like: lang-en-us:helloWorldlang-zh-ch:你好世界.
  36. /// </summary>
  37. public string Title { get; set; }
  38. /// <summary>
  39. /// Gets or sets the alarm message detail, LocalizedContent format is support.
  40. /// please fill with multiple languages string, like: lang-en-us:helloWorldlang-zh-ch:你好世界.
  41. /// </summary>
  42. public string Detail { get; set; }
  43. /// <summary>
  44. /// Abstract description for a serial of alarms that could help to group alarms, LocalizedContent format is support.
  45. /// this is mostly used by UI app that providing a group box to group similar alarms.
  46. /// please fill with multiple languages string, like: lang-en-us:helloWorldlang-zh-ch:你好世界.
  47. /// </summary>
  48. public string Category { get; set; }
  49. /// <summary>
  50. /// Abstract description for a serial of alarms that could help to further group alarms besides Category, LocalizedContent format is support.
  51. /// this is mostly used by UI app that providing a group box to group similar alarms.
  52. /// please fill with multiple languages string, like: lang-en-us:helloWorldlang-zh-ch:你好世界.
  53. /// </summary>
  54. public string SubCategory { get; set; }
  55. /// <summary>
  56. /// Used to store specific business data that the caller may use it when get the historical generic alarms.
  57. /// </summary>
  58. /// <summary>
  59. /// could be anything that recognized by front end(mostly the Web html/javascript).
  60. /// </summary>
  61. public string Action { get; set; }
  62. public GenericAlarmSeverity Severity { get; set; }
  63. /// <summary>
  64. /// alarms with same identity will be treat as the same alarm, thus only the earliest fired single alarm will be persist, following alarms will be ignore for persist.
  65. /// leave this value null or empty will treat every fired alarm is a new one, thus each alarm will be persist.
  66. /// </summary>
  67. //public string Identity { get; set; }
  68. //public DateTime OpeningTimestamp { get; set; }
  69. //public string ClosedReason { get; set; }
  70. //public DateTime? ClosedTimestamp { get; set; }
  71. }
  72. }