Rate This Document
Findability
Accuracy
Completeness
Readability

Command Word (VmiCmd)

Command words need to be specified for functions such as module data input, data output, and parameter setting. A command word consists of VmiDataType (module data type), VmiCmdType (command word type), and specific module command word (such as VmiVideoCmdId and VmiAudioCmdId). The definition is as follows:

enum VmiCmdType : uint8_t {
    CMD_SET_PARAM = 0,                               // Parameter setting
    CMD_GET_PARAM,                                   // Parameter obtaining
    CMD_TRANS_DATA,                                  // Data transmitting
};
enum VmiVideoCmdId : uint16_t {
    SET_ENCODER_PARAM = 0,                           // The client sets encoding parameters to the server.
    RETURN_VIDEO_DATA,                               // The server returns video data to the client.
    GET_ENCODER_PARAM,                               // Obtains the encoding parameters of the video module.
};
enum VmiAudioCmdId : uint16_t {
    SET_AUDIOPLAY_PARAM = 0,                         // The client sets audio playback parameters to the server.
    GET_AUDIOPLAY_PARAM,                             // The client obtains audio playback parameters from the server.
    SET_CLIENT_PLAY_QUEUE_SIZE,                      // The client feeds back the queue length of the audio data to be played to the server.
    RETURN_AUDIO_PLAY_DATA,                          // The server sends audio playback data to the client.
};
enum VmiMicCmdId : uint16_t {
    SEND_MIC_DATA = 0,                               // The client sends microphone data to the server.
    RETURN_OPEN_CLIENT_MIC,                          // The server notifies the client that the microphone is opened.
    RETURN_CLOSE_CLIENT_MIC,                         // The server notifies the client that the microphone is closed.
};
enum VmiTouchCmdId : uint16_t {
    SEND_TOUCH_EVENT = 0,                            // The client sends touch data to the server.
    SEND_KEY_EVENT,                                  // The client sends keyboard data to the server.
};
#define MAKE_CMD(dataType, cmdType, cmdId)  ((dataType) << 24 | (cmdType) << 16 | (cmdId))
enum VmiCmd : uint32_t {
    // CMD definition of the video module
    VIDEO_SET_ENCODER_PARAM = MAKE_CMD(DATA_VIDEO, CMD_SET_PARAM, SET_ENCODER_PARAM),      // Refer to EncodeParams for parameter formats.
    VIDEO_RETURN_VIDEO_DATA = MAKE_CMD(DATA_VIDEO, CMD_TRANS_DATA, RETURN_VIDEO_DATA),     // Refer to VideoData for data formats.
    VIDEO_GET_ENCODER_PARAM = MAKE_CMD(DATA_VIDEO, CMD_GET_PARAM, GET_ENCODER_PARAM),      // Refer to EncodeParams for parameter formats.
    // CMD definition of the audio module
    AUDIO_SET_AUDIOPLAY_PARAM = MAKE_CMD(DATA_AUDIO, CMD_SET_PARAM, SET_AUDIOPLAY_PARAM),  // Refer to AudioPlayParams for parameter formats.
    AUDIO_GET_AUDIOPLAY_PARAM = MAKE_CMD(DATA_AUDIO, CMD_GET_PARAM, GET_AUDIOPLAY_PARAM),
    AUDIO_SET_CLIENT_PLAY_QUEUE_SIZE = MAKE_CMD(DATA_AUDIO, CMD_SET_PARAM, SET_CLIENT_PLAY_QUEUE_SIZE),
    AUDIO_RETURN_AUDIO_PLAY_DATA = MAKE_CMD(DATA_AUDIO, CMD_TRANS_DATA, RETURN_AUDIO_PLAY_DATA),  // Refer to AudioData for data formats.
    AUDIO_SET_CLIENT_VOLUME = MAKE_CMD(DATA_AUDIO, CMD_SET_PARAM, SET_CLIENT_VOLUME),
    // CMD definition of the microphone module
    MIC_SEND_MIC_DATA = MAKE_CMD(DATA_MIC, CMD_TRANS_DATA, SEND_MIC_DATA),
    MIC_RETURN_OPEN_CLIENT_MIC = MAKE_CMD(DATA_MIC, CMD_TRANS_DATA, RETURN_OPEN_CLIENT_MIC),
    MIC_RETURN_CLOSE_CLIENT_MIC = MAKE_CMD(DATA_MIC, CMD_TRANS_DATA, RETURN_CLOSE_CLIENT_MIC),
    // CMD definition of the touch module
    TOUCH_SEND_TOUCH_EVENT = MAKE_CMD(DATA_TOUCH, CMD_TRANS_DATA, SEND_TOUCH_EVENT),    // Refer to VmiTouchInputData for data formats.
    TOUCH_SEND_KEY_EVENT = MAKE_CMD(DATA_TOUCH, CMD_TRANS_DATA, SEND_KEY_EVENT),        // Refer to VmiKeyInputData for data formats.
};