ioPAC RTU Controllers
C/C++ Sample Code Programming Guide
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
TagService

Moxa TAG Library
More...

Modules

 TagDataType
 
 TagEventCondition
 

Data Structures

struct  TAG_INFO_T
 
struct  TAG_EVENT_CONDITION_T
 

Macros

#define TAG_MAX_NAME_SIZE   64
 

Typedefs

typedef struct TAG_INFO_T TAG_INFO
 
typedef struct TAG_EVENT_CONDITION_T TAG_EVENT_CONDITION
 

Enumerations

enum  TAG_ERR_CODE {
  TAG_ERR_OK = 0, TAG_ERR_INIT, TAG_ERR_SEM, TAG_ERR_MSGQUEUE,
  TAG_ERR_ALLOC, TAG_ERR_PARAM, TAG_ERR_REG, TAG_ERR_DESTROY,
  TAG_ERR_BIND, TAG_ERR_RESET, TAG_ERR_AGAIN, TAG_ERR_IO,
  TAG_ERR_READY, TAG_ERR_NO_TAG, TAG_ERR_MSGQUEUE_FULL, TAG_ERR_NOT_SUPPORT,
  TAG_ERR_EVENT_INIT, TAG_ERR_EVENT_REGISTER, TAG_ERR_EVENT_SPACE, TAG_ERR_EVENT_HANDLE,
  TAG_ERR_EVENT_EMPTY, TAG_ERR_AMOUNT
}
 
enum  STATUS_CODE {
  STATUS_INIT = 0, STATUS_READY, STATUS_RUNNING, STATUS_SUCCESS,
  STATUS_FAIL, STATUS_ERR_AMOUNT
}
 

Functions

TAG_ERR_CODE MX_RTU_Tag_Init (void)
 This API must be called at first. More...
 
TAG_ERR_CODE MX_RTU_Tag_Uninit (void)
 This API must be called at the end. More...
 
TAG_ERR_CODE MX_RTU_Tag_List_All (void)
 Listing all of the tags. More...
 
TAG_ERR_CODE MX_RTU_Tag_Get_List (TAG_INFO ***list, UINT32 *quantity)
 
TAG_ERR_CODE MX_RTU_Tag_Get_Info (UINT8 *tagName, TAG_INFO *info)
 
TAG_ERR_CODE MX_RTU_Tag_Read (UINT8 *tagName, void *tagValue, UINT32 tagSize, UINT32 *readBytes, struct Timestamp *time)
 
TAG_ERR_CODE MX_RTU_Tag_Write (UINT8 *tagName, void *tagValue, UINT32 tagSize)
 
TAG_ERR_CODE MX_RTU_MultiTag_Read (UINT8 *prefixTagName, UINT8 *postfixTagName, UINT16 start, UINT16 count, UINT8 *tagValue, struct Timestamp *tagTimeStamp)
 
TAG_ERR_CODE MX_RTU_MultiTag_Write (UINT8 *prefixTagName, UINT8 *postfixTagName, UINT16 start, UINT16 count, UINT8 *tagValue)
 
TAG_ERR_CODE MX_RTU_Tag_Event_Register (UINT8 *tagName, TAG_EVENT_CONDITION *condition, int *handle)
 
TAG_ERR_CODE MX_RTU_Tag_Event_Unregister (int handle)
 
TAG_ERR_CODE MX_RTU_Tag_Event_Get (int handle, void *tagValue, struct Timestamp *time)
 
TAG_ERR_CODE MX_RTU_Tag_Event_Clear (int handle)
 

Detailed Description

Moxa TAG Library

Sample Code:

Macro Definition Documentation

#define TAG_MAX_NAME_SIZE   64

Typedef Documentation

typedef struct TAG_INFO_T TAG_INFO

Enumeration Type Documentation

Enumerator
TAG_ERR_OK 

0

TAG_ERR_INIT 

1

TAG_ERR_SEM 

2

TAG_ERR_MSGQUEUE 

3

TAG_ERR_ALLOC 

4

TAG_ERR_PARAM 

5

TAG_ERR_REG 

6

TAG_ERR_DESTROY 

7

TAG_ERR_BIND 

8

TAG_ERR_RESET 

9

TAG_ERR_AGAIN 

10

TAG_ERR_IO 

11

TAG_ERR_READY 

12

TAG_ERR_NO_TAG 

13

TAG_ERR_MSGQUEUE_FULL 

14

TAG_ERR_NOT_SUPPORT 

15

TAG_ERR_EVENT_INIT 

16

TAG_ERR_EVENT_REGISTER 

17

TAG_ERR_EVENT_SPACE 

18

TAG_ERR_EVENT_HANDLE 

19

TAG_ERR_EVENT_EMPTY 

20

TAG_ERR_AMOUNT 

21

Enumerator
STATUS_INIT 

0

STATUS_READY 

1

STATUS_RUNNING 

2

STATUS_SUCCESS 

3

STATUS_FAIL 

4

STATUS_ERR_AMOUNT 

5

Function Documentation

TAG_ERR_CODE MX_RTU_Tag_Init ( void  )

This API must be called at first.

Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Uninit ( void  )

This API must be called at the end.

Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_List_All ( void  )

Listing all of the tags.

Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Get_List ( TAG_INFO ***  list,
UINT32 quantity 
)
Parameters
[out]ppListlist of all tags.
[out]quantityquantity of the tags.
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Get_Info ( UINT8 tagName,
TAG_INFO info 
)
Parameters
[in]tagNamename of the tag
[out]infoTAG_INFO of the specified tag.
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Read ( UINT8 tagName,
void *  tagValue,
UINT32  tagSize,
UINT32 readBytes,
struct Timestamp time 
)
Parameters
[in]tagNamename of the tag
[out]tagValuebuffer to store the tag value
[in]tagSizesize of the specified tag.
[out]readBytesactually read bytes.
A null pointer can be specified to not to return this value.
[out]timeTimestamp of the tag value.
A null pointer can be specified to not to return this value.
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Write ( UINT8 tagName,
void *  tagValue,
UINT32  tagSize 
)
Parameters
[in]tagNamename of the tag
[in]tagValuevalue to be wrote to the tag
[in]tagSizesize of the specified tag.
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_MultiTag_Read ( UINT8 prefixTagName,
UINT8 postfixTagName,
UINT16  start,
UINT16  count,
UINT8 tagValue,
struct Timestamp tagTimeStamp 
)
Parameters
[in]prefixTagNameprefix tag name, it could be a null pointer.
[in]postfixTagNamepostfix tag name, it could be a null pointer.
[in]starttag start
[in]counttag amount
[out]tagValuebuffer to store tag values
[out]tagTimeStampTimestamp of the tag value.
A null pointer can be specified to not to return this value.
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_MultiTag_Write ( UINT8 prefixTagName,
UINT8 postfixTagName,
UINT16  start,
UINT16  count,
UINT8 tagValue 
)
Parameters
[in]prefixTagNameprefix tag name, it could be a null pointer.
[in]postfixTagNamepostfix tag name, it could be a null pointer.
[in]starttag start
[in]counttag amount
[in]tagValuevalues to be wrote to tags
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Event_Register ( UINT8 tagName,
TAG_EVENT_CONDITION condition,
int *  handle 
)
Parameters
[in]tagNamename of the tag
[in]conditioncondition of the event. Refer to TagEventCondition.
[out]handlea handle, like a file descriptor, stands for this tag event.
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Event_Unregister ( int  handle)
Parameters
[in]handlea handle, like a file descriptor, stands for the tag event.
Returns
TAG_ERR_CODE
TAG_ERR_CODE MX_RTU_Tag_Event_Get ( int  handle,
void *  tagValue,
struct Timestamp time 
)
Parameters
[in]handlea handle, like a file descriptor, stands for the tag event.
[out]tagValuebuffer to store the tag value when the condition is matched.
[out]timeTimestamp of the tag value.
A null pointer can be specified to not to return this value.
Returns
TAG_ERR_CODE
Note
A non-blocking function. TAG_ERR_EVENT_EMPTY will be returned, if there is no event occurred.
TAG_ERR_CODE MX_RTU_Tag_Event_Clear ( int  handle)
Parameters
[in]handlea handle, like a file descriptor, stands for the tag event.
Returns
TAG_ERR_CODE
Note
Clear all the tag events in the queue.