98 lines
1.9 KiB
C++
98 lines
1.9 KiB
C++
|
|
/*
|
||
|
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||
|
|
*
|
||
|
|
* 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;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
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
|
||
|
|
|
||
|
|
|
||
|
|
if (err != kErpcStatus_Success)
|
||
|
|
{
|
||
|
|
result = -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
return result;
|
||
|
|
}
|