How to get autopilot version?

I want to get autopilot version of my pixhawk.

I create message:
mavlink_message_t msg;
mavlink_command_long_t cmd;

cmd.confirmation = 1;
cmd.param1 = 1.0f;
cmd.param2 = 0.0f;
cmd.param3 = 0.0f;
cmd.param4 = 0.0f;
cmd.param5 = 0.0f;
cmd.param6 = 0.0f;
cmd.param7 = 0.0f;
cmd.target_system = BPLA::getInstance()->mavlinkVehicleID;
cmd.target_component = BPLA::getInstance()->mavlinkCompID;

mavlink_msg_command_long_encode(BPLA::getInstance()->mavlinkSysID, BPLA::getInstance()->mavlinkCompID, &msg, &cmd);

and after receiving heartbeat i send msg to pixhawk. And i wait message AUTOPILOT_VERSION, but nothing. What i’m doing wrong?

Are you sure the target_system matches your autopilot?

That function encodes the command into msg, but are you actually sending it to the vehicle (writing to serial or UDP)?