DJI_Camera.cpp
Go to the documentation of this file.
00001 
00012 #include "DJI_Camera.h"
00013 
00014 using namespace DJI::onboardSDK;
00015 
00016 Camera::Camera(CoreAPI *ControlAPI) { api = ControlAPI; }
00017 
00018 void Camera::setCamera(Camera::CAMERA_CODE camera_cmd)
00019 {
00020   unsigned char send_data = 0;
00021   api->send(0, encrypt, SET_CONTROL, camera_cmd, &send_data, 1);
00022 }
00023 
00024 void Camera::setGimbalAngle(GimbalAngleData *data)
00025 {
00026   api->send(0, encrypt, SET_CONTROL, Camera::CODE_GIMBAL_ANGLE, (unsigned char *)data,
00027     sizeof(GimbalAngleData));
00028 }
00029 
00030 void Camera::setGimbalSpeed(GimbalSpeedData *data)
00031 {
00032   data->reserved = 0x80;
00033   api->send(0, encrypt, SET_CONTROL, Camera::CODE_GIMBAL_SPEED, (unsigned char *)data,
00034     sizeof(GimbalSpeedData));
00035 }
00036 
00037 GimbalData Camera::getGimbal() const { return api->getBroadcastData().gimbal; }
00038 
00039 float32_t Camera::getYaw() const { return api->getBroadcastData().gimbal.yaw; }
00040 
00041 float32_t Camera::getRoll() const { return api->getBroadcastData().gimbal.roll; }
00042 
00043 float32_t Camera::getPitch() const { return api->getBroadcastData().gimbal.pitch; }
00044 
00045 bool Camera::isYawLimit() const
00046 {
00047   if (api->getSDKVersion() != versionM100_23)
00048     return api->getBroadcastData().gimbal.yawLimit ? true : false;
00049   return false;
00050 }
00051 
00052 bool Camera::isRollLimit() const
00053 {
00054   if (api->getSDKVersion() != versionM100_23)
00055     return api->getBroadcastData().gimbal.rollLimit ? true : false;
00056   return false;
00057 }
00058 bool Camera::isPitchLimit() const
00059 {
00060   if (api->getSDKVersion() != versionM100_23)
00061     return api->getBroadcastData().gimbal.pitchLimit ? true : false;
00062   return false;
00063 }
00064 
00065 CoreAPI *Camera::getApi() const { return api; }
00066 
00067 void Camera::setApi(CoreAPI *value) { api = value; }


dji_sdk_lib
Author(s):
autogenerated on Thu Jun 6 2019 17:55:25