代码拉取完成,页面将自动刷新
同步操作将从 10km/erpcdemo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/* 定义项目名称,也是所有生成的源码文件名前缀 */
/*
* Generated by erpcgen 1.7.3 on Sat Apr 18 09:33:42 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
#include "erpcdemo_server.h"
#include <new>
#include "erpc_port.h"
#include "erpc_manually_constructed.h"
#if 10703 != ERPC_VERSION_NUMBER
#error "The generated shim code version is different to the rest of eRPC code."
#endif
using namespace erpc;
using namespace std;
#if ERPC_NESTED_CALLS_DETECTION
extern bool nestingDetection;
#endif
static ManuallyConstructed<DEMO_service> s_DEMO_service;
//! @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)
{
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)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
else
{
memcpy(data->data, data_local, data->dataLength);
}
}
//! @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)
{
codec->writeBinary(data->dataLength, data->data);
}
//! @brief Function to free space allocated inside struct binary_t
static void free_binary_t_struct(binary_t * data);
// Free space allocated inside struct binary_t function implementation
static void free_binary_t_struct(binary_t * data)
{
if (data->data)
{
erpc_free(data->data);
}
}
// Call the correct server shim based on method unique ID.
erpc_status_t DEMO_service::handleInvocation(uint32_t methodId, uint32_t sequence, Codec * codec, MessageBufferFactory *messageFactory)
{
switch (methodId)
{
case kDEMO_RD_demoHello_id:
return RD_demoHello_shim(codec, messageFactory, sequence);
case kDEMO_RD_demoHello2_id:
return RD_demoHello2_shim(codec, messageFactory, sequence);
case kDEMO_RD_demoHello3_id:
return RD_demoHello3_shim(codec, messageFactory, sequence);
default:
return kErpcStatus_InvalidArgument;
}
}
// Server shim for RD_demoHello of DEMO interface.
erpc_status_t DEMO_service::RD_demoHello_shim(Codec * codec, MessageBufferFactory *messageFactory, uint32_t sequence)
{
erpc_status_t err = kErpcStatus_Success;
binary_t *txInput = NULL;
txInput = (binary_t *) erpc_malloc(sizeof(binary_t));
if (txInput == NULL)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
binary_t * result = NULL;
// startReadMessage() was already called before this shim was invoked.
read_binary_t_struct(codec, txInput);
err = codec->getStatus();
if (!err)
{
// Invoke the actual served function.
#if ERPC_NESTED_CALLS_DETECTION
nestingDetection = true;
#endif
result = RD_demoHello(txInput);
#if ERPC_NESTED_CALLS_DETECTION
nestingDetection = false;
#endif
// preparing MessageBuffer for serializing data
err = messageFactory->prepareServerBufferForSend(codec->getBuffer());
}
if (!err)
{
// preparing codec for serializing data
codec->reset();
// Build response message.
codec->startWriteMessage(kReplyMessage, kDEMO_service_id, kDEMO_RD_demoHello_id, sequence);
write_binary_t_struct(codec, result);
err = codec->getStatus();
}
if (txInput)
{
free_binary_t_struct(txInput);
}
if (txInput)
{
erpc_free(txInput);
}
if (result)
{
free_binary_t_struct(result);
}
if (result)
{
erpc_free(result);
}
return err;
}
// Server shim for RD_demoHello2 of DEMO interface.
erpc_status_t DEMO_service::RD_demoHello2_shim(Codec * codec, MessageBufferFactory *messageFactory, uint32_t sequence)
{
erpc_status_t err = kErpcStatus_Success;
binary_t *txInput = NULL;
txInput = (binary_t *) erpc_malloc(sizeof(binary_t));
if (txInput == NULL)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
binary_t *txOutput = NULL;
lockErrors_t result;
// startReadMessage() was already called before this shim was invoked.
read_binary_t_struct(codec, txInput);
txOutput = (binary_t *) erpc_malloc(sizeof(binary_t));
if (txOutput == NULL)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
err = codec->getStatus();
if (!err)
{
// Invoke the actual served function.
#if ERPC_NESTED_CALLS_DETECTION
nestingDetection = true;
#endif
result = RD_demoHello2(txInput, txOutput);
#if ERPC_NESTED_CALLS_DETECTION
nestingDetection = false;
#endif
// preparing MessageBuffer for serializing data
err = messageFactory->prepareServerBufferForSend(codec->getBuffer());
}
if (!err)
{
// preparing codec for serializing data
codec->reset();
// Build response message.
codec->startWriteMessage(kReplyMessage, kDEMO_service_id, kDEMO_RD_demoHello2_id, sequence);
write_binary_t_struct(codec, txOutput);
codec->write(static_cast<int32_t>(result));
err = codec->getStatus();
}
if (txInput)
{
free_binary_t_struct(txInput);
}
if (txInput)
{
erpc_free(txInput);
}
if (txOutput)
{
free_binary_t_struct(txOutput);
}
if (txOutput)
{
erpc_free(txOutput);
}
return err;
}
// Server shim for RD_demoHello3 of DEMO interface.
erpc_status_t DEMO_service::RD_demoHello3_shim(Codec * codec, MessageBufferFactory *messageFactory, uint32_t sequence)
{
erpc_status_t err = kErpcStatus_Success;
binary_t *txInput = NULL;
txInput = (binary_t *) erpc_malloc(sizeof(binary_t));
if (txInput == NULL)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
int8_t txOutput[64];
int32_t size;
lockErrors_t result;
// startReadMessage() was already called before this shim was invoked.
read_binary_t_struct(codec, txInput);
err = codec->getStatus();
if (!err)
{
// Invoke the actual served function.
#if ERPC_NESTED_CALLS_DETECTION
nestingDetection = true;
#endif
result = RD_demoHello3(txInput, txOutput, &size);
#if ERPC_NESTED_CALLS_DETECTION
nestingDetection = false;
#endif
// preparing MessageBuffer for serializing data
err = messageFactory->prepareServerBufferForSend(codec->getBuffer());
}
if (!err)
{
// preparing codec for serializing data
codec->reset();
// Build response message.
codec->startWriteMessage(kReplyMessage, kDEMO_service_id, kDEMO_RD_demoHello3_id, sequence);
for (uint32_t arrayCount0 = 0; arrayCount0 < 64; ++arrayCount0)
{
codec->write(txOutput[arrayCount0]);
}
codec->write(size);
codec->write(static_cast<int32_t>(result));
err = codec->getStatus();
}
if (txInput)
{
free_binary_t_struct(txInput);
}
if (txInput)
{
erpc_free(txInput);
}
return err;
}
erpc_service_t create_DEMO_service()
{
s_DEMO_service.construct();
return s_DEMO_service.get();
}
void destroy_DEMO_service()
{
s_DEMO_service.destroy();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。