Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _FECOM_INCLUDE_H
00033 #define _FECOM_INCLUDE_H
00034
00035
00036 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_CVI_)
00037 #ifdef FECOMDLL
00038 #define DLL_EXT_FUNC __declspec(dllexport) __stdcall
00039 #else
00040 #define DLL_EXT_FUNC __declspec(dllimport) __stdcall
00041 #endif
00042
00043 #ifndef CALLBACK
00044 #define CALLBACK __stdcall
00045 #endif
00046 #define FECOM_EXT_CALL __stdcall
00047 #define FECOM_CALL __cdecl
00048 #else
00049 #define DLL_EXT_FUNC
00050 #define CALLBACK
00051 #define FECOM_EXT_CALL
00052 #define FECOM_CALL
00053 #endif
00054
00055
00056
00057 #ifdef __GNUC__
00058 #ifndef __int64
00059 #define __int64 long long
00060 #endif
00061 #endif
00062
00063 #ifdef __cplusplus
00064 extern "C" {
00065 #endif
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #define FECOM_ERR_NEWPORT_FAILURE -1000
00078 #define FECOM_ERR_EMPTY_LIST -1001
00079 #define FECOM_ERR_POINTER_IS_NULL -1002
00080 #define FECOM_ERR_NO_MEMORY -1003
00081 #define FECOM_ERR_UNSUPPORTED_HARDWARE -1004
00082 #define FECOM_ERR_PORT_NOT_FOUND -1005
00083 #define FECOM_ERR_UNSUPPORTED -1006
00084
00085
00086 #define FECOM_ERR_NO_PORT -1010
00087 #define FECOM_ERR_NO_CONNECT -1011
00088 #define FECOM_ERR_LINK_ID -1012
00089 #define FECOM_ERR_PORT_IS_OPEN -1013
00090
00091
00092 #define FECOM_ERR_UNKNOWN_HND -1020
00093 #define FECOM_ERR_HND_IS_NULL -1021
00094 #define FECOM_ERR_HND_IS_NEGATIVE -1022
00095 #define FECOM_ERR_NO_HND_FOUND -1023
00096
00097
00098 #define FECOM_ERR_TIMEOUT -1030
00099 #define FECOM_ERR_NO_SENDPROTOCOL -1031
00100 #define FECOM_ERR_RECEIVE_PROCESS -1032
00101 #define FECOM_ERR_INIT_COMM_PROCESS -1033
00102 #define FECOM_ERR_FLUSH_INPUT_BUFFER -1034
00103 #define FECOM_ERR_FLUSH_OUTPUT_BUFFER -1035
00104 #define FECOM_ERR_CHANGE_PORT_PARA -1036
00105 #define FECOM_ERR_TRANSMIT_PROCESS -1037
00106 #define FECOM_ERR_RECEIVE_NOISE_DATA -1038
00107 #define FECOM_ERR_PORT_IS_BUSY -1039
00108 #define FECOM_ERR_READ_PORT_PARA -1040
00109
00110
00111 #define FECOM_ERR_UNKNOWN_PARAMETER -1050
00112 #define FECOM_ERR_PARAMETER_OUT_OF_RANGE -1051
00113 #define FECOM_ERR_ODD_PARAMETERSTRING -1052
00114 #define FECOM_ERR_PORTNR_OUT_OF_RANGE -1053
00115 #define FECOM_ERR_UNKNOWN_ERRORCODE -1054
00116
00117
00118 #define FECOM_ERR_OVL_RECBUF -1070
00119
00120
00121
00122
00123
00124
00125 #define FECOM_GET_DLL_VERSION 1000
00126 #define FECOM_GET_ERROR_TEXT 1001
00127 #define FECOM_GET_LAST_ERROR 1002
00128 #define FECOM_DETECT_PORT 1003
00129
00130
00131 #define FECOM_ADD_EVENT_HANDLER 1010
00132 #define FECOM_DEL_EVENT_HANDLER 1011
00133
00134
00135 #define FECOM_OPEN_PORT 1020
00136 #define FECOM_CLOSE_PORT 1021
00137 #define FECOM_GET_PORT_LIST 1022
00138 #define FECOM_GET_PORT_PARA 1023
00139 #define FECOM_SET_PORT_PARA 1024
00140 #define FECOM_DO_PORT_CMD 1025
00141 #define FECOM_GET_PORT_HND 1026
00142
00143
00144 #define FECOM_TRANSCEIVE 1030
00145 #define FECOM_TRANSMIT 1031
00146 #define FECOM_RECEIVE 1032
00147
00148
00149
00150
00151
00152
00153 #define FECOM_THREAD_ID 1
00154 #define FECOM_WND_HWND 2
00155 #define FECOM_CALLBACK 3
00156 #define FECOM_EVENT 4
00157
00158
00159 #define FECOM_CTS_EVENT 1
00160 #define FECOM_DCD_EVENT 2
00161 #define FECOM_DSR_EVENT 3
00162 #define FECOM_RTS_EVENT 4
00163 #define FECOM_DTR_EVENT 5
00164
00165 #define FECOM_PORT_CLOSED_EVENT 20 // only for Windows CE (customized versions)
00166 #define FECOM_PORT_REOPEN_EVENT 21 // only for Windows CE (customized versions)
00167
00168
00169
00170
00171
00172
00173
00174
00175 typedef struct _FECOM_EVENT_INIT
00176 {
00177 unsigned int uiUse;
00178 unsigned int uiMsg;
00179 unsigned int uiFlag;
00180 union
00181 {
00182 #if defined(_MSC_VER) || defined(__BORLANDC__)
00183 DWORD dwThreadID;
00184 HWND hwndWnd;
00185 HANDLE hEvent;
00186 #endif
00187 void (FECOM_CALL* cbFct)(int, int);
00188 #ifdef __cplusplus
00189 };
00190 #else
00191 }Method;
00192 #endif
00193
00194 } FECOM_EVENT_INIT;
00195
00196
00197
00198
00199
00200
00201
00202
00203 void DLL_EXT_FUNC FECOM_GetDLLVersion( char* cVersion );
00204 int DLL_EXT_FUNC FECOM_GetErrorText( int iErrorCode, char* cErrorText );
00205 int DLL_EXT_FUNC FECOM_GetLastError( int iPortHnd, int* iErrorCode, char* cErrorText );
00206 int DLL_EXT_FUNC FECOM_DetectPort( int iPortNr );
00207
00208
00209 int DLL_EXT_FUNC FECOM_AddEventHandler(int iPortHnd, FECOM_EVENT_INIT* pInit);
00210 int DLL_EXT_FUNC FECOM_DelEventHandler(int iPortHnd, FECOM_EVENT_INIT* pInit);
00211
00212
00213 int DLL_EXT_FUNC FECOM_OpenPort( char* cPortNr );
00214 int DLL_EXT_FUNC FECOM_ClosePort( int iPortHnd );
00215 int DLL_EXT_FUNC FECOM_GetPortList( int iNext );
00216 int DLL_EXT_FUNC FECOM_GetPortPara( int iPortHnd, char* cPara, char* cValue );
00217 int DLL_EXT_FUNC FECOM_SetPortPara( int iPortHnd, char* cPara, char* cValue );
00218 int DLL_EXT_FUNC FECOM_DoPortCmd( int iPortHnd, char* cCmd, char* cValue );
00219 int DLL_EXT_FUNC FECOM_GetPortHnd( char* cPortNr );
00220
00221
00222 int DLL_EXT_FUNC FECOM_Transceive( int iPortHnd, unsigned char* cSendProt, int iSendLen, unsigned char* cRecProt, int iRecLen );
00223 int DLL_EXT_FUNC FECOM_Transmit( int iPortHnd, unsigned char* cSendProt, int iSendLen );
00224 int DLL_EXT_FUNC FECOM_Receive( int iPortHnd, unsigned char* cRecProt, int iRecLen );
00225
00226
00227 #undef DLL_EXT_FUNC
00228
00229 #ifdef __cplusplus
00230 }
00231 #endif
00232
00233
00234
00235
00236
00237
00238
00239 typedef void (CALLBACK* LPFN_FECOM_GET_DLL_VERSION)(char*);
00240 typedef int (CALLBACK* LPFN_FECOM_GET_ERROR_TEXT)(int, char*);
00241 typedef int (CALLBACK* LPFN_FECOM_GET_LAST_ERROR)(int, int*, char*);
00242 typedef int (CALLBACK* LPFN_FECOM_DETECT_PORT)(int);
00243
00244
00245 typedef int (CALLBACK* LPFN_FECOM_ADD_EVENT_HANDLER)(int, FECOM_EVENT_INIT*);
00246 typedef int (CALLBACK* LPFN_FECOM_DEL_EVENT_HANDLER)(int, FECOM_EVENT_INIT*);
00247
00248
00249 typedef int (CALLBACK* LPFN_FECOM_OPEN_PORT)(char*);
00250 typedef int (CALLBACK* LPFN_FECOM_CLOSE_PORT)(int);
00251 typedef int (CALLBACK* LPFN_FECOM_GET_PORT_LIST)(int);
00252 typedef int (CALLBACK* LPFN_FECOM_GET_PORT_PARA)(int, char*, char*);
00253 typedef int (CALLBACK* LPFN_FECOM_SET_PORT_PARA)(int, char*, char*);
00254 typedef int (CALLBACK* LPFN_FECOM_DO_PORT_CMD)(int, char*, char*);
00255 typedef int (CALLBACK* LPFN_FECOM_GET_PORT_HND)(char*);
00256
00257
00258 typedef int (CALLBACK* LPFN_FECOM_TRANSCEIVE)(int, unsigned char*, int, unsigned char*, int);
00259 typedef int (CALLBACK* LPFN_FECOM_TRANSMIT)(int, unsigned char*, int);
00260 typedef int (CALLBACK* LPFN_FECOM_RECEIVE)(int, unsigned char*, int);
00261
00262 #endif // _FECOM_INCLUDE_H