ioPAC RTU Controllers
C/C++ Sample Code Programming Guide
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions

Moxa ActiveOPC Server (AOPC Server) More...

Modules

 AOPCTagType
 
 AOPCTagAccessRight
 
 AOPCTagQuality
 

Data Structures

struct  TagInfo
 

Macros

#define AOPC_DEFAULT_PORT   9900
 
#define AOPC_MAX_DEV_NAME   59
 
#define AOPC_MAX_TAG_NAME   30
 
#define AOPC_MAX_TAG_DESC   16
 
#define AOPC_MAX_TAG_UNIT   16
 

Typedefs

typedef struct TagInfo TAG
 

Enumerations

enum  AOPC_ERR_CODE {
  AOPC_ERR_OK = 0, AOPC_ERR_LIB_INIT, AOPC_ERR_PARAM, AOPC_ERR_SOCKET,
  AOPC_ERR_TIMEOUT, AOPC_ERR_CONNECT, AOPC_ERR_CREATE_THREAD, AOPC_ERR_NO_MEMORY,
  AOPC_ERR_NO_QUEUE, AOPC_ERR_INTR, AOPC_ERR_FRAME_PENDING, AOPC_ERR_FRAME_ERROR,
  AOPC_ERR_SERVER_ERROR, AOPC_ERR_CLOSE, AOPC_ERR_NO_TAG, AOPC_ERR_EXIST_TAG,
  AOPC_ERR_NO_WRITE_FUNC, AOPC_ERR_ACCESS, AOPC_ERR_USER_WRITE, AOPC_ERR_NOT_SUPPORT,
  AOPC_ERR_NOT_WRITABLE, AOPC_ERR_FAIL, AOPC_ERR_NOT_REGISTERED, AOPC_ERR_INVALID_ATTR,
  AOPC_ERR_SYSTEM_INFO, AOPC_ERR_STR_LEN, AOPC_ERR_AMOUNT
}
 

Functions

AOPC_ERR_CODE MX_RTU_AOPC_Init (void)
 This API must be called at first. More...
 
void MX_RTU_AOPC_Uninit (void)
 This API must be called at the end. More...
 
AOPC_ERR_CODE MX_RTU_AOPC_Connect (UINT8 *deviceName, UINT32 heartBeatS, UINT8 *ipAddress, UINT16 port, UINT32 timeoutMs, UINT32 *sHandle)
 
AOPC_ERR_CODE MX_RTU_AOPC_Disconnect (UINT32 sHandle)
 
AOPC_ERR_CODE MX_RTU_AOPC_Reconnect (UINT32 sHandle, UINT32 timeoutMs)
 
AOPC_ERR_CODE MX_RTU_AOPC_AddTag (UINT32 sHandle, TAG *tagInfo, struct Timestamp *tagTime, UINT32 timeoutMs)
 
AOPC_ERR_CODE MX_RTU_AOPC_DelTag (UINT32 sHandle, UINT8 *tagName, UINT32 timeoutMs)
 
AOPC_ERR_CODE MX_RTU_AOPC_DelAllTag (UINT32 sHandle, UINT32 timeoutMs)
 
AOPC_ERR_CODE MX_RTU_AOPC_UpdateTag (UINT32 sHandle, TAG *tagInfo, struct Timestamp *tagTime, UINT32 timeoutMs)
 
AOPC_ERR_CODE MX_RTU_AOPC_UpdateValue (UINT32 sHandle, UINT8 *tagName, void *tagValue, struct Timestamp *tagTime, UINT32 timeoutMs)
 
AOPC_ERR_CODE MX_RTU_AOPC_UpdateHeartbeat (UINT32 sHandle, UINT32 heartbeatS, UINT32 timeoutMs)
 

Detailed Description

Moxa ActiveOPC Server (AOPC Server)

Sample Code:
aopc_io_update.c

Macro Definition Documentation

#define AOPC_DEFAULT_PORT   9900
#define AOPC_MAX_DEV_NAME   59
#define AOPC_MAX_TAG_NAME   30
#define AOPC_MAX_TAG_DESC   16
#define AOPC_MAX_TAG_UNIT   16

Typedef Documentation

typedef struct TagInfo TAG

Enumeration Type Documentation

Enumerator
AOPC_ERR_OK 

0

AOPC_ERR_LIB_INIT 

1

AOPC_ERR_PARAM 

2

AOPC_ERR_SOCKET 

3

AOPC_ERR_TIMEOUT 

4

AOPC_ERR_CONNECT 

5

AOPC_ERR_CREATE_THREAD 

6

AOPC_ERR_NO_MEMORY 

7

AOPC_ERR_NO_QUEUE 

8

AOPC_ERR_INTR 

9

AOPC_ERR_FRAME_PENDING 

10

AOPC_ERR_FRAME_ERROR 

11

AOPC_ERR_SERVER_ERROR 

12

AOPC_ERR_CLOSE 

13

AOPC_ERR_NO_TAG 

14

AOPC_ERR_EXIST_TAG 

15

AOPC_ERR_NO_WRITE_FUNC 

16

AOPC_ERR_ACCESS 

17

AOPC_ERR_USER_WRITE 

18

AOPC_ERR_NOT_SUPPORT 

19

AOPC_ERR_NOT_WRITABLE 

20

AOPC_ERR_FAIL 

21

AOPC_ERR_NOT_REGISTERED 

22

AOPC_ERR_INVALID_ATTR 

23

AOPC_ERR_SYSTEM_INFO 

24

AOPC_ERR_STR_LEN 

25

AOPC_ERR_AMOUNT 

26

Function Documentation

AOPC_ERR_CODE MX_RTU_AOPC_Init ( void  )

This API must be called at first.

Returns
AOPC_ERR_CODE
void MX_RTU_AOPC_Uninit ( void  )

This API must be called at the end.

AOPC_ERR_CODE MX_RTU_AOPC_Connect ( UINT8 deviceName,
UINT32  heartBeatS,
UINT8 ipAddress,
UINT16  port,
UINT32  timeoutMs,
UINT32 sHandle 
)
Parameters
[in]deviceNameA device name displayed on AOPC Server.
[in]heartBeatSAlive Check for the connection by seconds, giving zero will disable this function.
[in]ipAddressAOPC Server IP.
[in]portAOPC Server Port, default port is 9900.
[in]timeoutMsAOPC connecting timeout by mini seconds.
[out]sHandleA handle, like a file descriptor, stands for the connection.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_Disconnect ( UINT32  sHandle)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_Reconnect ( UINT32  sHandle,
UINT32  timeoutMs 
)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
[in]timeoutMsAOPC reconnecting timeout by mini seconds.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_AddTag ( UINT32  sHandle,
TAG tagInfo,
struct Timestamp tagTime,
UINT32  timeoutMs 
)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
[in]tagInfoTag Information for AOPC Server.
[in]tagTimeTag timestamp, NULL stands for no timestamp.
[in]timeoutMsAdding timeout by mini seconds.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_DelTag ( UINT32  sHandle,
UINT8 tagName,
UINT32  timeoutMs 
)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
[in]tagNameDeleting a specific tag by name, the tag should be added already.
[in]timeoutMsDeleting timeout by mini seconds.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_DelAllTag ( UINT32  sHandle,
UINT32  timeoutMs 
)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
[in]timeoutMsDeleting timeout by mini seconds.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_UpdateTag ( UINT32  sHandle,
TAG tagInfo,
struct Timestamp tagTime,
UINT32  timeoutMs 
)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
[in]tagInfoTag Information for AOPC Server.
[in]tagTimeTag timestamp, NULL stands for no timestamp.
[in]timeoutMsUpdating timeout by mini seconds.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_UpdateValue ( UINT32  sHandle,
UINT8 tagName,
void *  tagValue,
struct Timestamp tagTime,
UINT32  timeoutMs 
)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
[in]tagNameUpdating a specific tag by name, the tag should be added already.
[in]tagValueUpdated tag value.
[in]tagTimeTag timestamp, NULL stands for no timestamp.
[in]timeoutMsUpdating timeout by mini seconds.
Returns
AOPC_ERR_CODE
AOPC_ERR_CODE MX_RTU_AOPC_UpdateHeartbeat ( UINT32  sHandle,
UINT32  heartbeatS,
UINT32  timeoutMs 
)
Parameters
[in]sHandleA handle, like a file descriptor, stands for the connection.
[in]heartbeatSUpdated heartbeat by seconds.
[in]timeoutMsUpdating timeout by mini seconds.
Returns
AOPC_ERR_CODE