A.3.4 Write Data

The COM UA Wrapper supports performing Write operations to DA servers of versions 2.05a and 3.

For version 2.05a, the COM UA wrapper creates a Group using the IOPCServer::AddGroup method and adds the items whose data is to be written using IOPCItemMgmt::AddItems method. The value is written for the items using the IOPCSyncIO::Write method. Note that if the StatusCode or TimeStamps (Source or Server) is specified to be written for the item then the COM UA Wrapper returns a BadWriteNotSupported Status code for the item.

For version 3, the COM UA Wrapper uses the IOPCItemIO::WriteVQT data including StatusCode and TimeStamp. If a SourceTimeStamp is provided, this timestamp is used for the Write else the ServerTimeStamp is used.

If there are errors for the items in the Write from the DA server, then these are mapped to the StatusCode for the corresponding item.

The mapping of the OPC COM DA Write Errors code to OPC UA Status code (in the COM UA Wrapper) is shown in Table A.5:

Table A.5 – OPC DA Write error code mapping
OPC DA Error IDOPC UA Status Code
E_BADRIGHTSBad_NotWritable
DISP_E_TYPEMISMATCHBad_TypeMismatch
E_BADTYPEBad_TypeMismatch
E_RANGEBad_OutOfRange
DISP_E_OVERFLOWBad_OutOfRange
E_OUTOFMEMORYBad_OutOfMemory
E_INVALIDHANDLEBad_NodeIdUnknown
E_UNKNOWNITEMIDBad_NodeIdUnknown
E_INVALIDITEMIDBad_NodeIdInvalid
E_INVALID_PIDBad_NodeIdInvalid
E_NOTSUPPORTEDBad_WriteNotSupported
S_CLAMPGood_Clamped
OthersBad_UnexpectedError