代码拉取完成,页面将自动刷新
/*
* Generated by erpcgen 1.9.1 on Fri Jul 29 09:33:29 2022.
*
* AUTOGENERATED - DO NOT EDIT
*/
#include "erpc_client_manager.h"
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
#include "erpc_port.h"
#endif
#include "erpc_codec.h"
extern "C"
{
#include "hello.h"
}
#if 10901 != ERPC_VERSION_NUMBER
#error "The generated shim code version is different to the rest of eRPC code."
#endif
using namespace erpc;
using namespace std;
extern ClientManager *g_client;
//! @brief Function to write struct binary_t
static void write_binary_t_struct(erpc::Codec * codec, const binary_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);
}
//! @brief Function to read struct binary_t
static void read_binary_t_struct(erpc::Codec * codec, binary_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);
data->data = (uint8_t *) erpc_malloc(data->dataLength * sizeof(uint8_t));
if ((data->data == NULL) && (data->dataLength > 0))
{
codec->updateStatus(kErpcStatus_MemoryError);
}
else
{
memcpy(data->data, data_local, data->dataLength);
}
}
// Hello interface sayHello function client shim.
binary_t * sayHello(const binary_t * txInput)
{
erpc_status_t err = kErpcStatus_Success;
binary_t * result = NULL;
#if ERPC_PRE_POST_ACTION
pre_post_action_cb preCB = g_client->getPreCB();
if (preCB)
{
preCB();
}
#endif
// Get a new request.
RequestContext request = g_client->createRequest(false);
// Encode the request.
Codec * codec = request.getCodec();
if (codec == NULL)
{
err = kErpcStatus_MemoryError;
}
else
{
codec->startWriteMessage(kInvocationMessage, kHello_service_id, kHello_sayHello_id, request.getSequence());
write_binary_t_struct(codec, txInput);
// Send message to server
// Codec status is checked inside this function.
g_client->performRequest(request);
result = (binary_t *) erpc_malloc(sizeof(binary_t));
if (result == NULL)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
read_binary_t_struct(codec, result);
err = codec->getStatus();
}
// Dispose of the request.
g_client->releaseRequest(request);
// Invoke error handler callback function
g_client->callErrorHandler(err, kHello_sayHello_id);
#if ERPC_PRE_POST_ACTION
pre_post_action_cb postCB = g_client->getPostCB();
if (postCB)
{
postCB();
}
#endif
return result;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。