Updated on 2022-03-13 GMT+08:00

Engine::SetDataRecvFunctor

Sets the callback function for an engine to receive messages. This API is defined in engine.h.

It must be used together with the DataRecvInterface::RecvData API. The detailed principles are as follows:

  1. Define a subclass (for example, DdkDataRecvInterface) of class DataRecvInterface and initialize the object of the subclass.
  2. Set the object of class DdkDataRecvInterface to a callback function by calling Engine::SetDataRecvFunctor.
  3. Send the input data to the corresponding output port by calling Engine::SendData.
  4. Return data by calling the RecvData function of class DdkDataRecvInterface.

Syntax

HIAI_StatusT Engine::SetDataRecvFunctor(const uint32_t portId, const shared_ptr<DataRecvInterface>& userDefineDataRecv)

Parameter Description

Parameter

Description

Value Range

portId

Port ID

-

userDefineDataRecv

Callback function for receiving user-defined data

-

Return Value

For details about the returned error codes, see "Error Codes."

Error Codes

No.

Error Code

Description

1

HIAI_OK

The running is OK.

2

HIAI_PORT_ID_ERROR

The port ID has an error.