eth_worker.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. #include <stdint.h>
  3. typedef struct EthWorker EthWorker;
  4. typedef struct EthViewProcess EthViewProcess;
  5. typedef struct EthViewDrawInit EthViewDrawInit;
  6. typedef enum {
  7. EthWorkerStateNotInited = 0,
  8. EthWorkerStateModuleInit,
  9. EthWorkerStateModulePowerOn,
  10. EthWorkerStateModuleConnect,
  11. EthWorkerStateMACInit,
  12. EthWorkerStateStaticIp,
  13. EthWorkerStateDHCP,
  14. EthWorkerStatePing,
  15. EthWorkerStateStop,
  16. } EthWorkerState;
  17. typedef enum {
  18. EthWorkerProcessInit,
  19. EthWorkerProcessDHCP,
  20. EthWorkerProcessStatic,
  21. EthWorkerProcessPing,
  22. EthWorkerProcessReset,
  23. } EthWorkerProcess;
  24. typedef enum {
  25. EthWorkerSubstateInProcess = 0,
  26. EthWorkerSubStateSuccess,
  27. EthWorkerSubStateError,
  28. } EthWorkerSubState;
  29. typedef enum {
  30. EthCustomEventUpdate = 0,
  31. EthCustomEventModuleInit,
  32. EthCustomEventModuleError,
  33. EthCustomEventModulePowerOn,
  34. EthCustomEventModuleConnect,
  35. EthCustomEventMACInit,
  36. EthCustomEventStaticIp,
  37. EthCustomEventDHCP,
  38. EthCustomEventPing,
  39. EthCustomEventTCP2UART,
  40. EthCustomEventTCP2CLI,
  41. EthCustomEventSaved,
  42. } EthCustomEvent;
  43. typedef void (*EthWorkerCallback)(EthCustomEvent event, void* context);
  44. EthWorker* eth_worker_alloc();
  45. EthWorkerState eth_worker_get_state(EthWorker* eth_worker);
  46. void eth_worker_set_active_process(EthWorker* eth_worker, EthWorkerProcess state);
  47. void eth_worker_free(EthWorker* eth_worker);
  48. void eth_worker_start(
  49. EthWorker* eth_worker,
  50. EthWorkerState state,
  51. EthWorkerCallback callback,
  52. void* context);
  53. void eth_worker_stop(EthWorker* eth_worker);
  54. void eth_worker_dhcp(EthWorker* eth_worker);
  55. void eth_worker_w5500(EthWorker* eth_worker);
  56. void eth_worker_init_process(EthWorker* eth_worker);