You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
925 B

2 years ago
2 years ago
  1. /**
  2. * @file device_ctrl_service.h
  3. * @author zhaohe (h_zhaohe@domain.com)
  4. * @brief Ʒ
  5. * @version 0.1
  6. * @date 2024-02-01
  7. *
  8. * @copyright Copyright (c) 2024
  9. *
  10. */
  11. #pragma once
  12. #include "znordic.h"
  13. typedef enum {
  14. // ����
  15. kdevice_state_standby = 0,
  16. // Ready
  17. kdevice_state_ready = 1,
  18. // sample
  19. kdevice_state_sampling = 2,
  20. } device_state_t;
  21. static const char* ds2str(device_state_t ds) {
  22. switch (ds) {
  23. case kdevice_state_standby:
  24. return "standby";
  25. case kdevice_state_ready:
  26. return "ready";
  27. case kdevice_state_sampling:
  28. return "sampling";
  29. default:
  30. return "unknown";
  31. }
  32. }
  33. void DeviceCtrl_change_to_state(device_state_t state);
  34. uint32_t DeviceCtrl_cur_state_haspassed_ms();
  35. device_state_t DeviceCtrl_now_state();
  36. void DeviceCtrl_startSample(int duration_ms);
  37. void DeviceCtrl_stopSample();
  38. void DeviceCtrl_schdeule();
  39. void DeviceCtrl_init();