Logo
中文版
详情联系: neusar-support@reachauto.com
API 文档

1 说明

私有协议模块为应用程序提供面向服务的通信接口,API主要包含服务提供端和服务请求端两部分。

2 头文件

头文件包括runtime_client_base.h,inter_core_comm_rte_consumer.h,inter_core_comm_rte_provider.h,runtime_client_wrapper_define.h。命名空间是Middleware::inter_core_comm。 runtime_client_wrapper_define.h是相关数据结构的定义。要使用私有协议提供的API进行通信,需要包含私有协议头文件。

2.1 runtime_client_base.h header file

服务提供端和服务消费端共同的父类头文件,主要定义共通的功能接口。

2.2 inter_core_comm_rte_consumer.h header file

该头文件包含服务消费端特有的接口定义,调用者是client角色时使用。

2.3 inter_core_comm_rte_provider.h header file

该头文件是服务提供端特有的接口定义,调用者是server角色时使用。

2.4 runtime_client_wrapper_define.h header file

该头文件提供基本类型的定义

3 类型定义

3.1 middleware::inter_core_comm::InterCoreCommRTEConsumer

Interface IDSWSD-comm-RuntimeAPI-API-011
Kind:class
Symbol:middleware::inter_core_comm::InterCoreCommRTEConsumer
Scope:namespace middleware::inter_core_comm
Syntax:class InterCoreCommRTEConsumer: public RuntimeClientBase {
public:
InterCoreCommRTEConsumer(int client_id, UNRemoteAddrInfo remote_info, ENMedium medim_type = EN_PFE); ~InterCoreCommRTEConsumer(); };
Header file: inter_core_comm_rte_consumer.h
Description:表示服务消费端的某个实例的标识符。使用client角色接口列表,需要构造该类的实例对象,例如: UNRemoteAddrInfo remoteInfo; remoteInfo.IPCFRemoteInfo.i_channel_id = 0; remoteInfo.IPCFRemoteInfo.i_instance_id = 0; remoteInfo.IPCFRemoteInfo.i_service_id = 10; uint8_t clientID = 1; ENMedium medimType = EN_IPCF; InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);

3.2 middleware::inter_core_comm::InterCoreCommRTEProvider

Interface IDSWSD-comm-RuntimeAPI-API-012
Kind:class
Symbol:middleware::inter_core_comm::InterCoreCommRTEProvider
Scope:namespace middleware::inter_core_comm
Syntax:class InterCoreCommRTEProvider : public RuntimeClientBase { public: InterCoreCommRTEProvider(uint8_t service_id, ENMedium medium_type = EN_PFE); ~InterCoreCommRTEProvider();
};
Header file:inter_core_comm_rte_provider.h
Description:表示服务提供端的接口标识。使用server角色接口列表,需要构造该类的实例对象,例如: uint8_t serviceID = 10; ENMedium medimType = EN_IPCF; InterCoreCommRTEProvider server(serviceID, mediumType);

3.3 middleware::inter_core_comm::UNRemoteAddrInfo

Interface IDSWSD-comm-RuntimeAPI-API-013
Kind:union
Symbol:middleware::inter_core_comm::UNRemoteAddrInfo
Scope:middleware::inter_core_comm
Syntax:union UNRemoteAddrInfo { struct { uint8_t i_service_id; uint8_t partition_name[16]; }PFERemoteInfo; struct { uint8_t i_service_id; uint8_t i_instance_id; uint8_t i_channel_id; }IPCFRemoteInfo; struct { uint8_t i_service_id; }LOCALRemoteInfo; };
Header file:runtime_client_wrapper_define.h
Description:表示要请求的对端服务类型信息。 partition_name[16]目前仅支持“mcu”,注意必须是小写字母,PFE通信方式时使用。 i_instance_id取值范围为0:hpc与mcu的IPCF通信。目前仅支持0。 i_channel_id取值范围为1:IPCF高优先级通道。2:IPCF低优先级通道。

3.4 middleware::inter_core_comm::ReturnCode

Interface IDSWSD-comm-RuntimeAPI-API-014
Kind:enum
Symbol:middleware::inter_core_comm::ReturnCode
Scope:namespace middleware::inter_core_comm
Syntax:enum ReturnCode { E_OK = 0x00, E_NOT_OK = 0x01, E_NOT_READY = 0x02 };
Header file:runtime_client_wrapper_define.h
Description:接口执行结果定义

3.5 middleware::inter_core_comm::MethodType

Interface IDSWSD-comm-RuntimeAPI-API-015
Kind:enum
Symbol:middleware::inter_core_comm::MethodType
Scope:middleware::inter_core_comm
Syntax:enum MethodType {EN_methodWithResponse = 0x05, EN_methodWithoutResponseWithAck = 0x06, EN_methodWithoutResponseWithoutAck = 0x07, EN_notificationWithAck = 0x08, EN_notificationWithoutAck = 0x09};
Header file:runtime_client_wrapper_define.h
Description:请求的服务类型, EN_methodWithResponse,EN_methodWithoutResponseWithAck,EN_methodWithoutResponseWithoutAck为method call使用,EN_notificationWithAck,EN_notificationWithoutAck为event send使用

3.6 middleware::inter_core_comm::ENMedium

Interface IDSWSD-comm-RuntimeAPI-API-016
Kind:enum
Symbol:middleware::inter_core_comm::ENMedium
Scope:namespace middleware::inter_core_comm
Syntax:enum ENMedium { EN_IPCF, EN_LOCAL, EN_PFE };
Header file:runtime_client_wrapper_define.h
Description:通信介质类型配置,值的代表意义描述如下: EN_IPCF:通信介质是IPCF共享内存的通信方式; EN_LOCAL:通信介质是local socket; EN_PFE: TCP/IP方式通信

3.7 middleware::inter_core_comm::LinkAvailableCallbackFunction

Interface IDSWSD-comm-RuntimeAPI-API-017
Kind:callback
Symbol:middleware::inter_core_comm::LinkAvailableCallbackFunction
Scope:namespace middleware::inter_core_comm
Syntax:typedef std::function<int(const uint8_t& connect_flag, const uint8_t& remote_id)> LinkAvailableCallbackFunction;
Header file:runtime_client_wrapper_define.h
Description:取得连接状态的回调函数,注册该回调后,当连接状态发生变化时,该函数被触发执行。

3.8 middleware::inter_core_comm::AsynMethodResponseCallbackFunction

Interface IDSWSD-comm-RuntimeAPI-API-018
Kind:callback
Symbol:middleware::inter_core_comm::AsynMethodResponseCallbackFunction
Scope:namespace middleware::inter_core_comm
Syntax:typedef std::function<void(uint8_t remote_id, uint8_t method_id, const ReturnCode& return_code, const vector<uint8_t>& rx_buffer, uint8_t session_id)> AsynMethodResponseCallbackFunction;
Header file:runtime_client_wrapper_define.h
Description:注册该回调函数,当Method异步请求后,数据返回时会通过该回调函数通知调用者。

3.9 middleware::inter_core_comm::MethodCallCallbackFunction

Interface IDSWSD-comm-RuntimeAPI-API-019
Kind:callback
Symbol:middleware::inter_core_comm::MethodCallCallbackFunction
Scope:namespace middleware::inter_core_comm
Syntax:typedef std::function<ReturnCode(uint8_t remote_id, uint8_t method_id, const vector<uint8_t>& rx_buffer, vector<uint8_t>& tx_buffer)> MethodCallCallbackFunction;
Header file:runtime_client_wrapper_define.h
Description:注册该回调函数,对端有method请求时,会触发执行该回调函数。 入参包括请求者的ID,methodID,以及对端请求数据buffer。 处理数据完成后,赋值给出参txBffer,返回给method请求者。 注:返回值类型是ReturnCode,使用场景参考: E_OK:服务处理完成,无异常 E_NOT_OK:MethodID服务处理出现异常 E_NOT_READY: MethodID服务不支持或者该MethodID服务未准备好。

3.10 middleware::inter_core_comm::EventReceiveCallbackFunction

Interface IDSWSD-comm-RuntimeAPI-API-020
Kind:callback
Symbol:middleware::inter_core_comm::EventReceiveCallbackFunction
Scope:namespace middleware::inter_core_comm
Syntax:typedef std::function<int(uint8_t service_id, uint8_t event_id, const vector<uint8_t>& rx_buffer)> EventReceiveCallbackFunction;
Header file:runtime_client_wrapper_define.h
Description:注册该回调函数,收到server发来的event时,触发执行该回调函数。 入参包括server的ID,eventID,以及对应的buffer。

4 接口定义

4.1 RuntimeClientBase API

4.1.1 GetConnectionStatus();

Interface IDSWSD-comm-RuntimeAPI-API-001
Symbol:RuntimeClientBase::GetConnectionStatus()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:ReturnCode GetConnectionStatus(uint8_t& remote_id);
Parameters (in):remote_id对端的ID
Parameters (inout):none
Parameters (out):none
Return value:ReturnCodeE_OK代表已连接,E_NOT_OK代表连接失败。详细的可参考3.4章节。
Exception Safety:none
Thread Safety:reentrant
Header file:runtime_client_base.h
Description:获取服务连接状态,返回值E_OK为连接成功,E_NOT_OK为未连接。
Additional示例: uint8_t clientID =5;
uint8_t serviceID = 9;
UNRemoteAddrInfo remoteInfo;
remoteInfo.IPCFRemoteInfo.i_channel_id = 1;
remoteInfo.IPCFRemoteInfo.i_instance_id = 0;
remoteInfo.IPCFRemoteInfo.i_service_id = serviceID;
ENMedium medimType = EN_PFE;
InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);
ReturnCode ret = client.GetConnectionStatus(serviceID);
Notes:

4.1.2 RegisterLinkAvailableHandler();

Interface IDSWSD-comm-RuntimeAPI-API-002
Symbol:RuntimeClientBase::RegisterLinkAvailableHandler()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax: int RegisterLinkAvailableHandler(LinkAvailableCallbackFunction callback);
Parameters (in):callback回调函数指针,当连接状态发生变化时,协议会通过该回调通知调用者。详细参考3.7章节
Parameters (inout):none
Parameters (out):none
Return value:int0代表注册成功。 参考6章节返回值定义。
Exception Safety:none
Thread Safety:reentrant
Header file:runtime_client_base.h
Description:注册连接状态的回调函数,连接状态发生变化时,能过该回调函数通知。
Additional示例:
int CliendlinkcallbackFunction(uint8_t flag,uint8_t remote_id)
{
printf("cliendlinkcallbackFunction() flag:%d/n", flag);
return 0;
}
InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);
client.RegisterLinkAvailableHandler(CliendlinkcallbackFunction);
Notes:

4.2 InterCoreCommRTEConsumer API

InterCoreCommRTEConsumer API是为服务的消费端提供接口。

4.2.1 SubscribeService()

Interface IDSWSD-comm-RuntimeAPI-API-003
Symbol:InterCoreCommRTEConsumer::SubscribeService()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int SubscribeService(uint8_t service_id, const vector<uint8_t>& event_id_list);
Parameters (in):service_id提供Event服务的ServerID
event_id_listEvent列表
Parameters (inout):none
Parameters (out):none
Return value:int参考6章节返回值定义
Exception Safety:调用此接口前需要与server建立连接成功,否则订阅无效
Thread Safety:none
Header file:inter_core_comm_rte_consumer.h
Description:订阅服务提供端支持的event。只有订阅了,才能收到server发的event消息。
Additional示例:
uint8_t serviceID = 9;
uint8_t enventID =5;
vector<uint8_t> eventList;
eventList.push_back(enventID);
InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);
int iRet = client.SubscribeService(serviceID, eventList);
Notes:

4.2.2 StopSubscribeService()

Interface IDSWSD-comm-RuntimeAPI-API-004
Symbol:InterCoreCommRTEConsumer::StopSubscribeService()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int StopSubscribeService(uint8_t service_id, const vector<uint8_t>& event_id_list);
Parameters (in):service_id提供Event服务的ServerID
event_id_listEvent列表
Parameters (inout):none
Parameters (out):none
Return value:int 参考6章节返回值定义
Exception Safety:调用此接口前需要建立连接成功,否则stop订阅无效
Thread Safety:none
Header file:inter_core_comm_rte_consumer.h
Description:Client停止订阅服务提供端的event,停止订阅后,client将不再接收server发来的该event。
Additional示例:
uint8_t serviceID = 9;
uint8_t enventID =5;
vector<uint8_t> eventList;
eventList.push_back(enventID);
InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);
client.StopSubscribeService(serviceID, eventList);
Notes:

4.2.3 RegisterEventReceiveHandler()

Interface IDSWSD-comm-RuntimeAPI-API-005
Symbol:InterCoreCommRTEConsumer::RegisterEventReceiveHandler()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int RegisterEventReceiveHandler(EventReceiveCallbackFunction callback);
Parameters (in):callback回调函数,收到server发来的event时,触发执行该回调函数。
Parameters (inout):none
Parameters (out):none
Return value:int0代表注册成功 参考6章节返回值定义
Exception Safety:none
Thread Safety:none
Header file:inter_core_comm_rte_consumer.h
Description:注册回调函数,当收到订阅的event消息时,通过该回调函数通知调用者。
Additional示例:
int eventreceivecallback(uint8_t serviceId, uint8_t methodId, const vector&ltuint8_t>& rxBuf)
{
return 0;
}
uint8_t serviceID = 9;
uint8_t enventID =5;
vector&ltuint8_t> eventList;
eventList.push_back(enventID);
InterCoreCommRTEConsumerclient(clientID, remoteInfo, medimType);
int iRet = client.RegisterEventReceiveHandler(eventreceivecallback);
Notes:

4.2.4 MethodCall();

Interface IDSWSD-comm-RuntimeAPI-API-006
Symbol:InterCoreCommRTEConsumer:MethodCall()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int MethodCall(uint8_t remote_id, uint8_t method_id, const vector<uint8_t>& tx_buffer, ReturnCode & return_code,vector<uint8_t>& rx_buffer, MethodType type = EN_methodWithResponse, uint16_t u16_wait_milliseconds = 500);
Parameters (in):remote_id服务端提供Method服务的consumerID。 0x00和0xFF是非法值。
method_idMethod ID。 0x00和0xFF是非法值。
tx_buffer请求数据。 介质是IPCF时, Channel 1的tx_buffer长度限制不大于1016字节。 Channel 2的tx_buffer长度限制不大于4088字节。
type请求的method的类型,参考3. 5章节methodType的描述
u16_wait_milliseconds超时时间参数,默认是500ms
Parameters (inout):none
Parameters (out):return_code对端处理请求后的返回码,参考ReturnCode类型
E_OK:成功
E_NOT_OK:对端处理服务出现异常
E_NOT_READY:对端不支持该method服务或者对端还未注册未准备好。
rx_buffer接收到的数据
Return value:int参考6章节返回值定义
Exception Safety:none
Thread Safety:none
Header file:inter_core_comm_rte_consumer.h
Description:请求服务接口,method服务请求有如下:
对端服务未注册(即未准备好):函数返回0,return_code参数是E_NOT_READY
对端不支持该methodID服务:接口返回值为0,return_code参数是E_NOT_READY
对端处理该服务异常:接口返回值为0,return_code参数为E_NOT_OK
对端处理该服务完成:接口返回值为0,return_code参数为E_OK
Additional示例:
uint8_t remoteId = 1;
uint8_t methodId = 1;
vector&ltuint8_t> buffer;buffer.pushback(1);
vector&luint8_t> tx_buffer;
vector&luint8_t> rx_buffer;
ReturnCode return_code;
MethodType enMethodType = EN_methodWithResponse;
InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);
int iRet = client.MethodCall(remoteId, methodId, buffer, return_code , rx_buffer, enMethodType);
Notes:

4.2.5 AsynMethodCall();

Interface IDSWSD-comm-RuntimeAPI-API-007
Symbol:InterCoreCommRTEConsumer:AsynMethodCall()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int AsynMethodCall(uint8_t remote_id, uint8_t method_id, const vector<uint8_t>& tx_buffer, uint8_t& session_id, MethodType type = EN_methodWithResponse);
Parameters (in):remote_id服务端提供Method服务的consumerID。 取值范围1-254。
method_idMethod ID。 取值范围1-254。
tx_buffer要发送的数据。 介质是IPCF时, Channel 1的tx_buffer长度限制不大于1016字节。 Channel 2的tx_buffer长度限制不大于4088字节。
type请求的类型,参考3.5章节
Parameters (inout):none
Parameters (out):session_idsessionID,当调用异步Method方法时,该函数返回调用时的会话ID,可以用于与异步Response消息的会话ID进行比对,是否一致
Return value:int参考6章节返回值定义
Exception Safety:none
Thread Safety:none
Header file:inter_core_comm_rte_consumer.h
Description:请求服务异步接口,调用后立即返回,返回的数据通过异步回调函数通知。
Additional示例:
uint8_t remoteId = 1;
uint8_t methodId = 1;
vector&luint8_t> buffer;buffer.pushback(1);
MethodType enMethodType = EN_methodWithResponse;
void asynMethodResponseCallback(uint8_t clientId, uint8_t methodId, ReturnCode& return_code, const <br>vector&luint8_t>& rxBuf, uint8_t sessionId){}
InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);
iRet = client.RegisterAsynMethodResponseHandler(asynClientMethodResponseCallback);
iRet = client.AsynMethodCall(remoteId, methodId, buffer, 0, enMethodType);
Notes:

4.2.6 RegisterAsynMethodResponseHandler();

Interface IDSWSD-comm-RuntimeAPI-API-008
Symbol:InterCoreCommRTEConsumer:RegisterAsynMethodResponseHandler()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int RegisterAsynMethodResponseHandler(AsynMethodResponseCallbackFunction callback);
Parameters (in):callback回调函数,调用异步method后,有请求数据返回时,触发该回调函数。
Parameters (inout):none
Parameters (out):none
Return value:int0代表注册成功 参考6章节返回值定义
Exception Safety:none
Thread Safety:none
Header file:inter_core_comm_rte_consumer.h
Description:请求服务异步接口,调用后立即返回,返回的数据通过异步回调函数通知。
Additional示例:
uint8_t remoteId = 1;
uint8_t methodId = 1;
vector<uint8_t> buffer;buffer.pushback(1);
MethodType enMethodType = EN_methodWithResponse;
void asynMethodResponseCallback(uint8_t clientId, uint8_t methodId, ReturnCode& return_code, const <br>vector&ltuint8_t>& rxBuf, uint8_t sessionId){}
InterCoreCommRTEConsumer client(clientID, remoteInfo, medimType);
iRet = client.RegisterAsynMethodResponseHandler(asynClientMethodResponseCallback);
iRet = client.AsynMethodCall(remoteId, methodId, buffer, 0, enMethodType);
Notes:

4.3 InterCoreCommRTEProvider API

InterCoreCommRTEProvider API是服务提供端的接口。

4.3.1 EventSend()

Interface IDSWSD-comm-RuntimeAPI-API-009
Symbol:InterCoreCommRTEProvider::EventSend()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int EventSend(uint8_t event_id, uint8_t consumer_id, const vector<uint8_t>& tx_buffer, MethodType en_method_type = EN_notificationWithAck, uint16_t wait_millisecond = 500);
Parameters (in):event_id要发送的eventID。 取值范围1-254。
consumer_id接收该event的clientID,取值范围1-255。 1-254:将event数据单独发给指定的client。 255:广播方式发送,将event数据群发给与之关联的client。
tx_buffer要发送的event对应的数据。 介质是IPCF时, Channel 1的tx_buffer长度限制不大于1016字节。 Channel 2的tx_buffer长度限制不大于4088字节。
en_method_type要发送的event的类型,参数3.5章节
wait_millisecond超时时间参数,默认500ms,如果该指定时间内没有收到对端回复的ACK,则认为超时。
Parameters (inout):none
Parameters (out):none
Return value:int5秒内没有收到回复,则认为超时,返回kTimeOut。 参考6章节返回值定义
Exception Safety:none
Thread Safety:none
Header file:inter_core_comm_rte_provider.h
Description:服务端发送Event服务信息,同步接口,如果连接多个consumer,则收到其中一个consumer的回复,就算发送成功,返回0。否则超时。
Additional示例:
InterCoreCommRTEProvider server(serviceID, mediumType);
vector&ltuint8_t> buffer;buffer.pushback(1);
uint8_t serviceID = 10;
ENMedium mediumType = EN_PFE;
uint8_t ServerTest_clientID = 80;
uint8_t ServerTest_eventID = 5;
MethodType enMethodType = EN_notificationWithAck;
int iRet = server.EventSend(ServerTest_eventID, ServerTest_clientID, buffer, enMethodType);
Notes:

4.3.2 RegisterMethodCallHandler();

Interface IDSWSD-comm-RuntimeAPI-API-010
Symbol:InterCoreCommRTEProvider::RegisterMethodCallHandler()
Kind:function
Scope:namespace middleware::inter_core_comm
Visibility:public
Syntax:int RegisterMethodCallHandler(MethodCallCallbackFunction callback);
Parameters (in):callback响应对端发来的method请求函数,当收到对端method请求时,触发该回调,所有的method请求都会触发该回调。
Parameters (inout):none
Parameters (out):none
Return value:int0代表注册成功 参考6章节返回值定义
Exception Safety:none
Thread Safety:none
Header file:inter_core_comm_rte_provider.h
Description:注册回调函数,用来响应对端发起的Method请求。
Additional示例:
char txClientBufBuf[] = "client tx buffer";
ReturnCode client_methodcallback(uint8_t clientId ,uint8_t methodId , const vector<uint8_t>& rxBuf, vector&ltuint8_t>& txBuf)
{
txBuf.reserve(sizeof(txClientBufBuf));
txBuf.resize(sizeof(txClientBufBuf));
memcpy(&txBuf[0], txClientBufBuf, sizeof(txClientBufBuf));
return E_OK;
}
InterCoreCommRTEProvider provider(clientID, remoteInfo, medimType);
provider.RegisterMethodCallHandler(client_methodcallback);
Notes:

5 接口变更履历

5.1 SW5.0到SW7.0的变更

SW5.0SW7.0含义
Middleware::InterCoreCommmiddleware::inter_core_comm命名空间
union UNRemoteAddrInfo { struct { uint8_t iServiceID; uint8_t ServerIp[16]; }PFERemoteInfo; struct { uint8_t iServiceID; uint8_t iInstanceID; uint8_t iChannelID; }IPCFRemoteInfo; struct { uint8_t iServiceID; }LOCALRemoteInfo; };union UNRemoteAddrInfo { struct { uint8_t i_service_id; uint8_t server_ip[16]; }PFERemoteInfo; struct { uint8_t i_service_id; uint8_t i_instance_id; uint8_t i_channel_id; }IPCFRemoteInfo; struct { uint8_t i_service_id; }LOCALRemoteInfo; };连接目的地地址信息
RuntimeClientBase::get_connection_status()RuntimeClientBase::GetConnectionStatus()获取连接状态
RuntimeClientBase::register_link_available_handler()RuntimeClientBase::RegisterLinkAvailableHandler()注册回调函数,用于获取连接状态
RuntimeClientBase::method_call()RuntimeClientBase::MethodCall()请求method服务同步接口
RuntimeClientBase::method_call_response_receive()RuntimeClientBase::MethodCallResponseReceive()接收method服务数据
RuntimeClientBase::asyn_method_call ()RuntimeClientBase::AsynMethodCall()请求method服务的异步接口
RuntimeClientBase::register_asyn_method_response_handler()RuntimeClientBase::RegisterAsynMethodResponseHandler()注册回调函数,用于接收异步请求的method服务返回的数据
RuntimeClientBase::register_method_call_handler()RuntimeClientBase::RegisterMethodCallHandler()注册回调函数,用于处理对端的method请求
InterCoreCommRTEClient::subscribe_service()InterCoreCommRTEClient::SubscribeService()订阅服务的接口
InterCoreCommRTEClient::stop_subscribe_service()InterCoreCommRTEClient::StopSubscribeService()停止订阅服务的接口
InterCoreCommRTEClient::register_event_receive_handler()InterCoreCommRTEClient::RegisterEventReceiveHandler()注册回调函数,用于接收server发来的event
InterCoreCommRTEClient::connect()InterCoreCommRTEClient::Connect()连接请求接口
InterCoreCommRTEClient::disconnect()InterCoreCommRTEClient::Disconnect()断开连接请求接口

5.2 SW7.0到SW9.0的变更

SW7.0SW9.0含义
middleware::inter_core_comm::
InterCoreCommRTEClient
middleware::inter_core_comm::
InterCoreCommRTEConsumer
私有协议
服务消费方
middleware::inter_core_comm::
InterCoreCommRTEServer
middleware::inter_core_comm::
InterCoreCommRTEProvider
私有协议
服务提供方
union UNRemoteAddrInfo {
struct { uint8_t i_service_id;
uint8_t server_ip[16];
}PFERemoteInfo;
struct { uint8_t i_service_id;
uint8_t i_instance_id;
uint8_t i_channel_id;
}IPCFRemoteInfo;
struct { uint8_t i_service_id;
}LOCALRemoteInfo;
};
union UNRemoteAddrInfo {
struct { uint8_t i_service_id;
uint8_t partition_name[16];
}PFERemoteInfo;
struct { uint8_t i_service_id;
uint8_t i_instance_id;
uint8_t i_channel_id;
}IPCFRemoteInfo;
struct { uint8_t i_service_id;
}LOCALRemoteInfo;
};
连接目的地信息
RuntimeClientBase::MethodCall(uint8_t remote_id,
uint8_t method_id,
const vector<uint8_t>& tx_buffer,
MethodType type = EN_methodWithResponse)
InterCoreCommRTEConsumer::MethodCall(uint8_t remote_id,
uint8_t method_id,
const vector<uint8_t>& tx_buffer,
ReturnCode & return_code,
vector<uint8_t>& rx_buffer,
MethodType type = EN_methodWithResponse,
uint16_t u16_wait_milliseconds = 500)
请求method服务,
同步接口,与MethodCall
ResponseReceive()合并。
RuntimeClientBase::MethodCallResponseReceive()删除接收method服务数据
RuntimeClientBase::AsynMethodCall(uint8_t remote_id,
uint8_t method_id,
const vector<uint8_t>& tx_buffer,
uint8_t& session_id,
MethodType type = EN_methodWithResponse)
InterCoreCommRTEConsumer::AsynMethodCall(uint8_t remote_id,
uint8_t method_id,
const vector<uint8_t>& tx_buffer,
uint8_t& session_id,
MethodType type = EN_methodWithResponse)
请求method服务
的异步接口
typedef std::function<int(uint8_t remote_id,<br> uint8_t method_id,<br> const vector<uint8_t>& rx_buffer,<br> uint8_t session_id)> AsynMethodResponseCallbackFunction;
typedef std::function<void(uint8_t remote_id,
uint8_t method_id,
const ReturnCode& return_code, const vector<uint8_t>& rx_buffer,
uint8_t session_id)> AsynMethodResponseCallbackFunction;
异步Method的
响应消息
回调函数
typedef std::function<int(uint8_t remote_id,<br> uint8_t method_id,<br> const vector<uint8_t>& rx_buffer,<br> vector<uint8_t>& tx_buffer)> MethodCallCallbackFunction;
typedef std::function<ReturnCode(uint8_t remote_id,<br> uint8_t method_id,<br> const vector<uint8_t>& rx_buffer,<br>vector<uint8_t>& tx_buffer)> MethodCallCallbackFunction;
服务端
Method方法的
处理回调函数
RuntimeClientBase::
RegisterAsynMethodResponseHandler<br>(AsynMethodResponseCallbackFunction callback)
InterCoreCommRTEConsumer::
RegisterAsynMethodResponseHandler<br>(AsynMethodResponseCallbackFunction callback)
注册回调函数,
用于接收异步请求<br>
的method服务
返回的数据
RuntimeClientBase::RegisterMethodCallHandler<br>(MethodCallCallbackFunction callback)InterCoreCommRTEProvider::RegisterMethodCallHandler<br>(MethodCallCallbackFunction callback)注册回调函数,
用于处理对端的method请求
InterCoreCommRTEClient::Connect()删除连接请求接口
InterCoreCommRTEClient::Disconnect()删除断开连接请求接口

6 ERROR

接口返回值描述:

ValueName描述
0x00kSuccess没有错误。
0x03kParamInvalid参数非法,包括consumerID、providerID、methodID、channelID。
0x04kLocalIDExistID已存在
0x05kTimeOut请求超时
0x06kUnconnect未连接
0x07kNoBuffers发送缓存空间不足,无法发送
0x08kNoMemory内存无法申请
0x09kChannelParamError通道参数错误
0xFFkOtherError其他未知错误

附录