diff -r 03df7946c2fa -r b217fb367574 C_runtime/erpc_PLCObject_server.cpp --- a/C_runtime/erpc_PLCObject_server.cpp Tue Nov 19 23:52:04 2024 +0100 +++ b/C_runtime/erpc_PLCObject_server.cpp Fri Nov 22 16:31:51 2024 +0100 @@ -1,5 +1,5 @@ /* - * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024. + * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024. * * AUTOGENERATED - DO NOT EDIT */ @@ -501,6 +501,12 @@ break; } + case BeremizPLCObjectService_interface::m_ExtendedCallId: + { + erpcStatus = ExtendedCall_shim(codec, messageFactory, transport, sequence); + break; + } + default: { erpcStatus = kErpcStatus_InvalidArgument; @@ -1313,3 +1319,92 @@ return err; } + +// Server shim for ExtendedCall of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::ExtendedCall_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + char * method = NULL; + binary_t *argument = NULL; + argument = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (argument == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + binary_t *answer = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + { + uint32_t method_len; + char * method_local; + codec->readString(method_len, &method_local); + method = (char*) erpc_malloc((method_len + 1) * sizeof(char)); + if ((method == NULL) || (method_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(method, method_local, method_len); + (method)[method_len] = 0; + } + } + + read_binary_t_struct(codec, argument); + + answer = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (answer == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->ExtendedCall(method, argument, answer); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ExtendedCallId, sequence); + + write_binary_t_struct(codec, answer); + + codec->write(result); + + err = codec->getStatus(); + } + + erpc_free(method); + + if (argument) + { + free_binary_t_struct(argument); + } + erpc_free(argument); + + if (answer) + { + free_binary_t_struct(answer); + } + erpc_free(answer); + + return err; +}