123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #ifndef __GATEWAY_MESSAGE_H
- #define __GATEWAY_MESSAGE_H
- #include "stm32f2xx.h"
- typedef struct _GATEWAY_WRITE_MODBUS_COMMAND
- {
- uint16_t registerByteNum;
- uint8_t slaveAddress;
- uint8_t functionCode;
- uint8_t dataType;
- uint8_t keyword[20];
- uint8_t bigLittleFormat;
- uint16_t registerAddress;
- uint8_t write_command_flag;
- struct _GATEWAY_WRITE_MODBUS_COMMAND *nextParams;
- } GATEWAY_WRITE_MODBUS_COMMAND;
- typedef struct _GATEWAY_READ_MODBUS_COMMAND
- {
- uint8_t slaveAddress;
- uint8_t functionCode;
- uint8_t keyword[20];
- uint16_t registerAddress;
- uint8_t read_command_flag;
- uint32_t value;
- uint16_t registerByteNum;
- uint8_t decimalPoint;
- struct _GATEWAY_READ_MODBUS_COMMAND *nextParams;
- } GATEWAY_READ_MODBUS_COMMAND;
- typedef struct _GATEWAY_READ_DLT645_COMMAND
- {
- uint8_t deviceID645[6];
- uint8_t keyword[20];
- uint32_t Identification;
- uint8_t data[9];
- uint8_t rxLen;
- struct _GATEWAY_READ_DLT645_COMMAND *nextParams;
- } GATEWAY_READ_DLT645_COMMAND;
- typedef struct _PARAMS_PROTOCOL_COMMAND
- {
- GATEWAY_READ_MODBUS_COMMAND *gateway_read_modbus_command;
- GATEWAY_WRITE_MODBUS_COMMAND *gateway_write_modbus_command;
- GATEWAY_READ_DLT645_COMMAND *gateway_read_dlt645_command;
- }PARAMS_PROTOCOL_COMMAND;
- typedef struct _DEVICE_PARAMS
- {
- uint8_t aliveflag;
- uint8_t deviceID[20];
- uint8_t protocol;
- uint8_t MDBbigLittleFormat;
- uint8_t MDBdataType;
- PARAMS_PROTOCOL_COMMAND *params;
- struct _DEVICE_PARAMS *nextDevice;
- } DEVICE_PARAMS;
- typedef struct _GATEWAY_PARAMS
- {
- uint8_t data_valid_flag;
- uint8_t host[20];
- uint16_t port;
- uint8_t messageTopic[50];
- uint8_t commandTopic[50];
- uint8_t username[20];
- uint8_t passwd[20];
- uint8_t deviceId[25];
- uint8_t dataSource;
- uint8_t dataType645;
- uint32_t pollTime;
- uint32_t inboundTime;
- uint8_t state;
- uint8_t gatewayId[10];
- uint8_t gatewayMode[10];
- uint8_t gateName[10];
-
- uint8_t deviceCount;
- DEVICE_PARAMS *device_params;
-
- uint32_t baudrate;
- uint8_t dataBits;
- uint8_t checkBit;
- uint8_t stopBit;
- uint8_t flowControl;
- uint8_t parity;
- uint8_t bandwidth;
- } GATEWAY_PARAMS;
- void addGatewayParams(char *gatewayString);
- int parseIntField(const char *data, const char *field);
- void parseStringField(const char *data, const char *field, char *value);
- GATEWAY_PARAMS *get_gateway_config_params(void);
- int extract_substring(const char *input_string, const char *start_token, const char *end_token, char *result);
- void analysis_read_data(DEVICE_PARAMS *device, char* buf);
- typedef struct _MODBUS_READ_DATA
- {
- uint8_t deviceId[20];
-
- uint8_t power;
- uint8_t temp;
- uint8_t mode;
- uint8_t fan;
- uint8_t roomTemp;
- uint8_t fault;
-
- struct _MODBUS_READ_DATA *nextParams;
- } MODBUS_READ_DATA;
- typedef struct _DLT_READ_DATA
- {
- uint8_t deviceId[20];
-
- uint8_t deviceID645[6];
- uint8_t keyword[20];
- uint32_t Identification;
- uint8_t data[9];
-
- struct _DLT_READ_DATA *nextParams;
- } DLT_READ_DATA;
- typedef struct _READ_DATA
- {
- MODBUS_READ_DATA *read_modbus_data;
- DLT_READ_DATA *read_dlt645_data;
- }READ_DATA;
- #endif
|