eth_worker.h 1.6 KB

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