|
- #ifndef __MODBUS_H
- #define __MODBUS_H
-
- #ifdef DLLProvider
- #define DLL_EXPORT_IMPORT __declspec(dllexport)
- #else
- #define DLL_EXPORT_IMPORT __declspec(dllimport)
- #endif
-
- #include <stdio.h>
- #include <winsock2.h>
- #include <WS2tcpip.h>
- #include <vector>
- #include <string>
- #include <iostream>
- #include <algorithm>
- #include <tchar.h>
- #include <bitset>
- #pragma comment(lib,"ws2_32.lib")
- using namespace std;
-
-
- #define DEVICE_ID 0x01 //É豸ID
- #define Device_ID 0x09
- #define MAX_Address 9999
- #define MAX_NUMBER 300
-
- enum Response_Type{
- MSG_LEN_ERROR,
- MABP_ERROR,
- FUNCTION_CODE_ERROR,
- START_ADDRESS_ERROR,
- OPERATION_NUMBER_ERROR,
- NORMAL_RESPONSE,
- ABNORMAL_RESPONSE
- };
-
- enum Request_Type{
- NO_RESPONSE,
- NORMAL_REQUEST,
- EXCEPTION_CODE_01,
- EXCEPTION_CODE_03,
- EXCEPTION_CODE_04,
- };
-
- DLL_EXPORT_IMPORT int Analysis_Response_Message(UINT8 *Response_Message, UINT8 *Request_Message, int response_message_len);
- DLL_EXPORT_IMPORT int Create_TCP_Message(UINT8 *Message, int function_code, unsigned int operations_Number, unsigned int starting_address, string write_date);
- DLL_EXPORT_IMPORT int Analysis_Response_Msg(UINT8 *Requst_Message, UINT8 *Response_Message, DWORD read_len);
- DLL_EXPORT_IMPORT bool Create_Response_Message(UINT8 *Requst_Message, UINT8 *Response_Message, int flage);
-
- #endif /* __MODBUS_H */
|