ErrorCode::ErrorCodeType retCode; CameraManager *pm = vehicle->cameraManager; /*set camera work mode as SHOOT_PHOTO*/ DSTATUS("set camera work mode as SHOOT_PHOTO"); retCode == pm->setModeSync(index, camreamodule::WorkMode::SHOOT_PHOTO, 3); if (retCode != ErrorCode::SysCommonErr::Success){ DERROR("Set camera as SHOOT_PHOTO fail. Error code : 0x%lX", retCode); ErrorCode::printErrorCodeMsg(retCode); return retCode; }
/*set camera work mode as RECORD_VIDEO*/ DSTATUS("set camera mode to RECORD_VIDEO"); pm->setModeAsync(index, camreamodule::WorkMode::RECORD_VIDEO, setCameraModeForRecordVideoCb, &udata);
void CameraManagerAsyncSample::setCameraModeForRecordVideoCb( ErrorCode ::ErrCodeType retCode, UserData userData){ AsyncSampleData *uData = (AsyncSampleData *)userData; DSTATUS("retCode : 0x%lX", retCode); if (!uData) { DERROR("User data is a null value."); return; } if (retCode == ErrorCode::SysCommonErr::Success) { DSTATUS("set camera work mode successfully"); if (uData->pm) { DSTATUS("start to RECORD_VIDEO"); uData->pm->startRecordVideoAsync) { uData->index, (void(*)ErrprCode::ErrorCodeType, UserData))uData->userCallBack, uData-> userData); } } else { DERROR("start to record video error. Error code : 0x%lX", retCode); ErrorCode::printErrorCodeMsg(retCode); if (uData->userCallBack) { void (*cb)(ErrorCode::ErrorCodeType, UserData); cb = (void (*)(ErrorCode::ErrorCodeType, UserData))uData->userCallBack; cb(retCode, uData->userData); } } }