Macro: HIAI_REGISTER_SERIALIZE_FUNC
Provides user-defined serialization and deserialization mechanisms for user-defined data types. This macro is defined in data_type_reg.h.
That is, during data sending, the struct pointers transferred by the user are converted into the struct buffer and data buffer. During data receiving, the struct buffer and data buffer obtained from the framework are converted into the structs.
Application scenario:
This API is used to quickly transfer data from the host side to the device side. If you want to improve the transfer performance, you must call this API.
- This API is used to quickly transfer data from the host side to the device side.
- If you want to use a high-performance transfer API, you must call this API to register serialization and deserialization functions.
Syntax
HIAI_REGISTER_SERIALIZE_FUNC(name, type, hiaiSerializeFunc, hiaiDeSerializeFunc)
Parameter Description
|
Parameter |
Description |
Value Range |
|---|---|---|
|
name |
Name of a registered message |
- |
|
type |
Type of a user-defined type |
- |
|
hiaiSerializeFunc |
Serialization function. The function format is as follows: typedef void(*hiaiSerializeFunc)(void* inputPtr, std::string& ctrlStr, uint8_t*& dataPtr, uint32_t& dataLen); The parameters are described as follows:
|
- |
|
hiaiDeSerializeFunc |
Deserialization function. The function format is as follows: typedef std::shared_ptr<void>(*hiaiDeSerializeFunc)( const char* ctrlPtr, const uint32_t& ctrlLen, const uint8_t* dataPtr, const uint32_t& dataLen); The parameters are described as follows:
|
- |
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_ENGINE_FUNCTOR_NULL |
The HiAI Engine function is null. |
|
3 |
HIAI_ENGINE_FUNCTOR_EXIST |
The HiAI Engine function exists. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot