Skip to content
DuolixDuolix
HomeAll RobotsKits & partsEvents

My

Saved itemsOrders

Explore

Developer docsCommunity
AboutSupportPrivacy

© 2026 Duolix

Duolix
Developer documentationSDK reference
All documentation
Start hereDevelopment overviewQuick startConnect to the device
QCS6490 hardwareQCS6490 hardware overviewQCS6490 interfacesQCS6490 bring-up
AidLux systemAidLux workspaceNetwork and remote accessDevelopment environmentStart an application at boot
AI developmentInference workflowAidLite SDKROS 2 integration
SDK referenceAidLite Python APIAidLite C++ APIAidCV Python APIAidConnect C++ APIAidConnect Android APIAidStream C++ APIAidVoice C++ API
TroubleshootingTroubleshooting
SDK reference

AidConnect C++ API

Data exchange between Android and Linux.

[!TIP] 💡Note When developing with Aidconnect-SDK C++, the following points need to be noted:

  • The header file must be included during compilation, stored at: /usr/local/include/aidlux/aidconnect/aidconnect.hpp
  • The library file must be specified during linking, stored at: /usr/local/lib/aidlux/aidconnect/libaidconnect.so

enum struct LogLevel

Member Variable NameTypeDefault ValueDescription
DEBUGuint8_t0Debug log level
INFOuint8_t1Info log level
WARNINGuint8_t2Warning log level
ERRORuint8_t3Error log level

Class Aidkv

A shared memory communication class implemented based on C++.

get_library_version()

Field 1Field 2
APIget_library_version
DescriptionUsed to obtain version-related information of the current Aidconnect.
Parametersvoid
ReturnReturns a string containing the version information of the current Aidconnect

set_log_level()

Field 1Field 2
APIset_log_level
DescriptionSets the current minimum log level, and outputs log data with levels greater than or equal to this level. By default, logs of WARNING level and above are printed.
Parameterslog_level: Value of the enumeration type LogLevel
ReturnReturns 0 by default

init()

As the name implies, this function implements relevant initialization work.

Field 1Field 2
APIinit
DescriptionCompletes relevant initialization work
Parametersvoid
Return0 indicates the initialization operation is successful; a non-0 value indicates failure
int status = aidconnect.init();
if(EXIT_SUCCESS != status){
    printf("aidconnect.init failed !\n");
    return EXIT_FAILURE;
}

aidconnect_with_name()

This function is used to specify which shared memory block we need to use. It should be noted that this interface only checks whether a shared memory block exists and does not create new shared memory (the creation of shared memory is implemented by the Android-side interface).

Field 1Field 2
APIaidconnect_with_name
DescriptionSpecifies the use of a specific shared memory block
Parametersblock_id: ID string of a specific shared memory block
Return0 indicates the operation is successful; a non-0 value indicates failure
status = aidconnect.aidconnect_with_name("we");
if(EXIT_SUCCESS != status){
    printf("aidconnect.aidkv_with_id failed !\n");
    return EXIT_FAILURE;
}

set_bytes()

This function writes byte data to the corresponding shared memory.

Field 1Field 2
APIset_bytes
DescriptionWrites byte data to the corresponding shared memory
Parametersbuffer: Memory address storing the data
len: Byte length of the data to be written—
Return0 indicates the write operation is successful; a non-0 value indicates failure
status = aidconnect.set_bytes(buffer, sizeof(buffer));
if(EXIT_SUCCESS != status){
    printf("aidconnect.set_bytes failed !\n");
    return EXIT_FAILURE;
}

get_bytes()

This function reads the required byte data from the corresponding shared memory.

Field 1Field 2
APIget_bytes
DescriptionReads the required byte data from the corresponding shared memory
Parametersbuffer: Address of a pointer variable; the function copies data to this pointer variable address
len: Byte length of the data to be obtained—
Return0 indicates the read operation is successful; a non-0 value indicates failure
NoteBefore using this interface, developers need to allocate the required memory by themselves to store the data obtained from the shared memory
status = aidconnect.get_bytes(&result, &length);
if(EXIT_SUCCESS != status){
    printf("aidconnect.get_bytes failed !\n");
    return EXIT_FAILURE;
}

AidConnect C++ Sample Program

[!TIP] 💡Note

The AidConnect-SDK sample program is installed with the software package:

  • C++ sample program path: /usr/local/share/aidconnect/examples/cpp/

The C++ sample program here roughly includes the following parts:

Initialization

Initialization is a mandatory step, which will complete prerequisites such as configuration parsing.

Aidlux::AidConnect aidconnect;
int status = aidconnect.init();
if(EXIT_SUCCESS != status){
    printf("aidconnect.init failed !\n");
    return EXIT_FAILURE;
}

Associate a Specific Shared Memory Block

To achieve data interaction, the entities that need to exchange data must focus on the same shared memory block and perform read/write operations on it.

status = aidconnect.aidconnect_with_name("your_shm_name");
if(EXIT_SUCCESS != status){
    printf("aidconnect.aidconnect_with_name failed !\n");
    return EXIT_FAILURE;
}

Read and Write Data

The essence of data interaction is the read/write operation of the same data. Here is an example of a write operation:

char buffer[] = "Hello Cpp";
status = aidconnect.set_bytes(buffer, sizeof(buffer));
if(EXIT_SUCCESS != status){
    printf("aidconnect.set_bytes failed !\n");
    return EXIT_FAILURE;
}

Similarly, the read operation follows the same steps: initialize first, then associate the shared memory block, and finally call the data reading interface to obtain data.

PreviousAidCV Python APINextAidConnect Android API