web.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef __WEB_Hx__
  2. #define __WEB_Hx__
  3. #include "stdint.h"
  4. #define CHANEL_WANNING_INFO_TYPE "{"\
  5. "\"code\":200,"\
  6. "\"data\":{"\
  7. "\"chnName\":\"%s\","\
  8. "\"chnId\":%d,"\
  9. "\"chnWanVolMax\":%d,"\
  10. "\"chnWanVolMin\":%d,"\
  11. "\"chnWanCurMax\":%d,"\
  12. "\"chnWanPwrMax\":%d,"\
  13. "\"chnWanKwhMax\":%d,"\
  14. "\"phOrder\":\"%s\""\
  15. "},"\
  16. "\"msg\":\"success\""\
  17. "}"
  18. #define CHANNEL_SINGLE_RES_TYPE "{"\
  19. "\"code\":200,"\
  20. "\"data\":{"\
  21. "\"chnName\":\"%s\","\
  22. "\"chnId\":%d,"\
  23. "\"chnVoltage\":%.2f,"\
  24. "\"chnCurrent\":%.2f,"\
  25. "\"chnPower\":%.2f,"\
  26. "\"chnApparentPower\":%.2f,"\
  27. "\"chnPowerFreq\":%.1f,"\
  28. "\"chnPowerFactor\":%.3f,"\
  29. "\"chnConsumption\":%.2f,"\
  30. "\"chnVoltageMax\":%.2f,"\
  31. "\"chnVoltageMin\":%.2f,"\
  32. "\"chnCurrentMAX\":%.2f,"\
  33. "\"chnPowerMAX\":%.2f,"\
  34. "\"chnConsumptionMAX\":%.2f,"\
  35. "\"openInterval\":%d,"\
  36. "\"closeInterval\":%d,"\
  37. "\"chStatus\":%d,"\
  38. "\"chnWanVolMax\":%d,"\
  39. "\"chnWanVolMin\":%d,"\
  40. "\"chnWanCurMax\":%d,"\
  41. "\"chnWanPwrMax\":%d,"\
  42. "\"chnWanKwhMax\":%d,"\
  43. "\"chPhOrder\":\"%s\""\
  44. "},"\
  45. "\"msg\":\"success\""\
  46. "}"
  47. #define ALL_INFO_RES_TYPE "{"\
  48. "\"code\":200,"\
  49. "\"data\":{"\
  50. "\"phId\":%d,"\
  51. "\"allVoltage\":%.2f,"\
  52. "\"allCurrent\":%.2f,"\
  53. "\"allPower\":%.2f,"\
  54. "\"allApparentPower\":%.2f,"\
  55. "\"allPowerFactor\":%.3f,"\
  56. "\"allConsumption\":%.2f,"\
  57. "\"phOrder\":\"%s\""\
  58. "},"\
  59. "\"msg\":\"success\""\
  60. "}"
  61. #define SENSOR_INFO_RES_TYPE "{"\
  62. "\"code\":200,"\
  63. "\"data\":{"\
  64. "\"sensorId\":%d,"\
  65. "\"sensorName\":\"%s\","\
  66. "\"sensorValue\":%.2f,"\
  67. "\"sensorThrMax\":%.2f,"\
  68. "\"sensorThrMin\":%.2f,"\
  69. "\"sensorWanMax\":%d,"\
  70. "\"sensorWanMin\":%d,"\
  71. "\"sensorStatus\":%d"\
  72. "},"\
  73. "\"msg\":\"success\""\
  74. "}"
  75. #define SUCESS_RSP "{\"code\": 200,\"msg\": \"success\"}"
  76. enum{
  77. USER_SUCCESS,
  78. USER_EXIST,
  79. USER_OVER_TEN,
  80. };
  81. enum{
  82. USER_DELETE_SUCCESS,
  83. USER_DELETE_NO_EXIT,
  84. };
  85. enum{
  86. USER_UPDATE_SUCCESS,
  87. USER_UPDATE_PASSERR,
  88. };
  89. int web_init(void);
  90. int web_post(int type, void *data, int len);
  91. #endif