GuideCamera *GuideCamera::Factory(const wxString& choice) { GuideCamera *pReturn = NULL; try { if (choice.IsEmpty()) { throw ERROR_INFO("CameraFactory called with choice.IsEmpty()"); } Debug.AddLine(wxString::Format("CameraFactory(%s)", choice)); if (false) // so else ifs can follow { } #if defined (ASCOM_LATECAMERA) // do ascom first since it includes many choices, some of which match other choices below (like Simulator) else if (choice.Find(_T("ASCOM")) != wxNOT_FOUND) { pReturn = new Camera_ASCOMLateClass(choice); } #endif else if (choice.Find(_("None")) + 1) { } else if (choice.Find(_T("Simulator")) + 1) { pReturn = new Camera_SimClass(); } #if defined (SAC42) else if (choice.Find(_T("SAC4-2")) + 1) { pReturn = new Camera_SAC42Class(); } #endif #if defined (ATIK16) else if (choice.Find(_T("Atik 16 series")) + 1) { Camera_Atik16Class *pNewGuideCamera = new Camera_Atik16Class(); pNewGuideCamera->HSModel = false; if (choice.Find(_T("color"))) pNewGuideCamera->Color = true; else pNewGuideCamera->Color = false; pReturn = pNewGuideCamera; } #endif #if defined (ATIK_GEN3) else if (choice.Find(_T("Atik Gen3")) + 1) { Camera_Atik16Class *pNewGuideCamera = new Camera_Atik16Class(); pNewGuideCamera->HSModel = true; if (choice.Find(_T("color"))) pNewGuideCamera->Color = true; else pNewGuideCamera->Color = false; pReturn = pNewGuideCamera; } #endif #if defined (QGUIDE) else if (choice.Find(_T("CCD Labs Q-Guider")) + 1) { pReturn = new Camera_QGuiderClass(); pReturn->Name = _T("Q-Guider"); } else if (choice.Find(_T("MagZero MZ-5")) + 1) { pReturn = new Camera_QGuiderClass(); pReturn->Name = _T("MagZero MZ-5"); } #endif #if defined (QHY5II) else if (choice.Find(_T("QHY 5-II")) + 1) { pReturn = new Camera_QHY5IIClass(); } #endif #if defined (QHY5LII) else if (choice.Find(_T("QHY 5L-II Mono")) != wxNOT_FOUND) pReturn = new Camera_QHY5LIIM(); else if (choice.Find(_T("QHY 5L-II Color")) != wxNOT_FOUND) pReturn = new Camera_QHY5LIIC(); #endif #if defined(ALTAIR) else if (choice.Find(_T("Altair Camera")) + 1) { pReturn = new Camera_Altair(); } #endif #if defined(ZWO_ASI) else if (choice.Find(_T("ZWO ASI Camera")) + 1) { pReturn = new Camera_ZWO(); } #endif #if defined (CAM_QHY5) // must come afer other QHY 5's since this pattern would match them else if (choice.Find(_T("QHY 5")) + 1) { pReturn = new Camera_QHY5Class(); } #endif #if defined (OPENSSAG) else if (choice.Find(_T("Orion StarShoot Autoguider")) + 1) { pReturn = new Camera_OpenSSAGClass(); } #endif #if defined (KWIQGUIDER) else if (choice.Find(_T("KWIQGuider")) + 1) { pReturn = new Camera_KWIQGuiderClass(); } #endif #if defined (SSAG) else if (choice.Find(_T("StarShoot Autoguider")) + 1) { pReturn = new Camera_SSAGClass(); } #endif #if defined (SSPIAG) else if (choice.Find(_T("StarShoot Planetary Imager & Autoguider")) + 1) { pReturn = new Camera_SSPIAGClass(); } #endif #if defined (ORION_DSCI) else if (choice.Find(_T("Orion StarShoot DSCI")) + 1) { pReturn = new Camera_StarShootDSCIClass(); } #endif #if defined (OPENCV_CAMERA) else if (choice.Find(_T("OpenCV webcam")) + 1) { int dev = 0; if (choice.Find(_T("2")) + 1) { dev = 1; } pReturn = new Camera_OpenCVClass(dev); } #endif #if defined (WDM_CAMERA) else if (choice.Find(_T("Windows WDM")) + 1) { pReturn = new Camera_WDMClass(); } #endif #if defined (VFW_CAMERA) else if (choice.Find(_T("Windows VFW")) + 1) { pReturn = new Camera_VFWClass(); } #endif #if defined (LE_SERIAL_CAMERA) else if (choice.Find(_T("Long exposure Serial webcam")) + 1) { pReturn = new Camera_LESerialWebcamClass(); } #endif #if defined (LE_PARALLEL_CAMERA) else if (choice.Find( _T("Long exposure Parallel webcam")) + 1) { pReturn = new Camera_LEParallelWebcamClass(); } #endif #if defined (LE_LXUSB_CAMERA) else if (choice.Find( _T("Long exposure LXUSB webcam")) + 1) { pReturn = new Camera_LELxUsbWebcamClass(); } #endif #if defined (MEADE_DSI) else if (choice.Find(_T("Meade DSI I, II, or III")) + 1) { pReturn = new Camera_DSIClass(); } #endif #if defined (STARFISH) else if (choice.Find(_T("Fishcamp Starfish")) + 1) { pReturn = new Camera_StarfishClass(); } #endif #if defined (SXV) else if (choice.Find(_T("Starlight Xpress SXV")) + 1) { pReturn = new Camera_SXVClass(); } #endif #if defined (OS_PL130) else if (choice.Find(_T("Opticstar PL-130M")) + 1) { Camera_OSPL130.Color=false; Camera_OSPL130.Name=_T("Opticstar PL-130M"); pReturn = new Camera_OSPL130Class(); } else if (choice.Find(_T("Opticstar PL-130C")) + 1) { Camera_OSPL130.Color=true; Camera_OSPL130.Name=_T("Opticstar PL-130C"); pReturn = new Camera_OSPL130Class(); } #endif #if defined (NEB_SBIG) else if (choice.Find(_T("Nebulosity")) + 1) { pReturn = new Camera_NebSBIGClass(); } #endif #if defined (SBIGROTATOR_CAMERA) // must go above SBIG else if (choice.Find(_T("SBIG Rotator")) + 1) { pReturn = new Camera_SBIGRotatorClass(); } #endif #if defined (SBIG) else if (choice.Find(_T("SBIG")) + 1) { pReturn = new Camera_SBIGClass(); } #endif #if defined (FIREWIRE) else if (choice.Find(_T("The Imaging Source (DCAM Firewire)")) + 1) { pReturn = new Camera_FirewireClass(); } #endif #if defined (INOVA_PLC) else if (choice.Find(_T("i-Nova PLC-M")) + 1) { pReturn = new Camera_INovaPLCClass(); } #endif #if defined (INDI_CAMERA) else if (choice.Find(_T("INDI Camera")) + 1) { pReturn = new Camera_INDIClass(); } #endif #if defined (V4L_CAMERA) else if (choice.Find(_T("V4L(2) Camera")) + 1) { // There is at least ONE V4L(2) device ... let's find out exactly DeviceInfo *deviceInfo = NULL; if (1 == Camera_VIDEODEVICE.NumberOfDevices()) { deviceInfo = Camera_VIDEODEVICE.GetDeviceAtIndex(0); Camera_VIDEODEVICE.SetDevice(deviceInfo->getDeviceName()); Camera_VIDEODEVICE.SetVendor(deviceInfo->getVendorId()); Camera_VIDEODEVICE.SetModel(deviceInfo->getModelId()); Camera_VIDEODEVICE.Name = deviceInfo->getProduct(); } else { wxArrayString choices; int choice = 0; if (-1 != (choice = wxGetSinglechoiceIndex(_("Select your camera"), _T("V4L(2) devices"), Camera_VIDEODEVICE.GetProductArray(choices)))) { deviceInfo = Camera_VIDEODEVICE.GetDeviceAtIndex(choice); Camera_VIDEODEVICE.SetDevice(deviceInfo->getDeviceName()); Camera_VIDEODEVICE.SetVendor(deviceInfo->getVendorId()); Camera_VIDEODEVICE.SetModel(deviceInfo->getModelId()); Camera_VIDEODEVICE.Name = deviceInfo->getProduct(); } else { throw ERROR_INFO("Camerafactory invalid V4L choice"); } } pReturn = new Camera_VIDEODEVICEClass(); } #endif else { throw ERROR_INFO("CameraFactory: Unknown camera choice"); } } catch (const wxString& Msg) { POSSIBLY_UNUSED(Msg); if (pReturn) { delete pReturn; pReturn = NULL; } } return pReturn; }