authNew.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef __AUTH_NEW_H_
  2. #define __AUTH_NEW_H_
  3. #define PRO_HEADER 0x89
  4. #define TX_RX_SEED 0x86
  5. #define PRO_AUTH_REQ 0x34 //终端向我申请鉴权
  6. #define PRO_AUTH_OK 0x35 //终端通知我它鉴权码与自己算出来的一样
  7. #define PRO_AUTH_SUC 0x36 //我向终端通知鉴权码
  8. #define PRO_AUTH_FAI 0x37 //终端通知我它鉴权码与自己算出来的不一样
  9. #define UNIQUE_ID_BYTES 12
  10. #define AUTH_FLAG '@'
  11. #define AUTH_UDP_SOCKET 1
  12. #define AUTH_REQ_ID 0x0930
  13. #define AUTH_ACK_ID 0x8930
  14. #define CHANNEL_NUM 1
  15. char authHandleData(char ,unsigned char *data, unsigned short len);
  16. void authNewInit(void);
  17. void ModemSendAuthReqHandle(void);
  18. typedef struct{
  19. unsigned char root;//表示是否有有效数据
  20. unsigned char reqTime;//请求鉴权计数
  21. unsigned char result;//鉴权结果 0 无鉴权请求 1 正在鉴权 2 鉴权成功 3 鉴权失败
  22. unsigned char id[UNIQUE_ID_BYTES];
  23. unsigned int encodeValue;
  24. unsigned int waitTime;
  25. }__attribute__((packed)) CHANNEL_DEF;
  26. typedef enum{
  27. CHL_UART1,
  28. CHL_TOTAL
  29. }CHANNEL_TYPEENUM;
  30. typedef enum{
  31. SER_AUTH_IDLE,
  32. SER_AUTH_BUSY,
  33. SER_AUTH_OK,
  34. SER_AUTH_WAIT,
  35. SER_AUTH_FAILED,
  36. SER_AUTH_DEV_OK_DLY,
  37. SER_AUTH_DEV_OK,
  38. SER_AUTH_DEV_FAI
  39. }SER_AUTH_RESULT_DEF;
  40. extern CHANNEL_DEF channel[CHANNEL_NUM];
  41. extern unsigned char authSocketStatus;
  42. void authLedShow();
  43. void authBubiaoHandleRecv(unsigned char *msg);
  44. #endif