# HG changeset patch # User Edouard Tisserant # Date 1733257612 -3600 # Node ID 5472b88bbc9d8a1b7cd819fb1064f67721d59b61 # Parent cf42c3dbdd5c0f155eef257cd620d28723ff15a6 C runtime: move generated erpc interface in separate "service" directory diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/Makefile --- a/C_runtime/Makefile Tue Dec 03 21:22:45 2024 +0100 +++ b/C_runtime/Makefile Tue Dec 03 21:26:52 2024 +0100 @@ -17,6 +17,7 @@ $(ERPC_ROOT)/test/common/config \ $(ERPC_ROOT)/erpcgen/src \ $(BEREMIZ_ROOT)/targets \ + $(RUNTIME_ROOT)/service \ $(MATIEC_ROOT)/lib/C INCLUDES := $(foreach includes, $(INCLUDES), -I $(includes)) @@ -42,9 +43,9 @@ $(ERPC_C_ROOT)/transports/erpc_serial_transport.cpp \ $(ERPC_C_ROOT)/transports/erpc_tcp_transport.cpp -SOURCES += $(RUNTIME_ROOT)/erpc_PLCObject_client.cpp \ - $(RUNTIME_ROOT)/erpc_PLCObject_interface.cpp \ - $(RUNTIME_ROOT)/erpc_PLCObject_server.cpp \ +SOURCES += $(RUNTIME_ROOT)/service/erpc_PLCObject_client.cpp \ + $(RUNTIME_ROOT)/service/erpc_PLCObject_interface.cpp \ + $(RUNTIME_ROOT)/service/erpc_PLCObject_server.cpp \ $(RUNTIME_ROOT)/md5.cpp \ $(RUNTIME_ROOT)/blob.cpp \ $(RUNTIME_ROOT)/posix_main.cpp \ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/c_erpc_PLCObject_client.cpp --- a/C_runtime/c_erpc_PLCObject_client.cpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#include "c_erpc_PLCObject_client.h" -#include "erpc_PLCObject_client.hpp" -#include "erpc_manually_constructed.hpp" - -using namespace erpc; -using namespace std; -using namespace erpcShim; - - -#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC -BeremizPLCObjectService_client *s_BeremizPLCObjectService_client = nullptr; -#else -ERPC_MANUALLY_CONSTRUCTED_STATIC(BeremizPLCObjectService_client, s_BeremizPLCObjectService_client); -#endif - -uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->AppendChunkToBlob(data, blobID, newBlobID); - - return result; -} - -uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->GetLogMessage(level, msgID, message); - - return result; -} - -uint32_t GetPLCID(PSKID * plcID) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->GetPLCID(plcID); - - return result; -} - -uint32_t GetPLCstatus(PLCstatus * status) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->GetPLCstatus(status); - - return result; -} - -uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->GetTraceVariables(debugToken, traces); - - return result; -} - -uint32_t MatchMD5(const char * MD5, bool * match) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->MatchMD5(MD5, match); - - return result; -} - -uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->NewPLC(md5sum, plcObjectBlobID, extrafiles, success); - - return result; -} - -uint32_t PurgeBlobs(void) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->PurgeBlobs(); - - return result; -} - -uint32_t RepairPLC(void) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->RepairPLC(); - - return result; -} - -uint32_t ResetLogCount(void) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->ResetLogCount(); - - return result; -} - -uint32_t SeedBlob(const binary_t * seed, binary_t * blobID) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->SeedBlob(seed, blobID); - - return result; -} - -uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->SetTraceVariablesList(orders, debugtoken); - - return result; -} - -uint32_t StartPLC(void) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->StartPLC(); - - return result; -} - -uint32_t StopPLC(bool * success) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->StopPLC(success); - - return result; -} - -uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) -{ - uint32_t result; - result = s_BeremizPLCObjectService_client->ExtendedCall(method, argument, answer); - - return result; -} - -void initBeremizPLCObjectService_client(erpc_client_t client) -{ -#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - erpc_assert(s_BeremizPLCObjectService_client == nullptr); - s_BeremizPLCObjectService_client = new BeremizPLCObjectService_client(reinterpret_cast(client)); -#else - erpc_assert(!s_BeremizPLCObjectService_client.isUsed()); - s_BeremizPLCObjectService_client.construct(reinterpret_cast(client)); -#endif -} - -void deinitBeremizPLCObjectService_client(void) -{ -#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - if (s_BeremizPLCObjectService_client != nullptr) - { - delete s_BeremizPLCObjectService_client; - s_BeremizPLCObjectService_client = nullptr; - } -#else - s_BeremizPLCObjectService_client.destroy(); -#endif -} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/c_erpc_PLCObject_client.h --- a/C_runtime/c_erpc_PLCObject_client.h Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if !defined(_c_erpc_PLCObject_client_h_) -#define _c_erpc_PLCObject_client_h_ - -#include "erpc_PLCObject_common.h" -#include "erpc_client_manager.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if !defined(ERPC_FUNCTIONS_DEFINITIONS) -#define ERPC_FUNCTIONS_DEFINITIONS - - -/*! @brief BeremizPLCObjectService identifiers */ -enum _BeremizPLCObjectService_ids -{ - kBeremizPLCObjectService_service_id = 1, - kBeremizPLCObjectService_AppendChunkToBlob_id = 1, - kBeremizPLCObjectService_GetLogMessage_id = 2, - kBeremizPLCObjectService_GetPLCID_id = 3, - kBeremizPLCObjectService_GetPLCstatus_id = 4, - kBeremizPLCObjectService_GetTraceVariables_id = 5, - kBeremizPLCObjectService_MatchMD5_id = 6, - kBeremizPLCObjectService_NewPLC_id = 7, - kBeremizPLCObjectService_PurgeBlobs_id = 8, - kBeremizPLCObjectService_RepairPLC_id = 9, - kBeremizPLCObjectService_ResetLogCount_id = 10, - kBeremizPLCObjectService_SeedBlob_id = 11, - kBeremizPLCObjectService_SetTraceVariablesList_id = 12, - kBeremizPLCObjectService_StartPLC_id = 13, - kBeremizPLCObjectService_StopPLC_id = 14, - kBeremizPLCObjectService_ExtendedCall_id = 15, -}; - -//! @name BeremizPLCObjectService -//@{ -uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID); - -uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message); - -uint32_t GetPLCID(PSKID * plcID); - -uint32_t GetPLCstatus(PLCstatus * status); - -uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces); - -uint32_t MatchMD5(const char * MD5, bool * match); - -uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success); - -uint32_t PurgeBlobs(void); - -uint32_t RepairPLC(void); - -uint32_t ResetLogCount(void); - -uint32_t SeedBlob(const binary_t * seed, binary_t * blobID); - -uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken); - -uint32_t StartPLC(void); - -uint32_t StopPLC(bool * success); - -uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer); -//@} - -#endif // ERPC_FUNCTIONS_DEFINITIONS - -void initBeremizPLCObjectService_client(erpc_client_t client); - -void deinitBeremizPLCObjectService_client(void); - -#if defined(__cplusplus) -} -#endif - -#endif // _c_erpc_PLCObject_client_h_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/c_erpc_PLCObject_server.cpp --- a/C_runtime/c_erpc_PLCObject_server.cpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#include -#include "c_erpc_PLCObject_server.h" -#include "erpc_PLCObject_server.hpp" -#include "erpc_manually_constructed.hpp" - -using namespace erpc; -using namespace std; -using namespace erpcShim; - - -class BeremizPLCObjectService_server: public BeremizPLCObjectService_interface -{ - public: - virtual ~BeremizPLCObjectService_server() {}; - - - uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) - { - uint32_t result; - result = ::AppendChunkToBlob(data, blobID, newBlobID); - - return result; - } - - uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) - { - uint32_t result; - result = ::GetLogMessage(level, msgID, message); - - return result; - } - - uint32_t GetPLCID(PSKID * plcID) - { - uint32_t result; - result = ::GetPLCID(plcID); - - return result; - } - - uint32_t GetPLCstatus(PLCstatus * status) - { - uint32_t result; - result = ::GetPLCstatus(status); - - return result; - } - - uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces) - { - uint32_t result; - result = ::GetTraceVariables(debugToken, traces); - - return result; - } - - uint32_t MatchMD5(const char * MD5, bool * match) - { - uint32_t result; - result = ::MatchMD5(MD5, match); - - return result; - } - - uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) - { - uint32_t result; - result = ::NewPLC(md5sum, plcObjectBlobID, extrafiles, success); - - return result; - } - - uint32_t PurgeBlobs(void) - { - uint32_t result; - result = ::PurgeBlobs(); - - return result; - } - - uint32_t RepairPLC(void) - { - uint32_t result; - result = ::RepairPLC(); - - return result; - } - - uint32_t ResetLogCount(void) - { - uint32_t result; - result = ::ResetLogCount(); - - return result; - } - - uint32_t SeedBlob(const binary_t * seed, binary_t * blobID) - { - uint32_t result; - result = ::SeedBlob(seed, blobID); - - return result; - } - - uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) - { - uint32_t result; - result = ::SetTraceVariablesList(orders, debugtoken); - - return result; - } - - uint32_t StartPLC(void) - { - uint32_t result; - result = ::StartPLC(); - - return result; - } - - uint32_t StopPLC(bool * success) - { - uint32_t result; - result = ::StopPLC(success); - - return result; - } - - uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) - { - uint32_t result; - result = ::ExtendedCall(method, argument, answer); - - return result; - } -}; - -ERPC_MANUALLY_CONSTRUCTED_STATIC(BeremizPLCObjectService_service, s_BeremizPLCObjectService_service); -ERPC_MANUALLY_CONSTRUCTED_STATIC(BeremizPLCObjectService_server, s_BeremizPLCObjectService_server); - -erpc_service_t create_BeremizPLCObjectService_service(void) -{ - erpc_service_t service; - -#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - service = new (nothrow) BeremizPLCObjectService_service(new (nothrow)BeremizPLCObjectService_server()); -#else - if (s_BeremizPLCObjectService_service.isUsed()) - { - service = NULL; - } - else - { - s_BeremizPLCObjectService_server.construct(); - s_BeremizPLCObjectService_service.construct(s_BeremizPLCObjectService_server.get()); - service = s_BeremizPLCObjectService_service.get(); - } -#endif - - return service; -} - -void destroy_BeremizPLCObjectService_service(erpc_service_t service) -{ -#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - if (service) - { - delete (BeremizPLCObjectService_server *)(((BeremizPLCObjectService_service *)service)->getHandler()); - delete (BeremizPLCObjectService_service *)service; - } -#else - (void)service; - erpc_assert(service == s_BeremizPLCObjectService_service.get()); - s_BeremizPLCObjectService_service.destroy(); - s_BeremizPLCObjectService_server.destroy(); -#endif -} - diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/c_erpc_PLCObject_server.h --- a/C_runtime/c_erpc_PLCObject_server.h Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if !defined(_c_erpc_PLCObject_server_h_) -#define _c_erpc_PLCObject_server_h_ - -#include "erpc_PLCObject_common.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -typedef void * erpc_service_t; - -#if !defined(ERPC_FUNCTIONS_DEFINITIONS) -#define ERPC_FUNCTIONS_DEFINITIONS - - -/*! @brief BeremizPLCObjectService identifiers */ -enum _BeremizPLCObjectService_ids -{ - kBeremizPLCObjectService_service_id = 1, - kBeremizPLCObjectService_AppendChunkToBlob_id = 1, - kBeremizPLCObjectService_GetLogMessage_id = 2, - kBeremizPLCObjectService_GetPLCID_id = 3, - kBeremizPLCObjectService_GetPLCstatus_id = 4, - kBeremizPLCObjectService_GetTraceVariables_id = 5, - kBeremizPLCObjectService_MatchMD5_id = 6, - kBeremizPLCObjectService_NewPLC_id = 7, - kBeremizPLCObjectService_PurgeBlobs_id = 8, - kBeremizPLCObjectService_RepairPLC_id = 9, - kBeremizPLCObjectService_ResetLogCount_id = 10, - kBeremizPLCObjectService_SeedBlob_id = 11, - kBeremizPLCObjectService_SetTraceVariablesList_id = 12, - kBeremizPLCObjectService_StartPLC_id = 13, - kBeremizPLCObjectService_StopPLC_id = 14, - kBeremizPLCObjectService_ExtendedCall_id = 15, -}; - -//! @name BeremizPLCObjectService -//@{ -uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID); - -uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message); - -uint32_t GetPLCID(PSKID * plcID); - -uint32_t GetPLCstatus(PLCstatus * status); - -uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces); - -uint32_t MatchMD5(const char * MD5, bool * match); - -uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success); - -uint32_t PurgeBlobs(void); - -uint32_t RepairPLC(void); - -uint32_t ResetLogCount(void); - -uint32_t SeedBlob(const binary_t * seed, binary_t * blobID); - -uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken); - -uint32_t StartPLC(void); - -uint32_t StopPLC(bool * success); - -uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer); -//@} - - -#endif // ERPC_FUNCTIONS_DEFINITIONS - -/*! @brief Return BeremizPLCObjectService_service service object. */ -erpc_service_t create_BeremizPLCObjectService_service(void); - -/*! @brief Destroy BeremizPLCObjectService_service service object. */ -void destroy_BeremizPLCObjectService_service(erpc_service_t service); - - -#if defined(__cplusplus) -} -#endif - -#endif // _c_erpc_PLCObject_server_h_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_client.cpp --- a/C_runtime/erpc_PLCObject_client.cpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1286 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC -#include "erpc_port.h" -#endif -#include "erpc_codec.hpp" -#include "erpc_PLCObject_client.hpp" -#include "erpc_manually_constructed.hpp" - -#if 11300 != ERPC_VERSION_NUMBER -#error "The generated shim code version is different to the rest of eRPC code." -#endif - -using namespace erpc; -using namespace std; -using namespace erpcShim; - -//! @brief Function to write struct binary_t -static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data); - -//! @brief Function to write struct extra_file -static void write_extra_file_struct(erpc::Codec * codec, const extra_file * data); - -//! @brief Function to write struct list_extra_file_1_t -static void write_list_extra_file_1_t_struct(erpc::Codec * codec, const list_extra_file_1_t * data); - -//! @brief Function to write struct trace_order -static void write_trace_order_struct(erpc::Codec * codec, const trace_order * data); - -//! @brief Function to write struct list_trace_order_1_t -static void write_list_trace_order_1_t_struct(erpc::Codec * codec, const list_trace_order_1_t * data); - - -// Write struct binary_t function implementation -static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data) -{ - if(NULL == data) - { - return; - } - - codec->writeBinary(data->dataLength, data->data); -} - -// Write struct extra_file function implementation -static void write_extra_file_struct(erpc::Codec * codec, const extra_file * data) -{ - if(NULL == data) - { - return; - } - - { - uint32_t fname_len = strlen((const char*)data->fname); - - codec->writeString(fname_len, (const char*)data->fname); - } - - write_binary_t_struct(codec, &(data->blobID)); -} - -// Write struct list_extra_file_1_t function implementation -static void write_list_extra_file_1_t_struct(erpc::Codec * codec, const list_extra_file_1_t * data) -{ - if(NULL == data) - { - return; - } - - codec->startWriteList(data->elementsCount); - for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) - { - write_extra_file_struct(codec, &(data->elements[listCount])); - } -} - -// Write struct trace_order function implementation -static void write_trace_order_struct(erpc::Codec * codec, const trace_order * data) -{ - if(NULL == data) - { - return; - } - - codec->write(data->idx); - - write_binary_t_struct(codec, &(data->force)); -} - -// Write struct list_trace_order_1_t function implementation -static void write_list_trace_order_1_t_struct(erpc::Codec * codec, const list_trace_order_1_t * data) -{ - if(NULL == data) - { - return; - } - - codec->startWriteList(data->elementsCount); - for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) - { - write_trace_order_struct(codec, &(data->elements[listCount])); - } -} - - -//! @brief Function to read struct binary_t -static void read_binary_t_struct(erpc::Codec * codec, binary_t * data); - -//! @brief Function to read struct log_message -static void read_log_message_struct(erpc::Codec * codec, log_message * data); - -//! @brief Function to read struct PSKID -static void read_PSKID_struct(erpc::Codec * codec, PSKID * data); - -//! @brief Function to read struct PLCstatus -static void read_PLCstatus_struct(erpc::Codec * codec, PLCstatus * data); - -//! @brief Function to read struct trace_sample -static void read_trace_sample_struct(erpc::Codec * codec, trace_sample * data); - -//! @brief Function to read struct TraceVariables -static void read_TraceVariables_struct(erpc::Codec * codec, TraceVariables * data); - -//! @brief Function to read struct list_trace_sample_1_t -static void read_list_trace_sample_1_t_struct(erpc::Codec * codec, list_trace_sample_1_t * data); - - -// Read struct binary_t function implementation -static void read_binary_t_struct(erpc::Codec * codec, binary_t * data) -{ - if(NULL == data) - { - return; - } - - uint8_t * data_local; - codec->readBinary(data->dataLength, &data_local); - if (data->dataLength > 0) - { - data->data = (uint8_t *) erpc_malloc(data->dataLength * sizeof(uint8_t)); - if (data->data == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(data->data, data_local, data->dataLength); - } - } - else - { - data->data = NULL; - } -} - -// Read struct log_message function implementation -static void read_log_message_struct(erpc::Codec * codec, log_message * data) -{ - if(NULL == data) - { - return; - } - - { - uint32_t msg_len; - char * msg_local; - codec->readString(msg_len, &msg_local); - data->msg = (char*) erpc_malloc((msg_len + 1) * sizeof(char)); - if ((data->msg == NULL) || (msg_local == NULL)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(data->msg, msg_local, msg_len); - (data->msg)[msg_len] = 0; - } - } - - codec->read(data->tick); - - codec->read(data->sec); - - codec->read(data->nsec); -} - -// Read struct PSKID function implementation -static void read_PSKID_struct(erpc::Codec * codec, PSKID * data) -{ - if(NULL == data) - { - return; - } - - { - uint32_t ID_len; - char * ID_local; - codec->readString(ID_len, &ID_local); - data->ID = (char*) erpc_malloc((ID_len + 1) * sizeof(char)); - if ((data->ID == NULL) || (ID_local == NULL)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(data->ID, ID_local, ID_len); - (data->ID)[ID_len] = 0; - } - } - - { - uint32_t PSK_len; - char * PSK_local; - codec->readString(PSK_len, &PSK_local); - data->PSK = (char*) erpc_malloc((PSK_len + 1) * sizeof(char)); - if ((data->PSK == NULL) || (PSK_local == NULL)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(data->PSK, PSK_local, PSK_len); - (data->PSK)[PSK_len] = 0; - } - } -} - -// Read struct PLCstatus function implementation -static void read_PLCstatus_struct(erpc::Codec * codec, PLCstatus * data) -{ - int32_t _tmp_local_i32; - - if(NULL == data) - { - return; - } - - codec->read(_tmp_local_i32); - data->PLCstatus = static_cast(_tmp_local_i32); - - for (uint32_t arrayCount0 = 0U; arrayCount0 < 4U; ++arrayCount0) - { - codec->read(data->logcounts[arrayCount0]); - } -} - -// Read struct trace_sample function implementation -static void read_trace_sample_struct(erpc::Codec * codec, trace_sample * data) -{ - if(NULL == data) - { - return; - } - - codec->read(data->tick); - - read_binary_t_struct(codec, &(data->TraceBuffer)); -} - -// Read struct TraceVariables function implementation -static void read_TraceVariables_struct(erpc::Codec * codec, TraceVariables * data) -{ - int32_t _tmp_local_i32; - - if(NULL == data) - { - return; - } - - codec->read(_tmp_local_i32); - data->PLCstatus = static_cast(_tmp_local_i32); - - read_list_trace_sample_1_t_struct(codec, &(data->traces)); -} - -// Read struct list_trace_sample_1_t function implementation -static void read_list_trace_sample_1_t_struct(erpc::Codec * codec, list_trace_sample_1_t * data) -{ - if(NULL == data) - { - return; - } - - codec->startReadList(data->elementsCount); - data->elements = (trace_sample *) erpc_malloc(data->elementsCount * sizeof(trace_sample)); - if ((data->elements == NULL) && (data->elementsCount > 0)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) - { - read_trace_sample_struct(codec, &(data->elements[listCount])); - } -} - - - - -BeremizPLCObjectService_client::BeremizPLCObjectService_client(ClientManager *manager) -:m_clientManager(manager) -{ -} - -BeremizPLCObjectService_client::~BeremizPLCObjectService_client() -{ -} - -// BeremizPLCObjectService interface AppendChunkToBlob function client shim. -uint32_t BeremizPLCObjectService_client::AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_AppendChunkToBlobId, request.getSequence()); - - write_binary_t_struct(codec, data); - - write_binary_t_struct(codec, blobID); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - read_binary_t_struct(codec, newBlobID); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_AppendChunkToBlobId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface GetLogMessage function client shim. -uint32_t BeremizPLCObjectService_client::GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetLogMessageId, request.getSequence()); - - codec->write(level); - - codec->write(msgID); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - read_log_message_struct(codec, message); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_GetLogMessageId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface GetPLCID function client shim. -uint32_t BeremizPLCObjectService_client::GetPLCID(PSKID * plcID) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetPLCIDId, request.getSequence()); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - read_PSKID_struct(codec, plcID); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_GetPLCIDId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface GetPLCstatus function client shim. -uint32_t BeremizPLCObjectService_client::GetPLCstatus(PLCstatus * status) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetPLCstatusId, request.getSequence()); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - read_PLCstatus_struct(codec, status); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_GetPLCstatusId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface GetTraceVariables function client shim. -uint32_t BeremizPLCObjectService_client::GetTraceVariables(uint32_t debugToken, TraceVariables * traces) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetTraceVariablesId, request.getSequence()); - - codec->write(debugToken); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - read_TraceVariables_struct(codec, traces); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_GetTraceVariablesId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface MatchMD5 function client shim. -uint32_t BeremizPLCObjectService_client::MatchMD5(const char * MD5, bool * match) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_MatchMD5Id, request.getSequence()); - - { - uint32_t MD5_len = strlen((const char*)MD5); - - codec->writeString(MD5_len, (const char*)MD5); - } - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(*match); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_MatchMD5Id); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface NewPLC function client shim. -uint32_t BeremizPLCObjectService_client::NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_NewPLCId, request.getSequence()); - - { - uint32_t md5sum_len = strlen((const char*)md5sum); - - codec->writeString(md5sum_len, (const char*)md5sum); - } - - write_binary_t_struct(codec, plcObjectBlobID); - - write_list_extra_file_1_t_struct(codec, extrafiles); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(*success); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_NewPLCId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface PurgeBlobs function client shim. -uint32_t BeremizPLCObjectService_client::PurgeBlobs(void) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_PurgeBlobsId, request.getSequence()); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_PurgeBlobsId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface RepairPLC function client shim. -uint32_t BeremizPLCObjectService_client::RepairPLC(void) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_RepairPLCId, request.getSequence()); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_RepairPLCId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface ResetLogCount function client shim. -uint32_t BeremizPLCObjectService_client::ResetLogCount(void) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_ResetLogCountId, request.getSequence()); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_ResetLogCountId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface SeedBlob function client shim. -uint32_t BeremizPLCObjectService_client::SeedBlob(const binary_t * seed, binary_t * blobID) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_SeedBlobId, request.getSequence()); - - write_binary_t_struct(codec, seed); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - read_binary_t_struct(codec, blobID); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_SeedBlobId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface SetTraceVariablesList function client shim. -uint32_t BeremizPLCObjectService_client::SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_SetTraceVariablesListId, request.getSequence()); - - write_list_trace_order_1_t_struct(codec, orders); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(*debugtoken); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_SetTraceVariablesListId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface StartPLC function client shim. -uint32_t BeremizPLCObjectService_client::StartPLC(void) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_StartPLCId, request.getSequence()); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_StartPLCId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface StopPLC function client shim. -uint32_t BeremizPLCObjectService_client::StopPLC(bool * success) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_StopPLCId, request.getSequence()); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - codec->read(*success); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_StopPLCId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} - -// BeremizPLCObjectService interface ExtendedCall function client shim. -uint32_t BeremizPLCObjectService_client::ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb preCB = m_clientManager->getPreCB(); - if (preCB) - { - preCB(); - } -#endif - - // Get a new request. - RequestContext request = m_clientManager->createRequest(false); - - // Encode the request. - Codec * codec = request.getCodec(); - - if (codec == NULL) - { - err = kErpcStatus_MemoryError; - } - else - { - codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_ExtendedCallId, request.getSequence()); - - { - uint32_t method_len = strlen((const char*)method); - - codec->writeString(method_len, (const char*)method); - } - - write_binary_t_struct(codec, argument); - - // Send message to server - // Codec status is checked inside this function. - m_clientManager->performRequest(request); - - read_binary_t_struct(codec, answer); - - codec->read(result); - - err = codec->getStatus(); - } - - // Dispose of the request. - m_clientManager->releaseRequest(request); - - // Invoke error handler callback function - m_clientManager->callErrorHandler(err, m_ExtendedCallId); - -#if ERPC_PRE_POST_ACTION - pre_post_action_cb postCB = m_clientManager->getPostCB(); - if (postCB) - { - postCB(); - } -#endif - - - if (err != kErpcStatus_Success) - { - result = 0xFFFFFFFFU; - } - - return result; -} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_client.hpp --- a/C_runtime/erpc_PLCObject_client.hpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if !defined(_erpc_PLCObject_client_hpp_) -#define _erpc_PLCObject_client_hpp_ - -#include "erpc_PLCObject_interface.hpp" - -#include "erpc_client_manager.h" - -namespace erpcShim -{ - -class BeremizPLCObjectService_client: public BeremizPLCObjectService_interface -{ - public: - BeremizPLCObjectService_client(erpc::ClientManager *manager); - - virtual ~BeremizPLCObjectService_client(); - - virtual uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID); - - virtual uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message); - - virtual uint32_t GetPLCID(PSKID * plcID); - - virtual uint32_t GetPLCstatus(PLCstatus * status); - - virtual uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces); - - virtual uint32_t MatchMD5(const char * MD5, bool * match); - - virtual uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success); - - virtual uint32_t PurgeBlobs(void); - - virtual uint32_t RepairPLC(void); - - virtual uint32_t ResetLogCount(void); - - virtual uint32_t SeedBlob(const binary_t * seed, binary_t * blobID); - - virtual uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken); - - virtual uint32_t StartPLC(void); - - virtual uint32_t StopPLC(bool * success); - - virtual uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer); - - protected: - erpc::ClientManager *m_clientManager; -}; - -} // erpcShim - - -#endif // _erpc_PLCObject_client_hpp_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_common.h --- a/C_runtime/erpc_PLCObject_common.h Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if !defined(_erpc_PLCObject_common_h_) -#define _erpc_PLCObject_common_h_ - - -#if defined(__cplusplus) -extern "C" -{ -#endif -#include -#include -#include - -#include "erpc_version.h" - -#if 11300 != ERPC_VERSION_NUMBER -#error "The generated shim code version is different to the rest of eRPC code." -#endif - - -#if !defined(ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT) -#define ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT - -// Enumerators data types declarations -typedef enum PLCstatus_enum -{ - Empty = 0, - Stopped = 1, - Started = 2, - Broken = 3, - Disconnected = 4 -} PLCstatus_enum; - -// Aliases data types declarations -typedef struct binary_t binary_t; -typedef struct PSKID PSKID; -typedef struct PLCstatus PLCstatus; -typedef struct trace_sample trace_sample; -typedef struct list_trace_sample_1_t list_trace_sample_1_t; -typedef struct TraceVariables TraceVariables; -typedef struct extra_file extra_file; -typedef struct list_extra_file_1_t list_extra_file_1_t; -typedef struct trace_order trace_order; -typedef struct list_trace_order_1_t list_trace_order_1_t; -typedef struct log_message log_message; - -// Structures/unions data types declarations -struct binary_t -{ - uint8_t * data; - uint32_t dataLength; -}; - -struct PSKID -{ - char * ID; - char * PSK; -}; - -struct PLCstatus -{ - PLCstatus_enum PLCstatus; - uint32_t logcounts[4]; -}; - -struct trace_sample -{ - uint32_t tick; - binary_t TraceBuffer; -}; - -struct list_trace_sample_1_t -{ - trace_sample * elements; - uint32_t elementsCount; -}; - -struct TraceVariables -{ - PLCstatus_enum PLCstatus; - list_trace_sample_1_t traces; -}; - -struct extra_file -{ - char * fname; - binary_t blobID; -}; - -struct list_extra_file_1_t -{ - extra_file * elements; - uint32_t elementsCount; -}; - -struct trace_order -{ - uint32_t idx; - binary_t force; -}; - -struct list_trace_order_1_t -{ - trace_order * elements; - uint32_t elementsCount; -}; - -struct log_message -{ - char * msg; - uint32_t tick; - uint32_t sec; - uint32_t nsec; -}; - - -#endif // ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT - -#if defined(__cplusplus) -} -#endif - -#endif // _erpc_PLCObject_common_h_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_common.hpp --- a/C_runtime/erpc_PLCObject_common.hpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if !defined(_erpc_PLCObject_common_hpp_) -#define _erpc_PLCObject_common_hpp_ - - -#include -#include - -#include "erpc_version.h" - -#if 11300 != ERPC_VERSION_NUMBER -#error "The generated shim code version is different to the rest of eRPC code." -#endif - - -#if !defined(ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT) -#define ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT - -// Enumerators data types declarations -typedef enum PLCstatus_enum -{ - Empty = 0, - Stopped = 1, - Started = 2, - Broken = 3, - Disconnected = 4 -} PLCstatus_enum; - -// Aliases data types declarations -typedef struct binary_t binary_t; -typedef struct PSKID PSKID; -typedef struct PLCstatus PLCstatus; -typedef struct trace_sample trace_sample; -typedef struct list_trace_sample_1_t list_trace_sample_1_t; -typedef struct TraceVariables TraceVariables; -typedef struct extra_file extra_file; -typedef struct list_extra_file_1_t list_extra_file_1_t; -typedef struct trace_order trace_order; -typedef struct list_trace_order_1_t list_trace_order_1_t; -typedef struct log_message log_message; - -// Structures/unions data types declarations -struct binary_t -{ - uint8_t * data; - uint32_t dataLength; -}; - -struct PSKID -{ - char * ID; - char * PSK; -}; - -struct PLCstatus -{ - PLCstatus_enum PLCstatus; - uint32_t logcounts[4]; -}; - -struct trace_sample -{ - uint32_t tick; - binary_t TraceBuffer; -}; - -struct list_trace_sample_1_t -{ - trace_sample * elements; - uint32_t elementsCount; -}; - -struct TraceVariables -{ - PLCstatus_enum PLCstatus; - list_trace_sample_1_t traces; -}; - -struct extra_file -{ - char * fname; - binary_t blobID; -}; - -struct list_extra_file_1_t -{ - extra_file * elements; - uint32_t elementsCount; -}; - -struct trace_order -{ - uint32_t idx; - binary_t force; -}; - -struct list_trace_order_1_t -{ - trace_order * elements; - uint32_t elementsCount; -}; - -struct log_message -{ - char * msg; - uint32_t tick; - uint32_t sec; - uint32_t nsec; -}; - - -#endif // ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT - - -#endif // _erpc_PLCObject_common_hpp_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_interface.cpp --- a/C_runtime/erpc_PLCObject_interface.cpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#include "erpc_PLCObject_interface.hpp" - -#if 11300 != ERPC_VERSION_NUMBER -#error "The generated shim code version is different to the rest of eRPC code." -#endif - - -using namespace std; -using namespace erpcShim; - -BeremizPLCObjectService_interface::~BeremizPLCObjectService_interface(void) -{ -} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_interface.hpp --- a/C_runtime/erpc_PLCObject_interface.hpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if !defined(_erpc_PLCObject_interface_hpp_) -#define _erpc_PLCObject_interface_hpp_ - -#include "erpc_PLCObject_common.hpp" - -namespace erpcShim -{ - - -// Abstract base class for BeremizPLCObjectService -class BeremizPLCObjectService_interface -{ - public: - static const uint8_t m_serviceId = 1; - static const uint8_t m_AppendChunkToBlobId = 1; - static const uint8_t m_GetLogMessageId = 2; - static const uint8_t m_GetPLCIDId = 3; - static const uint8_t m_GetPLCstatusId = 4; - static const uint8_t m_GetTraceVariablesId = 5; - static const uint8_t m_MatchMD5Id = 6; - static const uint8_t m_NewPLCId = 7; - static const uint8_t m_PurgeBlobsId = 8; - static const uint8_t m_RepairPLCId = 9; - static const uint8_t m_ResetLogCountId = 10; - static const uint8_t m_SeedBlobId = 11; - static const uint8_t m_SetTraceVariablesListId = 12; - static const uint8_t m_StartPLCId = 13; - static const uint8_t m_StopPLCId = 14; - static const uint8_t m_ExtendedCallId = 15; - - virtual ~BeremizPLCObjectService_interface(void); - - virtual uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) = 0; - - virtual uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) = 0; - - virtual uint32_t GetPLCID(PSKID * plcID) = 0; - - virtual uint32_t GetPLCstatus(PLCstatus * status) = 0; - - virtual uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces) = 0; - - virtual uint32_t MatchMD5(const char * MD5, bool * match) = 0; - - virtual uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) = 0; - - virtual uint32_t PurgeBlobs(void) = 0; - - virtual uint32_t RepairPLC(void) = 0; - - virtual uint32_t ResetLogCount(void) = 0; - - virtual uint32_t SeedBlob(const binary_t * seed, binary_t * blobID) = 0; - - virtual uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) = 0; - - virtual uint32_t StartPLC(void) = 0; - - virtual uint32_t StopPLC(bool * success) = 0; - - virtual uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) = 0; -private: -}; -} // erpcShim - - -#endif // _erpc_PLCObject_interface_hpp_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_server.cpp --- a/C_runtime/erpc_PLCObject_server.cpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1410 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#include "erpc_PLCObject_server.hpp" -#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC -#include -#include "erpc_port.h" -#endif -#include "erpc_manually_constructed.hpp" - -#if 11300 != ERPC_VERSION_NUMBER -#error "The generated shim code version is different to the rest of eRPC code." -#endif - -using namespace erpc; -using namespace std; -using namespace erpcShim; - -#if ERPC_NESTED_CALLS_DETECTION -extern bool nestingDetection; -#endif - - -//! @brief Function to read struct binary_t -static void read_binary_t_struct(erpc::Codec * codec, binary_t * data); - -//! @brief Function to read struct extra_file -static void read_extra_file_struct(erpc::Codec * codec, extra_file * data); - -//! @brief Function to read struct list_extra_file_1_t -static void read_list_extra_file_1_t_struct(erpc::Codec * codec, list_extra_file_1_t * data); - -//! @brief Function to read struct trace_order -static void read_trace_order_struct(erpc::Codec * codec, trace_order * data); - -//! @brief Function to read struct list_trace_order_1_t -static void read_list_trace_order_1_t_struct(erpc::Codec * codec, list_trace_order_1_t * data); - - -// Read struct binary_t function implementation -static void read_binary_t_struct(erpc::Codec * codec, binary_t * data) -{ - if(NULL == data) - { - return; - } - - uint8_t * data_local; - codec->readBinary(data->dataLength, &data_local); - if (data->dataLength > 0) - { - data->data = (uint8_t *) erpc_malloc(data->dataLength * sizeof(uint8_t)); - if (data->data == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(data->data, data_local, data->dataLength); - } - } - else - { - data->data = NULL; - } -} - -// Read struct extra_file function implementation -static void read_extra_file_struct(erpc::Codec * codec, extra_file * data) -{ - if(NULL == data) - { - return; - } - - { - uint32_t fname_len; - char * fname_local; - codec->readString(fname_len, &fname_local); - data->fname = (char*) erpc_malloc((fname_len + 1) * sizeof(char)); - if ((data->fname == NULL) || (fname_local == NULL)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(data->fname, fname_local, fname_len); - (data->fname)[fname_len] = 0; - } - } - - read_binary_t_struct(codec, &(data->blobID)); -} - -// Read struct list_extra_file_1_t function implementation -static void read_list_extra_file_1_t_struct(erpc::Codec * codec, list_extra_file_1_t * data) -{ - if(NULL == data) - { - return; - } - - codec->startReadList(data->elementsCount); - data->elements = (extra_file *) erpc_malloc(data->elementsCount * sizeof(extra_file)); - if ((data->elements == NULL) && (data->elementsCount > 0)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) - { - read_extra_file_struct(codec, &(data->elements[listCount])); - } -} - -// Read struct trace_order function implementation -static void read_trace_order_struct(erpc::Codec * codec, trace_order * data) -{ - if(NULL == data) - { - return; - } - - codec->read(data->idx); - - read_binary_t_struct(codec, &(data->force)); -} - -// Read struct list_trace_order_1_t function implementation -static void read_list_trace_order_1_t_struct(erpc::Codec * codec, list_trace_order_1_t * data) -{ - if(NULL == data) - { - return; - } - - codec->startReadList(data->elementsCount); - data->elements = (trace_order *) erpc_malloc(data->elementsCount * sizeof(trace_order)); - if ((data->elements == NULL) && (data->elementsCount > 0)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) - { - read_trace_order_struct(codec, &(data->elements[listCount])); - } -} - - -//! @brief Function to write struct binary_t -static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data); - -//! @brief Function to write struct log_message -static void write_log_message_struct(erpc::Codec * codec, const log_message * data); - -//! @brief Function to write struct PSKID -static void write_PSKID_struct(erpc::Codec * codec, const PSKID * data); - -//! @brief Function to write struct PLCstatus -static void write_PLCstatus_struct(erpc::Codec * codec, const PLCstatus * data); - -//! @brief Function to write struct trace_sample -static void write_trace_sample_struct(erpc::Codec * codec, const trace_sample * data); - -//! @brief Function to write struct TraceVariables -static void write_TraceVariables_struct(erpc::Codec * codec, const TraceVariables * data); - -//! @brief Function to write struct list_trace_sample_1_t -static void write_list_trace_sample_1_t_struct(erpc::Codec * codec, const list_trace_sample_1_t * data); - - -// Write struct binary_t function implementation -static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data) -{ - if(NULL == data) - { - return; - } - - codec->writeBinary(data->dataLength, data->data); -} - -// Write struct log_message function implementation -static void write_log_message_struct(erpc::Codec * codec, const log_message * data) -{ - if(NULL == data) - { - return; - } - - { - uint32_t msg_len = strlen((const char*)data->msg); - - codec->writeString(msg_len, (const char*)data->msg); - } - - codec->write(data->tick); - - codec->write(data->sec); - - codec->write(data->nsec); -} - -// Write struct PSKID function implementation -static void write_PSKID_struct(erpc::Codec * codec, const PSKID * data) -{ - if(NULL == data) - { - return; - } - - { - uint32_t ID_len = strlen((const char*)data->ID); - - codec->writeString(ID_len, (const char*)data->ID); - } - - { - uint32_t PSK_len = strlen((const char*)data->PSK); - - codec->writeString(PSK_len, (const char*)data->PSK); - } -} - -// Write struct PLCstatus function implementation -static void write_PLCstatus_struct(erpc::Codec * codec, const PLCstatus * data) -{ - if(NULL == data) - { - return; - } - - codec->write(static_cast(data->PLCstatus)); - - for (uint32_t arrayCount0 = 0U; arrayCount0 < 4U; ++arrayCount0) - { - codec->write(data->logcounts[arrayCount0]); - } -} - -// Write struct trace_sample function implementation -static void write_trace_sample_struct(erpc::Codec * codec, const trace_sample * data) -{ - if(NULL == data) - { - return; - } - - codec->write(data->tick); - - write_binary_t_struct(codec, &(data->TraceBuffer)); -} - -// Write struct TraceVariables function implementation -static void write_TraceVariables_struct(erpc::Codec * codec, const TraceVariables * data) -{ - if(NULL == data) - { - return; - } - - codec->write(static_cast(data->PLCstatus)); - - write_list_trace_sample_1_t_struct(codec, &(data->traces)); -} - -// Write struct list_trace_sample_1_t function implementation -static void write_list_trace_sample_1_t_struct(erpc::Codec * codec, const list_trace_sample_1_t * data) -{ - if(NULL == data) - { - return; - } - - codec->startWriteList(data->elementsCount); - for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) - { - write_trace_sample_struct(codec, &(data->elements[listCount])); - } -} - - -//! @brief Function to free space allocated inside struct binary_t -static void free_binary_t_struct(binary_t * data); - -//! @brief Function to free space allocated inside struct log_message -static void free_log_message_struct(log_message * data); - -//! @brief Function to free space allocated inside struct PSKID -static void free_PSKID_struct(PSKID * data); - -//! @brief Function to free space allocated inside struct trace_sample -static void free_trace_sample_struct(trace_sample * data); - -//! @brief Function to free space allocated inside struct TraceVariables -static void free_TraceVariables_struct(TraceVariables * data); - -//! @brief Function to free space allocated inside struct list_trace_sample_1_t -static void free_list_trace_sample_1_t_struct(list_trace_sample_1_t * data); - -//! @brief Function to free space allocated inside struct extra_file -static void free_extra_file_struct(extra_file * data); - -//! @brief Function to free space allocated inside struct list_extra_file_1_t -static void free_list_extra_file_1_t_struct(list_extra_file_1_t * data); - -//! @brief Function to free space allocated inside struct trace_order -static void free_trace_order_struct(trace_order * data); - -//! @brief Function to free space allocated inside struct list_trace_order_1_t -static void free_list_trace_order_1_t_struct(list_trace_order_1_t * data); - - -// Free space allocated inside struct binary_t function implementation -static void free_binary_t_struct(binary_t * data) -{ - erpc_free(data->data); -} - -// Free space allocated inside struct log_message function implementation -static void free_log_message_struct(log_message * data) -{ - erpc_free(data->msg); -} - -// Free space allocated inside struct PSKID function implementation -static void free_PSKID_struct(PSKID * data) -{ - erpc_free(data->ID); - - erpc_free(data->PSK); -} - -// Free space allocated inside struct trace_sample function implementation -static void free_trace_sample_struct(trace_sample * data) -{ - free_binary_t_struct(&data->TraceBuffer); -} - -// Free space allocated inside struct TraceVariables function implementation -static void free_TraceVariables_struct(TraceVariables * data) -{ - free_list_trace_sample_1_t_struct(&data->traces); -} - -// Free space allocated inside struct list_trace_sample_1_t function implementation -static void free_list_trace_sample_1_t_struct(list_trace_sample_1_t * data) -{ - for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) - { - free_trace_sample_struct(&data->elements[listCount]); - } - - erpc_free(data->elements); -} - -// Free space allocated inside struct extra_file function implementation -static void free_extra_file_struct(extra_file * data) -{ - erpc_free(data->fname); - - free_binary_t_struct(&data->blobID); -} - -// Free space allocated inside struct list_extra_file_1_t function implementation -static void free_list_extra_file_1_t_struct(list_extra_file_1_t * data) -{ - for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) - { - free_extra_file_struct(&data->elements[listCount]); - } - - erpc_free(data->elements); -} - -// Free space allocated inside struct trace_order function implementation -static void free_trace_order_struct(trace_order * data) -{ - free_binary_t_struct(&data->force); -} - -// Free space allocated inside struct list_trace_order_1_t function implementation -static void free_list_trace_order_1_t_struct(list_trace_order_1_t * data) -{ - for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) - { - free_trace_order_struct(&data->elements[listCount]); - } - - erpc_free(data->elements); -} - - - -BeremizPLCObjectService_service::BeremizPLCObjectService_service(BeremizPLCObjectService_interface *_BeremizPLCObjectService_interface) - : erpc::Service(BeremizPLCObjectService_interface::m_serviceId) - , m_handler(_BeremizPLCObjectService_interface) -{ -} - -BeremizPLCObjectService_service::~BeremizPLCObjectService_service() -{ -} - -// return service interface handler. -BeremizPLCObjectService_interface* BeremizPLCObjectService_service::getHandler(void) -{ - return m_handler; -} - -// Call the correct server shim based on method unique ID. -erpc_status_t BeremizPLCObjectService_service::handleInvocation(uint32_t methodId, uint32_t sequence, Codec * codec, MessageBufferFactory *messageFactory, Transport * transport) -{ - erpc_status_t erpcStatus; - switch (methodId) - { - case BeremizPLCObjectService_interface::m_AppendChunkToBlobId: - { - erpcStatus = AppendChunkToBlob_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_GetLogMessageId: - { - erpcStatus = GetLogMessage_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_GetPLCIDId: - { - erpcStatus = GetPLCID_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_GetPLCstatusId: - { - erpcStatus = GetPLCstatus_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_GetTraceVariablesId: - { - erpcStatus = GetTraceVariables_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_MatchMD5Id: - { - erpcStatus = MatchMD5_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_NewPLCId: - { - erpcStatus = NewPLC_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_PurgeBlobsId: - { - erpcStatus = PurgeBlobs_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_RepairPLCId: - { - erpcStatus = RepairPLC_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_ResetLogCountId: - { - erpcStatus = ResetLogCount_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_SeedBlobId: - { - erpcStatus = SeedBlob_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_SetTraceVariablesListId: - { - erpcStatus = SetTraceVariablesList_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_StartPLCId: - { - erpcStatus = StartPLC_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_StopPLCId: - { - erpcStatus = StopPLC_shim(codec, messageFactory, transport, sequence); - break; - } - - case BeremizPLCObjectService_interface::m_ExtendedCallId: - { - erpcStatus = ExtendedCall_shim(codec, messageFactory, transport, sequence); - break; - } - - default: - { - erpcStatus = kErpcStatus_InvalidArgument; - break; - } - } - - return erpcStatus; -} - -// Server shim for AppendChunkToBlob of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::AppendChunkToBlob_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - binary_t *data = NULL; - data = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (data == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - binary_t *blobID = NULL; - blobID = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (blobID == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - binary_t *newBlobID = NULL; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - read_binary_t_struct(codec, data); - - read_binary_t_struct(codec, blobID); - - newBlobID = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (newBlobID == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->AppendChunkToBlob(data, blobID, newBlobID); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_AppendChunkToBlobId, sequence); - - write_binary_t_struct(codec, newBlobID); - - codec->write(result); - - err = codec->getStatus(); - } - - if (data) - { - free_binary_t_struct(data); - } - erpc_free(data); - - if (blobID) - { - free_binary_t_struct(blobID); - } - erpc_free(blobID); - - if (newBlobID) - { - free_binary_t_struct(newBlobID); - } - erpc_free(newBlobID); - - return err; -} - -// Server shim for GetLogMessage of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::GetLogMessage_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - uint8_t level; - uint32_t msgID; - log_message *message = NULL; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - codec->read(level); - - codec->read(msgID); - - message = (log_message *) erpc_malloc(sizeof(log_message)); - if (message == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->GetLogMessage(level, msgID, message); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetLogMessageId, sequence); - - write_log_message_struct(codec, message); - - codec->write(result); - - err = codec->getStatus(); - } - - if (message) - { - free_log_message_struct(message); - } - erpc_free(message); - - return err; -} - -// Server shim for GetPLCID of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::GetPLCID_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - PSKID *plcID = NULL; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - plcID = (PSKID *) erpc_malloc(sizeof(PSKID)); - if (plcID == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->GetPLCID(plcID); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetPLCIDId, sequence); - - write_PSKID_struct(codec, plcID); - - codec->write(result); - - err = codec->getStatus(); - } - - if (plcID) - { - free_PSKID_struct(plcID); - } - erpc_free(plcID); - - return err; -} - -// Server shim for GetPLCstatus of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::GetPLCstatus_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - PLCstatus *status = NULL; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - status = (PLCstatus *) erpc_malloc(sizeof(PLCstatus)); - if (status == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->GetPLCstatus(status); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetPLCstatusId, sequence); - - write_PLCstatus_struct(codec, status); - - codec->write(result); - - err = codec->getStatus(); - } - - erpc_free(status); - - return err; -} - -// Server shim for GetTraceVariables of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::GetTraceVariables_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t debugToken; - TraceVariables *traces = NULL; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - codec->read(debugToken); - - traces = (TraceVariables *) erpc_malloc(sizeof(TraceVariables)); - if (traces == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->GetTraceVariables(debugToken, traces); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetTraceVariablesId, sequence); - - write_TraceVariables_struct(codec, traces); - - codec->write(result); - - err = codec->getStatus(); - } - - if (traces) - { - free_TraceVariables_struct(traces); - } - erpc_free(traces); - - return err; -} - -// Server shim for MatchMD5 of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::MatchMD5_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - char * MD5 = NULL; - bool match; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - { - uint32_t MD5_len; - char * MD5_local; - codec->readString(MD5_len, &MD5_local); - MD5 = (char*) erpc_malloc((MD5_len + 1) * sizeof(char)); - if ((MD5 == NULL) || (MD5_local == NULL)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(MD5, MD5_local, MD5_len); - (MD5)[MD5_len] = 0; - } - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->MatchMD5(MD5, &match); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_MatchMD5Id, sequence); - - codec->write(match); - - codec->write(result); - - err = codec->getStatus(); - } - - erpc_free(MD5); - - return err; -} - -// Server shim for NewPLC of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::NewPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - char * md5sum = NULL; - binary_t *plcObjectBlobID = NULL; - plcObjectBlobID = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (plcObjectBlobID == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - list_extra_file_1_t *extrafiles = NULL; - extrafiles = (list_extra_file_1_t *) erpc_malloc(sizeof(list_extra_file_1_t)); - if (extrafiles == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - bool success; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - { - uint32_t md5sum_len; - char * md5sum_local; - codec->readString(md5sum_len, &md5sum_local); - md5sum = (char*) erpc_malloc((md5sum_len + 1) * sizeof(char)); - if ((md5sum == NULL) || (md5sum_local == NULL)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(md5sum, md5sum_local, md5sum_len); - (md5sum)[md5sum_len] = 0; - } - } - - read_binary_t_struct(codec, plcObjectBlobID); - - read_list_extra_file_1_t_struct(codec, extrafiles); - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->NewPLC(md5sum, plcObjectBlobID, extrafiles, &success); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_NewPLCId, sequence); - - codec->write(success); - - codec->write(result); - - err = codec->getStatus(); - } - - erpc_free(md5sum); - - if (plcObjectBlobID) - { - free_binary_t_struct(plcObjectBlobID); - } - erpc_free(plcObjectBlobID); - - if (extrafiles) - { - free_list_extra_file_1_t_struct(extrafiles); - } - erpc_free(extrafiles); - - return err; -} - -// Server shim for PurgeBlobs of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::PurgeBlobs_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->PurgeBlobs(); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_PurgeBlobsId, sequence); - - codec->write(result); - - err = codec->getStatus(); - } - - return err; -} - -// Server shim for RepairPLC of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::RepairPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->RepairPLC(); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_RepairPLCId, sequence); - - codec->write(result); - - err = codec->getStatus(); - } - - return err; -} - -// Server shim for ResetLogCount of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::ResetLogCount_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->ResetLogCount(); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ResetLogCountId, sequence); - - codec->write(result); - - err = codec->getStatus(); - } - - return err; -} - -// Server shim for SeedBlob of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::SeedBlob_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - binary_t *seed = NULL; - seed = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (seed == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - binary_t *blobID = NULL; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - read_binary_t_struct(codec, seed); - - blobID = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (blobID == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->SeedBlob(seed, blobID); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_SeedBlobId, sequence); - - write_binary_t_struct(codec, blobID); - - codec->write(result); - - err = codec->getStatus(); - } - - if (seed) - { - free_binary_t_struct(seed); - } - erpc_free(seed); - - if (blobID) - { - free_binary_t_struct(blobID); - } - erpc_free(blobID); - - return err; -} - -// Server shim for SetTraceVariablesList of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::SetTraceVariablesList_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - list_trace_order_1_t *orders = NULL; - orders = (list_trace_order_1_t *) erpc_malloc(sizeof(list_trace_order_1_t)); - if (orders == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - int32_t debugtoken; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - read_list_trace_order_1_t_struct(codec, orders); - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->SetTraceVariablesList(orders, &debugtoken); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_SetTraceVariablesListId, sequence); - - codec->write(debugtoken); - - codec->write(result); - - err = codec->getStatus(); - } - - if (orders) - { - free_list_trace_order_1_t_struct(orders); - } - erpc_free(orders); - - return err; -} - -// Server shim for StartPLC of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::StartPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->StartPLC(); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_StartPLCId, sequence); - - codec->write(result); - - err = codec->getStatus(); - } - - return err; -} - -// Server shim for StopPLC of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::StopPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - bool success; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->StopPLC(&success); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_StopPLCId, sequence); - - codec->write(success); - - codec->write(result); - - err = codec->getStatus(); - } - - return err; -} - -// Server shim for ExtendedCall of BeremizPLCObjectService interface. -erpc_status_t BeremizPLCObjectService_service::ExtendedCall_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) -{ - erpc_status_t err = kErpcStatus_Success; - - char * method = NULL; - binary_t *argument = NULL; - argument = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (argument == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - binary_t *answer = NULL; - uint32_t result; - - // startReadMessage() was already called before this shim was invoked. - - { - uint32_t method_len; - char * method_local; - codec->readString(method_len, &method_local); - method = (char*) erpc_malloc((method_len + 1) * sizeof(char)); - if ((method == NULL) || (method_local == NULL)) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - else - { - memcpy(method, method_local, method_len); - (method)[method_len] = 0; - } - } - - read_binary_t_struct(codec, argument); - - answer = (binary_t *) erpc_malloc(sizeof(binary_t)); - if (answer == NULL) - { - codec->updateStatus(kErpcStatus_MemoryError); - } - - err = codec->getStatus(); - if (err == kErpcStatus_Success) - { - // Invoke the actual served function. -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = true; -#endif - result = m_handler->ExtendedCall(method, argument, answer); -#if ERPC_NESTED_CALLS_DETECTION - nestingDetection = false; -#endif - - // preparing MessageBuffer for serializing data - err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); - } - - if (err == kErpcStatus_Success) - { - // preparing codec for serializing data - codec->reset(transport->reserveHeaderSize()); - - // Build response message. - codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ExtendedCallId, sequence); - - write_binary_t_struct(codec, answer); - - codec->write(result); - - err = codec->getStatus(); - } - - erpc_free(method); - - if (argument) - { - free_binary_t_struct(argument); - } - erpc_free(argument); - - if (answer) - { - free_binary_t_struct(answer); - } - erpc_free(answer); - - return err; -} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/erpc_PLCObject_server.hpp --- a/C_runtime/erpc_PLCObject_server.hpp Tue Dec 03 21:22:45 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. - * - * AUTOGENERATED - DO NOT EDIT - */ - - -#if !defined(_erpc_PLCObject_server_hpp_) -#define _erpc_PLCObject_server_hpp_ - -#include "erpc_PLCObject_interface.hpp" - -#include "erpc_server.hpp" -#include "erpc_codec.hpp" - -#if 11300 != ERPC_VERSION_NUMBER -#error "The generated shim code version is different to the rest of eRPC code." -#endif - - -namespace erpcShim -{ - -/*! - * @brief Service subclass for BeremizPLCObjectService. - */ -class BeremizPLCObjectService_service : public erpc::Service -{ -public: - BeremizPLCObjectService_service(BeremizPLCObjectService_interface *_BeremizPLCObjectService_interface); - - virtual ~BeremizPLCObjectService_service(); - - /*! @brief return service interface handler. */ - BeremizPLCObjectService_interface* getHandler(void); - - /*! @brief Call the correct server shim based on method unique ID. */ - virtual erpc_status_t handleInvocation(uint32_t methodId, uint32_t sequence, erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport); - -private: - BeremizPLCObjectService_interface *m_handler; - /*! @brief Server shim for AppendChunkToBlob of BeremizPLCObjectService interface. */ - erpc_status_t AppendChunkToBlob_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for GetLogMessage of BeremizPLCObjectService interface. */ - erpc_status_t GetLogMessage_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for GetPLCID of BeremizPLCObjectService interface. */ - erpc_status_t GetPLCID_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for GetPLCstatus of BeremizPLCObjectService interface. */ - erpc_status_t GetPLCstatus_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for GetTraceVariables of BeremizPLCObjectService interface. */ - erpc_status_t GetTraceVariables_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for MatchMD5 of BeremizPLCObjectService interface. */ - erpc_status_t MatchMD5_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for NewPLC of BeremizPLCObjectService interface. */ - erpc_status_t NewPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for PurgeBlobs of BeremizPLCObjectService interface. */ - erpc_status_t PurgeBlobs_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for RepairPLC of BeremizPLCObjectService interface. */ - erpc_status_t RepairPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for ResetLogCount of BeremizPLCObjectService interface. */ - erpc_status_t ResetLogCount_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for SeedBlob of BeremizPLCObjectService interface. */ - erpc_status_t SeedBlob_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for SetTraceVariablesList of BeremizPLCObjectService interface. */ - erpc_status_t SetTraceVariablesList_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for StartPLC of BeremizPLCObjectService interface. */ - erpc_status_t StartPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for StopPLC of BeremizPLCObjectService interface. */ - erpc_status_t StopPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); - - /*! @brief Server shim for ExtendedCall of BeremizPLCObjectService interface. */ - erpc_status_t ExtendedCall_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); -}; - -} // erpcShim - - -#endif // _erpc_PLCObject_server_hpp_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/c_erpc_PLCObject_client.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/c_erpc_PLCObject_client.cpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,165 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#include "c_erpc_PLCObject_client.h" +#include "erpc_PLCObject_client.hpp" +#include "erpc_manually_constructed.hpp" + +using namespace erpc; +using namespace std; +using namespace erpcShim; + + +#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC +BeremizPLCObjectService_client *s_BeremizPLCObjectService_client = nullptr; +#else +ERPC_MANUALLY_CONSTRUCTED_STATIC(BeremizPLCObjectService_client, s_BeremizPLCObjectService_client); +#endif + +uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->AppendChunkToBlob(data, blobID, newBlobID); + + return result; +} + +uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->GetLogMessage(level, msgID, message); + + return result; +} + +uint32_t GetPLCID(PSKID * plcID) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->GetPLCID(plcID); + + return result; +} + +uint32_t GetPLCstatus(PLCstatus * status) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->GetPLCstatus(status); + + return result; +} + +uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->GetTraceVariables(debugToken, traces); + + return result; +} + +uint32_t MatchMD5(const char * MD5, bool * match) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->MatchMD5(MD5, match); + + return result; +} + +uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->NewPLC(md5sum, plcObjectBlobID, extrafiles, success); + + return result; +} + +uint32_t PurgeBlobs(void) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->PurgeBlobs(); + + return result; +} + +uint32_t RepairPLC(void) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->RepairPLC(); + + return result; +} + +uint32_t ResetLogCount(void) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->ResetLogCount(); + + return result; +} + +uint32_t SeedBlob(const binary_t * seed, binary_t * blobID) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->SeedBlob(seed, blobID); + + return result; +} + +uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->SetTraceVariablesList(orders, debugtoken); + + return result; +} + +uint32_t StartPLC(void) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->StartPLC(); + + return result; +} + +uint32_t StopPLC(bool * success) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->StopPLC(success); + + return result; +} + +uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) +{ + uint32_t result; + result = s_BeremizPLCObjectService_client->ExtendedCall(method, argument, answer); + + return result; +} + +void initBeremizPLCObjectService_client(erpc_client_t client) +{ +#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC + erpc_assert(s_BeremizPLCObjectService_client == nullptr); + s_BeremizPLCObjectService_client = new BeremizPLCObjectService_client(reinterpret_cast(client)); +#else + erpc_assert(!s_BeremizPLCObjectService_client.isUsed()); + s_BeremizPLCObjectService_client.construct(reinterpret_cast(client)); +#endif +} + +void deinitBeremizPLCObjectService_client(void) +{ +#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC + if (s_BeremizPLCObjectService_client != nullptr) + { + delete s_BeremizPLCObjectService_client; + s_BeremizPLCObjectService_client = nullptr; + } +#else + s_BeremizPLCObjectService_client.destroy(); +#endif +} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/c_erpc_PLCObject_client.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/c_erpc_PLCObject_client.h Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,87 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if !defined(_c_erpc_PLCObject_client_h_) +#define _c_erpc_PLCObject_client_h_ + +#include "erpc_PLCObject_common.h" +#include "erpc_client_manager.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#if !defined(ERPC_FUNCTIONS_DEFINITIONS) +#define ERPC_FUNCTIONS_DEFINITIONS + + +/*! @brief BeremizPLCObjectService identifiers */ +enum _BeremizPLCObjectService_ids +{ + kBeremizPLCObjectService_service_id = 1, + kBeremizPLCObjectService_AppendChunkToBlob_id = 1, + kBeremizPLCObjectService_GetLogMessage_id = 2, + kBeremizPLCObjectService_GetPLCID_id = 3, + kBeremizPLCObjectService_GetPLCstatus_id = 4, + kBeremizPLCObjectService_GetTraceVariables_id = 5, + kBeremizPLCObjectService_MatchMD5_id = 6, + kBeremizPLCObjectService_NewPLC_id = 7, + kBeremizPLCObjectService_PurgeBlobs_id = 8, + kBeremizPLCObjectService_RepairPLC_id = 9, + kBeremizPLCObjectService_ResetLogCount_id = 10, + kBeremizPLCObjectService_SeedBlob_id = 11, + kBeremizPLCObjectService_SetTraceVariablesList_id = 12, + kBeremizPLCObjectService_StartPLC_id = 13, + kBeremizPLCObjectService_StopPLC_id = 14, + kBeremizPLCObjectService_ExtendedCall_id = 15, +}; + +//! @name BeremizPLCObjectService +//@{ +uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID); + +uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message); + +uint32_t GetPLCID(PSKID * plcID); + +uint32_t GetPLCstatus(PLCstatus * status); + +uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces); + +uint32_t MatchMD5(const char * MD5, bool * match); + +uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success); + +uint32_t PurgeBlobs(void); + +uint32_t RepairPLC(void); + +uint32_t ResetLogCount(void); + +uint32_t SeedBlob(const binary_t * seed, binary_t * blobID); + +uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken); + +uint32_t StartPLC(void); + +uint32_t StopPLC(bool * success); + +uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer); +//@} + +#endif // ERPC_FUNCTIONS_DEFINITIONS + +void initBeremizPLCObjectService_client(erpc_client_t client); + +void deinitBeremizPLCObjectService_client(void); + +#if defined(__cplusplus) +} +#endif + +#endif // _c_erpc_PLCObject_client_h_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/c_erpc_PLCObject_server.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/c_erpc_PLCObject_server.cpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,185 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#include +#include "c_erpc_PLCObject_server.h" +#include "erpc_PLCObject_server.hpp" +#include "erpc_manually_constructed.hpp" + +using namespace erpc; +using namespace std; +using namespace erpcShim; + + +class BeremizPLCObjectService_server: public BeremizPLCObjectService_interface +{ + public: + virtual ~BeremizPLCObjectService_server() {}; + + + uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) + { + uint32_t result; + result = ::AppendChunkToBlob(data, blobID, newBlobID); + + return result; + } + + uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) + { + uint32_t result; + result = ::GetLogMessage(level, msgID, message); + + return result; + } + + uint32_t GetPLCID(PSKID * plcID) + { + uint32_t result; + result = ::GetPLCID(plcID); + + return result; + } + + uint32_t GetPLCstatus(PLCstatus * status) + { + uint32_t result; + result = ::GetPLCstatus(status); + + return result; + } + + uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces) + { + uint32_t result; + result = ::GetTraceVariables(debugToken, traces); + + return result; + } + + uint32_t MatchMD5(const char * MD5, bool * match) + { + uint32_t result; + result = ::MatchMD5(MD5, match); + + return result; + } + + uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) + { + uint32_t result; + result = ::NewPLC(md5sum, plcObjectBlobID, extrafiles, success); + + return result; + } + + uint32_t PurgeBlobs(void) + { + uint32_t result; + result = ::PurgeBlobs(); + + return result; + } + + uint32_t RepairPLC(void) + { + uint32_t result; + result = ::RepairPLC(); + + return result; + } + + uint32_t ResetLogCount(void) + { + uint32_t result; + result = ::ResetLogCount(); + + return result; + } + + uint32_t SeedBlob(const binary_t * seed, binary_t * blobID) + { + uint32_t result; + result = ::SeedBlob(seed, blobID); + + return result; + } + + uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) + { + uint32_t result; + result = ::SetTraceVariablesList(orders, debugtoken); + + return result; + } + + uint32_t StartPLC(void) + { + uint32_t result; + result = ::StartPLC(); + + return result; + } + + uint32_t StopPLC(bool * success) + { + uint32_t result; + result = ::StopPLC(success); + + return result; + } + + uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) + { + uint32_t result; + result = ::ExtendedCall(method, argument, answer); + + return result; + } +}; + +ERPC_MANUALLY_CONSTRUCTED_STATIC(BeremizPLCObjectService_service, s_BeremizPLCObjectService_service); +ERPC_MANUALLY_CONSTRUCTED_STATIC(BeremizPLCObjectService_server, s_BeremizPLCObjectService_server); + +erpc_service_t create_BeremizPLCObjectService_service(void) +{ + erpc_service_t service; + +#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC + service = new (nothrow) BeremizPLCObjectService_service(new (nothrow)BeremizPLCObjectService_server()); +#else + if (s_BeremizPLCObjectService_service.isUsed()) + { + service = NULL; + } + else + { + s_BeremizPLCObjectService_server.construct(); + s_BeremizPLCObjectService_service.construct(s_BeremizPLCObjectService_server.get()); + service = s_BeremizPLCObjectService_service.get(); + } +#endif + + return service; +} + +void destroy_BeremizPLCObjectService_service(erpc_service_t service) +{ +#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC + if (service) + { + delete (BeremizPLCObjectService_server *)(((BeremizPLCObjectService_service *)service)->getHandler()); + delete (BeremizPLCObjectService_service *)service; + } +#else + (void)service; + erpc_assert(service == s_BeremizPLCObjectService_service.get()); + s_BeremizPLCObjectService_service.destroy(); + s_BeremizPLCObjectService_server.destroy(); +#endif +} + diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/c_erpc_PLCObject_server.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/c_erpc_PLCObject_server.h Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,92 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if !defined(_c_erpc_PLCObject_server_h_) +#define _c_erpc_PLCObject_server_h_ + +#include "erpc_PLCObject_common.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +typedef void * erpc_service_t; + +#if !defined(ERPC_FUNCTIONS_DEFINITIONS) +#define ERPC_FUNCTIONS_DEFINITIONS + + +/*! @brief BeremizPLCObjectService identifiers */ +enum _BeremizPLCObjectService_ids +{ + kBeremizPLCObjectService_service_id = 1, + kBeremizPLCObjectService_AppendChunkToBlob_id = 1, + kBeremizPLCObjectService_GetLogMessage_id = 2, + kBeremizPLCObjectService_GetPLCID_id = 3, + kBeremizPLCObjectService_GetPLCstatus_id = 4, + kBeremizPLCObjectService_GetTraceVariables_id = 5, + kBeremizPLCObjectService_MatchMD5_id = 6, + kBeremizPLCObjectService_NewPLC_id = 7, + kBeremizPLCObjectService_PurgeBlobs_id = 8, + kBeremizPLCObjectService_RepairPLC_id = 9, + kBeremizPLCObjectService_ResetLogCount_id = 10, + kBeremizPLCObjectService_SeedBlob_id = 11, + kBeremizPLCObjectService_SetTraceVariablesList_id = 12, + kBeremizPLCObjectService_StartPLC_id = 13, + kBeremizPLCObjectService_StopPLC_id = 14, + kBeremizPLCObjectService_ExtendedCall_id = 15, +}; + +//! @name BeremizPLCObjectService +//@{ +uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID); + +uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message); + +uint32_t GetPLCID(PSKID * plcID); + +uint32_t GetPLCstatus(PLCstatus * status); + +uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces); + +uint32_t MatchMD5(const char * MD5, bool * match); + +uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success); + +uint32_t PurgeBlobs(void); + +uint32_t RepairPLC(void); + +uint32_t ResetLogCount(void); + +uint32_t SeedBlob(const binary_t * seed, binary_t * blobID); + +uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken); + +uint32_t StartPLC(void); + +uint32_t StopPLC(bool * success); + +uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer); +//@} + + +#endif // ERPC_FUNCTIONS_DEFINITIONS + +/*! @brief Return BeremizPLCObjectService_service service object. */ +erpc_service_t create_BeremizPLCObjectService_service(void); + +/*! @brief Destroy BeremizPLCObjectService_service service object. */ +void destroy_BeremizPLCObjectService_service(erpc_service_t service); + + +#if defined(__cplusplus) +} +#endif + +#endif // _c_erpc_PLCObject_server_h_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_client.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_client.cpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,1286 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC +#include "erpc_port.h" +#endif +#include "erpc_codec.hpp" +#include "erpc_PLCObject_client.hpp" +#include "erpc_manually_constructed.hpp" + +#if 11300 != ERPC_VERSION_NUMBER +#error "The generated shim code version is different to the rest of eRPC code." +#endif + +using namespace erpc; +using namespace std; +using namespace erpcShim; + +//! @brief Function to write struct binary_t +static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data); + +//! @brief Function to write struct extra_file +static void write_extra_file_struct(erpc::Codec * codec, const extra_file * data); + +//! @brief Function to write struct list_extra_file_1_t +static void write_list_extra_file_1_t_struct(erpc::Codec * codec, const list_extra_file_1_t * data); + +//! @brief Function to write struct trace_order +static void write_trace_order_struct(erpc::Codec * codec, const trace_order * data); + +//! @brief Function to write struct list_trace_order_1_t +static void write_list_trace_order_1_t_struct(erpc::Codec * codec, const list_trace_order_1_t * data); + + +// Write struct binary_t function implementation +static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data) +{ + if(NULL == data) + { + return; + } + + codec->writeBinary(data->dataLength, data->data); +} + +// Write struct extra_file function implementation +static void write_extra_file_struct(erpc::Codec * codec, const extra_file * data) +{ + if(NULL == data) + { + return; + } + + { + uint32_t fname_len = strlen((const char*)data->fname); + + codec->writeString(fname_len, (const char*)data->fname); + } + + write_binary_t_struct(codec, &(data->blobID)); +} + +// Write struct list_extra_file_1_t function implementation +static void write_list_extra_file_1_t_struct(erpc::Codec * codec, const list_extra_file_1_t * data) +{ + if(NULL == data) + { + return; + } + + codec->startWriteList(data->elementsCount); + for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) + { + write_extra_file_struct(codec, &(data->elements[listCount])); + } +} + +// Write struct trace_order function implementation +static void write_trace_order_struct(erpc::Codec * codec, const trace_order * data) +{ + if(NULL == data) + { + return; + } + + codec->write(data->idx); + + write_binary_t_struct(codec, &(data->force)); +} + +// Write struct list_trace_order_1_t function implementation +static void write_list_trace_order_1_t_struct(erpc::Codec * codec, const list_trace_order_1_t * data) +{ + if(NULL == data) + { + return; + } + + codec->startWriteList(data->elementsCount); + for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) + { + write_trace_order_struct(codec, &(data->elements[listCount])); + } +} + + +//! @brief Function to read struct binary_t +static void read_binary_t_struct(erpc::Codec * codec, binary_t * data); + +//! @brief Function to read struct log_message +static void read_log_message_struct(erpc::Codec * codec, log_message * data); + +//! @brief Function to read struct PSKID +static void read_PSKID_struct(erpc::Codec * codec, PSKID * data); + +//! @brief Function to read struct PLCstatus +static void read_PLCstatus_struct(erpc::Codec * codec, PLCstatus * data); + +//! @brief Function to read struct trace_sample +static void read_trace_sample_struct(erpc::Codec * codec, trace_sample * data); + +//! @brief Function to read struct TraceVariables +static void read_TraceVariables_struct(erpc::Codec * codec, TraceVariables * data); + +//! @brief Function to read struct list_trace_sample_1_t +static void read_list_trace_sample_1_t_struct(erpc::Codec * codec, list_trace_sample_1_t * data); + + +// Read struct binary_t function implementation +static void read_binary_t_struct(erpc::Codec * codec, binary_t * data) +{ + if(NULL == data) + { + return; + } + + uint8_t * data_local; + codec->readBinary(data->dataLength, &data_local); + if (data->dataLength > 0) + { + data->data = (uint8_t *) erpc_malloc(data->dataLength * sizeof(uint8_t)); + if (data->data == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(data->data, data_local, data->dataLength); + } + } + else + { + data->data = NULL; + } +} + +// Read struct log_message function implementation +static void read_log_message_struct(erpc::Codec * codec, log_message * data) +{ + if(NULL == data) + { + return; + } + + { + uint32_t msg_len; + char * msg_local; + codec->readString(msg_len, &msg_local); + data->msg = (char*) erpc_malloc((msg_len + 1) * sizeof(char)); + if ((data->msg == NULL) || (msg_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(data->msg, msg_local, msg_len); + (data->msg)[msg_len] = 0; + } + } + + codec->read(data->tick); + + codec->read(data->sec); + + codec->read(data->nsec); +} + +// Read struct PSKID function implementation +static void read_PSKID_struct(erpc::Codec * codec, PSKID * data) +{ + if(NULL == data) + { + return; + } + + { + uint32_t ID_len; + char * ID_local; + codec->readString(ID_len, &ID_local); + data->ID = (char*) erpc_malloc((ID_len + 1) * sizeof(char)); + if ((data->ID == NULL) || (ID_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(data->ID, ID_local, ID_len); + (data->ID)[ID_len] = 0; + } + } + + { + uint32_t PSK_len; + char * PSK_local; + codec->readString(PSK_len, &PSK_local); + data->PSK = (char*) erpc_malloc((PSK_len + 1) * sizeof(char)); + if ((data->PSK == NULL) || (PSK_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(data->PSK, PSK_local, PSK_len); + (data->PSK)[PSK_len] = 0; + } + } +} + +// Read struct PLCstatus function implementation +static void read_PLCstatus_struct(erpc::Codec * codec, PLCstatus * data) +{ + int32_t _tmp_local_i32; + + if(NULL == data) + { + return; + } + + codec->read(_tmp_local_i32); + data->PLCstatus = static_cast(_tmp_local_i32); + + for (uint32_t arrayCount0 = 0U; arrayCount0 < 4U; ++arrayCount0) + { + codec->read(data->logcounts[arrayCount0]); + } +} + +// Read struct trace_sample function implementation +static void read_trace_sample_struct(erpc::Codec * codec, trace_sample * data) +{ + if(NULL == data) + { + return; + } + + codec->read(data->tick); + + read_binary_t_struct(codec, &(data->TraceBuffer)); +} + +// Read struct TraceVariables function implementation +static void read_TraceVariables_struct(erpc::Codec * codec, TraceVariables * data) +{ + int32_t _tmp_local_i32; + + if(NULL == data) + { + return; + } + + codec->read(_tmp_local_i32); + data->PLCstatus = static_cast(_tmp_local_i32); + + read_list_trace_sample_1_t_struct(codec, &(data->traces)); +} + +// Read struct list_trace_sample_1_t function implementation +static void read_list_trace_sample_1_t_struct(erpc::Codec * codec, list_trace_sample_1_t * data) +{ + if(NULL == data) + { + return; + } + + codec->startReadList(data->elementsCount); + data->elements = (trace_sample *) erpc_malloc(data->elementsCount * sizeof(trace_sample)); + if ((data->elements == NULL) && (data->elementsCount > 0)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) + { + read_trace_sample_struct(codec, &(data->elements[listCount])); + } +} + + + + +BeremizPLCObjectService_client::BeremizPLCObjectService_client(ClientManager *manager) +:m_clientManager(manager) +{ +} + +BeremizPLCObjectService_client::~BeremizPLCObjectService_client() +{ +} + +// BeremizPLCObjectService interface AppendChunkToBlob function client shim. +uint32_t BeremizPLCObjectService_client::AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_AppendChunkToBlobId, request.getSequence()); + + write_binary_t_struct(codec, data); + + write_binary_t_struct(codec, blobID); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + read_binary_t_struct(codec, newBlobID); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_AppendChunkToBlobId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface GetLogMessage function client shim. +uint32_t BeremizPLCObjectService_client::GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetLogMessageId, request.getSequence()); + + codec->write(level); + + codec->write(msgID); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + read_log_message_struct(codec, message); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_GetLogMessageId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface GetPLCID function client shim. +uint32_t BeremizPLCObjectService_client::GetPLCID(PSKID * plcID) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetPLCIDId, request.getSequence()); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + read_PSKID_struct(codec, plcID); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_GetPLCIDId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface GetPLCstatus function client shim. +uint32_t BeremizPLCObjectService_client::GetPLCstatus(PLCstatus * status) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetPLCstatusId, request.getSequence()); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + read_PLCstatus_struct(codec, status); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_GetPLCstatusId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface GetTraceVariables function client shim. +uint32_t BeremizPLCObjectService_client::GetTraceVariables(uint32_t debugToken, TraceVariables * traces) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_GetTraceVariablesId, request.getSequence()); + + codec->write(debugToken); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + read_TraceVariables_struct(codec, traces); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_GetTraceVariablesId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface MatchMD5 function client shim. +uint32_t BeremizPLCObjectService_client::MatchMD5(const char * MD5, bool * match) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_MatchMD5Id, request.getSequence()); + + { + uint32_t MD5_len = strlen((const char*)MD5); + + codec->writeString(MD5_len, (const char*)MD5); + } + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(*match); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_MatchMD5Id); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface NewPLC function client shim. +uint32_t BeremizPLCObjectService_client::NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_NewPLCId, request.getSequence()); + + { + uint32_t md5sum_len = strlen((const char*)md5sum); + + codec->writeString(md5sum_len, (const char*)md5sum); + } + + write_binary_t_struct(codec, plcObjectBlobID); + + write_list_extra_file_1_t_struct(codec, extrafiles); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(*success); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_NewPLCId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface PurgeBlobs function client shim. +uint32_t BeremizPLCObjectService_client::PurgeBlobs(void) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_PurgeBlobsId, request.getSequence()); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_PurgeBlobsId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface RepairPLC function client shim. +uint32_t BeremizPLCObjectService_client::RepairPLC(void) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_RepairPLCId, request.getSequence()); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_RepairPLCId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface ResetLogCount function client shim. +uint32_t BeremizPLCObjectService_client::ResetLogCount(void) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_ResetLogCountId, request.getSequence()); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_ResetLogCountId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface SeedBlob function client shim. +uint32_t BeremizPLCObjectService_client::SeedBlob(const binary_t * seed, binary_t * blobID) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_SeedBlobId, request.getSequence()); + + write_binary_t_struct(codec, seed); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + read_binary_t_struct(codec, blobID); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_SeedBlobId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface SetTraceVariablesList function client shim. +uint32_t BeremizPLCObjectService_client::SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_SetTraceVariablesListId, request.getSequence()); + + write_list_trace_order_1_t_struct(codec, orders); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(*debugtoken); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_SetTraceVariablesListId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface StartPLC function client shim. +uint32_t BeremizPLCObjectService_client::StartPLC(void) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_StartPLCId, request.getSequence()); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_StartPLCId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface StopPLC function client shim. +uint32_t BeremizPLCObjectService_client::StopPLC(bool * success) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_StopPLCId, request.getSequence()); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + codec->read(*success); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_StopPLCId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} + +// BeremizPLCObjectService interface ExtendedCall function client shim. +uint32_t BeremizPLCObjectService_client::ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb preCB = m_clientManager->getPreCB(); + if (preCB) + { + preCB(); + } +#endif + + // Get a new request. + RequestContext request = m_clientManager->createRequest(false); + + // Encode the request. + Codec * codec = request.getCodec(); + + if (codec == NULL) + { + err = kErpcStatus_MemoryError; + } + else + { + codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_ExtendedCallId, request.getSequence()); + + { + uint32_t method_len = strlen((const char*)method); + + codec->writeString(method_len, (const char*)method); + } + + write_binary_t_struct(codec, argument); + + // Send message to server + // Codec status is checked inside this function. + m_clientManager->performRequest(request); + + read_binary_t_struct(codec, answer); + + codec->read(result); + + err = codec->getStatus(); + } + + // Dispose of the request. + m_clientManager->releaseRequest(request); + + // Invoke error handler callback function + m_clientManager->callErrorHandler(err, m_ExtendedCallId); + +#if ERPC_PRE_POST_ACTION + pre_post_action_cb postCB = m_clientManager->getPostCB(); + if (postCB) + { + postCB(); + } +#endif + + + if (err != kErpcStatus_Success) + { + result = 0xFFFFFFFFU; + } + + return result; +} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_client.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_client.hpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,62 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if !defined(_erpc_PLCObject_client_hpp_) +#define _erpc_PLCObject_client_hpp_ + +#include "erpc_PLCObject_interface.hpp" + +#include "erpc_client_manager.h" + +namespace erpcShim +{ + +class BeremizPLCObjectService_client: public BeremizPLCObjectService_interface +{ + public: + BeremizPLCObjectService_client(erpc::ClientManager *manager); + + virtual ~BeremizPLCObjectService_client(); + + virtual uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID); + + virtual uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message); + + virtual uint32_t GetPLCID(PSKID * plcID); + + virtual uint32_t GetPLCstatus(PLCstatus * status); + + virtual uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces); + + virtual uint32_t MatchMD5(const char * MD5, bool * match); + + virtual uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success); + + virtual uint32_t PurgeBlobs(void); + + virtual uint32_t RepairPLC(void); + + virtual uint32_t ResetLogCount(void); + + virtual uint32_t SeedBlob(const binary_t * seed, binary_t * blobID); + + virtual uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken); + + virtual uint32_t StartPLC(void); + + virtual uint32_t StopPLC(bool * success); + + virtual uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer); + + protected: + erpc::ClientManager *m_clientManager; +}; + +} // erpcShim + + +#endif // _erpc_PLCObject_client_hpp_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_common.h Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,129 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if !defined(_erpc_PLCObject_common_h_) +#define _erpc_PLCObject_common_h_ + + +#if defined(__cplusplus) +extern "C" +{ +#endif +#include +#include +#include + +#include "erpc_version.h" + +#if 11300 != ERPC_VERSION_NUMBER +#error "The generated shim code version is different to the rest of eRPC code." +#endif + + +#if !defined(ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT) +#define ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT + +// Enumerators data types declarations +typedef enum PLCstatus_enum +{ + Empty = 0, + Stopped = 1, + Started = 2, + Broken = 3, + Disconnected = 4 +} PLCstatus_enum; + +// Aliases data types declarations +typedef struct binary_t binary_t; +typedef struct PSKID PSKID; +typedef struct PLCstatus PLCstatus; +typedef struct trace_sample trace_sample; +typedef struct list_trace_sample_1_t list_trace_sample_1_t; +typedef struct TraceVariables TraceVariables; +typedef struct extra_file extra_file; +typedef struct list_extra_file_1_t list_extra_file_1_t; +typedef struct trace_order trace_order; +typedef struct list_trace_order_1_t list_trace_order_1_t; +typedef struct log_message log_message; + +// Structures/unions data types declarations +struct binary_t +{ + uint8_t * data; + uint32_t dataLength; +}; + +struct PSKID +{ + char * ID; + char * PSK; +}; + +struct PLCstatus +{ + PLCstatus_enum PLCstatus; + uint32_t logcounts[4]; +}; + +struct trace_sample +{ + uint32_t tick; + binary_t TraceBuffer; +}; + +struct list_trace_sample_1_t +{ + trace_sample * elements; + uint32_t elementsCount; +}; + +struct TraceVariables +{ + PLCstatus_enum PLCstatus; + list_trace_sample_1_t traces; +}; + +struct extra_file +{ + char * fname; + binary_t blobID; +}; + +struct list_extra_file_1_t +{ + extra_file * elements; + uint32_t elementsCount; +}; + +struct trace_order +{ + uint32_t idx; + binary_t force; +}; + +struct list_trace_order_1_t +{ + trace_order * elements; + uint32_t elementsCount; +}; + +struct log_message +{ + char * msg; + uint32_t tick; + uint32_t sec; + uint32_t nsec; +}; + + +#endif // ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT + +#if defined(__cplusplus) +} +#endif + +#endif // _erpc_PLCObject_common_h_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_common.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_common.hpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,121 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if !defined(_erpc_PLCObject_common_hpp_) +#define _erpc_PLCObject_common_hpp_ + + +#include +#include + +#include "erpc_version.h" + +#if 11300 != ERPC_VERSION_NUMBER +#error "The generated shim code version is different to the rest of eRPC code." +#endif + + +#if !defined(ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT) +#define ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT + +// Enumerators data types declarations +typedef enum PLCstatus_enum +{ + Empty = 0, + Stopped = 1, + Started = 2, + Broken = 3, + Disconnected = 4 +} PLCstatus_enum; + +// Aliases data types declarations +typedef struct binary_t binary_t; +typedef struct PSKID PSKID; +typedef struct PLCstatus PLCstatus; +typedef struct trace_sample trace_sample; +typedef struct list_trace_sample_1_t list_trace_sample_1_t; +typedef struct TraceVariables TraceVariables; +typedef struct extra_file extra_file; +typedef struct list_extra_file_1_t list_extra_file_1_t; +typedef struct trace_order trace_order; +typedef struct list_trace_order_1_t list_trace_order_1_t; +typedef struct log_message log_message; + +// Structures/unions data types declarations +struct binary_t +{ + uint8_t * data; + uint32_t dataLength; +}; + +struct PSKID +{ + char * ID; + char * PSK; +}; + +struct PLCstatus +{ + PLCstatus_enum PLCstatus; + uint32_t logcounts[4]; +}; + +struct trace_sample +{ + uint32_t tick; + binary_t TraceBuffer; +}; + +struct list_trace_sample_1_t +{ + trace_sample * elements; + uint32_t elementsCount; +}; + +struct TraceVariables +{ + PLCstatus_enum PLCstatus; + list_trace_sample_1_t traces; +}; + +struct extra_file +{ + char * fname; + binary_t blobID; +}; + +struct list_extra_file_1_t +{ + extra_file * elements; + uint32_t elementsCount; +}; + +struct trace_order +{ + uint32_t idx; + binary_t force; +}; + +struct list_trace_order_1_t +{ + trace_order * elements; + uint32_t elementsCount; +}; + +struct log_message +{ + char * msg; + uint32_t tick; + uint32_t sec; + uint32_t nsec; +}; + + +#endif // ERPC_TYPE_DEFINITIONS_ERPC_PLCOBJECT + + +#endif // _erpc_PLCObject_common_hpp_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_interface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_interface.cpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,20 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#include "erpc_PLCObject_interface.hpp" + +#if 11300 != ERPC_VERSION_NUMBER +#error "The generated shim code version is different to the rest of eRPC code." +#endif + + +using namespace std; +using namespace erpcShim; + +BeremizPLCObjectService_interface::~BeremizPLCObjectService_interface(void) +{ +} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_interface.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_interface.hpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,74 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if !defined(_erpc_PLCObject_interface_hpp_) +#define _erpc_PLCObject_interface_hpp_ + +#include "erpc_PLCObject_common.hpp" + +namespace erpcShim +{ + + +// Abstract base class for BeremizPLCObjectService +class BeremizPLCObjectService_interface +{ + public: + static const uint8_t m_serviceId = 1; + static const uint8_t m_AppendChunkToBlobId = 1; + static const uint8_t m_GetLogMessageId = 2; + static const uint8_t m_GetPLCIDId = 3; + static const uint8_t m_GetPLCstatusId = 4; + static const uint8_t m_GetTraceVariablesId = 5; + static const uint8_t m_MatchMD5Id = 6; + static const uint8_t m_NewPLCId = 7; + static const uint8_t m_PurgeBlobsId = 8; + static const uint8_t m_RepairPLCId = 9; + static const uint8_t m_ResetLogCountId = 10; + static const uint8_t m_SeedBlobId = 11; + static const uint8_t m_SetTraceVariablesListId = 12; + static const uint8_t m_StartPLCId = 13; + static const uint8_t m_StopPLCId = 14; + static const uint8_t m_ExtendedCallId = 15; + + virtual ~BeremizPLCObjectService_interface(void); + + virtual uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID) = 0; + + virtual uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message) = 0; + + virtual uint32_t GetPLCID(PSKID * plcID) = 0; + + virtual uint32_t GetPLCstatus(PLCstatus * status) = 0; + + virtual uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces) = 0; + + virtual uint32_t MatchMD5(const char * MD5, bool * match) = 0; + + virtual uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success) = 0; + + virtual uint32_t PurgeBlobs(void) = 0; + + virtual uint32_t RepairPLC(void) = 0; + + virtual uint32_t ResetLogCount(void) = 0; + + virtual uint32_t SeedBlob(const binary_t * seed, binary_t * blobID) = 0; + + virtual uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken) = 0; + + virtual uint32_t StartPLC(void) = 0; + + virtual uint32_t StopPLC(bool * success) = 0; + + virtual uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) = 0; +private: +}; +} // erpcShim + + +#endif // _erpc_PLCObject_interface_hpp_ diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_server.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_server.cpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,1410 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#include "erpc_PLCObject_server.hpp" +#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC +#include +#include "erpc_port.h" +#endif +#include "erpc_manually_constructed.hpp" + +#if 11300 != ERPC_VERSION_NUMBER +#error "The generated shim code version is different to the rest of eRPC code." +#endif + +using namespace erpc; +using namespace std; +using namespace erpcShim; + +#if ERPC_NESTED_CALLS_DETECTION +extern bool nestingDetection; +#endif + + +//! @brief Function to read struct binary_t +static void read_binary_t_struct(erpc::Codec * codec, binary_t * data); + +//! @brief Function to read struct extra_file +static void read_extra_file_struct(erpc::Codec * codec, extra_file * data); + +//! @brief Function to read struct list_extra_file_1_t +static void read_list_extra_file_1_t_struct(erpc::Codec * codec, list_extra_file_1_t * data); + +//! @brief Function to read struct trace_order +static void read_trace_order_struct(erpc::Codec * codec, trace_order * data); + +//! @brief Function to read struct list_trace_order_1_t +static void read_list_trace_order_1_t_struct(erpc::Codec * codec, list_trace_order_1_t * data); + + +// Read struct binary_t function implementation +static void read_binary_t_struct(erpc::Codec * codec, binary_t * data) +{ + if(NULL == data) + { + return; + } + + uint8_t * data_local; + codec->readBinary(data->dataLength, &data_local); + if (data->dataLength > 0) + { + data->data = (uint8_t *) erpc_malloc(data->dataLength * sizeof(uint8_t)); + if (data->data == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(data->data, data_local, data->dataLength); + } + } + else + { + data->data = NULL; + } +} + +// Read struct extra_file function implementation +static void read_extra_file_struct(erpc::Codec * codec, extra_file * data) +{ + if(NULL == data) + { + return; + } + + { + uint32_t fname_len; + char * fname_local; + codec->readString(fname_len, &fname_local); + data->fname = (char*) erpc_malloc((fname_len + 1) * sizeof(char)); + if ((data->fname == NULL) || (fname_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(data->fname, fname_local, fname_len); + (data->fname)[fname_len] = 0; + } + } + + read_binary_t_struct(codec, &(data->blobID)); +} + +// Read struct list_extra_file_1_t function implementation +static void read_list_extra_file_1_t_struct(erpc::Codec * codec, list_extra_file_1_t * data) +{ + if(NULL == data) + { + return; + } + + codec->startReadList(data->elementsCount); + data->elements = (extra_file *) erpc_malloc(data->elementsCount * sizeof(extra_file)); + if ((data->elements == NULL) && (data->elementsCount > 0)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) + { + read_extra_file_struct(codec, &(data->elements[listCount])); + } +} + +// Read struct trace_order function implementation +static void read_trace_order_struct(erpc::Codec * codec, trace_order * data) +{ + if(NULL == data) + { + return; + } + + codec->read(data->idx); + + read_binary_t_struct(codec, &(data->force)); +} + +// Read struct list_trace_order_1_t function implementation +static void read_list_trace_order_1_t_struct(erpc::Codec * codec, list_trace_order_1_t * data) +{ + if(NULL == data) + { + return; + } + + codec->startReadList(data->elementsCount); + data->elements = (trace_order *) erpc_malloc(data->elementsCount * sizeof(trace_order)); + if ((data->elements == NULL) && (data->elementsCount > 0)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) + { + read_trace_order_struct(codec, &(data->elements[listCount])); + } +} + + +//! @brief Function to write struct binary_t +static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data); + +//! @brief Function to write struct log_message +static void write_log_message_struct(erpc::Codec * codec, const log_message * data); + +//! @brief Function to write struct PSKID +static void write_PSKID_struct(erpc::Codec * codec, const PSKID * data); + +//! @brief Function to write struct PLCstatus +static void write_PLCstatus_struct(erpc::Codec * codec, const PLCstatus * data); + +//! @brief Function to write struct trace_sample +static void write_trace_sample_struct(erpc::Codec * codec, const trace_sample * data); + +//! @brief Function to write struct TraceVariables +static void write_TraceVariables_struct(erpc::Codec * codec, const TraceVariables * data); + +//! @brief Function to write struct list_trace_sample_1_t +static void write_list_trace_sample_1_t_struct(erpc::Codec * codec, const list_trace_sample_1_t * data); + + +// Write struct binary_t function implementation +static void write_binary_t_struct(erpc::Codec * codec, const binary_t * data) +{ + if(NULL == data) + { + return; + } + + codec->writeBinary(data->dataLength, data->data); +} + +// Write struct log_message function implementation +static void write_log_message_struct(erpc::Codec * codec, const log_message * data) +{ + if(NULL == data) + { + return; + } + + { + uint32_t msg_len = strlen((const char*)data->msg); + + codec->writeString(msg_len, (const char*)data->msg); + } + + codec->write(data->tick); + + codec->write(data->sec); + + codec->write(data->nsec); +} + +// Write struct PSKID function implementation +static void write_PSKID_struct(erpc::Codec * codec, const PSKID * data) +{ + if(NULL == data) + { + return; + } + + { + uint32_t ID_len = strlen((const char*)data->ID); + + codec->writeString(ID_len, (const char*)data->ID); + } + + { + uint32_t PSK_len = strlen((const char*)data->PSK); + + codec->writeString(PSK_len, (const char*)data->PSK); + } +} + +// Write struct PLCstatus function implementation +static void write_PLCstatus_struct(erpc::Codec * codec, const PLCstatus * data) +{ + if(NULL == data) + { + return; + } + + codec->write(static_cast(data->PLCstatus)); + + for (uint32_t arrayCount0 = 0U; arrayCount0 < 4U; ++arrayCount0) + { + codec->write(data->logcounts[arrayCount0]); + } +} + +// Write struct trace_sample function implementation +static void write_trace_sample_struct(erpc::Codec * codec, const trace_sample * data) +{ + if(NULL == data) + { + return; + } + + codec->write(data->tick); + + write_binary_t_struct(codec, &(data->TraceBuffer)); +} + +// Write struct TraceVariables function implementation +static void write_TraceVariables_struct(erpc::Codec * codec, const TraceVariables * data) +{ + if(NULL == data) + { + return; + } + + codec->write(static_cast(data->PLCstatus)); + + write_list_trace_sample_1_t_struct(codec, &(data->traces)); +} + +// Write struct list_trace_sample_1_t function implementation +static void write_list_trace_sample_1_t_struct(erpc::Codec * codec, const list_trace_sample_1_t * data) +{ + if(NULL == data) + { + return; + } + + codec->startWriteList(data->elementsCount); + for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount) + { + write_trace_sample_struct(codec, &(data->elements[listCount])); + } +} + + +//! @brief Function to free space allocated inside struct binary_t +static void free_binary_t_struct(binary_t * data); + +//! @brief Function to free space allocated inside struct log_message +static void free_log_message_struct(log_message * data); + +//! @brief Function to free space allocated inside struct PSKID +static void free_PSKID_struct(PSKID * data); + +//! @brief Function to free space allocated inside struct trace_sample +static void free_trace_sample_struct(trace_sample * data); + +//! @brief Function to free space allocated inside struct TraceVariables +static void free_TraceVariables_struct(TraceVariables * data); + +//! @brief Function to free space allocated inside struct list_trace_sample_1_t +static void free_list_trace_sample_1_t_struct(list_trace_sample_1_t * data); + +//! @brief Function to free space allocated inside struct extra_file +static void free_extra_file_struct(extra_file * data); + +//! @brief Function to free space allocated inside struct list_extra_file_1_t +static void free_list_extra_file_1_t_struct(list_extra_file_1_t * data); + +//! @brief Function to free space allocated inside struct trace_order +static void free_trace_order_struct(trace_order * data); + +//! @brief Function to free space allocated inside struct list_trace_order_1_t +static void free_list_trace_order_1_t_struct(list_trace_order_1_t * data); + + +// Free space allocated inside struct binary_t function implementation +static void free_binary_t_struct(binary_t * data) +{ + erpc_free(data->data); +} + +// Free space allocated inside struct log_message function implementation +static void free_log_message_struct(log_message * data) +{ + erpc_free(data->msg); +} + +// Free space allocated inside struct PSKID function implementation +static void free_PSKID_struct(PSKID * data) +{ + erpc_free(data->ID); + + erpc_free(data->PSK); +} + +// Free space allocated inside struct trace_sample function implementation +static void free_trace_sample_struct(trace_sample * data) +{ + free_binary_t_struct(&data->TraceBuffer); +} + +// Free space allocated inside struct TraceVariables function implementation +static void free_TraceVariables_struct(TraceVariables * data) +{ + free_list_trace_sample_1_t_struct(&data->traces); +} + +// Free space allocated inside struct list_trace_sample_1_t function implementation +static void free_list_trace_sample_1_t_struct(list_trace_sample_1_t * data) +{ + for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) + { + free_trace_sample_struct(&data->elements[listCount]); + } + + erpc_free(data->elements); +} + +// Free space allocated inside struct extra_file function implementation +static void free_extra_file_struct(extra_file * data) +{ + erpc_free(data->fname); + + free_binary_t_struct(&data->blobID); +} + +// Free space allocated inside struct list_extra_file_1_t function implementation +static void free_list_extra_file_1_t_struct(list_extra_file_1_t * data) +{ + for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) + { + free_extra_file_struct(&data->elements[listCount]); + } + + erpc_free(data->elements); +} + +// Free space allocated inside struct trace_order function implementation +static void free_trace_order_struct(trace_order * data) +{ + free_binary_t_struct(&data->force); +} + +// Free space allocated inside struct list_trace_order_1_t function implementation +static void free_list_trace_order_1_t_struct(list_trace_order_1_t * data) +{ + for (uint32_t listCount = 0; listCount < data->elementsCount; ++listCount) + { + free_trace_order_struct(&data->elements[listCount]); + } + + erpc_free(data->elements); +} + + + +BeremizPLCObjectService_service::BeremizPLCObjectService_service(BeremizPLCObjectService_interface *_BeremizPLCObjectService_interface) + : erpc::Service(BeremizPLCObjectService_interface::m_serviceId) + , m_handler(_BeremizPLCObjectService_interface) +{ +} + +BeremizPLCObjectService_service::~BeremizPLCObjectService_service() +{ +} + +// return service interface handler. +BeremizPLCObjectService_interface* BeremizPLCObjectService_service::getHandler(void) +{ + return m_handler; +} + +// Call the correct server shim based on method unique ID. +erpc_status_t BeremizPLCObjectService_service::handleInvocation(uint32_t methodId, uint32_t sequence, Codec * codec, MessageBufferFactory *messageFactory, Transport * transport) +{ + erpc_status_t erpcStatus; + switch (methodId) + { + case BeremizPLCObjectService_interface::m_AppendChunkToBlobId: + { + erpcStatus = AppendChunkToBlob_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_GetLogMessageId: + { + erpcStatus = GetLogMessage_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_GetPLCIDId: + { + erpcStatus = GetPLCID_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_GetPLCstatusId: + { + erpcStatus = GetPLCstatus_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_GetTraceVariablesId: + { + erpcStatus = GetTraceVariables_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_MatchMD5Id: + { + erpcStatus = MatchMD5_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_NewPLCId: + { + erpcStatus = NewPLC_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_PurgeBlobsId: + { + erpcStatus = PurgeBlobs_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_RepairPLCId: + { + erpcStatus = RepairPLC_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_ResetLogCountId: + { + erpcStatus = ResetLogCount_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_SeedBlobId: + { + erpcStatus = SeedBlob_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_SetTraceVariablesListId: + { + erpcStatus = SetTraceVariablesList_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_StartPLCId: + { + erpcStatus = StartPLC_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_StopPLCId: + { + erpcStatus = StopPLC_shim(codec, messageFactory, transport, sequence); + break; + } + + case BeremizPLCObjectService_interface::m_ExtendedCallId: + { + erpcStatus = ExtendedCall_shim(codec, messageFactory, transport, sequence); + break; + } + + default: + { + erpcStatus = kErpcStatus_InvalidArgument; + break; + } + } + + return erpcStatus; +} + +// Server shim for AppendChunkToBlob of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::AppendChunkToBlob_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + binary_t *data = NULL; + data = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (data == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + binary_t *blobID = NULL; + blobID = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (blobID == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + binary_t *newBlobID = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + read_binary_t_struct(codec, data); + + read_binary_t_struct(codec, blobID); + + newBlobID = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (newBlobID == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->AppendChunkToBlob(data, blobID, newBlobID); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_AppendChunkToBlobId, sequence); + + write_binary_t_struct(codec, newBlobID); + + codec->write(result); + + err = codec->getStatus(); + } + + if (data) + { + free_binary_t_struct(data); + } + erpc_free(data); + + if (blobID) + { + free_binary_t_struct(blobID); + } + erpc_free(blobID); + + if (newBlobID) + { + free_binary_t_struct(newBlobID); + } + erpc_free(newBlobID); + + return err; +} + +// Server shim for GetLogMessage of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::GetLogMessage_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + uint8_t level; + uint32_t msgID; + log_message *message = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + codec->read(level); + + codec->read(msgID); + + message = (log_message *) erpc_malloc(sizeof(log_message)); + if (message == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->GetLogMessage(level, msgID, message); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetLogMessageId, sequence); + + write_log_message_struct(codec, message); + + codec->write(result); + + err = codec->getStatus(); + } + + if (message) + { + free_log_message_struct(message); + } + erpc_free(message); + + return err; +} + +// Server shim for GetPLCID of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::GetPLCID_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + PSKID *plcID = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + plcID = (PSKID *) erpc_malloc(sizeof(PSKID)); + if (plcID == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->GetPLCID(plcID); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetPLCIDId, sequence); + + write_PSKID_struct(codec, plcID); + + codec->write(result); + + err = codec->getStatus(); + } + + if (plcID) + { + free_PSKID_struct(plcID); + } + erpc_free(plcID); + + return err; +} + +// Server shim for GetPLCstatus of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::GetPLCstatus_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + PLCstatus *status = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + status = (PLCstatus *) erpc_malloc(sizeof(PLCstatus)); + if (status == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->GetPLCstatus(status); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetPLCstatusId, sequence); + + write_PLCstatus_struct(codec, status); + + codec->write(result); + + err = codec->getStatus(); + } + + erpc_free(status); + + return err; +} + +// Server shim for GetTraceVariables of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::GetTraceVariables_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t debugToken; + TraceVariables *traces = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + codec->read(debugToken); + + traces = (TraceVariables *) erpc_malloc(sizeof(TraceVariables)); + if (traces == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->GetTraceVariables(debugToken, traces); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_GetTraceVariablesId, sequence); + + write_TraceVariables_struct(codec, traces); + + codec->write(result); + + err = codec->getStatus(); + } + + if (traces) + { + free_TraceVariables_struct(traces); + } + erpc_free(traces); + + return err; +} + +// Server shim for MatchMD5 of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::MatchMD5_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + char * MD5 = NULL; + bool match; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + { + uint32_t MD5_len; + char * MD5_local; + codec->readString(MD5_len, &MD5_local); + MD5 = (char*) erpc_malloc((MD5_len + 1) * sizeof(char)); + if ((MD5 == NULL) || (MD5_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(MD5, MD5_local, MD5_len); + (MD5)[MD5_len] = 0; + } + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->MatchMD5(MD5, &match); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_MatchMD5Id, sequence); + + codec->write(match); + + codec->write(result); + + err = codec->getStatus(); + } + + erpc_free(MD5); + + return err; +} + +// Server shim for NewPLC of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::NewPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + char * md5sum = NULL; + binary_t *plcObjectBlobID = NULL; + plcObjectBlobID = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (plcObjectBlobID == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + list_extra_file_1_t *extrafiles = NULL; + extrafiles = (list_extra_file_1_t *) erpc_malloc(sizeof(list_extra_file_1_t)); + if (extrafiles == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + bool success; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + { + uint32_t md5sum_len; + char * md5sum_local; + codec->readString(md5sum_len, &md5sum_local); + md5sum = (char*) erpc_malloc((md5sum_len + 1) * sizeof(char)); + if ((md5sum == NULL) || (md5sum_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(md5sum, md5sum_local, md5sum_len); + (md5sum)[md5sum_len] = 0; + } + } + + read_binary_t_struct(codec, plcObjectBlobID); + + read_list_extra_file_1_t_struct(codec, extrafiles); + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->NewPLC(md5sum, plcObjectBlobID, extrafiles, &success); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_NewPLCId, sequence); + + codec->write(success); + + codec->write(result); + + err = codec->getStatus(); + } + + erpc_free(md5sum); + + if (plcObjectBlobID) + { + free_binary_t_struct(plcObjectBlobID); + } + erpc_free(plcObjectBlobID); + + if (extrafiles) + { + free_list_extra_file_1_t_struct(extrafiles); + } + erpc_free(extrafiles); + + return err; +} + +// Server shim for PurgeBlobs of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::PurgeBlobs_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->PurgeBlobs(); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_PurgeBlobsId, sequence); + + codec->write(result); + + err = codec->getStatus(); + } + + return err; +} + +// Server shim for RepairPLC of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::RepairPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->RepairPLC(); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_RepairPLCId, sequence); + + codec->write(result); + + err = codec->getStatus(); + } + + return err; +} + +// Server shim for ResetLogCount of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::ResetLogCount_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->ResetLogCount(); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ResetLogCountId, sequence); + + codec->write(result); + + err = codec->getStatus(); + } + + return err; +} + +// Server shim for SeedBlob of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::SeedBlob_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + binary_t *seed = NULL; + seed = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (seed == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + binary_t *blobID = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + read_binary_t_struct(codec, seed); + + blobID = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (blobID == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->SeedBlob(seed, blobID); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_SeedBlobId, sequence); + + write_binary_t_struct(codec, blobID); + + codec->write(result); + + err = codec->getStatus(); + } + + if (seed) + { + free_binary_t_struct(seed); + } + erpc_free(seed); + + if (blobID) + { + free_binary_t_struct(blobID); + } + erpc_free(blobID); + + return err; +} + +// Server shim for SetTraceVariablesList of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::SetTraceVariablesList_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + list_trace_order_1_t *orders = NULL; + orders = (list_trace_order_1_t *) erpc_malloc(sizeof(list_trace_order_1_t)); + if (orders == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + int32_t debugtoken; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + read_list_trace_order_1_t_struct(codec, orders); + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->SetTraceVariablesList(orders, &debugtoken); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_SetTraceVariablesListId, sequence); + + codec->write(debugtoken); + + codec->write(result); + + err = codec->getStatus(); + } + + if (orders) + { + free_list_trace_order_1_t_struct(orders); + } + erpc_free(orders); + + return err; +} + +// Server shim for StartPLC of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::StartPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->StartPLC(); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_StartPLCId, sequence); + + codec->write(result); + + err = codec->getStatus(); + } + + return err; +} + +// Server shim for StopPLC of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::StopPLC_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + bool success; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->StopPLC(&success); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_StopPLCId, sequence); + + codec->write(success); + + codec->write(result); + + err = codec->getStatus(); + } + + return err; +} + +// Server shim for ExtendedCall of BeremizPLCObjectService interface. +erpc_status_t BeremizPLCObjectService_service::ExtendedCall_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence) +{ + erpc_status_t err = kErpcStatus_Success; + + char * method = NULL; + binary_t *argument = NULL; + argument = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (argument == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + binary_t *answer = NULL; + uint32_t result; + + // startReadMessage() was already called before this shim was invoked. + + { + uint32_t method_len; + char * method_local; + codec->readString(method_len, &method_local); + method = (char*) erpc_malloc((method_len + 1) * sizeof(char)); + if ((method == NULL) || (method_local == NULL)) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + else + { + memcpy(method, method_local, method_len); + (method)[method_len] = 0; + } + } + + read_binary_t_struct(codec, argument); + + answer = (binary_t *) erpc_malloc(sizeof(binary_t)); + if (answer == NULL) + { + codec->updateStatus(kErpcStatus_MemoryError); + } + + err = codec->getStatus(); + if (err == kErpcStatus_Success) + { + // Invoke the actual served function. +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = true; +#endif + result = m_handler->ExtendedCall(method, argument, answer); +#if ERPC_NESTED_CALLS_DETECTION + nestingDetection = false; +#endif + + // preparing MessageBuffer for serializing data + err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize()); + } + + if (err == kErpcStatus_Success) + { + // preparing codec for serializing data + codec->reset(transport->reserveHeaderSize()); + + // Build response message. + codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ExtendedCallId, sequence); + + write_binary_t_struct(codec, answer); + + codec->write(result); + + err = codec->getStatus(); + } + + erpc_free(method); + + if (argument) + { + free_binary_t_struct(argument); + } + erpc_free(argument); + + if (answer) + { + free_binary_t_struct(answer); + } + erpc_free(answer); + + return err; +} diff -r cf42c3dbdd5c -r 5472b88bbc9d C_runtime/service/erpc_PLCObject_server.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C_runtime/service/erpc_PLCObject_server.hpp Tue Dec 03 21:26:52 2024 +0100 @@ -0,0 +1,91 @@ +/* + * Generated by erpcgen 1.13.0 on Fri Nov 22 15:03:08 2024. + * + * AUTOGENERATED - DO NOT EDIT + */ + + +#if !defined(_erpc_PLCObject_server_hpp_) +#define _erpc_PLCObject_server_hpp_ + +#include "erpc_PLCObject_interface.hpp" + +#include "erpc_server.hpp" +#include "erpc_codec.hpp" + +#if 11300 != ERPC_VERSION_NUMBER +#error "The generated shim code version is different to the rest of eRPC code." +#endif + + +namespace erpcShim +{ + +/*! + * @brief Service subclass for BeremizPLCObjectService. + */ +class BeremizPLCObjectService_service : public erpc::Service +{ +public: + BeremizPLCObjectService_service(BeremizPLCObjectService_interface *_BeremizPLCObjectService_interface); + + virtual ~BeremizPLCObjectService_service(); + + /*! @brief return service interface handler. */ + BeremizPLCObjectService_interface* getHandler(void); + + /*! @brief Call the correct server shim based on method unique ID. */ + virtual erpc_status_t handleInvocation(uint32_t methodId, uint32_t sequence, erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport); + +private: + BeremizPLCObjectService_interface *m_handler; + /*! @brief Server shim for AppendChunkToBlob of BeremizPLCObjectService interface. */ + erpc_status_t AppendChunkToBlob_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for GetLogMessage of BeremizPLCObjectService interface. */ + erpc_status_t GetLogMessage_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for GetPLCID of BeremizPLCObjectService interface. */ + erpc_status_t GetPLCID_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for GetPLCstatus of BeremizPLCObjectService interface. */ + erpc_status_t GetPLCstatus_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for GetTraceVariables of BeremizPLCObjectService interface. */ + erpc_status_t GetTraceVariables_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for MatchMD5 of BeremizPLCObjectService interface. */ + erpc_status_t MatchMD5_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for NewPLC of BeremizPLCObjectService interface. */ + erpc_status_t NewPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for PurgeBlobs of BeremizPLCObjectService interface. */ + erpc_status_t PurgeBlobs_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for RepairPLC of BeremizPLCObjectService interface. */ + erpc_status_t RepairPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for ResetLogCount of BeremizPLCObjectService interface. */ + erpc_status_t ResetLogCount_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for SeedBlob of BeremizPLCObjectService interface. */ + erpc_status_t SeedBlob_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for SetTraceVariablesList of BeremizPLCObjectService interface. */ + erpc_status_t SetTraceVariablesList_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for StartPLC of BeremizPLCObjectService interface. */ + erpc_status_t StartPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for StopPLC of BeremizPLCObjectService interface. */ + erpc_status_t StopPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); + + /*! @brief Server shim for ExtendedCall of BeremizPLCObjectService interface. */ + erpc_status_t ExtendedCall_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence); +}; + +} // erpcShim + + +#endif // _erpc_PLCObject_server_hpp_