SendData
Function Usage
Sends data to the instruction stream engine server.
Restrictions
N/A
Prototype
uint32_t SendData(VMIMsgType type, uint8_t* data, uint32_t length)
Parameters
Parameter |
Input/Output |
Type |
Description |
|---|---|---|---|
type |
Input |
VMIMsgType |
Type of sent data. For details, see the definition of the instruction stream data types. |
data |
Input |
uint8_t* |
Address of the buffer for sending the type data. |
length |
Input |
uint32_t |
Length of the buffer for sending the type data. |
Returns
- VMI_SUCCESS: The data is successfully sent.
- VMI_CLIENT_EXEC_ORDER_FAIL: The engine execution order is invalid.
- VMI_ENGINE_INVALID_PARAM: Invalid parameter.
- VMI_ENGINE_UNINIT_SOCK: The socket is not initialized.
- VMI_ENGINE_SEND_ALLOC_FAILED: Failed to allocate memory for sending data.
- VMI_ENGINE_SEND_MEMCPY_FAILED: Failed to copy the memory for sending data.
- VMI_ENGINE_SEND_FAIL: Failed to send data.
Example Call
void Test()
{
const int MAX_BUF_LEN =1048576;
uint8_t *recvBuf = new uint8_t[MAX_BUF_LEN];
uint32_t result = SendData(VMIMsgType::AUDIO, recvBuf, MAX_BUF_LEN);
if (result == VMI_SUCCESS) {
// send success
} else {
// send failed
}
}
Parent topic: External APIs of the Instruction Stream Engine Client