edouard@4058: /* edouard@4058: * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. edouard@4058: * edouard@4058: * AUTOGENERATED - DO NOT EDIT edouard@4058: */ edouard@4058: edouard@4058: edouard@4058: #include "erpc_PLCObject_server.hpp" edouard@4058: #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC edouard@4058: #include edouard@4058: #include "erpc_port.h" edouard@4058: #endif edouard@4058: #include "erpc_manually_constructed.hpp" edouard@4058: edouard@4058: #if 11300 != ERPC_VERSION_NUMBER edouard@4058: #error "The generated shim code version is different to the rest of eRPC code." edouard@4058: #endif edouard@4058: edouard@4058: using namespace erpc; edouard@4058: using namespace std; edouard@4058: using namespace erpcShim; edouard@4058: edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: extern bool nestingDetection; edouard@4058: #endif edouard@4058: edouard@4058: edouard@4058: //! @brief Function to read struct binary_t edouard@4058: static void read_binary_t_struct(erpc::Codec * codec, binary_t * data); edouard@4058: edouard@4058: //! @brief Function to read struct extra_file edouard@4058: static void read_extra_file_struct(erpc::Codec * codec, extra_file * data); edouard@4058: edouard@4058: //! @brief Function to read struct list_extra_file_1_t edouard@4058: static void read_list_extra_file_1_t_struct(erpc::Codec * codec, list_extra_file_1_t * data); edouard@4058: edouard@4058: //! @brief Function to read struct trace_order edouard@4058: static void read_trace_order_struct(erpc::Codec * codec, trace_order * data); edouard@4058: edouard@4058: //! @brief Function to read struct list_trace_order_1_t edouard@4058: static void read_list_trace_order_1_t_struct(erpc::Codec * codec, list_trace_order_1_t * data); edouard@4058: edouard@4058: edouard@4058: // Read struct binary_t function implementation edouard@4058: static void read_binary_t_struct(erpc::Codec * codec, binary_t * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: uint8_t * data_local; edouard@4058: codec->readBinary(data->dataLength, &data_local); edouard@4058: if (data->dataLength > 0) edouard@4058: { edouard@4058: data->data = (uint8_t *) erpc_malloc(data->dataLength * sizeof(uint8_t)); edouard@4058: if (data->data == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: else edouard@4058: { edouard@4058: memcpy(data->data, data_local, data->dataLength); edouard@4058: } edouard@4058: } edouard@4058: else edouard@4058: { edouard@4058: data->data = NULL; edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: // Read struct extra_file function implementation edouard@4058: static void read_extra_file_struct(erpc::Codec * codec, extra_file * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: { edouard@4058: uint32_t fname_len; edouard@4058: char * fname_local; edouard@4058: codec->readString(fname_len, &fname_local); edouard@4058: data->fname = (char*) erpc_malloc((fname_len + 1) * sizeof(char)); edouard@4058: if ((data->fname == NULL) || (fname_local == NULL)) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: else edouard@4058: { edouard@4058: memcpy(data->fname, fname_local, fname_len); edouard@4058: (data->fname)[fname_len] = 0; edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: read_binary_t_struct(codec, &(data->blobID)); edouard@4058: } edouard@4058: edouard@4058: // Read struct list_extra_file_1_t function implementation edouard@4058: static void read_list_extra_file_1_t_struct(erpc::Codec * codec, list_extra_file_1_t * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->startReadList(data->elementsCount); edouard@4058: data->elements = (extra_file *) erpc_malloc(data->elementsCount * sizeof(extra_file)); edouard@4058: if ((data->elements == NULL) && (data->elementsCount > 0)) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) edouard@4058: { edouard@4058: read_extra_file_struct(codec, &(data->elements[listCount])); edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: // Read struct trace_order function implementation edouard@4058: static void read_trace_order_struct(erpc::Codec * codec, trace_order * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->read(data->idx); edouard@4058: edouard@4058: read_binary_t_struct(codec, &(data->force)); edouard@4058: } edouard@4058: edouard@4058: // Read struct list_trace_order_1_t function implementation edouard@4058: static void read_list_trace_order_1_t_struct(erpc::Codec * codec, list_trace_order_1_t * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->startReadList(data->elementsCount); edouard@4058: data->elements = (trace_order *) erpc_malloc(data->elementsCount * sizeof(trace_order)); edouard@4058: if ((data->elements == NULL) && (data->elementsCount > 0)) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) edouard@4058: { edouard@4058: read_trace_order_struct(codec, &(data->elements[listCount])); edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: edouard@4058: //! @brief Function to write struct binary_t edouard@4058: static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data); edouard@4058: edouard@4058: //! @brief Function to write struct log_message edouard@4058: static void write_log_message_struct(erpc::Codec * codec, const log_message * data); edouard@4058: edouard@4058: //! @brief Function to write struct PSKID edouard@4058: static void write_PSKID_struct(erpc::Codec * codec, const PSKID * data); edouard@4058: edouard@4058: //! @brief Function to write struct PLCstatus edouard@4058: static void write_PLCstatus_struct(erpc::Codec * codec, const PLCstatus * data); edouard@4058: edouard@4058: //! @brief Function to write struct trace_sample edouard@4058: static void write_trace_sample_struct(erpc::Codec * codec, const trace_sample * data); edouard@4058: edouard@4058: //! @brief Function to write struct TraceVariables edouard@4058: static void write_TraceVariables_struct(erpc::Codec * codec, const TraceVariables * data); edouard@4058: edouard@4058: //! @brief Function to write struct list_trace_sample_1_t edouard@4058: static void write_list_trace_sample_1_t_struct(erpc::Codec * codec, const list_trace_sample_1_t * data); edouard@4058: edouard@4058: edouard@4058: // Write struct binary_t function implementation edouard@4058: static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->writeBinary(data->dataLength, data->data); edouard@4058: } edouard@4058: edouard@4058: // Write struct log_message function implementation edouard@4058: static void write_log_message_struct(erpc::Codec * codec, const log_message * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: { edouard@4058: uint32_t msg_len = strlen((const char*)data->msg); edouard@4058: edouard@4058: codec->writeString(msg_len, (const char*)data->msg); edouard@4058: } edouard@4058: edouard@4058: codec->write(data->tick); edouard@4058: edouard@4058: codec->write(data->sec); edouard@4058: edouard@4058: codec->write(data->nsec); edouard@4058: } edouard@4058: edouard@4058: // Write struct PSKID function implementation edouard@4058: static void write_PSKID_struct(erpc::Codec * codec, const PSKID * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: { edouard@4058: uint32_t ID_len = strlen((const char*)data->ID); edouard@4058: edouard@4058: codec->writeString(ID_len, (const char*)data->ID); edouard@4058: } edouard@4058: edouard@4058: { edouard@4058: uint32_t PSK_len = strlen((const char*)data->PSK); edouard@4058: edouard@4058: codec->writeString(PSK_len, (const char*)data->PSK); edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: // Write struct PLCstatus function implementation edouard@4058: static void write_PLCstatus_struct(erpc::Codec * codec, const PLCstatus * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->write(static_cast(data->PLCstatus)); edouard@4058: edouard@4058: for (uint32_t arrayCount0 = 0U; arrayCount0 < 4U; ++arrayCount0) edouard@4058: { edouard@4058: codec->write(data->logcounts[arrayCount0]); edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: // Write struct trace_sample function implementation edouard@4058: static void write_trace_sample_struct(erpc::Codec * codec, const trace_sample * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->write(data->tick); edouard@4058: edouard@4058: write_binary_t_struct(codec, &(data->TraceBuffer)); edouard@4058: } edouard@4058: edouard@4058: // Write struct TraceVariables function implementation edouard@4058: static void write_TraceVariables_struct(erpc::Codec * codec, const TraceVariables * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->write(static_cast(data->PLCstatus)); edouard@4058: edouard@4058: write_list_trace_sample_1_t_struct(codec, &(data->traces)); edouard@4058: } edouard@4058: edouard@4058: // Write struct list_trace_sample_1_t function implementation edouard@4058: static void write_list_trace_sample_1_t_struct(erpc::Codec * codec, const list_trace_sample_1_t * data) edouard@4058: { edouard@4058: if(NULL == data) edouard@4058: { edouard@4058: return; edouard@4058: } edouard@4058: edouard@4058: codec->startWriteList(data->elementsCount); edouard@4058: for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) edouard@4058: { edouard@4058: write_trace_sample_struct(codec, &(data->elements[listCount])); edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct binary_t edouard@4058: static void free_binary_t_struct(binary_t * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct log_message edouard@4058: static void free_log_message_struct(log_message * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct PSKID edouard@4058: static void free_PSKID_struct(PSKID * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct trace_sample edouard@4058: static void free_trace_sample_struct(trace_sample * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct TraceVariables edouard@4058: static void free_TraceVariables_struct(TraceVariables * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct list_trace_sample_1_t edouard@4058: static void free_list_trace_sample_1_t_struct(list_trace_sample_1_t * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct extra_file edouard@4058: static void free_extra_file_struct(extra_file * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct list_extra_file_1_t edouard@4058: static void free_list_extra_file_1_t_struct(list_extra_file_1_t * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct trace_order edouard@4058: static void free_trace_order_struct(trace_order * data); edouard@4058: edouard@4058: //! @brief Function to free space allocated inside struct list_trace_order_1_t edouard@4058: static void free_list_trace_order_1_t_struct(list_trace_order_1_t * data); edouard@4058: edouard@4058: edouard@4058: // Free space allocated inside struct binary_t function implementation edouard@4058: static void free_binary_t_struct(binary_t * data) edouard@4058: { edouard@4058: erpc_free(data->data); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct log_message function implementation edouard@4058: static void free_log_message_struct(log_message * data) edouard@4058: { edouard@4058: erpc_free(data->msg); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct PSKID function implementation edouard@4058: static void free_PSKID_struct(PSKID * data) edouard@4058: { edouard@4058: erpc_free(data->ID); edouard@4058: edouard@4058: erpc_free(data->PSK); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct trace_sample function implementation edouard@4058: static void free_trace_sample_struct(trace_sample * data) edouard@4058: { edouard@4058: free_binary_t_struct(&data->TraceBuffer); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct TraceVariables function implementation edouard@4058: static void free_TraceVariables_struct(TraceVariables * data) edouard@4058: { edouard@4058: free_list_trace_sample_1_t_struct(&data->traces); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct list_trace_sample_1_t function implementation edouard@4058: static void free_list_trace_sample_1_t_struct(list_trace_sample_1_t * data) edouard@4058: { edouard@4058: for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) edouard@4058: { edouard@4058: free_trace_sample_struct(&data->elements[listCount]); edouard@4058: } edouard@4058: edouard@4058: erpc_free(data->elements); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct extra_file function implementation edouard@4058: static void free_extra_file_struct(extra_file * data) edouard@4058: { edouard@4058: erpc_free(data->fname); edouard@4058: edouard@4058: free_binary_t_struct(&data->blobID); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct list_extra_file_1_t function implementation edouard@4058: static void free_list_extra_file_1_t_struct(list_extra_file_1_t * data) edouard@4058: { edouard@4058: for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) edouard@4058: { edouard@4058: free_extra_file_struct(&data->elements[listCount]); edouard@4058: } edouard@4058: edouard@4058: erpc_free(data->elements); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct trace_order function implementation edouard@4058: static void free_trace_order_struct(trace_order * data) edouard@4058: { edouard@4058: free_binary_t_struct(&data->force); edouard@4058: } edouard@4058: edouard@4058: // Free space allocated inside struct list_trace_order_1_t function implementation edouard@4058: static void free_list_trace_order_1_t_struct(list_trace_order_1_t * data) edouard@4058: { edouard@4058: for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) edouard@4058: { edouard@4058: free_trace_order_struct(&data->elements[listCount]); edouard@4058: } edouard@4058: edouard@4058: erpc_free(data->elements); edouard@4058: } edouard@4058: edouard@4058: edouard@4058: edouard@4058: BeremizPLCObjectService_service::BeremizPLCObjectService_service(BeremizPLCObjectService_interface *_BeremizPLCObjectService_interface) edouard@4058: : erpc::Service(BeremizPLCObjectService_interface::m_serviceId) edouard@4058: , m_handler(_BeremizPLCObjectService_interface) edouard@4058: { edouard@4058: } edouard@4058: edouard@4058: BeremizPLCObjectService_service::~BeremizPLCObjectService_service() edouard@4058: { edouard@4058: } edouard@4058: edouard@4058: // return service interface handler. edouard@4058: BeremizPLCObjectService_interface* BeremizPLCObjectService_service::getHandler(void) edouard@4058: { edouard@4058: return m_handler; edouard@4058: } edouard@4058: edouard@4058: // Call the correct server shim based on method unique ID. edouard@4058: erpc_status_t BeremizPLCObjectService_service::handleInvocation(uint32_t methodId, uint32_t sequence, Codec * codec, MessageBufferFactory *messageFactory, Transport * transport) edouard@4058: { edouard@4058: erpc_status_t erpcStatus; edouard@4058: switch (methodId) edouard@4058: { edouard@4058: case BeremizPLCObjectService_interface::m_AppendChunkToBlobId: edouard@4058: { edouard@4058: erpcStatus = AppendChunkToBlob_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_GetLogMessageId: edouard@4058: { edouard@4058: erpcStatus = GetLogMessage_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_GetPLCIDId: edouard@4058: { edouard@4058: erpcStatus = GetPLCID_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_GetPLCstatusId: edouard@4058: { edouard@4058: erpcStatus = GetPLCstatus_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_GetTraceVariablesId: edouard@4058: { edouard@4058: erpcStatus = GetTraceVariables_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_MatchMD5Id: edouard@4058: { edouard@4058: erpcStatus = MatchMD5_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_NewPLCId: edouard@4058: { edouard@4058: erpcStatus = NewPLC_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_PurgeBlobsId: edouard@4058: { edouard@4058: erpcStatus = PurgeBlobs_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_RepairPLCId: edouard@4058: { edouard@4058: erpcStatus = RepairPLC_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_ResetLogCountId: edouard@4058: { edouard@4058: erpcStatus = ResetLogCount_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_SeedBlobId: edouard@4058: { edouard@4058: erpcStatus = SeedBlob_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_SetTraceVariablesListId: edouard@4058: { edouard@4058: erpcStatus = SetTraceVariablesList_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_StartPLCId: edouard@4058: { edouard@4058: erpcStatus = StartPLC_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_StopPLCId: edouard@4058: { edouard@4058: erpcStatus = StopPLC_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: case BeremizPLCObjectService_interface::m_ExtendedCallId: edouard@4058: { edouard@4058: erpcStatus = ExtendedCall_shim(codec, messageFactory, transport, sequence); edouard@4058: break; edouard@4058: } edouard@4058: edouard@4058: default: edouard@4058: { edouard@4058: erpcStatus = kErpcStatus_InvalidArgument; edouard@4058: break; edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: return erpcStatus; edouard@4058: } edouard@4058: edouard@4058: // Server shim for AppendChunkToBlob of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::AppendChunkToBlob_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: binary_t *data = NULL; edouard@4058: data = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (data == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: binary_t *blobID = NULL; edouard@4058: blobID = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (blobID == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: binary_t *newBlobID = NULL; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: read_binary_t_struct(codec, data); edouard@4058: edouard@4058: read_binary_t_struct(codec, blobID); edouard@4058: edouard@4058: newBlobID = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (newBlobID == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->AppendChunkToBlob(data, blobID, newBlobID); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_AppendChunkToBlobId, sequence); edouard@4058: edouard@4058: write_binary_t_struct(codec, newBlobID); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: if (data) edouard@4058: { edouard@4058: free_binary_t_struct(data); edouard@4058: } edouard@4058: erpc_free(data); edouard@4058: edouard@4058: if (blobID) edouard@4058: { edouard@4058: free_binary_t_struct(blobID); edouard@4058: } edouard@4058: erpc_free(blobID); edouard@4058: edouard@4058: if (newBlobID) edouard@4058: { edouard@4058: free_binary_t_struct(newBlobID); edouard@4058: } edouard@4058: erpc_free(newBlobID); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for GetLogMessage of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::GetLogMessage_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: uint8_t level; edouard@4058: uint32_t msgID; edouard@4058: log_message *message = NULL; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: codec->read(level); edouard@4058: edouard@4058: codec->read(msgID); edouard@4058: edouard@4058: message = (log_message *) erpc_malloc(sizeof(log_message)); edouard@4058: if (message == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->GetLogMessage(level, msgID, message); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetLogMessageId, sequence); edouard@4058: edouard@4058: write_log_message_struct(codec, message); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: if (message) edouard@4058: { edouard@4058: free_log_message_struct(message); edouard@4058: } edouard@4058: erpc_free(message); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for GetPLCID of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::GetPLCID_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: PSKID *plcID = NULL; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: plcID = (PSKID *) erpc_malloc(sizeof(PSKID)); edouard@4058: if (plcID == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->GetPLCID(plcID); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetPLCIDId, sequence); edouard@4058: edouard@4058: write_PSKID_struct(codec, plcID); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: if (plcID) edouard@4058: { edouard@4058: free_PSKID_struct(plcID); edouard@4058: } edouard@4058: erpc_free(plcID); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for GetPLCstatus of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::GetPLCstatus_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: PLCstatus *status = NULL; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: status = (PLCstatus *) erpc_malloc(sizeof(PLCstatus)); edouard@4058: if (status == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->GetPLCstatus(status); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetPLCstatusId, sequence); edouard@4058: edouard@4058: write_PLCstatus_struct(codec, status); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: erpc_free(status); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for GetTraceVariables of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::GetTraceVariables_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: uint32_t debugToken; edouard@4058: TraceVariables *traces = NULL; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: codec->read(debugToken); edouard@4058: edouard@4058: traces = (TraceVariables *) erpc_malloc(sizeof(TraceVariables)); edouard@4058: if (traces == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->GetTraceVariables(debugToken, traces); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetTraceVariablesId, sequence); edouard@4058: edouard@4058: write_TraceVariables_struct(codec, traces); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: if (traces) edouard@4058: { edouard@4058: free_TraceVariables_struct(traces); edouard@4058: } edouard@4058: erpc_free(traces); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for MatchMD5 of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::MatchMD5_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: char * MD5 = NULL; edouard@4058: bool match; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: { edouard@4058: uint32_t MD5_len; edouard@4058: char * MD5_local; edouard@4058: codec->readString(MD5_len, &MD5_local); edouard@4058: MD5 = (char*) erpc_malloc((MD5_len + 1) * sizeof(char)); edouard@4058: if ((MD5 == NULL) || (MD5_local == NULL)) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: else edouard@4058: { edouard@4058: memcpy(MD5, MD5_local, MD5_len); edouard@4058: (MD5)[MD5_len] = 0; edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->MatchMD5(MD5, &match); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_MatchMD5Id, sequence); edouard@4058: edouard@4058: codec->write(match); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: erpc_free(MD5); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for NewPLC of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::NewPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: char * md5sum = NULL; edouard@4058: binary_t *plcObjectBlobID = NULL; edouard@4058: plcObjectBlobID = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (plcObjectBlobID == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: list_extra_file_1_t *extrafiles = NULL; edouard@4058: extrafiles = (list_extra_file_1_t *) erpc_malloc(sizeof(list_extra_file_1_t)); edouard@4058: if (extrafiles == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: bool success; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: { edouard@4058: uint32_t md5sum_len; edouard@4058: char * md5sum_local; edouard@4058: codec->readString(md5sum_len, &md5sum_local); edouard@4058: md5sum = (char*) erpc_malloc((md5sum_len + 1) * sizeof(char)); edouard@4058: if ((md5sum == NULL) || (md5sum_local == NULL)) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: else edouard@4058: { edouard@4058: memcpy(md5sum, md5sum_local, md5sum_len); edouard@4058: (md5sum)[md5sum_len] = 0; edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: read_binary_t_struct(codec, plcObjectBlobID); edouard@4058: edouard@4058: read_list_extra_file_1_t_struct(codec, extrafiles); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->NewPLC(md5sum, plcObjectBlobID, extrafiles, &success); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_NewPLCId, sequence); edouard@4058: edouard@4058: codec->write(success); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: erpc_free(md5sum); edouard@4058: edouard@4058: if (plcObjectBlobID) edouard@4058: { edouard@4058: free_binary_t_struct(plcObjectBlobID); edouard@4058: } edouard@4058: erpc_free(plcObjectBlobID); edouard@4058: edouard@4058: if (extrafiles) edouard@4058: { edouard@4058: free_list_extra_file_1_t_struct(extrafiles); edouard@4058: } edouard@4058: erpc_free(extrafiles); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for PurgeBlobs of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::PurgeBlobs_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->PurgeBlobs(); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_PurgeBlobsId, sequence); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for RepairPLC of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::RepairPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->RepairPLC(); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_RepairPLCId, sequence); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for ResetLogCount of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::ResetLogCount_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->ResetLogCount(); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ResetLogCountId, sequence); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for SeedBlob of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::SeedBlob_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: binary_t *seed = NULL; edouard@4058: seed = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (seed == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: binary_t *blobID = NULL; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: read_binary_t_struct(codec, seed); edouard@4058: edouard@4058: blobID = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (blobID == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->SeedBlob(seed, blobID); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_SeedBlobId, sequence); edouard@4058: edouard@4058: write_binary_t_struct(codec, blobID); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: if (seed) edouard@4058: { edouard@4058: free_binary_t_struct(seed); edouard@4058: } edouard@4058: erpc_free(seed); edouard@4058: edouard@4058: if (blobID) edouard@4058: { edouard@4058: free_binary_t_struct(blobID); edouard@4058: } edouard@4058: erpc_free(blobID); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for SetTraceVariablesList of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::SetTraceVariablesList_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: list_trace_order_1_t *orders = NULL; edouard@4058: orders = (list_trace_order_1_t *) erpc_malloc(sizeof(list_trace_order_1_t)); edouard@4058: if (orders == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: int32_t debugtoken; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: read_list_trace_order_1_t_struct(codec, orders); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->SetTraceVariablesList(orders, &debugtoken); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_SetTraceVariablesListId, sequence); edouard@4058: edouard@4058: codec->write(debugtoken); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: if (orders) edouard@4058: { edouard@4058: free_list_trace_order_1_t_struct(orders); edouard@4058: } edouard@4058: erpc_free(orders); edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for StartPLC of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::StartPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->StartPLC(); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_StartPLCId, sequence); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for StopPLC of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::StopPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: bool success; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->StopPLC(&success); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_StopPLCId, sequence); edouard@4058: edouard@4058: codec->write(success); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: return err; edouard@4058: } edouard@4058: edouard@4058: // Server shim for ExtendedCall of BeremizPLCObjectService interface. edouard@4058: erpc_status_t BeremizPLCObjectService_service::ExtendedCall_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) edouard@4058: { edouard@4058: erpc_status_t err = kErpcStatus_Success; edouard@4058: edouard@4058: char * method = NULL; edouard@4058: binary_t *argument = NULL; edouard@4058: argument = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (argument == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: binary_t *answer = NULL; edouard@4058: uint32_t result; edouard@4058: edouard@4058: // startReadMessage() was already called before this shim was invoked. edouard@4058: edouard@4058: { edouard@4058: uint32_t method_len; edouard@4058: char * method_local; edouard@4058: codec->readString(method_len, &method_local); edouard@4058: method = (char*) erpc_malloc((method_len + 1) * sizeof(char)); edouard@4058: if ((method == NULL) || (method_local == NULL)) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: else edouard@4058: { edouard@4058: memcpy(method, method_local, method_len); edouard@4058: (method)[method_len] = 0; edouard@4058: } edouard@4058: } edouard@4058: edouard@4058: read_binary_t_struct(codec, argument); edouard@4058: edouard@4058: answer = (binary_t *) erpc_malloc(sizeof(binary_t)); edouard@4058: if (answer == NULL) edouard@4058: { edouard@4058: codec->updateStatus(kErpcStatus_MemoryError); edouard@4058: } edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // Invoke the actual served function. edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = true; edouard@4058: #endif edouard@4058: result = m_handler->ExtendedCall(method, argument, answer); edouard@4058: #if ERPC_NESTED_CALLS_DETECTION edouard@4058: nestingDetection = false; edouard@4058: #endif edouard@4058: edouard@4058: // preparing MessageBuffer for serializing data edouard@4058: err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); edouard@4058: } edouard@4058: edouard@4058: if (err == kErpcStatus_Success) edouard@4058: { edouard@4058: // preparing codec for serializing data edouard@4058: codec->reset(transport->reserveHeaderSize()); edouard@4058: edouard@4058: // Build response message. edouard@4058: codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ExtendedCallId, sequence); edouard@4058: edouard@4058: write_binary_t_struct(codec, answer); edouard@4058: edouard@4058: codec->write(result); edouard@4058: edouard@4058: err = codec->getStatus(); edouard@4058: } edouard@4058: edouard@4058: erpc_free(method); edouard@4058: edouard@4058: if (argument) edouard@4058: { edouard@4058: free_binary_t_struct(argument); edouard@4058: } edouard@4058: erpc_free(argument); edouard@4058: edouard@4058: if (answer) edouard@4058: { edouard@4058: free_binary_t_struct(answer); edouard@4058: } edouard@4058: erpc_free(answer); edouard@4058: edouard@4058: return err; edouard@4058: }