net_ctrl.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef __NET_CTRL_H__
  2. #define __NET_CTRL_H__
  3. #include "stm32f10x.h"
  4. #define COLLECT_PARA_NUM 6
  5. #define TAX_PARA_NUM 53
  6. #define SINGLE_DATA 0
  7. #define CUMULATIVE_DATA 1
  8. #define COLLECT_COM 94
  9. extern uint8_t net_send_buf[1024],net_send_len;
  10. extern uint8_t net_seng_state;
  11. extern uint8_t net_rcv_data[512];
  12. extern uint16_t net_rcv_len;
  13. extern uint8_t net_rcv_state;
  14. typedef struct _guns_info
  15. {
  16. uint8_t gun_number;
  17. uint8_t gun_status;
  18. uint8_t gun_type;
  19. uint32_t gun_msgid;
  20. uint32_t total_price;
  21. uint32_t total_oil_volume;
  22. uint32_t last_unit_price;
  23. uint32_t last_oil_volume;
  24. uint32_t last_price;
  25. }__attribute__((packed)) guns_info_t;
  26. typedef struct _tax_control_info
  27. {
  28. uint8_t monitor_serino[16];
  29. uint8_t coder_serino[20];
  30. uint8_t dispaly_serino[16];
  31. uint8_t gun_count;
  32. guns_info_t guns_info;
  33. }__attribute__((packed)) tax_control_info_t;
  34. typedef struct _tax_comm_info
  35. {
  36. uint32_t device_type;
  37. uint32_t device_id;
  38. uint8_t device_status;
  39. uint8_t tax_control_count;
  40. tax_control_info_t tax_control_info;
  41. uint32_t collect_time;
  42. }__attribute__((packed)) tax_comm_info_t;
  43. //²É¼¯Æ÷²ÎÊý
  44. typedef struct _collect_para
  45. {
  46. uint32_t device_id;
  47. uint8_t device_status;
  48. uint8_t tax_control_count;
  49. }__attribute__((packed)) collect_para_t;
  50. //˰¿Ø¿Ú²ÎÊý
  51. typedef struct _tax_para
  52. {
  53. uint8_t tax_serino[16];
  54. uint8_t coder_serino[20];
  55. uint8_t dispaly_serino[16];
  56. uint8_t gun_count;
  57. }__attribute__((packed)) tax_para_t;
  58. extern int tax_net_send(uint8_t *tx_data, uint16_t len, uint8_t typeFirst, uint16_t typeSecd);
  59. void gw_net_comm_test(void);
  60. int air_mqtt_pub(char *topic, char *data, uint8_t len);
  61. void gw_net_send(char *data, uint32_t len);
  62. uint16_t crc16_get(uint8_t *data, uint8_t size);
  63. void net_msg_recv1(void);
  64. int net_rcvdata_ch(char *data, uint8_t *out_data, int len);
  65. int net_data_copy(char *data, uint8_t *out_data);
  66. int tax_net_data_analyze(void *puser,uint8_t collect, uint8_t tax, uint8_t *outdata, uint8_t *len);
  67. void serino_init(void);
  68. #endif