485 lines
11 KiB
C++
485 lines
11 KiB
C++
/*
|
|
* Generated by erpcgen 1.14.0 on Tue Apr 28 12:16:31 2026.
|
|
*
|
|
* AUTOGENERATED - DO NOT EDIT
|
|
*/
|
|
|
|
|
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
|
#include "erpc_port.h"
|
|
#endif
|
|
#include "erpc_codec.hpp"
|
|
#include "servo_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;
|
|
|
|
//! @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);
|
|
|
|
//! @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);
|
|
|
|
|
|
// 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_rad);
|
|
}
|
|
|
|
// 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]));
|
|
}
|
|
}
|
|
|
|
// 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]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
servo_service_client::servo_service_client(ClientManager *manager)
|
|
:m_clientManager(manager)
|
|
{
|
|
}
|
|
|
|
servo_service_client::~servo_service_client()
|
|
{
|
|
}
|
|
|
|
// servo_service interface setConstraints function client shim.
|
|
bool servo_service_client::setConstraints(const char * id, float max_velocity_rad, float max_acceleration_rad, float max_jerk_rad)
|
|
{
|
|
erpc_status_t err = kErpcStatus_Success;
|
|
|
|
bool 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_setConstraintsId, request.getSequence());
|
|
|
|
{
|
|
uint32_t id_len = strlen((const char*)id);
|
|
|
|
codec->writeString(id_len, (const char*)id);
|
|
}
|
|
|
|
codec->write(max_velocity_rad);
|
|
|
|
codec->write(max_acceleration_rad);
|
|
|
|
codec->write(max_jerk_rad);
|
|
|
|
// 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_setConstraintsId);
|
|
|
|
#if ERPC_PRE_POST_ACTION
|
|
pre_post_action_cb postCB = m_clientManager->getPostCB();
|
|
if (postCB)
|
|
{
|
|
postCB();
|
|
}
|
|
#endif
|
|
|
|
|
|
if (err != kErpcStatus_Success)
|
|
{
|
|
result = false;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// servo_service interface setPositionGain function client shim.
|
|
bool servo_service_client::setPositionGain(const char * id, float position_gain)
|
|
{
|
|
erpc_status_t err = kErpcStatus_Success;
|
|
|
|
bool 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_setPositionGainId, request.getSequence());
|
|
|
|
{
|
|
uint32_t id_len = strlen((const char*)id);
|
|
|
|
codec->writeString(id_len, (const char*)id);
|
|
}
|
|
|
|
codec->write(position_gain);
|
|
|
|
// 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_setPositionGainId);
|
|
|
|
#if ERPC_PRE_POST_ACTION
|
|
pre_post_action_cb postCB = m_clientManager->getPostCB();
|
|
if (postCB)
|
|
{
|
|
postCB();
|
|
}
|
|
#endif
|
|
|
|
|
|
if (err != kErpcStatus_Success)
|
|
{
|
|
result = false;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// servo_service interface setMode function client shim.
|
|
bool servo_service_client::setMode(RpcMotionMode mode)
|
|
{
|
|
erpc_status_t err = kErpcStatus_Success;
|
|
|
|
bool 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_setModeId, request.getSequence());
|
|
|
|
codec->write(static_cast<int32_t>(mode));
|
|
|
|
// 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_setModeId);
|
|
|
|
#if ERPC_PRE_POST_ACTION
|
|
pre_post_action_cb postCB = m_clientManager->getPostCB();
|
|
if (postCB)
|
|
{
|
|
postCB();
|
|
}
|
|
#endif
|
|
|
|
|
|
if (err != kErpcStatus_Success)
|
|
{
|
|
result = false;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// servo_service interface setUpdatePeriodMs function client shim.
|
|
bool servo_service_client::setUpdatePeriodMs(uint32_t ms)
|
|
{
|
|
erpc_status_t err = kErpcStatus_Success;
|
|
|
|
bool 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_setUpdatePeriodMsId, request.getSequence());
|
|
|
|
codec->write(ms);
|
|
|
|
// 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_setUpdatePeriodMsId);
|
|
|
|
#if ERPC_PRE_POST_ACTION
|
|
pre_post_action_cb postCB = m_clientManager->getPostCB();
|
|
if (postCB)
|
|
{
|
|
postCB();
|
|
}
|
|
#endif
|
|
|
|
|
|
if (err != kErpcStatus_Success)
|
|
{
|
|
result = false;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// servo_service interface move function client shim.
|
|
int32_t servo_service_client::move(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_moveId, 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_moveId);
|
|
|
|
#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;
|
|
}
|
|
|
|
// servo_service interface moveJ function client shim.
|
|
int32_t servo_service_client::moveJ(const list_float_1_t * angles_rad)
|
|
{
|
|
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_moveJId, request.getSequence());
|
|
|
|
write_list_float_1_t_struct(codec, angles_rad);
|
|
|
|
// 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_moveJId);
|
|
|
|
#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;
|
|
}
|