events_config.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifdef EVENT_POST_ENABLED
  2. #define EVENT_COUNTS (3)
  3. static TYPE_DEF_TEMPLATE_BOOL sg_status_report_status = 0;
  4. static TYPE_DEF_TEMPLATE_STRING sg_status_report_message[64 + 1] = {0};
  5. static DeviceProperty g_propertyEvent_status_report[] = {
  6. {.key = "status", .data = &sg_status_report_status, .type = TYPE_TEMPLATE_BOOL},
  7. {.key = "message", .data = sg_status_report_message, .type = TYPE_TEMPLATE_STRING},
  8. };
  9. static TYPE_DEF_TEMPLATE_FLOAT sg_low_voltage_voltage = 1;
  10. static DeviceProperty g_propertyEvent_low_voltage[] = {
  11. {.key = "voltage", .data = &sg_low_voltage_voltage, .type = TYPE_TEMPLATE_FLOAT},
  12. };
  13. static TYPE_DEF_TEMPLATE_STRING sg_hardware_fault_name[64 + 1] = {0};
  14. static TYPE_DEF_TEMPLATE_INT sg_hardware_fault_error_code = 1;
  15. static DeviceProperty g_propertyEvent_hardware_fault[] = {
  16. {.key = "name", .data = sg_hardware_fault_name, .type = TYPE_TEMPLATE_STRING},
  17. {.key = "error_code", .data = &sg_hardware_fault_error_code, .type = TYPE_TEMPLATE_INT},
  18. };
  19. static sEvent g_events[] = {
  20. {
  21. .event_name = "status_report",
  22. .type = "info",
  23. .timestamp = 0,
  24. .eventDataNum = sizeof(g_propertyEvent_status_report) / sizeof(g_propertyEvent_status_report[0]),
  25. .pEventData = g_propertyEvent_status_report,
  26. },
  27. {
  28. .event_name = "low_voltage",
  29. .type = "alert",
  30. .timestamp = 0,
  31. .eventDataNum = sizeof(g_propertyEvent_low_voltage) / sizeof(g_propertyEvent_low_voltage[0]),
  32. .pEventData = g_propertyEvent_low_voltage,
  33. },
  34. {
  35. .event_name = "hardware_fault",
  36. .type = "fault",
  37. .timestamp = 0,
  38. .eventDataNum = sizeof(g_propertyEvent_hardware_fault) / sizeof(g_propertyEvent_hardware_fault[0]),
  39. .pEventData = g_propertyEvent_hardware_fault,
  40. },
  41. };
  42. #endif