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