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.
RETURN_AUDIO_PLAY_DATA, // The server sends audio playback data to the client.
SET_CLIENT_VOLUME, // The server sends the volume size to the client.
GET_AUDIOPLAY_PARAM, // The client obtains audio playback parameters from the server.
};
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.
};
enum VmiSensorCmdId : uint16_t {
SEND_SENSOR_DATA = 0, // The client sends sensor data to the server.
RETURN_REGISTER_CLIENT_SENSOR, // The server notifies the client to register sensor listening.
RETURN_UNREGISTER_CLIENT_SENSOR, // The server notifies the client to unregister sensor listening.
RETURN_UPDATE_CLIENT_SENSOR_RATE, // The server notifies the client to update the sensor sampling rate.
};
enum VmiGpsCmdId : uint16_t {
SEND_LOCATION_DATA = 0, // The client sends GPS location data to the server.
SEND_NMEA_DATA, // The client sends NMEA data to the server.
RETURN_START_GPS, // The server notifies the client to start to send GPS data.
RETURN_STOP_GPS, // The server notifies the client to stop sending GPS data.
};
#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_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.
// CMD definition of the sensor module
SENSOR_SEND_SENSOR_DATA = MAKE_CMD(DATA_SENSOR, CMD_TRANS_DATA, SEND_SENSOR_DATA), // Refer to SensorData for data formats.
SENSOR_RETURN_REGISTER_CLIENT_SENSOR = MAKE_CMD(DATA_SENSOR, CMD_TRANS_DATA, RETURN_REGISTER_CLIENT_SENSOR),
SENSOR_RETURN_UNREGISTER_CLIENT_SENSOR = MAKE_CMD(DATA_SENSOR, CMD_TRANS_DATA, RETURN_UNREGISTER_CLIENT_SENSOR),
SENSOR_RETURN_UPDATE_CLIENT_SENSOR_RATE = MAKE_CMD(DATA_SENSOR, CMD_TRANS_DATA, RETURN_UPDATE_CLIENT_SENSOR_RATE),
// CMD definition of the GPS module
GPS_SEND_LOCATION_DATA = MAKE_CMD(DATA_GPS, CMD_TRANS_DATA, SEND_LOCATION_DATA), // Refer to VmiGPSLocationData for data formats.
GPS_SEND_NMEA_DATA = MAKE_CMD(DATA_GPS, CMD_TRANS_DATA, SEND_NMEA_DATA), // Refer to VmiGPSLocationData for data formats.
GPS_RETURN_START_GPS = MAKE_CMD(DATA_GPS, CMD_TRANS_DATA, RETURN_START_GPS),
GPS_RETURN_STOP_GPS = MAKE_CMD(DATA_GPS, CMD_TRANS_DATA, RETURN_STOP_GPS),
};
Parent topic: Basic Data Types