MXIO Software Development Kit
C++ Sample Code Programming Guide
 All Classes Files Functions Variables Typedefs Macros Groups Pages
MXIO_V3_4500.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright Moxa Inc.
3  *
4  * Moxa MXIO Library
5  *
6  * Date Author Comment
7  * 03-26-2019 Daniel Chang Created.
8  ******************************************************************************/
9 
19 #ifndef __MXIO_V3_4500_H__
20 #define __MXIO_V3_4500_H__
21 
22 //------------------------------------------------------------------
28 //-----------------------------------------------------------------
29 #ifndef __MX_FWR
30 //-----------------------------------------------------------------
31 #ifndef WINDOWS_TYPE
32  #include <sys/types.h>
33  #include <sys/socket.h>
34  #include <sys/ioctl.h>
35  #include <sys/time.h>
36  #include <time.h>
37  #include <netinet/in.h>
38  #include <fcntl.h>
39  #include <unistd.h>
40  #include <string.h>
41  #include <ctype.h>
42  #include <arpa/inet.h>
43 
44  #define BOOL bool
45  #define WORD unsigned short
46  #define DWORD unsigned int
47  #define LONG long
48  #define BYTE unsigned char
49  #define UINT unsigned int
50  #define MXIO_V3_API
51  #define CALLBACK
52  #define G_PACKED __attribute__ ((packed))
53 #else
54  #include <windows.h>
55  #ifdef MXIO_V3_EXPORTS
56  #define MXIO_V3_API __declspec(dllexport)
57  #else
58  #define MXIO_V3_API __declspec(dllimport)
59  #endif
60 #endif
61 
62 #ifndef FD_SETSIZE
63  #define FD_SETSIZE 1024
64 #endif
65 #ifndef UINT8
66  #define UINT8 unsigned char
67 #endif
68 #ifndef UINT16
69  #define UINT16 unsigned short
70 #endif
71 #ifndef UINT32
72  #define UINT32 unsigned int
73 #endif
74 #ifndef MAX_PATH
75  #define MAX_PATH 256
76 #endif
77 #ifndef TRUE
78  #define TRUE 1
79  #define FALSE 0
80 #endif
81 
82 
83 //--------------------------------------------------------------------
84 typedef void (CALLBACK *pfnREADCALLBACK)(WORD wBlockQuantity, int *pRecvReadBlockData, void *pParam);
85 typedef void (CALLBACK *pfnWRITECALLBACK)(WORD wBlockQuantity, int *pRecvWriteBlockData, void *pParam);
86 typedef void (CALLBACK *pfnCLEARCALLBACK)(WORD wBlockQuantity, int *pRecvClearBlockData, void *pParam);
87 
92 typedef void (CALLBACK *pfnSTRREADCALLBACK)(int *pRecvReadData, void *pParam);
93 typedef void (CALLBACK *pfnSTRWRITECALLBACK)(int *pRecvWriteData, void *pParam);
94 typedef void (CALLBACK *pfnSTRCLEARCALLBACK)(int *pRecvClearData, void *pParam);
96 #endif
97 //--------------------------------------------------------------------
104 #define MXIO_V3_MAX_BLOCK_SIZE 1
105 #define MXIO_V3_MAX_TOTAL_CH 500
106 
107 #define MXIO_V3_AGENT_PORT 10124
108 #define MXIO_V3_DEFAULT_CDA_PORT 9400
109 
110 #define MXIO_V3_IP_ADDRESS_LENGTH 16
111 #define MXIO_V3_MAC_ADDRESS_LENGTH 6
112 #define MXIO_V3_SERVER_NAME_LENGTH 256
113 #define MXIO_V3_DESCRIPTION_LENGTH 256
114 #define MXIO_ACCOUNT_NAME_LENGTH 30
115 #define MXIO_ACCOUNT_PASSWORD_LENGTH 30
116 
118 //-----
123 #define MXIO_V3_OK 0x0000
124 #define MXIO_V3_ERR_INVALID_REQ 0x8000 //invalid request format
125 #define MXIO_V3_ERR_ACCESS_FS 0x8001 //failed to access file system
126 #define MXIO_V3_ERR_RESTART 0x8002 //failed to restart device
127 #define MXIO_V3_ERR_RESET 0x8003 //failed to reset device to default
128 #define MXIO_V3_ERR_SET_TIME 0x8004 //failed to set device system time
129 #define MXIO_V3_ERR_SET_IO 0x8005 //failed to set I/O
130 #define MXIO_V3_ERR_FWR_UPGRADE 0x8006 //failed to update firmware
131 #define MXIO_V3_ERR_RESP_SYS_CONFIG 0x8007 //failed to update system configuration
132 #define MXIO_V3_ERR_CALIBRATION 0x8008 //failed to calibrate TC/RTD channel
133 #define MXIO_V3_ERR_SET_FWR_FILE_INFO 0x8009 //mismatched firmware file and device model
134 #define MXIO_V3_ERR_INPUT_OVER_RANGE 0x800A //Input Data Length over range
135 #define MXIO_V3_ERR_OUTPUT_OVER_RANGE 0x800B //Output Data Length over range
136 #define MXIO_V3_ERR_SET_NETWORK 0x800C
137 #define MXIO_V3_ERR_FILE_NOT_EXIST 0x800D //file not exist
138 
139 #define MXIO_V3_ERR_ACCOUNT_ACCESS_RIGHT 0x8010 //Verify: Connection not verified or current account has no access right
140 #define MXIO_V3_ERR_ACCOUNT_VERIFY_FAIL 0x8011 //Verify: Input Wrong (not exist) User name or password
141 #define MXIO_V3_ERR_ENCRYPT_DEVICE_INFO_FAIL 0x8012 //Verify: Encrypt file failed
142 #define MXIO_V3_ERR_DECRYPT_DEVICE_INFO_FAIL 0x8013 //Verify: Decrypt file failed
143 #define MXIO_V3_ERR_PARSING_DEVICE_INFO_FAIL 0x8014 //Verify: Parsing account file failed
144 
145 //For Network Interface
146 #define MXIO_V3_ERR_ENUM_NET_INTERFACE_FAIL 0x8050
147 #define MXIO_V3_ERR_SELECT_NET_INTERFACE_FAIL 0x8051
148 
149 //for support new MXIO Agent Error code
150 #define MXIO_V3_ERR_INVALID_HANDLE 0x8080
151 #define MXIO_V3_ERR_BLOCK_QUANTITY 0x8081
152 #define MXIO_V3_ERR_TOTAL_BLOCK_SIZE 0x8082
153 #define MXIO_V3_ERR_PARSE_XML_FAIL 0x8083
154 
155 #define MXIO_V3_ERR_FUNCTION_NOT_SUPPORT 0x8100
156 #define MXIO_V3_ERR_IN_DEPLOY_PROCESS_MODE 0x8101
157 
158 #define MXIO_V3_ERR_REACH_MXIO_LIMIT_CONNECTION 0x8110
159 
160 #define MXIO_V3_ILLEGAL_FUNCTION 0x8201
161 #define MXIO_V3_ILLEGAL_DATA_ADDRESS 0x8202
162 #define MXIO_V3_ILLEGAL_DATA_VALUE 0x8203
163 #define MXIO_V3_SLAVE_DEVICE_FAILURE 0x8204
164 #define MXIO_V3_SLAVE_DEVICE_BUSY 0x8206
165 
166 #define MXIO_V3_EIO_TIME_OUT 0x8210
167 #define MXIO_V3_EIO_INIT_SOCKETS_FAIL 0x8211
168 #define MXIO_V3_EIO_CREATING_SOCKET_ERROR 0x8212
169 #define MXIO_V3_EIO_RESPONSE_BAD 0x8213
170 #define MXIO_V3_EIO_SOCKET_DISCONNECT 0x8214
171 #define MXIO_V3_PROTOCOL_TYPE_ERROR 0x8215
172 #define MXIO_V3_EIO_PASSWORD_INCORRECT 0x8216
173 
174 #define MXIO_V3_PRODUCT_NOT_SUPPORT 0x8217
175 #define MXIO_V3_HANDLE_ERROR 0x8218
176 #define MXIO_V3_SLOT_OUT_OF_RANGE 0x8219
177 #define MXIO_V3_CHANNEL_OUT_OF_RANGE 0x8220
178 #define MXIO_V3_COIL_TYPE_ERROR 0x8221
179 #define MXIO_V3_REGISTER_TYPE_ERROR 0x8222
180 #define MXIO_V3_FUNCTION_NOT_SUPPORT 0x8223
181 #define MXIO_V3_OUTPUT_VALUE_OUT_OF_RANGE 0x8224
182 #define MXIO_V3_INPUT_VALUE_OUT_OF_RANGE 0x8225
183 #define MXIO_V3_SLOT_NOT_EXIST 0x8226
184 #define MXIO_V3_FIRMWARE_NOT_SUPPORT 0x8227
185 #define MXIO_V3_CREATE_MUTEX_FAIL 0x8228
186 #define MXIO_V3_MEMORY_TOO_SMALL 0x8229
187 
188 #define MXIO_V3_PARSING_DEVICE_NAME_ERROR 0x8240
189 #define MXIO_V3_PARSING_CHANNEL_NAME_ERROR 0x8241
190 #define MXIO_V3_PARSING_INPUT_NAME_ERROR 0x8242
191 
192 //-----
197 //Error code for Block
198 #define MXIO_V3_BLOCK_OK 0x0000
199 #define MXIO_V3_BLOCK_ERR_SIZE 0x0001
200 #define MXIO_V3_BLOCK_ERR_SLOT 0x0002
201 #define MXIO_V3_BLOCK_ERR_TYPE 0x0003
202 #define MXIO_V3_BLOCK_ERR_SUBTYPE 0x0004
203 #define MXIO_V3_BLOCK_ERR_FUNCTION 0x0005
204 #define MXIO_V3_BLOCK_ERR_START_OBJ 0x0006
205 #define MXIO_V3_BLOCK_ERR_TOTAL_OBJ 0x0007
206 
207 
212 //Error code for Channel
213 #define MXIO_V3_CH_OK 0x00
214 #define MXIO_V3_CH_ERR_LOCKED 0x01
215 #define MXIO_V3_CH_ERR_READ_ONLY 0x02
216 #define MXIO_V3_CH_ERR_SUBTYPE 0x03
217 #define MXIO_V3_CH_ERR_DATA_TYPE 0x04
218 #define MXIO_V3_CH_ERR_DATA 0x05
219 #define MXIO_V3_CH_ERR_DISABLE 0x06
220 #define MXIO_V3_CH_ERR_BOOLEAN_ONLY 0x07
221 #define MXIO_V3_CH_ERR_WRITE_FAIL 0x08
222 #define MXIO_V3_CH_ERR_PARSING_STR_FAIL 0x09
223 
224 //----------------------------------------------------------
229 #define MXIO_AI_BURNOUT_STATUS_NORMAL 0
230 #define MXIO_AI_BURNOUT_STATUS_BURNOUT 1
231 #define MXIO_AI_BURNOUT_STATUS_OVER_RANGE 2
232 #define MXIO_AI_BURNOUT_STATUS_UNDER_RANGE 3
233 
234 
239 #define MXIO_TEMPERATURE_UNIT_C 0
240 #define MXIO_TEMPERATURE_UNIT_F 1
241 #define MXIO_TEMPERATURE_UNIT_MILLIVOLT 2
242 #define MXIO_TEMPERATURE_UNIT_RESISTANCE 3
243 
244 
249 #define MXIO_COUNTER_ACTIVE_MODE_RISING_EDGE 0
250 #define MXIO_COUNTER_ACTIVE_MODE_FALLING_EDGE 1
251 #define MXIO_COUNTER_ACTIVE_MODE_BOTH 2
252 
253 //----------------------------------------------------------
260 //-----
261 #define IOTYPE_DI 0x000
262 //-----
263 #define IOTYPE_DO 0x100
264 //-----
265 #define IOTYPE_DIO 0x200
266 //-----
267 #define IOTYPE_RELAY 0x300
268 //-----
269 #define IOTYPE_AI 0x400
270 //-----
271 #define IOTYPE_AO 0x500
272 //-----
273 #define IOTYPE_TC 0x600
274 //-----
275 #define IOTYPE_RTD 0x700
276 //-----
277 #define IOTYPE_IR_WORD 0x800
278 //-----
279 #define IOTYPE_SERIALTAG 0x900
280 //-----
281 #define IOTYPE_SYS_SYSTEM 0xA00
282 //-----
283 #define IOTYPE_IR_FLOAT 0xC00
284 //-----
285 #define IOTYPE_IR_BOOL 0xE00
286 //-----
287 #define IOTYPE_IR_DWORD 0xF00
288 //-----
289 #define IOTYPE_POWER_EXT 0x1000
290 
291 //-----------------------------------------------------------------
302 //#define IOFUNC_DI_CH_NAME 0 //R /*!< 0 */
303 #define IOFUNC_DI_CH_MODE 1 //R
304 //#define IOFUNC_DI_CH_FILTER_US 2 //R
306 
307 //-----
308 
313 #define IOFUNC_DI_DI_CH_VALUE 1000 //R
315 
316 //-----
317 
325 //#define IOFUNC_DI_COUNTER_CH_INITIAL_VALUE 2000 //R /*!< 2000 */
326 //#define IOFUNC_DI_COUNTER_CH_POWER_ON_STATUS 2001 //R /*!< 2001 */
327 //#define IOFUNC_DI_COUNTER_CH_ACTIVE_MODE 2002 //R /*!< 2002 */ //(TRIGGER TYPE)
328 //#define IOFUNC_DI_COUNTER_CH_SCALING_ENABLE 2003 //R /*!< 2003 */
329 //#define IOFUNC_DI_COUNTER_CH_SCALING_SLOPE 2004 //R /*!< 2004 */
330 //#define IOFUNC_DI_COUNTER_CH_SCALING_OFFSET 2005 //R /*!< 2005 */
331 //#define IOFUNC_DI_COUNTER_CH_SCALING_INTERVAL_SEC 2006 //R /*!< 2006 */
332 #define IOFUNC_DI_COUNTER_CH_VALUE 2007 //R/W
333 #define IOFUNC_DI_COUNTER_CH_START_STOP 2008 //R/W
334 //#define IOFUNC_DI_COUNTER_CH_RESET 2009 //C
335 #define IOFUNC_DI_COUNTER_CH_OVERFLOW_FLAG 2010 //R/C
336 
337 //-----
338 
343 //#define IOFUNC_DO_CH_NAME 0 //R /*!< 0 */
344 #define IOFUNC_DO_CH_MODE 1 //R
345 
346 //-----
347 
354 //#define IOFUNC_DO_DO_CH_POWER_ON_STATUS 1000 //R /*!< 1000 */
355 //#define IOFUNC_DO_DO_CH_POWER_ON_DELAY_SEC 1001 //R /*!< 1001 */
356 //#define IOFUNC_DO_DO_CH_SAFE_MODE_STATUS 1002 //R /*!< 1002 */
357 #define IOFUNC_DO_DO_CH_VALUE 1003 //R/W
358 
359 //-----
360 
367 #define IOFUNC_DO_PULSE_CH_COUNT 2000 //R
368 #define IOFUNC_DO_PULSE_CH_ON_WIDTH 2001 //R
369 #define IOFUNC_DO_PULSE_CH_OFF_WIDTH 2002 //R
370 //#define IOFUNC_DO_PULSE_CH_POWER_ON_STATUS 2003 //R
371 //#define IOFUNC_DO_PULSE_CH_POWER_ON_DELAY_SEC 2004 //R
372 //#define IOFUNC_DO_PULSE_CH_SAFE_MODE_STATUS 2005 //R
373 #define IOFUNC_DO_PULSE_CH_STATUS 2006 //R/W //Start/Stop
374 
375 //-----
381 //#define IOFUNC_RELAY_CH_NAME 0 //R /*!< 0 */
382 //#define IOFUNC_RELAY_CH_MODE 1 //R /*!< 1 */
383 #define IOFUNC_RELAY_CH_CURRENT_COUNT 2 //R/C
384 #define IOFUNC_RELAY_CH_TOTAL_COUNT 3 //R
385 
386 //-----
387 
394 //#define IOFUNC_RELAY_RELAY_CH_POWER_ON_STATUS 1000 //R /*!< 1000 */
395 //#define IOFUNC_RELAY_RELAY_CH_POWER_ON_DELAY_SEC 1001 //R /*!< 1001 */
396 //#define IOFUNC_RELAY_RELAY_CH_SAFE_MODE_STATUS 1002 //R /*!< 1002 */
397 #define IOFUNC_RELAY_RELAY_CH_VALUE 1003 //R/W
398 
399 //-----
400 
406 //#define IOFUNC_AI_CH_NAME 0 //R /*!< 0 */
407 #define IOFUNC_AI_CH_MODE 1 //R
408 //#define IOFUNC_AI_CH_SCALING_SLOPE 2 //R
409 //#define IOFUNC_AI_CH_SCALING_OFFSET 3 //R
410 //#define IOFUNC_AI_CH_SCALING_UNIT 4 //R
411 #define IOFUNC_AI_CH_BURNOUT_VALUE 5 //R
412 #define IOFUNC_AI_CH_SCALED_VALUE 6 //R
413 #define IOFUNC_AI_CH_MINIMUM_VALUE 7 //R/C
414 #define IOFUNC_AI_CH_MAXIMUM_VALUE 8 //R/C
415 #define IOFUNC_AI_CH_BURNOUT_STATUS 9 //R
416 #define IOFUNC_AI_CH_RAW_VALUE 10 //R
417 //#define IOFUNC_AI_CH_BURNOUT_SCALED_VALUE 11 //R
418 #define IOFUNC_AI_CH_MINIMUM_VALUE_RAW 12 //R/C
419 #define IOFUNC_AI_CH_MAXIMUM_VALUE_RAW 13 //R/C
421 
422 //-----
423 
429 //#define IOFUNC_TC_CH_NAME 0 //R /*!< 0 */
430 #define IOFUNC_TC_CH_MODE 1 //R
431 //#define IOFUNC_TC_CH_TEMPERATURE_UNIT 2 //R
432 //#define IOFUNC_TC_CH_SCALING_SLOPE 3 //R
433 //#define IOFUNC_TC_CH_SCALING_OFFSET 4 //R
434 #define IOFUNC_TC_CH_VALUE_FLOAT 5 //R
435 #define IOFUNC_TC_CH_MINIMUM_VALUE 6 //R/C
436 #define IOFUNC_TC_CH_MAXIMUM_VALUE 7 //R/C
437 //#define IOFUNC_TC_MULTIPLIED_ENGINEERING_VALUE 8 //R
438 #define IOFUNC_TC_CH_STATUS 9 //R
439 
440 //-----
441 
447 //#define IOFUNC_RTD_CH_NAME 0 //R /*!< 0 */
448 #define IOFUNC_RTD_CH_MODE 1 //R
449 //#define IOFUNC_RTD_CH_TEMPERATURE_UNIT 2 //R
450 //#define IOFUNC_RTD_CH_SCALING_SLOPE 3 //R
451 //#define IOFUNC_RTD_CH_SCALING_OFFSET 4 //R
452 #define IOFUNC_RTD_CH_VALUE_FLOAT 5 //R
453 #define IOFUNC_RTD_CH_MINIMUM_VALUE 6 //R/C
454 #define IOFUNC_RTD_CH_MAXIMUM_VALUE 7 //R/C
455 //#define IOFUNC_RTD_MULTIPLIED_ENGINEERING_VALUE 8 //R
456 #define IOFUNC_RTD_CH_STATUS 9 //R
457 
458 //-----
459 
469 //#define IOFUNC_IR_CH_NAME 0 //R /*!< 0 */
470 //#define IOFUNC_IR_CH_INITIAL_VALUE 1 //R /*!< 1 */
471 #define IOFUNC_IR_CH_VALUE 2 //R/W
472 
473 //-----
474 
478 //#define IOFUNC_SYS_DATE 0 //R /*!< 0 */
479 //#define IOFUNC_SYS_TIME 1 //R /*!< 1 */
480 #define IOFUNC_SYS_LAN_IP 2 //R
481 #define IOFUNC_SYS_SERVER_NAME 3 //R
482 #define IOFUNC_SYS_FWR_VERSION 4 //R
483 #define IOFUNC_SYS_LIVE_TIME_SEC 5 //R
484 //#define IOFUNC_SYS_MODEL_NAME 6 //R
485 //#define IOFUNC_SYS_SAFE_MODE_FLAG 7 //R
486 //#define IOFUNC_SYS_SAFE_MODE_COMM_WATCHDOG_TIMEOUT_SEC 8 //R
487 //#define IOFUNC_SYS_SAFE_MODE_AUTO_CLEAN_FLAG 9 //R
488 //#define IOFUNC_SYS_POWER_VOLTAGE 10 //R
489 //#define IOFUNC_SYS_MODBUS_CONNECTION_FAIL_FLAG 11 //R
490 //#define IOFUNC_SYS_CELLULAR_IP 12 //R
491 //#define IOFUNC_SYS_SLOT_COUNT 13 //R
492 //#define IOFUNC_SYS_SLOT_NAME 14 //R
493 #define IOFUNC_SYS_DATETIME 15 //R
494 #define IOFUNC_SYS_SERIAL_NUM 16 //R
495 #define IOFUNC_SYS_ERROR 17 //R
496 #define IOFUNC_SYS_LAN_MAC 18 //R
497 
498 //-----
499 
503 #define IOFUNC_POWER_SP_STATUS 0 //R
504 #define IOFUNC_POWER_SP_ALARM_VALUE 1 //R
505 #define IOFUNC_POWER_FP_STATUS 2 //R
506 
507 //-----
508 
509 //-----
514 #define DATA_TYPE_UNKNOWN 0
515 #define DATA_TYPE_BYTE 1
516 #define DATA_TYPE_WORD 2
517 #define DATA_TYPE_DWORD 3
518 #define DATA_TYPE_INT 4
519 #define DATA_TYPE_FLOAT 5
520 #define DATA_TYPE_STRING 6
521 #define DATA_TYPE_DATE 7
522 #define DATA_TYPE_TIME 8
523 #define DATA_TYPE_BINARY 9
524 
525 
526 //-----------------------------------------------------------------
527 
528 // define: Channel Info
536 //-----
537 #define CHINFO_DI_DI 0x001
538 #define CHINFO_DI_COUNTER 0x002
539 //-----
540 #define CHINFO_DO_DO 0x101
541 #define CHINFO_DO_PULSE 0x102
542 //-----
543 #define CHINFO_DIO_DI 0x201
544 #define CHINFO_DIO_COUNTER 0x202
545 #define CHINFO_DIO_DO 0x203
546 #define CHINFO_DIO_PULSE 0x204
547 //-----
548 #define CHINFO_RELAY_RELAY 0x301
549 #define CHINFO_RELAY_PULSE 0x302
550 //-----
551 #define CHINFO_AI_DISABLED 0x400
552 #define CHINFO_AI_150mV 0x401
553 #define CHINFO_AI_500mV 0x402
554 #define CHINFO_AI_5V 0x403
555 #define CHINFO_AI_10V 0x404
556 #define CHINFO_AI_0_20mA 0x405
557 #define CHINFO_AI_4_20mA 0x406
558 #define CHINFO_AI_0_10V 0x407
559 #define CHINFO_AI_4_20mA_BurnOut 0x408
560 #define CHINFO_AI_M10V_10V 0x409
561 //-----
562 #define CHINFO_AO_DISABLED 0x500
563 #define CHINFO_AO_4_20mA 0x501
564 #define CHINFO_AO_0_10V 0x502
565 //-----
566 #define CHINFO_TC_DISABLED 0x600
567 #define CHINFO_TC_J_TYPE 0x601
568 #define CHINFO_TC_K_TYPE 0x602
569 #define CHINFO_TC_T_TYPE 0x603
570 #define CHINFO_TC_E_TYPE 0x604
571 #define CHINFO_TC_R_TYPE 0x605
572 #define CHINFO_TC_S_TYPE 0x606
573 #define CHINFO_TC_B_TYPE 0x607
574 #define CHINFO_TC_N_TYPE 0x608
575 #define CHINFO_TC_VOL_78126 0x609
576 #define CHINFO_TC_VOL_39062 0x60A
577 #define CHINFO_TC_VOL_19532 0x60B
578 //-----
579 #define CHINFO_RTD_DISABLED 0x700
580 #define CHINFO_RTD_PT100 0x701
581 #define CHINFO_RTD_PT200 0x702
582 #define CHINFO_RTD_PT500 0x703
583 #define CHINFO_RTD_PT1000 0x704
584 #define CHINFO_RTD_JPT100 0x705
585 #define CHINFO_RTD_JPT200 0x706
586 #define CHINFO_RTD_JPT500 0x707
587 #define CHINFO_RTD_JPT1000 0x708
588 #define CHINFO_RTD_NI100 0x709
589 #define CHINFO_RTD_NI200 0x70A
590 #define CHINFO_RTD_NI500 0x70B
591 #define CHINFO_RTD_NI1000 0x70C
592 #define CHINFO_RTD_RES_310 0x70D
593 #define CHINFO_RTD_RES_620 0x70E
594 #define CHINFO_RTD_RES_1250 0x70F
595 #define CHINFO_RTD_RES_2200 0x710
596 #define CHINFO_RTD_PT50 0x711
597 #define CHINFO_RTD_NI120 0x712
598 //-----
599 #define CHINFO_IR_WORD 0x801
600 #define CHINFO_IR_FLOAT 0x802
601 #define CHINFO_IR_BOOL 0x803
602 #define CHINFO_IR_DWORD 0x804
603 //-----
604 #define CHINFO_SERIALTAG_BYTE 0x901
605 #define CHINFO_SERIALTAG_WORD 0x902
606 #define CHINFO_SERIALTAG_DWORD 0x903
607 #define CHINFO_SERIALTAG_INT 0x904
608 #define CHINFO_SERIALTAG_FLOAT 0x905
609 //-----
610 #define CHINFO_VC_MAXIMUM 0xB01
611 #define CHINFO_VC_MINIMUM 0xB02
612 #define CHINFO_VC_AVERAGE 0xB03
613 #define CHINFO_VC_ACCUMULATION 0xB04
614 #define CHINFO_VC_INSTANTANEOUS 0xB05
615 #define CHINFO_VC_INCREMENTAL 0xB06
616 //-----
618 
619 #ifndef __MX_FWR
620 //-----------------------------------------------------------------
622 {
623 public:
624  #pragma pack(1)
625  //===============================
627  {
634 
635  //===============================
636  typedef struct _MX_VERSION
637  {
642  } MX_VERSION;
643 
644  //===============================
645  typedef struct _MX_DATE
646  {
650  } MX_DATE;
651 
652  //============================
653  typedef struct _MX_TIME
654  {
658  } MX_TIME;
659 
660  //============================
661  typedef struct _MX_CMD_BLOCK_HEADER
662  {
666  WORD wStartObj; // 0-511
667  WORD wTotalObj; // 1-512
669 
670  //============================
671  typedef struct _MX_RECV_BLOCK_HEADER
672  {
676  WORD wResult; // Current Block Cmd Result
677  WORD wTotalObj; // Total Object Quantity or String Length
679 
680  //============================
681  typedef struct _MX_CLEAR_OBJ_DATA
682  {
686 
687  //============================
689  {
690  int iHConnection; // Device Connection ID
694 
695  //============================
696  typedef struct _RW_BINARY_VALUE
697  {
698  WORD wLength; // Read: MAX_READ_SIZE(512), WRITE: 1-512
701 
702  //============================
704  {
708  int iValue;
709  float fValue;
710  char *szValue; // for String
714  };
715 
716  //============================
717  typedef struct _MX_RW_OBJ_DATA
718  {
723  //============================
724  typedef struct _MX_WRITE_BLOCK_DATA
725  {
729 
730  //============================
731  typedef struct _MX_READ_BLOCK_DATA
732  {
735 
736  //============================
737  typedef struct _MX_WRITE_OBJ_DATA
738  {
742 
743  //============================
745  {
746  int iHConnection; // Device Connection ID
750  //============================
752  {
753  int iHConnection; // Device Connection ID
757  //============================
758  typedef struct _MX_ACCOUNT_DATA
759  {
763  //============================
764  typedef struct _MX_MAC_ADDRESS
765  {
768 
769  //===================================================
770  // New API Send
771  //============================
772  typedef struct _MX_STR_CMD
773  {
776  char* szDevChName;
778  //============================
779  typedef struct _MX_READ_STR_DATA
780  {
784  //============================
785  typedef struct _MX_WRITE_STR_DATA
786  {
791 
792  //====================================================
793  // New API Receive
794  //============================
795  typedef struct _MX_RECV_STR_CMD
796  {
800  WORD wResult; // Current Block Cmd Result
801  //WORD wTotalObj; // Total Object Quantity or String Length
802  char* szDevChName; // Source String
804  //============================
805  typedef struct _MX_RECV_STR_WRITE_DATA
806  {
807  int iHConnection; // Device Connection ID
812  //============================
813  typedef struct _MX_RECV_STR_READ_DATA
814  {
815  int iHConnection; // Device Connection ID
820  //============================
821  typedef struct _MX_RECV_STR_CLEAR_DATA
822  {
823  int iHConnection; // Device Connection ID
828  //====================================================
829  #pragma pack()
830 public:
832  virtual ~CMXIO_V3_4500(void) {};
840  virtual void MXIO_GetDllVersion(MX_VERSION *pMxVersion) = 0;
844  virtual void MXIO_GetDllBuildDate(MX_DATE *pMxDate) = 0;
846 
850  virtual int MXIO_Init() = 0;
851  virtual int MXIO_Exit() = 0;
853 
865  virtual int MXIO_ListCDADevice(char *szIP, WORD wPort, DWORD dwTimeOut, WORD *wDevCount) = 0;
871  virtual int MXIO_GetCDADeviceInfo(WORD wDevCount, MX_STRU_CDA_DEVICE_INFO pCDADeviceInfo[]) = 0;
873 
874  virtual int MXIO_Read(int hConnection, WORD wBlockQuantity, CMXIO_V3_4500::MX_READ_BLOCK_DATA *pReadBlockData, pfnREADCALLBACK pfnProc, void *pParam) = 0;
875  virtual int MXIO_Write(int hConnection, WORD wBlockQuantity, CMXIO_V3_4500::MX_WRITE_BLOCK_DATA *pWriteBlockData, pfnWRITECALLBACK pfnProc, void *pParam) = 0;
876  virtual int MXIO_Clear(int hConnection, WORD wBlockQuantity, CMXIO_V3_4500::MX_CLEAR_BLOCK_DATA *pClearBlockData, pfnCLEARCALLBACK pfnProc, void *pParam) = 0;
877 
891  virtual int MXIO_Connect(char *szIP, WORD wPort, DWORD dwTimeOut, CMXIO_V3_4500::MX_MAC_ADDRESS *pMxMACAddr, MX_ACCOUNT_DATA *AccountData, int *hConnection) = 0;
896  virtual int MXIO_Disconnect(int hConnection) = 0;
901  virtual int MXIO_Restart(int hConnection) = 0;
902 
903  //---------------------------------------------------------------------------
911  virtual int MXIO_Read(int hConnection, CMXIO_V3_4500::MX_READ_STR_DATA *pReadData, pfnSTRREADCALLBACK pfnProc, void *pParam) = 0;
919  virtual int MXIO_Write(int hConnection, CMXIO_V3_4500::MX_WRITE_STR_DATA *pWriteData, pfnSTRWRITECALLBACK pfnProc, void *pParam) = 0;
927  virtual int MXIO_Clear(int hConnection, CMXIO_V3_4500::MX_CLEAR_STR_DATA *pClearData, pfnSTRCLEARCALLBACK pfnProc, void *pParam) = 0;
929 };
930 
931 typedef CMXIO_V3_4500 *(*PFNCREATEMXIO_V3_4500)();
932 typedef void *(*PFNDESTROYMXIO_V3_4500)(CMXIO_V3_4500 *pMXIO_V3_4500);
933 
935 extern "C" MXIO_V3_API void DestroyMXIO_4500(CMXIO_V3_4500 *pMXIO_V3_4500);
936 //-----------------------------------------------------------------
937 #endif
938 
939 #endif