Graph::SendData
用户从外部向Matrix发送void类型的数据到指定的端口。该接口在graph.h中定义。
在跨侧(Host->Device或Device->Host)传输数据时,该接口采用DMA(Direct Memory Access)传送方式,可能会影响CPU对中断请求的及时响应与处理,例如影响调用new或者malloc分配内存时的性能。
函数格式
HIAI_StatusT Graph::SendData(const EnginePortID& targetPortConfig, const std::string& messageName, const std::shared_ptr<void>& dataPtr, const uint32_t timeOut = 500)
参数说明
参数 |
说明 |
取值范围 |
---|---|---|
targetPortConfig |
数据接收方的Graph ID、Engine ID 和Port ID。 |
- |
messageName |
消息的名称。 |
- |
dataPtr |
消息的指针。 |
- |
timeOut |
调用该接口发送数据时的一次超时时间,不指定timeout参数时,默认的一次超时时间为500ms。 若发送数据超时,系统后台会再次尝试发送数据,最大尝试16次。 |
- |
返回值
返回的部分错误码请参见“错误码示例”中的“错误码”列。
错误码示例
序号 |
错误码 |
错误码描述 |
---|---|---|
1 |
HIAI_OK |
running ok |
2 |
HIAI_GRAPH_ENGINE_NOT_EXIST |
engine not exist |
3 |
HIAI_GRAPH_NOT_EXIST |
graph not exist |
4 |
HIAI_GRAPH_NO_USEFUL_MEMORY |
no useful memory |
5 |
HIAI_GRAPH_SENDMSG_FAILED |
hdc send msg failed |
6 |
HIAI_GRAPH_INVALID_VALUE |
graph invalid value |