Configuration | Acyclic communication via Explicit Messaging END_IF END_IF 10: //new Ind from EthIp-Drv received response.resHdr.nServiceCode := request.reqHdr.nServiceCode OR CONST.CN_SC_REPLY_MASK; response.resHdr.nGeneralStatus := 0; response.resHdr.nAdditionalStatus := 0; response.resHdr.nDataLen := 0; IF request.reqHdr.nServiceCode = CONST.CN_SC_GET_ATTR_SINGLE OR request.reqHdr.nServiceCode = CONS T.CN_SC_SET_ATTR_SINGLE THEN i:=11; ELSE response.resHdr.nGeneralStatus := CONST.CN_GRC_BAD_SERVICE; nResponseLen := SIZEOF(response.resHdr); i:=20; END_IF 11: //case decision for request CASE request.reqHdr.nClassId OF 16#1000:
//erlaubte Beispiel Class 0x10000 CASE request.reqHdr.nInstanceId OF 16#1: //erlaubte Beispiel Instance 0x1 CASE request.reqHdr.nAttributeId OF // Attributes 1-4 erlaubt; only attr 4 is settable 1,2,3: IF request.reqHdr.nServiceCode = CONST.CN_SC_SET_ATTR_SINGLE THEN response.resHdr.nGeneralStatus := CONST.CN_GRC_ATTR_NOT_SETTABLE; nResponseLen := SIZEOF(response.resHdr); i:=20; ELSE i:=12; END_IF 4:
IF request.reqHdr.nServiceCode = CONST.CN_SC_SET_ATTR_SINGLE THEN i:=14; ELSE i:=12; END_IF ELSE response.resHdr.nGeneralStatus := CONST.CN_GRC_UNDEFINED_ATTR; nResponseLen := SIZEOF(response.resHdr); i:=20; END_CASE ELSE response.resHdr.nGeneralStatus := CONST.CN_GRC_BAD_CLASS_INSTANCE; nResponseLen := SIZEOF(response.resHdr); i:=20; END_CASE ELSE response.resHdr.nGeneralStatus := CONST.CN_GRC_BAD_CLASS_INSTANCE; nResponseLen := SIZEOF(response.resHdr); i:=20; END_CASE 12:
//GetAttribute response.resHdr.nGeneralStatus := CONST.CN_GRC_SUCCESS; MEMCPY(ADR(response.resData), ADR(Attributes[request.reqHdr.nAttributeId]), SIZEOF(Attributes[requ est.reqHdr.nAttributeId])); response.resHdr.nDataLen := INT_TO_UINT(LEN(Attributes[request.reqHdr.nAttributeId])); nResponseLen := UDINT_TO_UINT(response.resHdr.nDataLen) + SIZEOF(response.resHdr); i:=20; 14: //SetAttribute response.resHdr.nGeneralStatus := CONST.CN_GRC_SUCCESS; IF request.reqHdr.nDataLen MEMCPY(ADR(Attributes[request.reqHdr.nAttributeId]), ADR(request.reqData), request.reqHdr.nDat aLen); ELSE response.resHdr.nGeneralStatus := CONST.CN_GRC_BAD_DATA; END_IF nResponseLen := SIZEOF(response.resHdr); i:=20; 20:
//response to Ethernet/IP-driver fbAdsRdWrRes( NETID:= fbADSRDWRTINDEX.NETID , PORT:= fbADSRDWRTINDEX.PORT , INVOKEID:= fbADSRDWRTINDEX.INVOKEID , RESULT:=nAdsResult , LEN:=nResponseLen, DATAADDR:=ADR(Response) , RESPOND:=TRUE ); TF6281 46 Version: 1.9.0