ICIPSymbolObject.SymbolicServiceRequest (METH)¶
METHOD SymbolicServiceRequest : ERROR_CODE
Use this method to create CIP Services with should be accessed with symbolic paths
METHOD SymbolicServiceRequest : CIP_Object.ERROR_CODE VAR_INPUT
(* ID from the service to execute ) uiServiceCode : UINT; ( Pointer to data which points to the symbolic path ) pSymbolicPath : POINTER TO BYTE; ( Pointer to data which points to the value ) pData : POINTER TO BYTE; ( Size of the memory specified by pData ) uiDataSize : UINT; ( Inputs for response callback *) pRequest : POINTER TO CIP_ENC.EncapsulationPacket; itfCallback : ICIPCallback;
END_VAR VAR
pResponseData : POINTER TO BYTE; uiResponseSize : UINT; strResult : STRING; strSymbol1 : STRING := ‘mySymbol1’; strSymbol2 : STRING := ‘mySymbol2’; byteBuffer : MEMUtils.ByteBuffer;
END_VAR
byteBuffer(pbyBuffer := pData, udiBufferSize := uiDataSize, eByteOrder := MEMUtils.ByteOrder.LITTLE_ENDIAN); //used for reading input data strResult := CIP_Object.SymbolToString(pSymbolicPath); IF StrCaseCmpA(ADR(strResult), ADR(strSymbol1)) THEN
- IF uiServiceCode = 16#E THEN //Get attribute single service (see CIP specification)
//Return data // the variable should be declared in fb body pResponseData := ADR(_uiMySymbol1); uiResponseSize := SIZEOF(_uiMySymbol1);
- ELSIF uiServiceCode = 16#10 THEN //Set attribute single service (see CIP specification)
- IF uiDataSize = SIZEOF(_uiMySymbol1) THEN
_uiMySymbol1 := byteBuffer.GetWord();
- ELSE
- IF uiDataSize < SIZEOF(_uiMySymbol1) THEN
SymbolicServiceRequest.GENERAL_STATUS := CIP_Object.GeneralStatus.NOT_ENOUGH_DATA;
- ELSE
SymbolicServiceRequest.GENERAL_STATUS := CIP_Object.GeneralStatus.TOO_MUCH_DATA;
END_IF
END_IF
- ELSE
SymbolicServiceRequest.GENERAL_STATUS := CIP_Object.GeneralStatus.SERVICE_NOT_SUPPORTED;
END_IF
- ELSIF StrCaseCmpA(ADR(strResult), ADR(strSymbol2)) THEN
- IF uiServiceCode = 16#E THEN //Get attribute single service (see CIP specification)
- //Return data // the variable should be declared in fb body pResponseData := ADR(_udiMySymbol2); uiResponseSize := SIZEOF(_udiMySymbol2); 
- ELSIF uiServiceCode = 16#10 THEN //Set attribute single service (see CIP specification)
- IF uiDataSize = SIZEOF(_udiMySymbol2) THEN
- _udiMySymbol2 := byteBuffer.GetDWord(); 
- ELSE
- IF uiDataSize < SIZEOF(_udiMySymbol2) THEN
- SymbolicServiceRequest.GENERAL_STATUS := CIP_Object.GeneralStatus.NOT_ENOUGH_DATA; 
- ELSE
- SymbolicServiceRequest.GENERAL_STATUS := CIP_Object.GeneralStatus.TOO_MUCH_DATA; 
 - END_IF 
 - END_IF 
- ELSE
- SymbolicServiceRequest.GENERAL_STATUS := CIP_Object.GeneralStatus.SERVICE_NOT_SUPPORTED; 
 - END_IF 
- ELSE
- SymbolicServiceRequest.GENERAL_STATUS := CIP_Object.GeneralStatus.PATH_SEGMENT_ERROR; 
END_IF
- IF itfCallback <> 0 THEN
- itfCallback.ServiceResponse(uiServiceCode := uiServiceCode, pData := pResponseData, uiDataSize := uiResponseSize, pRequest := pRequest, strStatus := SymbolicServiceRequest); 
END_IF
- InOut:
- Scope - Name - Type - Comment - Return - SymbolicServiceRequest- Input - uiServiceCode- UINT- ID from the service to execute - pSymbolicPath- POINTER TO BYTE - Pointer to data which points to the symbolic path - pData- POINTER TO BYTE - Pointer to data which points to the value - uiDataSize- UINT- Size of the memory specified by pData - pRequest- POINTER TO CIP_ENC.EncapsulationPacket - Inputs for response callback - itfCallback