304 lines
6.7 KiB
C++
304 lines
6.7 KiB
C++
/*
|
|
* Generated by erpcgen 1.14.0 on Wed Jan 14 16:06:40 2026.
|
|
*
|
|
* AUTOGENERATED - DO NOT EDIT
|
|
*/
|
|
|
|
|
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
|
#include "erpc_port.h"
|
|
#endif
|
|
#include "erpc_codec.hpp"
|
|
#include "face_servo_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;
|
|
|
|
|
|
// Constant variable definitions
|
|
#if defined(__MINGW32__)
|
|
__declspec( selectany )
|
|
#else
|
|
#pragma weak kServoIdMaxLen
|
|
#endif
|
|
extern const int32_t kServoIdMaxLen = 32;
|
|
#if defined(__MINGW32__)
|
|
__declspec( selectany )
|
|
#else
|
|
#pragma weak kMaxServoCount
|
|
#endif
|
|
extern const int32_t kMaxServoCount = 48;
|
|
|
|
//! @brief Function to write struct list_float_1_t
|
|
static void write_list_float_1_t_struct(erpc::Codec * codec, const list_float_1_t * data);
|
|
|
|
//! @brief Function to write struct ServoCmd
|
|
static void write_ServoCmd_struct(erpc::Codec * codec, const ServoCmd * data);
|
|
|
|
//! @brief Function to write struct list_ServoCmd_1_t
|
|
static void write_list_ServoCmd_1_t_struct(erpc::Codec * codec, const list_ServoCmd_1_t * data);
|
|
|
|
|
|
// Write struct list_float_1_t function implementation
|
|
static void write_list_float_1_t_struct(erpc::Codec * codec, const list_float_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]);
|
|
}
|
|
}
|
|
|
|
// Write struct ServoCmd function implementation
|
|
static void write_ServoCmd_struct(erpc::Codec * codec, const ServoCmd * data)
|
|
{
|
|
if(NULL == data)
|
|
{
|
|
return;
|
|
}
|
|
|
|
{
|
|
uint32_t id_len = strlen((const char*)data->id);
|
|
|
|
codec->writeString(id_len, (const char*)data->id);
|
|
}
|
|
|
|
codec->write(data->angle_deg);
|
|
}
|
|
|
|
// Write struct list_ServoCmd_1_t function implementation
|
|
static void write_list_ServoCmd_1_t_struct(erpc::Codec * codec, const list_ServoCmd_1_t * data)
|
|
{
|
|
if(NULL == data)
|
|
{
|
|
return;
|
|
}
|
|
|
|
codec->startWriteList(data->elementsCount);
|
|
for (uint32_t listCount = 0U; listCount < data->elementsCount; ++listCount)
|
|
{
|
|
write_ServoCmd_struct(codec, &(data->elements[listCount]));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
FaceServo_client::FaceServo_client(ClientManager *manager)
|
|
:m_clientManager(manager)
|
|
{
|
|
}
|
|
|
|
FaceServo_client::~FaceServo_client()
|
|
{
|
|
}
|
|
|
|
// FaceServo interface setAllAngles function client shim.
|
|
int32_t FaceServo_client::setAllAngles(const list_float_1_t * angles_deg)
|
|
{
|
|
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_setAllAnglesId, request.getSequence());
|
|
|
|
write_list_float_1_t_struct(codec, angles_deg);
|
|
|
|
// 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_setAllAnglesId);
|
|
|
|
#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;
|
|
}
|
|
|
|
// FaceServo interface setAngles function client shim.
|
|
int32_t FaceServo_client::setAngles(const list_ServoCmd_1_t * cmds)
|
|
{
|
|
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_setAnglesId, request.getSequence());
|
|
|
|
write_list_ServoCmd_1_t_struct(codec, cmds);
|
|
|
|
// 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_setAnglesId);
|
|
|
|
#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;
|
|
}
|
|
|
|
// FaceServo interface setAngle function client shim.
|
|
int32_t FaceServo_client::setAngle(const char * id, float angle_deg)
|
|
{
|
|
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_setAngleId, request.getSequence());
|
|
|
|
{
|
|
uint32_t id_len = strlen((const char*)id);
|
|
|
|
erpc_assert(kServoIdMaxLen >= 0);
|
|
erpc_assert(id_len <= static_cast<uint32_t>(kServoIdMaxLen));
|
|
|
|
codec->writeString(id_len, (const char*)id);
|
|
}
|
|
|
|
codec->write(angle_deg);
|
|
|
|
// 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_setAngleId);
|
|
|
|
#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;
|
|
}
|