event_subscriber.c 680 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include "wasm_app.h"
  6. #include "wa-inc/request.h"
  7. void
  8. over_heat_event_handler(request_t *request)
  9. {
  10. printf("### user over heat event handler called\n");
  11. if (request->payload != NULL && request->fmt == FMT_ATTR_CONTAINER)
  12. attr_container_dump((attr_container_t *)request->payload);
  13. }
  14. void
  15. on_init()
  16. {
  17. api_subscribe_event("alert/overheat", over_heat_event_handler);
  18. }
  19. void
  20. on_destroy()
  21. {
  22. /* real destroy work including killing timer and closing sensor is
  23. accomplished in wasm app library version of on_destroy() */
  24. }