void PointGreyCamera::handleError(const std::string &prefix, const FlyCapture2::Error &error)
{
  if(error == PGRERROR_TIMEOUT)
  {
    throw CameraTimeoutException("PointGreyCamera: Failed to retrieve buffer within timeout.");
  }
  else if(error != PGRERROR_OK)     // If there is actually an error (PGRERROR_OK means the function worked as intended...)
  {
    std::string start(" | FlyCapture2::ErrorType ");
    std::stringstream out;
    out << error.GetType();
    std::string desc(error.GetDescription());
    throw std::runtime_error(prefix + start + out.str() + " " + desc);
  }
}
示例#2
0
void CCflycap_get_camera_property_info(CCflycap *ccntxt,
				       int property_number,
				       CameraPropertyInfo *info) {
  CHECK_CC(ccntxt);
  FlyCapture2::Camera *cam = (FlyCapture2::Camera *)ccntxt->inherited.cam;

  if (info==NULL) {
    CAM_IFACE_THROW_ERROR("no info argument specified (NULL argument)");
  }

  if ((property_number<0) || (property_number>=NUM_CAM_PROPS)) {
    BACKEND_GLOBAL(cam_iface_error) = CAM_IFACE_GENERIC_ERROR;
    CAM_IFACE_ERROR_FORMAT("property invalid");
  }

  FlyCapture2::Property prop;
  FlyCapture2::PropertyInfo propinfo;

  prop.type = propno2prop(property_number);
  propinfo.type = prop.type;

  switch(prop.type) {
  case FlyCapture2::BRIGHTNESS: info->name = "brightness"; break;
  case FlyCapture2::AUTO_EXPOSURE: info->name = "auto exposure"; break;
  case FlyCapture2::SHARPNESS: info->name = "sharpness"; break;
  case FlyCapture2::WHITE_BALANCE: info->name = "white balance"; break;
  case FlyCapture2::HUE: info->name = "hue"; break;
  case FlyCapture2::SATURATION: info->name = "saturation"; break;
  case FlyCapture2::GAMMA: info->name = "gamma"; break;
  case FlyCapture2::IRIS: info->name = "iris"; break;
  case FlyCapture2::FOCUS: info->name = "focus"; break;
  case FlyCapture2::ZOOM: info->name = "zoom"; break;
  case FlyCapture2::PAN: info->name = "pan"; break;
  case FlyCapture2::TILT: info->name = "tilt"; break;
  case FlyCapture2::SHUTTER: info->name = "shutter"; break;
  case FlyCapture2::GAIN: info->name = "gain"; break;
  case FlyCapture2::TRIGGER_MODE: info->name = "trigger mode"; break;
  case FlyCapture2::TRIGGER_DELAY: info->name = "trigger delay"; break;
  case FlyCapture2::FRAME_RATE: info->name = "frame rate"; break;
  case FlyCapture2::TEMPERATURE: info->name = "temperature"; break;
  }

  FlyCapture2::Error error = cam->GetProperty( &prop );
  if (error.GetType()==FlyCapture2::PGRERROR_PROPERTY_FAILED) {
    info->is_present = 0;
    return;
  }
  CIPGRCHK(error);

  CIPGRCHK(cam->GetPropertyInfo( &propinfo ));

  info->is_present = prop.present;

  info->min_value = propinfo.min;
  info->max_value = propinfo.max;

  info->has_auto_mode = propinfo.autoSupported;
  info->has_manual_mode = propinfo.manualSupported;

  info->is_scaled_quantity = 0;

  info->original_value = 0; // XXX FIXME

  info->available = prop.present;
  info->readout_capable = propinfo.readOutSupported;
  info->on_off_capable = propinfo.onOffSupported;

  info->absolute_capable = propinfo.absValSupported;
  info->absolute_control_mode = 0;
  info->absolute_min_value = propinfo.absMin;
  info->absolute_max_value = propinfo.absMax;

  return;
}