2025-12-24 18:28:20 +08:00
|
|
|
/*
|
2026-01-07 11:41:07 +08:00
|
|
|
* Generated by erpcgen 1.14.0 on Wed Dec 31 16:10:10 2025.
|
2025-12-24 18:28:20 +08:00
|
|
|
*
|
|
|
|
|
* AUTOGENERATED - DO NOT EDIT
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
|
|
|
|
#include "erpc_port.h"
|
|
|
|
|
#endif
|
|
|
|
|
#include "erpc_codec.hpp"
|
|
|
|
|
#include "head_service_client.hpp"
|
|
|
|
|
#include "erpc_manually_constructed.hpp"
|
|
|
|
|
|
|
|
|
|
#if 11400 != 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;
|
|
|
|
|
|
2026-01-07 11:41:07 +08:00
|
|
|
//! @brief Function to write struct list_int32_1_t
|
|
|
|
|
static void write_list_int32_1_t_struct(erpc::Codec * codec, const list_int32_1_t * data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Write struct list_int32_1_t function implementation
|
|
|
|
|
static void write_list_int32_1_t_struct(erpc::Codec * codec, const list_int32_1_t * data)
|
|
|
|
|
{
|
|
|
|
|
if(NULL == data)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
codec->startWriteList(data->elementsCount);
|
|
|
|
|
for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount)
|
|
|
|
|
{
|
|
|
|
|
codec->write(data->elements[listCount]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 18:28:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
demo_client::demo_client(ClientManager *manager)
|
|
|
|
|
:m_clientManager(manager)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
demo_client::~demo_client()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// demo interface add function client shim.
|
|
|
|
|
int32_t demo_client::add(int32_t a, int32_t b)
|
|
|
|
|
{
|
|
|
|
|
erpc_status_t err = kErpcStatus_Success;
|
|
|
|
|
|
|
|
|
|
int32_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_addId, request.getSequence());
|
|
|
|
|
|
|
|
|
|
codec->write(a);
|
|
|
|
|
|
|
|
|
|
codec->write(b);
|
|
|
|
|
|
|
|
|
|
// 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_addId);
|
|
|
|
|
|
|
|
|
|
#if ERPC_PRE_POST_ACTION
|
|
|
|
|
pre_post_action_cb postCB = m_clientManager->getPostCB();
|
|
|
|
|
if (postCB)
|
|
|
|
|
{
|
|
|
|
|
postCB();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
2026-01-07 11:41:07 +08:00
|
|
|
if (err != kErpcStatus_Success)
|
|
|
|
|
{
|
|
|
|
|
result = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// demo interface sum_i32 function client shim.
|
|
|
|
|
int64_t demo_client::sum_i32(const list_int32_1_t * arr)
|
|
|
|
|
{
|
|
|
|
|
erpc_status_t err = kErpcStatus_Success;
|
|
|
|
|
|
|
|
|
|
int64_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_sum_i32Id, request.getSequence());
|
|
|
|
|
|
|
|
|
|
write_list_int32_1_t_struct(codec, arr);
|
|
|
|
|
|
|
|
|
|
// 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_sum_i32Id);
|
|
|
|
|
|
|
|
|
|
#if ERPC_PRE_POST_ACTION
|
|
|
|
|
pre_post_action_cb postCB = m_clientManager->getPostCB();
|
|
|
|
|
if (postCB)
|
|
|
|
|
{
|
|
|
|
|
postCB();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 18:28:20 +08:00
|
|
|
if (err != kErpcStatus_Success)
|
|
|
|
|
{
|
|
|
|
|
result = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|