branch_def.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef __SPBRANCH_BRANCH_DEF_H
  2. #define __SPBRANCH_BRANCH_DEF_H
  3. #pragma once
  4. #include "SpHelper.h"
  5. namespace SpBranch {
  6. #define TO_STRING(str) \
  7. (#str)
  8. #define BUFSIZE 4096
  9. const int MAX_RETVALUE_LEN = 2048;
  10. enum CMDType {
  11. BRCMD_START,
  12. BRCMD_GETSTATE,
  13. BRCMD_OPENDEV,
  14. BRCMD_CLOSEDEV,
  15. BRCMD_GETERROR,
  16. BRCMD_SENDCMD,
  17. BRCMD_GETDEVINFO,
  18. BRCMD_END
  19. };
  20. enum DevThreadState {
  21. State_NoInit,
  22. State_Invalid,
  23. State_LoadFailed,
  24. State_LoadSucc,
  25. State_OpenFailed,
  26. State_Opened,
  27. State_Idle,
  28. State_Busy,
  29. State_Max
  30. };
  31. struct SpBranch_Command_Req
  32. {
  33. int nCmdType;
  34. int nparam1;
  35. int nparam2;
  36. CSimpleStringA ssparam1;
  37. CSimpleStringA ssparam2;
  38. void Serialize(SpBuffer &buf)
  39. {
  40. buf & nCmdType & nparam1 & nparam2 & ssparam1 & ssparam2;
  41. }
  42. };
  43. struct SpBranch_Command_Ans
  44. {
  45. int nparam1;
  46. int nparam2;
  47. CSimpleStringA ssparam1;
  48. CSimpleStringA ssparam2;
  49. CSimpleStringA ssparam3;
  50. CSimpleStringA ssparam4;
  51. DWORD dwErroCode;
  52. CSimpleStringA desc;
  53. void Serialize(SpBuffer &buf)
  54. {
  55. buf & nparam1 & nparam2 & ssparam1 & ssparam2 & ssparam3 & ssparam4 & dwErroCode & desc;
  56. }
  57. void Init()
  58. {
  59. nparam2 = nparam1 = 0;
  60. ssparam1 = ssparam2 = ssparam3 = ssparam4 = "";
  61. dwErroCode = 0x7fffffff;
  62. desc = "No more Information";
  63. }
  64. };
  65. }
  66. #endif //__SPBRANCH_BRANCH_DEF_H