diff --git a/alpacapi_EditHistory.txt b/alpacapi_EditHistory.txt index 4f13003..1f939cb 100755 --- a/alpacapi_EditHistory.txt +++ b/alpacapi_EditHistory.txt @@ -1,4 +1,4 @@ -History Comments found =3505 in 522 files +History Comments found =3512 in 522 files PDS_ReadNASAfiles.c:28 //* Jan 26, 1992 Reading of PDS files into Mac program from CD working PDS_ReadNASAfiles.c:29 //* Mar 14, 1992 Starting on more detailed interpretation of label (header) PDS_ReadNASAfiles.c:30 //* Mar 16, 1992 Changed number of displayed bytes from 836 to 800 @@ -1854,7 +1854,7 @@ alpacadriver.cpp:133 //* Apr 13, 2022 Added CreateDriverObjects() alpaca_defs.h:42 //* Apr 13, 2022 Build 136 cameradriver_ATIK.cpp:52 //* Apr 15, 2022 Installed ATIK 460ex on WO71 telescope, updating ATIK drivers cameradriver_QHY.cpp:39 //* Apr 15, 2022 Installed QHY5III462C on WO102 ONAG guider -cameradriver_save.cpp:108 //* Apr 15, 2022 Disabled Histogram to speed up saving files +cameradriver_save.cpp:107 //* Apr 15, 2022 Disabled Histogram to speed up saving files cameradriver.cpp:168 //* Apr 16, 2022 Added CreateFakeImageData() for debugging without a sky cameradriver_ATIK.cpp:53 //* Apr 16, 2022 Fixed bug in GetImage_ROI_info() cameradriver_QSI.cpp:33 //* Apr 16, 2022 Added simulation option to QSI camera driver @@ -2674,7 +2674,7 @@ rotatordriver_sim.cpp:26 //* Mar 2, 2023 CONFORMU-rotatordriver_sim -> P switchdriver_sim.cpp:25 //* Mar 2, 2023 Created switchdriver_sim.cpp switchdriver_sim.h:11 //* Mar 2, 2023 Created switchdriver_sim.h alpacadriver.cpp:157 //* Mar 3, 2023 Added ProcessAlpacaCommand() -alpacadriver.cpp:4089 //* Mar 3, 2023 Make CONFORMU happy, check for valid device number +alpacadriver.cpp:4124 //* Mar 3, 2023 Make CONFORMU happy, check for valid device number alpacadriver_helper.c:13 //* Mar 3, 2023 Added FindDeviceTypeByStringLowerCase() calibration_sim.cpp:20 //* Mar 3, 2023 Created calibration_sim.cpp cameradriver_SONY.cpp:1295 //* Mar 3, 2023 this line caused a compile err @@ -3492,31 +3492,38 @@ alpaca_defs.h:100 //* Jun 16, 2024 Build 179 - pushed to github Makefile:68 #++ Jun 16, 2024 Updated QSI Makefile entry alpacadriver.cpp:194 //* Jun 17, 2024 Fixed bug in ProcessCmdLineArgs(), -p6502 caused a segmentation fault cameradriver_QSI.cpp:42 //* Jun 17, 2024 Fixed bug in CreateCameraObjects_QSI() invalid camera count -cameradriver.cpp:214 //* Jan 1, 2119 ---------------------------------------- -cameradriver.cpp:215 //* Jun 26, 2119 Add support for sub frames +cameradriver_QSI.cpp:43 //* Jun 21, 2024 Added Read_SensorTargetTemp() & Write_SensorTargetTemp() to QSI camera +alpacadriver.cpp:195 //* Jun 25, 2024 Added contentdata to requestlog file for PUT cmds +alpaca_defs.h:101 //* Jun 25, 2024 Build 180 - pushed to github +cameradriver.cpp:213 //* Jun 25, 2024 Updated PUT_CoolerOn() to pass CONFORMU +cameradriver.cpp:214 //* Jun 25, 2024 Updated Put_Fastreadout() to pass CONFORMU +cameradriver.cpp:215 //* Jun 25, 2024 Updated Put_SetCCDtemperature() to pass CONFORMU +cameradriver_ASI.cpp:87 //* Jun 25, 2024 Changed all kASCOM_Err_FailedUnknown to kASCOM_Err_UnspecifiedError +cameradriver.cpp:217 //* Jan 1, 2119 ---------------------------------------- +cameradriver.cpp:218 //* Jun 26, 2119 Add support for sub frames cameradriver_png.cpp:33 //* Jan 31, 2120 Add support for libpng cameradriver_TOUP.cpp:48 //* Feb 4, 2120 Add 16 bit readout to Toupcam cameradriver_TOUP.cpp:49 //* Feb 16, 2120 Add gain setting to Toupcam -cameradriver_ASI.cpp:1041 //* Jun 29, 2120 Change video timestamp to an option +cameradriver_ASI.cpp:1042 //* Jun 29, 2120 Change video timestamp to an option controller_camera.cpp:77 //* Jan 1, 2121 control key for different step size. controller_camera.cpp:78 //* Jan 1, 2121 add error list window controller_camera.cpp:79 //* Feb 6, 2121 Move downloading of images to a separate thread cameradriver_QHY.cpp:52 //* Oct 10, 2122 Add support for percentcompleted to QHY camera driver spectrodriver.cpp:33 //* May 7, 2123 Add support for SlitID, SlitAngle, SlitWidth controller_dome.cpp:47 //* Jun 25, 2123 Add slaved to DeviceState -History Comments found = 3505 in 522 files -Total lines = 246878 -Total comment Lines = 40487 (16.4%) -Total comments = 45472 (18.4%) -Total history comments = 3505 (1.4%) +History Comments found = 3512 in 522 files +Total lines = 247019 +Total comment Lines = 40531 (16.4%) +Total comments = 45516 (18.4%) +Total history comments = 3512 (1.4%) Total C files = 69 Total C++ files = 196 Total H files = 255 Preprocssor cnt = 7893 -Total SLOC = 156884 -Total SLOC-Logical = 120997 +Total SLOC = 156965 +Total SLOC-Logical = 121078 Programmer comment summary -MLS = 3095 +MLS = 3102 TODO = 11 DDB = 1 JMH = 3 diff --git a/src/alpaca_defs.h b/src/alpaca_defs.h index cb08185..b844063 100755 --- a/src/alpaca_defs.h +++ b/src/alpaca_defs.h @@ -98,6 +98,7 @@ //* May 15, 2024 Added TYPE_GuideDirections enums //* May 26, 2024 Build 178 //* Jun 16, 2024 Build 179 - pushed to github +//* Jun 25, 2024 Build 180 - pushed to github //***************************************************************************** //#include "alpaca_defs.h" @@ -117,7 +118,7 @@ #define kApplicationName "AlpacaPi" #define kVersionString "V0.7.2" -#define kBuildNumber 179 +#define kBuildNumber 180 #define kAlpacaDiscoveryPORT 32227 #define kAlpacaPiDefaultPORT 6800 diff --git a/src/alpacadriver.cpp b/src/alpacadriver.cpp index 48aaad4..f495d01 100644 --- a/src/alpacadriver.cpp +++ b/src/alpacadriver.cpp @@ -192,6 +192,7 @@ //* May 18, 2024 Fixed cSendJSONresponse bug, not initialized to true //* Jun 1, 2024 Global GPS now looks for Emlid and if found, uses that port //* Jun 17, 2024 Fixed bug in ProcessCmdLineArgs(), -p6502 caused a segmentation fault +//* Jun 25, 2024 Added contentdata to requestlog file for PUT cmds //***************************************************************************** //* to install code blocks 20 //* Step 1: sudo add-apt-repository ppa:codeblocks-devs/release @@ -3283,6 +3284,7 @@ static void LogRequest(TYPE_GetPutRequestData *reqData) { char lineBuff[512]; char datestring[64]; +char myHttpUserAgentStr[kUserAgentLen]; time_t currentTime; struct tm *linuxTime; int bytesWritten; @@ -3347,13 +3349,39 @@ int returnCode; // DEBUG_TIMING("Time to open log file (ms)\t="); } + //* ConformU generates a ridiculously long user agent string + //* ConformUniversal/2.2.0-rc.3+26636.58f2f3d79821bd5fa5e11173c24f1d7e1397a2f8 + strcpy(myHttpUserAgentStr, reqData->httpUserAgent); + if (strlen(myHttpUserAgentStr) > 32) + { + char *slashPtr; - sprintf(lineBuff, "%-18s\t%-18s\t%s\t%s %s\r\n", + slashPtr = strchr(myHttpUserAgentStr, '/'); + if (slashPtr != NULL) + { + *slashPtr = 0; + } + else + { + myHttpUserAgentStr[32] = 0; + } + } + sprintf(lineBuff, "%-18s\t%-18s\t%s\t%s %s", datestring, reqData->clientIPaddr, - reqData->httpUserAgent, + myHttpUserAgentStr, getPutStr, reqData->cmdBuffer); + + //* Added 6/25/2024 + //* Jun 25, 2024 Added contentdata to requestlog file for PUT cmds + if (reqData->get_putIndicator == 'P') + { + strcat(lineBuff, "\t"); + strcat(lineBuff, reqData->contentData); + } + strcat(lineBuff, "\r\n"); + // CONSOLE_DEBUG(lineBuff); @@ -3391,6 +3419,13 @@ int returnCode; { CONSOLE_DEBUG("Error: gIPlogFilePointer is NULL"); } + +// //* CONFORMU debugging 6/25/2024 +// if (reqData->get_putIndicator == 'P') +// { +// DumpRequestStructure(__FUNCTION__, reqData); +// CONSOLE_ABORT(__FUNCTION__); +// } // CONSOLE_DEBUG_W_STR(__FUNCTION__, "Exit"); } @@ -5495,6 +5530,7 @@ void DumpRequestStructure(const char *functionName, TYPE_GetPutRequestData *reqD CONSOLE_DEBUG_W_NUM( "cHTTPclientType \t=", reqData->cHTTPclientType); CONSOLE_DEBUG_W_BOOL( "clientIs_AlpacaPi \t=", reqData->clientIs_AlpacaPi); CONSOLE_DEBUG_W_BOOL( "clientIs_ConformU \t=", reqData->clientIs_ConformU); + CONSOLE_DEBUG_W_BOOL( "clientIs_Conform \t=", reqData->clientIs_Conform); CONSOLE_DEBUG_W_STR( "httpCmdString \t=", reqData->httpCmdString); CONSOLE_DEBUG_W_NUM( "requestTypeEnum \t=", reqData->requestTypeEnum); diff --git a/src/cameradriver.cpp b/src/cameradriver.cpp index c56f21c..7e81948 100755 --- a/src/cameradriver.cpp +++ b/src/cameradriver.cpp @@ -210,6 +210,9 @@ //* Apr 19, 2024 Added check for flip enabled to Put_Flip() //* May 17, 2024 Started adding http error 400 to camera methods //* Jun 15, 2024 Fixed case bug in Put_SaveAsPNG() +//* Jun 25, 2024 Updated PUT_CoolerOn() to pass CONFORMU +//* Jun 25, 2024 Updated Put_Fastreadout() to pass CONFORMU +//* Jun 25, 2024 Updated Put_SetCCDtemperature() to pass CONFORMU //***************************************************************************** //* Jan 1, 2119 ---------------------------------------- //* Jun 26, 2119 Add support for sub frames @@ -1059,7 +1062,8 @@ char httpHeader[500]; else { CONSOLE_DEBUG("invalid request"); - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; } break; @@ -1287,7 +1291,8 @@ char httpHeader[500]; } else { - alpacaErrCode = kASCOM_Err_InvalidOperation; + alpacaErrCode = kASCOM_Err_InvalidOperation; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Get not supported"); CONSOLE_DEBUG(alpacaErrMsg); } @@ -1300,7 +1305,8 @@ char httpHeader[500]; } else { - alpacaErrCode = kASCOM_Err_InvalidOperation; + alpacaErrCode = kASCOM_Err_InvalidOperation; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Get not supported"); CONSOLE_DEBUG(alpacaErrMsg); } @@ -1313,7 +1319,8 @@ char httpHeader[500]; } else { - alpacaErrCode = kASCOM_Err_InvalidOperation; + alpacaErrCode = kASCOM_Err_InvalidOperation; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Get not supported for stopexposure"); CONSOLE_DEBUG(alpacaErrMsg); } @@ -1610,6 +1617,20 @@ char httpHeader[500]; gServerTransactionID, INCLUDE_COMMA); + //* this is for debugging with CONFORUM 2024-06-25 + if (true) + { + if (strlen(reqData->contentData) > 0) + { + cBytesWrittenForThisCmd += JsonResponse_Add_String( mySocket, + reqData->jsonTextBuffer, + kMaxJsonBuffLen, + "ContentData", + reqData->contentData, + INCLUDE_COMMA); + } + } + cBytesWrittenForThisCmd += JsonResponse_Add_Int32( mySocket, reqData->jsonTextBuffer, kMaxJsonBuffLen, @@ -1624,6 +1645,7 @@ char httpHeader[500]; alpacaErrMsg, NO_COMMA); + //CONSOLE_DEBUG_W_NUM("len of jsonTextBuffer\t=", strlen(reqData->jsonTextBuffer)); cBytesWrittenForThisCmd += JsonResponse_Add_Finish( mySocket, reqData->httpRetCode, @@ -1668,7 +1690,8 @@ char myValueString[256]; keywordFound = GetKeyWordArgument( sourceData, keyword, myValueString, - (sizeof(myValueString) -1)); + (sizeof(myValueString) -1), + kIgnoreCase); if (keywordFound) { // CONSOLE_DEBUG_W_STR("Keyword found:", keyword); @@ -1703,50 +1726,41 @@ double myExposureDuration_secs; double myExposure_usecs; // CONSOLE_DEBUG(__FUNCTION__); - if (reqData != NULL) - { - ProcessTelescopeKeyWord(reqData->contentData, "Object", cObjectName, kObjectNameMaxLen); - ProcessTelescopeKeyWord(reqData->contentData, "Prefix", cFileNamePrefix, kFileNamePrefixMaxLen); - ProcessTelescopeKeyWord(reqData->contentData, "Suffix", cFileNameSuffix, kFileNamePrefixMaxLen); + ProcessTelescopeKeyWord(reqData->contentData, "Object", cObjectName, kObjectNameMaxLen); + ProcessTelescopeKeyWord(reqData->contentData, "Prefix", cFileNamePrefix, kFileNamePrefixMaxLen); + ProcessTelescopeKeyWord(reqData->contentData, "Suffix", cFileNameSuffix, kFileNamePrefixMaxLen); // CONSOLE_DEBUG_W_STR("Suffix", cFileNameSuffix); - durationFound = GetKeyWordArgument( reqData->contentData, - "Duration", - duarationString, - (sizeof(duarationString) -1), - kArgumentIsNumeric); + durationFound = GetKeyWordArgument( reqData->contentData, + "Duration", + duarationString, + (sizeof(duarationString) -1), + kRequireCase, + kArgumentIsNumeric); - //* if duration is NOT found, leave it alone - if (durationFound) + //* if duration is NOT found, leave it alone + if (durationFound) + { + myExposureDuration_secs = AsciiToDouble(duarationString); +// CONSOLE_DEBUG_W_DBL("myExposureDuration_secs\t=", myExposureDuration_secs); + myExposure_usecs = myExposureDuration_secs * 1000 * 1000; + if (myExposure_usecs < cCameraProp.ExposureMin_us) { - myExposureDuration_secs = AsciiToDouble(duarationString); -// CONSOLE_DEBUG_W_DBL("myExposureDuration_secs\t=", myExposureDuration_secs); - myExposure_usecs = myExposureDuration_secs * 1000 * 1000; - if (myExposure_usecs < cCameraProp.ExposureMin_us) - { - myExposure_usecs = cCameraProp.ExposureMin_us; - CONSOLE_DEBUG_W_DBL("Setting to default minimum exposure time of", myExposure_usecs); - } - else if (myExposure_usecs > cCameraProp.ExposureMax_us) - { - myExposure_usecs = cCameraProp.ExposureMax_us; - CONSOLE_DEBUG_W_DBL("Setting to default maximum exposure time of", myExposure_usecs); - } - cCurrentExposure_us = myExposure_usecs; + myExposure_usecs = cCameraProp.ExposureMin_us; + CONSOLE_DEBUG_W_DBL("Setting to default minimum exposure time of", myExposure_usecs); } - else + else if (myExposure_usecs > cCameraProp.ExposureMax_us) { -// CONSOLE_DEBUG("'Duration' not specified"); + myExposure_usecs = cCameraProp.ExposureMax_us; + CONSOLE_DEBUG_W_DBL("Setting to default maximum exposure time of", myExposure_usecs); } - + cCurrentExposure_us = myExposure_usecs; } else { - CONSOLE_DEBUG("Internal Error"); - // alpacaErrCode = kASCOM_Err_InternalError; - // CONSOLE_ABORT("Internal Error"); +// CONSOLE_DEBUG("'Duration' not specified"); } } @@ -1812,7 +1826,7 @@ TYPE_ASCOM_STATUS alpacaErrCode; else { GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Camera is monochrome"); - alpacaErrCode = kASCOM_Err_PropertyNotImplemented; + alpacaErrCode = kASCOM_Err_PropertyNotImplemented; } return(alpacaErrCode); } @@ -1872,45 +1886,37 @@ bool foundKeyWord; int newBinValue; // CONSOLE_DEBUG(__FUNCTION__); - if (reqData != NULL) + foundKeyWord = GetKeyWordArgument( reqData->contentData, + "BinX", + argumentString, + (sizeof(argumentString) -1), + kRequireCase, + kArgumentIsNumeric); + if (foundKeyWord) { - foundKeyWord = GetKeyWordArgument( reqData->contentData, - "BinX", - argumentString, - (sizeof(argumentString) -1)); - if (foundKeyWord) + if (IsValidNumericString(argumentString)) { - if (IsValidNumericString(argumentString)) + newBinValue = atoi(argumentString); + if ((newBinValue >= 1) && (newBinValue <= cCameraProp.MaxbinX)) { - newBinValue = atoi(argumentString); - if ((newBinValue >= 1) && (newBinValue <= cCameraProp.MaxbinX)) + // alpacaErrCode = kASCOM_Err_Success; + alpacaErrCode = Write_BinX(newBinValue); + if (alpacaErrCode == kASCOM_Err_Success) { - // alpacaErrCode = kASCOM_Err_Success; - alpacaErrCode = Write_BinX(newBinValue); - if (alpacaErrCode == kASCOM_Err_Success) - { - cCameraProp.BinX = newBinValue; - } - else - { - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, cLastCameraErrMsg); - CONSOLE_DEBUG_W_STR("cLastCameraErrMsg\t=", cLastCameraErrMsg); - CONSOLE_DEBUG_W_STR("alpacaErrMsg\t=", alpacaErrMsg); - } + cCameraProp.BinX = newBinValue; } else { - alpacaErrCode = kASCOM_Err_InvalidValue; - reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "BinX out of range"); - CONSOLE_DEBUG(alpacaErrMsg); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, cLastCameraErrMsg); + CONSOLE_DEBUG_W_STR("cLastCameraErrMsg\t=", cLastCameraErrMsg); + CONSOLE_DEBUG_W_STR("alpacaErrMsg\t=", alpacaErrMsg); } } else { alpacaErrCode = kASCOM_Err_InvalidValue; reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "BinX is non-numeric"); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "BinX out of range"); CONSOLE_DEBUG(alpacaErrMsg); } } @@ -1918,13 +1924,16 @@ int newBinValue; { alpacaErrCode = kASCOM_Err_InvalidValue; reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Keyword 'BinX' not found"); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "BinX is non-numeric"); CONSOLE_DEBUG(alpacaErrMsg); } } else { - alpacaErrCode = kASCOM_Err_InternalError; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Keyword 'BinX' not found"); + CONSOLE_DEBUG(alpacaErrMsg); } return(alpacaErrCode); } @@ -2167,50 +2176,44 @@ bool coolerState; // CONSOLE_DEBUG(__FUNCTION__); - if (reqData != NULL) + if (cIsCoolerCam) { - if (cIsCoolerCam) + alpacaErrCode = Read_CoolerState(&coolerState); + if (alpacaErrCode == 0) { - alpacaErrCode = Read_CoolerState(&coolerState); - if (alpacaErrCode == 0) - { - // CONSOLE_DEBUG(__FUNCTION__); - } - else if (alpacaErrCode == kASCOM_Err_NotImplemented) - { - coolerState = false; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Not implemented:"); - strcat(alpacaErrMsg, cLastCameraErrMsg); - if (cVerboseDebug) - { - CONSOLE_DEBUG(alpacaErrMsg); - } - } - else + // CONSOLE_DEBUG(__FUNCTION__); + } + else if (alpacaErrCode == kASCOM_Err_NotImplemented) + { + coolerState = false; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Not implemented:"); + strcat(alpacaErrMsg, cLastCameraErrMsg); + if (cVerboseDebug) { - coolerState = false; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Failed to read cooler state:"); - strcat(alpacaErrMsg, cLastCameraErrMsg); - if (cVerboseDebug) - { - CONSOLE_DEBUG(alpacaErrMsg); - } + CONSOLE_DEBUG(alpacaErrMsg); } - cBytesWrittenForThisCmd += JsonResponse_Add_Bool( reqData->socket, - reqData->jsonTextBuffer, - kMaxJsonBuffLen, - responseString, // "Value", - coolerState, - INCLUDE_COMMA); } else { - alpacaErrCode = kASCOM_Err_NotImplemented; + coolerState = false; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Failed to read cooler state:"); + strcat(alpacaErrMsg, cLastCameraErrMsg); + if (cVerboseDebug) + { + CONSOLE_DEBUG(alpacaErrMsg); + } } + cBytesWrittenForThisCmd += JsonResponse_Add_Bool( reqData->socket, + reqData->jsonTextBuffer, + kMaxJsonBuffLen, + responseString, // "Value", + coolerState, + INCLUDE_COMMA); } else { - alpacaErrCode = kASCOM_Err_InternalError; + alpacaErrCode = kASCOM_Err_NotImplemented; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Not implemented:"); } return(alpacaErrCode); } @@ -2221,22 +2224,23 @@ TYPE_ASCOM_STATUS CameraDriver::Put_Cooleron(TYPE_GetPutRequestData *reqData, ch TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_NotImplemented; char argumentString[32]; bool foundKeyWord; +bool validTrueFalse; bool newCoolerState; - CONSOLE_DEBUG(__FUNCTION__); - if (reqData != NULL) +// CONSOLE_DEBUG(__FUNCTION__); + if (cIsCoolerCam) { - if (cIsCoolerCam) + foundKeyWord = GetKeyWordArgument( reqData->contentData, + "CoolerOn", + argumentString, + (sizeof(argumentString) -1)); + if (foundKeyWord) { - foundKeyWord = GetKeyWordArgument( reqData->contentData, - "CoolerOn", - argumentString, - (sizeof(argumentString) -1)); - if (foundKeyWord) + CONSOLE_DEBUG_W_STR("argumentString\t=", argumentString); + validTrueFalse = IsValidTrueFalseString(argumentString); + if (validTrueFalse) { - CONSOLE_DEBUG_W_STR("argumentString\t=", argumentString); newCoolerState = IsTrueFalse(argumentString); - if (newCoolerState) { alpacaErrCode = Cooler_TurnOn(); @@ -2253,25 +2257,27 @@ bool newCoolerState; } else { - alpacaErrCode = kASCOM_Err_InvalidValue; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'CoolerOn' is missing"); + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Argument is not true/false"); } } else { - alpacaErrCode = kASCOM_Err_NotImplemented; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "This Camera does not support cooling"); - CONSOLE_DEBUG(alpacaErrMsg); + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'CoolerOn' is missing"); } } else { - alpacaErrCode = kASCOM_Err_InternalError; + alpacaErrCode = kASCOM_Err_NotImplemented; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Cooleron Not implemented:"); } + return(alpacaErrCode); } - //***************************************************************************** TYPE_ASCOM_STATUS CameraDriver::Get_CoolerPower(TYPE_GetPutRequestData *reqData, char *alpacaErrMsg, const char *responseString) { @@ -2846,7 +2852,7 @@ bool validData; // CONSOLE_DEBUG(__FUNCTION__); foundKeyWord = GetKeyWordArgument( reqData->contentData, - "offset", + "Offset", argumentString, (sizeof(argumentString) -1)); validData = false; @@ -2862,7 +2868,7 @@ bool validData; //* the keyword "offset" is missing alpacaErrCode = kASCOM_Err_InvalidValue; reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "offset is non-numeric"); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Offset is non-numeric"); CONSOLE_DEBUG(alpacaErrMsg); } } @@ -3081,7 +3087,7 @@ TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_InternalError; char argumentString[32]; bool foundKeyWord; int newValue; -char errorString[64]; +//char errorString[64]; // CONSOLE_DEBUG(__FUNCTION__); @@ -3091,11 +3097,10 @@ char errorString[64]; (sizeof(argumentString) -1)); if (foundKeyWord) { - newValue = atoi(argumentString); - //* ASCOM docs say to check these values ONLY at start exposure, how stupid -// if ((newValue >= 0) && (newValue < cCameraYsize)) - if (1) + if (IsValidNumericString(argumentString)) { + newValue = atoi(argumentString); + //* ASCOM docs say to check these values ONLY at start exposure, how stupid cCameraProp.StartY = newValue; alpacaErrCode = kASCOM_Err_Success; } @@ -3103,14 +3108,16 @@ char errorString[64]; { alpacaErrCode = kASCOM_Err_InvalidValue; reqData->httpRetCode = 400; - sprintf(errorString, "Value out of range: StartY=%d", newValue); - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, errorString); +// sprintf(errorString, "StartY is non-numeric: StartY=%d", newValue); +// GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, errorString); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "StartY value is non-numeric"); CONSOLE_DEBUG(alpacaErrMsg); } } else { - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Keyword 'StartY' not found"); CONSOLE_DEBUG(alpacaErrMsg); } @@ -3222,71 +3229,61 @@ bool directionFound; bool durationFound; char directionString[32]; char durationString[32]; -bool validData; CONSOLE_DEBUG(__FUNCTION__); //* "Direction=1&Duration=2&ClientID=34&ClientTransactionID=56" directionFound = GetKeyWordArgument( reqData->contentData, "Direction", directionString, - (sizeof(directionString) -1)); + (sizeof(directionString) -1), + kRequireCase); durationFound = GetKeyWordArgument( reqData->contentData, "Duration", durationString, (sizeof(durationString) -1), + kRequireCase, kArgumentIsNumeric); - validData = false; if (directionFound && durationFound) { if (IsValidNumericString(directionString) && IsValidNumericString(durationString)) { - validData = true; - } - else - { - alpacaErrCode = kASCOM_Err_InvalidValue; - reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "argument non-numeric"); - CONSOLE_DEBUG(alpacaErrMsg); - } - } - else - { - alpacaErrCode = kASCOM_Err_InvalidValue; - reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Keywords missing"); - CONSOLE_DEBUG(alpacaErrMsg); - } - if (cCameraProp.CanPulseGuide) - { - if (validData) - { - if (cSt4Port) + if (cCameraProp.CanPulseGuide) { - alpacaErrCode = kASCOM_Err_Success; - cCameraProp.IsPulseGuiding = true; - gettimeofday(&cPulseGuideStartTime, NULL); + if (cSt4Port) + { + alpacaErrCode = kASCOM_Err_Success; + cCameraProp.IsPulseGuiding = true; + gettimeofday(&cPulseGuideStartTime, NULL); + } + else + { + alpacaErrCode = kASCOM_Err_NotImplemented; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Pulse guiding not supported"); + CONSOLE_DEBUG(alpacaErrMsg); + } } else { alpacaErrCode = kASCOM_Err_NotImplemented; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Pulse guiding not supported"); - CONSOLE_DEBUG(alpacaErrMsg); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Pulse Guide not finished") } } else { - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Arguments not valid"); CONSOLE_DEBUG(alpacaErrMsg); } } else { - alpacaErrCode = kASCOM_Err_NotImplemented; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Pulse Guide not finished") + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'Direction' or 'Duration' Keyword missing"); + CONSOLE_DEBUG(alpacaErrMsg); } return(alpacaErrCode); } @@ -3423,22 +3420,22 @@ char readOutModeString[32]; int alpacaReadOutModeIdx; TYPE_IMAGE_TYPE newImageType; - CONSOLE_DEBUG(__FUNCTION__); +// CONSOLE_DEBUG(__FUNCTION__); readOutFound = GetKeyWordArgument( reqData->contentData, "ReadoutMode", readOutModeString, (sizeof(readOutModeString) -1)); - CONSOLE_DEBUG_W_STR("readOutModeString\t\t=", readOutModeString); +// CONSOLE_DEBUG_W_STR("readOutModeString\t\t=", readOutModeString); if (readOutFound) { if (isdigit(readOutModeString[0])) { - CONSOLE_DEBUG("Processing digit"); +// CONSOLE_DEBUG("Processing digit"); alpacaReadOutModeIdx = atoi(readOutModeString); - CONSOLE_DEBUG_W_NUM("alpacaReadOutModeIdx\t=", alpacaReadOutModeIdx); +// CONSOLE_DEBUG_W_NUM("alpacaReadOutModeIdx\t=", alpacaReadOutModeIdx); //* is the new image mode index within range if ((alpacaReadOutModeIdx >= 0) && (alpacaReadOutModeIdx < kMaxReadOutModes)) @@ -3447,22 +3444,25 @@ TYPE_IMAGE_TYPE newImageType; if (cCameraProp.ReadOutModes[alpacaReadOutModeIdx].valid) { newImageType = (TYPE_IMAGE_TYPE)cCameraProp.ReadOutModes[alpacaReadOutModeIdx].internalImageType; - CONSOLE_DEBUG_W_NUM("newImageType\t\t=", newImageType); +// CONSOLE_DEBUG_W_NUM("newImageType\t\t=", newImageType); alpacaErrCode = SetImageType(newImageType); //* now update the sensor type based on the image type if (newImageType == kImageType_RGB24) { - CONSOLE_DEBUG("Setting sensorType to kSensorType_Color"); +// CONSOLE_DEBUG("Setting sensorType to kSensorType_Color"); cCameraProp.SensorType = kSensorType_Color; } else { - CONSOLE_DEBUG("Setting sensorType to kSensorType_Monochrome"); +// CONSOLE_DEBUG("Setting sensorType to kSensorType_Monochrome"); cCameraProp.SensorType = kSensorType_Monochrome; } } else { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "INVALID alpacaReadOutModeIdx"); CONSOLE_DEBUG_W_NUM("INVALID alpacaReadOutModeIdx\t=", alpacaReadOutModeIdx); } } @@ -3571,38 +3571,51 @@ TYPE_ASCOM_STATUS CameraDriver::Put_SetCCDtemperature(TYPE_GetPutRequestData *re { TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_InternalError; bool setCCDtempFound; +bool validNumber; char setCCDtempString[256]; double newSetCCDvalue; // CONSOLE_DEBUG(__FUNCTION__); // CONSOLE_DEBUG_W_STR("contentData\t=", reqData->contentData); - if (cCameraProp.CanSetCCDtemperature) { setCCDtempFound = GetKeyWordArgument( reqData->contentData, "SetCCDTemperature", setCCDtempString, (sizeof(setCCDtempString) -1), + kRequireCase, kArgumentIsNumeric); if (setCCDtempFound) { - newSetCCDvalue = AsciiToDouble(setCCDtempString); - CONSOLE_DEBUG_W_DBL("newSetCCDvalue\t=", newSetCCDvalue); - if ((newSetCCDvalue > -273.15) && (newSetCCDvalue <= 100.0)) + validNumber = IsValidNumericString(setCCDtempString); + if (validNumber) { - //* The current camera cooler setpoint in degrees Celsius. - cCameraProp.SetCCDTemperature = newSetCCDvalue; - alpacaErrCode = Write_SensorTargetTemp(cCameraProp.SetCCDTemperature); - if (alpacaErrCode != kASCOM_Err_Success) + newSetCCDvalue = AsciiToDouble(setCCDtempString); + CONSOLE_DEBUG_W_DBL("newSetCCDvalue\t=", newSetCCDvalue); + if ((newSetCCDvalue > -273.15) && (newSetCCDvalue <= 100.0)) { - strcpy(alpacaErrMsg, cLastCameraErrMsg); + //* The current camera cooler setpoint in degrees Celsius. + cCameraProp.SetCCDTemperature = newSetCCDvalue; + alpacaErrCode = Write_SensorTargetTemp(cCameraProp.SetCCDTemperature); + if (alpacaErrCode != kASCOM_Err_Success) + { +// strcpy(alpacaErrMsg, cLastCameraErrMsg); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, cLastCameraErrMsg); + } + } + else + { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "CCD Setpoint Temperature out of bounds"); + CONSOLE_DEBUG(alpacaErrMsg); } } else { alpacaErrCode = kASCOM_Err_InvalidValue; reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "CCD Setpoint Temperature out of bounds"); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "SetCCDTemperature value is non numeric"); CONSOLE_DEBUG(alpacaErrMsg); } } @@ -3619,10 +3632,6 @@ double newSetCCDvalue; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Setting CCD temp not supported"); alpacaErrCode = kASCOM_Err_NotImplemented; } - if (alpacaErrCode != kASCOM_Err_Success) - { - CONSOLE_DEBUG_W_NUM("alpacaErrCode\t=", alpacaErrCode); - } return(alpacaErrCode); } @@ -3689,155 +3698,175 @@ bool lightFrame; DumpRequestStructure(__FUNCTION__, reqData); } - if (reqData != NULL) - { - lightFrame = true; + ProcessExposureOptions(reqData); + //----------------------------------------------------------------- + lightFrame = true; + lightFound = GetKeyWordArgument( reqData->contentData, + "Light", + lightString, + (sizeof(lightString) -1)); - //* first we are going to check a bunch of stuff to make CONFORM happy - if ((cCameraProp.CanAsymmetricBin == false) && (cCameraProp.BinX != cCameraProp.BinY)) + if (lightFound) + { + CONSOLE_DEBUG_W_STR("Light\t=", lightString); + if (IsValidTrueFalseString(lightString)) { - alpacaErrCode = kASCOM_Err_InvalidValue; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "binX and binY do not match"); - CONSOLE_DEBUG(alpacaErrMsg); + lightFrame = IsTrueFalse(lightString); } - else if ((cCameraProp.StartX >= 0) && (cCameraProp.StartX < cCameraProp.CameraXsize) && - (cCameraProp.StartY >= 0) && (cCameraProp.StartY < cCameraProp.CameraYsize) && - (cCameraProp.NumX >= 1) && (cCameraProp.NumX <= cCameraProp.CameraXsize) && - (cCameraProp.NumY >= 1) && (cCameraProp.NumY <= cCameraProp.CameraYsize) && - (cCameraProp.BinX >= 1) && (cCameraProp.BinX <= cCameraProp.MaxbinX) && - (cCameraProp.BinY >= 1) && (cCameraProp.BinY <= cCameraProp.MaxbinY)) + else { - CONSOLE_DEBUG_W_NUM("cCurrentExposure_us\t=", cCurrentExposure_us); + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Light is not true/false"); + CONSOLE_DEBUG(alpacaErrMsg); + } + } + //----------------------------------------------------------------- + durationFound = GetKeyWordArgument( reqData->contentData, + "Duration", + duarationString, + (sizeof(duarationString) -1), + kRequireCase, + kArgumentIsNumeric); - ProcessExposureOptions(reqData); - durationFound = GetKeyWordArgument( reqData->contentData, - "Duration", - duarationString, - (sizeof(duarationString) -1), - kArgumentIsNumeric); +// //===================================================================================== +// //* make CONFORMU happy +// if ((reqData->clientIs_AlpacaPi == false) && ((lightFound == false) || (durationFound == false))) +// { +// alpacaErrCode = kASCOM_Err_InvalidValue; +// reqData->httpRetCode = 400; +// GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'Duration' or 'Light' not specified"); +// CONSOLE_DEBUG(alpacaErrMsg); +// return(alpacaErrCode); +// } - lightFound = GetKeyWordArgument( reqData->contentData, - "Light", - lightString, - (sizeof(lightString) -1)); + //* first we are going to check a bunch of stuff to make CONFORM happy + if ((cCameraProp.CanAsymmetricBin == false) && (cCameraProp.BinX != cCameraProp.BinY)) + { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "binX and binY do not match"); + CONSOLE_DEBUG(alpacaErrMsg); + } + else if ((cCameraProp.StartX >= 0) && (cCameraProp.StartX < cCameraProp.CameraXsize) && + (cCameraProp.StartY >= 0) && (cCameraProp.StartY < cCameraProp.CameraYsize) && + (cCameraProp.NumX >= 1) && (cCameraProp.NumX <= cCameraProp.CameraXsize) && + (cCameraProp.NumY >= 1) && (cCameraProp.NumY <= cCameraProp.CameraYsize) && + (cCameraProp.BinX >= 1) && (cCameraProp.BinX <= cCameraProp.MaxbinX) && + (cCameraProp.BinY >= 1) && (cCameraProp.BinY <= cCameraProp.MaxbinY)) + { + CONSOLE_DEBUG_W_NUM("cCurrentExposure_us\t=", cCurrentExposure_us); - if (durationFound) - { - myExposureDuration_secs = AsciiToDouble(duarationString); - myExposure_usecs = myExposureDuration_secs * (1000.0 * 1000.0); - CONSOLE_DEBUG_W_STR("Specified Duration (str) \t=", duarationString); - CONSOLE_DEBUG_W_DBL("Specified Duration (dbl) \t=", myExposureDuration_secs); - CONSOLE_DEBUG_W_DBL("Specified Duration (usecs)\t=", myExposure_usecs); - } - else - { - CONSOLE_DEBUG("Duration was not Specified!!!"); - CONSOLE_DEBUG_W_STR("reqData->contentData\t=", reqData->contentData); - myExposure_usecs = cCurrentExposure_us; - } - CONSOLE_DEBUG_W_DBL("Using Duration (u-secs)\t=", myExposure_usecs); - if (lightFound) - { - CONSOLE_DEBUG_W_STR("Light\t=", lightString); - lightFrame = IsTrueFalse(lightString); - } + if (durationFound) + { + myExposureDuration_secs = AsciiToDouble(duarationString); + myExposure_usecs = myExposureDuration_secs * (1000.0 * 1000.0); - if ((myExposure_usecs > 0) && (myExposure_usecs >= cCameraProp.ExposureMin_us)) - { -// CONSOLE_DEBUG("cCameraProp.ImageReady set to FALSE!!!!!!!!!!!!!!"); - cCameraProp.ImageReady = false; - cAVIfourCC = 0; - cFrameRate = 0; - SaveNextImage(); + CONSOLE_DEBUG_W_STR("Specified Duration (str) \t=", duarationString); + CONSOLE_DEBUG_W_DBL("Specified Duration (dbl) \t=", myExposureDuration_secs); + CONSOLE_DEBUG_W_DBL("Specified Duration (usecs)\t=", myExposure_usecs); + } + else + { + CONSOLE_DEBUG("Duration was not Specified!!!"); + CONSOLE_DEBUG_W_STR("reqData->contentData\t=", reqData->contentData); + myExposure_usecs = cCurrentExposure_us; + } + CONSOLE_DEBUG_W_DBL("Using Duration (u-secs)\t=", myExposure_usecs); - //====================================================================================== - //* Save all of the info about this exposure for reference - SetLastExposureInfo(); - alpacaErrCode = Start_CameraExposure(cCurrentExposure_us, lightFrame); - GenerateFileNameRoot(); + if ((myExposure_usecs > 0) && (myExposure_usecs >= cCameraProp.ExposureMin_us)) + { + // CONSOLE_DEBUG("cCameraProp.ImageReady set to FALSE!!!!!!!!!!!!!!"); + cCameraProp.ImageReady = false; + cAVIfourCC = 0; + cFrameRate = 0; + SaveNextImage(); - if (alpacaErrCode == 0) - { - cBytesWrittenForThisCmd += JsonResponse_Add_String(reqData->socket, - reqData->jsonTextBuffer, - kMaxJsonBuffLen, - "filenameroot", - cFileNameRoot, - INCLUDE_COMMA); + //====================================================================================== + //* Save all of the info about this exposure for reference + SetLastExposureInfo(); - currExposure_secs = (1.0 * cCurrentExposure_us) / 1000000.0; - cBytesWrittenForThisCmd += JsonResponse_Add_Double(reqData->socket, - reqData->jsonTextBuffer, - kMaxJsonBuffLen, - "exposure", - currExposure_secs, - INCLUDE_COMMA); + alpacaErrCode = Start_CameraExposure(cCurrentExposure_us, lightFrame); + GenerateFileNameRoot(); - cBytesWrittenForThisCmd += JsonResponse_Add_Bool(reqData->socket, - reqData->jsonTextBuffer, - kMaxJsonBuffLen, - "Light", - lightFrame, - INCLUDE_COMMA); - } - else - { - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, cLastCameraErrMsg); - CONSOLE_DEBUG(alpacaErrMsg); - } + if (alpacaErrCode == 0) + { + cBytesWrittenForThisCmd += JsonResponse_Add_String(reqData->socket, + reqData->jsonTextBuffer, + kMaxJsonBuffLen, + "filenameroot", + cFileNameRoot, + INCLUDE_COMMA); + + currExposure_secs = (1.0 * cCurrentExposure_us) / 1000000.0; + cBytesWrittenForThisCmd += JsonResponse_Add_Double(reqData->socket, + reqData->jsonTextBuffer, + kMaxJsonBuffLen, + "exposure", + currExposure_secs, + INCLUDE_COMMA); + + cBytesWrittenForThisCmd += JsonResponse_Add_Bool(reqData->socket, + reqData->jsonTextBuffer, + kMaxJsonBuffLen, + "Light", + lightFrame, + INCLUDE_COMMA); } else { - alpacaErrCode = kASCOM_Err_InvalidValue; - reqData->httpRetCode = 400; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Invalid exposure time"); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, cLastCameraErrMsg); CONSOLE_DEBUG(alpacaErrMsg); } } else { - alpacaErrCode = kASCOM_Err_InvalidValue; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "num, start,or bin is out of range"); + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Invalid exposure time"); CONSOLE_DEBUG(alpacaErrMsg); - - //* show the offending value(s) - if ((cCameraProp.StartX< 0) || (cCameraProp.StartX >= cCameraProp.CameraXsize)) - { - CONSOLE_DEBUG_W_NUM("cCameraProp.StartX\t\t=", cCameraProp.StartX); - CONSOLE_DEBUG_W_NUM("cCameraProp.CameraXsize\t=", cCameraProp.CameraXsize); - } - if ((cCameraProp.StartY< 0) || (cCameraProp.StartY >= cCameraProp.CameraYsize)) - { - CONSOLE_DEBUG_W_NUM("cCameraProp.StartY\t\t=", cCameraProp.StartY); - CONSOLE_DEBUG_W_NUM("cCameraProp.CameraYsize\t=", cCameraProp.CameraYsize); - } - if ((cCameraProp.NumX < 1) || (cCameraProp.NumX > cCameraProp.CameraXsize)) - { - CONSOLE_DEBUG_W_NUM("cCameraProp.NumX\t\t=", cCameraProp.NumX); - } - if ((cCameraProp.NumY < 1) || (cCameraProp.NumY > cCameraProp.CameraYsize)) - { - CONSOLE_DEBUG_W_NUM("cCameraProp.NumY\t\t=", cCameraProp.NumY); - } - if ((cCameraProp.BinX < 1) || (cCameraProp.BinX > cCameraProp.MaxbinX)) - { - CONSOLE_DEBUG_W_NUM("cCameraProp.BinX\t\t=", cCameraProp.BinX); - CONSOLE_DEBUG_W_NUM("cCameraProp.MaxbinX\t=", cCameraProp.MaxbinX); - } - if ((cCameraProp.BinY < 1) || (cCameraProp.BinY > cCameraProp.MaxbinY)) - { - CONSOLE_DEBUG_W_NUM("cCameraProp.BinY\t\t=", cCameraProp.BinY); - CONSOLE_DEBUG_W_NUM("cCameraProp.MaxbinY\t=", cCameraProp.MaxbinY); - } } } else { - alpacaErrCode = kASCOM_Err_InternalError; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "num, start,or bin is out of range"); + CONSOLE_DEBUG(alpacaErrMsg); + + //* show the offending value(s) + if ((cCameraProp.StartX< 0) || (cCameraProp.StartX >= cCameraProp.CameraXsize)) + { + CONSOLE_DEBUG_W_NUM("cCameraProp.StartX\t\t=", cCameraProp.StartX); + CONSOLE_DEBUG_W_NUM("cCameraProp.CameraXsize\t=", cCameraProp.CameraXsize); + } + if ((cCameraProp.StartY< 0) || (cCameraProp.StartY >= cCameraProp.CameraYsize)) + { + CONSOLE_DEBUG_W_NUM("cCameraProp.StartY\t\t=", cCameraProp.StartY); + CONSOLE_DEBUG_W_NUM("cCameraProp.CameraYsize\t=", cCameraProp.CameraYsize); + } + if ((cCameraProp.NumX < 1) || (cCameraProp.NumX > cCameraProp.CameraXsize)) + { + CONSOLE_DEBUG_W_NUM("cCameraProp.NumX\t\t=", cCameraProp.NumX); + } + if ((cCameraProp.NumY < 1) || (cCameraProp.NumY > cCameraProp.CameraYsize)) + { + CONSOLE_DEBUG_W_NUM("cCameraProp.NumY\t\t=", cCameraProp.NumY); + } + if ((cCameraProp.BinX < 1) || (cCameraProp.BinX > cCameraProp.MaxbinX)) + { + CONSOLE_DEBUG_W_NUM("cCameraProp.BinX\t\t=", cCameraProp.BinX); + CONSOLE_DEBUG_W_NUM("cCameraProp.MaxbinX\t=", cCameraProp.MaxbinX); + } + if ((cCameraProp.BinY < 1) || (cCameraProp.BinY > cCameraProp.MaxbinY)) + { + CONSOLE_DEBUG_W_NUM("cCameraProp.BinY\t\t=", cCameraProp.BinY); + CONSOLE_DEBUG_W_NUM("cCameraProp.MaxbinY\t=", cCameraProp.MaxbinY); + } } return(alpacaErrCode); } @@ -3876,6 +3905,7 @@ TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_NotImplemented; else { alpacaErrCode = kASCOM_Err_NotImplemented; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "SubExposureDuration not supported") } return(alpacaErrCode); } @@ -3887,28 +3917,45 @@ TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_NotImplemented; bool subDurationFound; char mySubDurationString[32]; - if (cSubDurationSupported) + + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "SubExposureDuration not supported") + return(kASCOM_Err_NotImplemented); + + subDurationFound = GetKeyWordArgument( reqData->contentData, + "SubExposureDuration", + mySubDurationString, + (sizeof(mySubDurationString) -1), + kArgumentIsNumeric); + if (subDurationFound) { - subDurationFound = GetKeyWordArgument( reqData->contentData, - "SubExposureDuration", - mySubDurationString, - (sizeof(mySubDurationString) -1), - kArgumentIsNumeric); - if (subDurationFound) + if (IsValidNumericString(mySubDurationString)) { - //* not finished + if (cSubDurationSupported) + { + //* not finished + } + else + { + alpacaErrCode = kASCOM_Err_NotImplemented; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "SubExposureDuration not supported") + } } else { - alpacaErrCode = kASCOM_Err_InvalidValue; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'SubExposureDuration' argument not found"); + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'SubExposureDuration' argument is non-numeric"); CONSOLE_DEBUG(alpacaErrMsg); } } else { - alpacaErrCode = kASCOM_Err_NotImplemented; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'SubExposureDuration' argument not found"); + CONSOLE_DEBUG(alpacaErrMsg); } + return(alpacaErrCode); } @@ -4474,6 +4521,10 @@ bool xmit16BitAs32Bit = false; binaryImageHdr.Dimension2 = cLastExposure_ROIinfo.currentROIheight; // Length of image array second dimension binaryImageHdr.Dimension3 = 0; // Length of image array third dimension (0 for 2D array) + + binaryImageHdr.ClientTransactionID = reqData->ClientTransactionID; + binaryImageHdr.ServerTransactionID = gServerTransactionID; + CONSOLE_DEBUG_W_NUM("cLastExposure_ROIinfo.currentROIimageType\t=", cLastExposure_ROIinfo.currentROIimageType); CONSOLE_DEBUG_W_NUM("cLastExposure_ROIinfo.currentROIwidth\t=", cLastExposure_ROIinfo.currentROIwidth); CONSOLE_DEBUG_W_NUM("cLastExposure_ROIinfo.currentROIheight\t=", cLastExposure_ROIinfo.currentROIheight); @@ -5632,35 +5683,28 @@ TYPE_ASCOM_STATUS CameraDriver::Get_Fastreadout(TYPE_GetPutRequestData *reqData, TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_Success; // CONSOLE_DEBUG(__FUNCTION__); - if (reqData != NULL) + if (cCameraProp.CanFastReadout) { - if (cCameraProp.CanFastReadout) + alpacaErrCode = Read_Fastreadout(); + if (alpacaErrCode == 0) { - alpacaErrCode = Read_Fastreadout(); - if (alpacaErrCode == 0) - { - cBytesWrittenForThisCmd += JsonResponse_Add_Bool( reqData->socket, - reqData->jsonTextBuffer, - kMaxJsonBuffLen, - responseString, - cHighSpeedMode, - INCLUDE_COMMA); - } - else - { - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Failed to read FastReadout:, camera-err="); - strcat(alpacaErrMsg, cLastCameraErrMsg); - } + cBytesWrittenForThisCmd += JsonResponse_Add_Bool( reqData->socket, + reqData->jsonTextBuffer, + kMaxJsonBuffLen, + responseString, + cHighSpeedMode, + INCLUDE_COMMA); } else { - alpacaErrCode = kASCOM_Err_PropertyNotImplemented; - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "FastReadOut not supported"); + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Failed to read FastReadout:, camera-err="); + strcat(alpacaErrMsg, cLastCameraErrMsg); } } else { - alpacaErrCode = kASCOM_Err_InternalError; + alpacaErrCode = kASCOM_Err_PropertyNotImplemented; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "FastReadOut not supported"); } return(alpacaErrCode); } @@ -5670,36 +5714,46 @@ TYPE_ASCOM_STATUS CameraDriver::Put_Fastreadout( TYPE_GetPutRequestData *reqDat { TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_InternalError; bool fastReadOutFound; -char myFastReadOut[32]; +char myFastReadOutStr[32]; bool newFastReadOutState; +bool validTrueFalse; // CONSOLE_DEBUG(__FUNCTION__); - strcpy(myFastReadOut, "not specified"); - if (reqData != NULL) + if (cCameraProp.CanFastReadout) { - if (cCameraProp.CanFastReadout) + fastReadOutFound = GetKeyWordArgument( reqData->contentData, + "FastReadout", + myFastReadOutStr, + (sizeof(myFastReadOutStr) -1)); + if (fastReadOutFound) { - alpacaErrCode = kASCOM_Err_Success; - fastReadOutFound = GetKeyWordArgument( reqData->contentData, - "FastReadout", - myFastReadOut, - (sizeof(myFastReadOut) -1)); - if (fastReadOutFound) + validTrueFalse = IsValidTrueFalseString(myFastReadOutStr); + if (validTrueFalse) { - newFastReadOutState = IsTrueFalse(myFastReadOut); + newFastReadOutState = IsTrueFalse(myFastReadOutStr); CONSOLE_DEBUG_W_NUM("newFastReadOutState\t=", newFastReadOutState); } + else + { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Argument is not true/false"); + CONSOLE_DEBUG(alpacaErrMsg); + } } else { - alpacaErrCode = kASCOM_Err_PropertyNotImplemented; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'FastReadout' argument not found"); + CONSOLE_DEBUG(alpacaErrMsg); } } else { - alpacaErrCode = kASCOM_Err_InternalError; + alpacaErrCode = kASCOM_Err_PropertyNotImplemented; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'FastReadout' not supported"); } - return(alpacaErrCode); } @@ -5842,7 +5896,8 @@ bool newLiveModeState; } else { - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "'Livemode' argument not found"); CONSOLE_DEBUG(alpacaErrMsg); } @@ -5920,13 +5975,16 @@ long exposureDuration_us; //* micro seconds else { alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Exposure time out of valid range"); } } else { - CONSOLE_DEBUG("Duration not specified"); - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Duration not specified"); + CONSOLE_DEBUG(alpacaErrMsg); } } else @@ -5977,28 +6035,22 @@ char saveAllFoundString[32]; // CONSOLE_DEBUG(__FUNCTION__); - if (reqData != NULL) + saveAllFound = GetKeyWordArgument( reqData->contentData, + "saveallimages", + saveAllFoundString, + (sizeof(saveAllFoundString) -1)); + if (saveAllFound) { - saveAllFound = GetKeyWordArgument( reqData->contentData, - "saveallimages", - saveAllFoundString, - (sizeof(saveAllFoundString) -1)); - if (saveAllFound) - { - cSaveAllImages = IsTrueFalse(saveAllFoundString); - alpacaErrCode = kASCOM_Err_Success; - } - else - { - GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "SaveAll argument not specified"); - alpacaErrCode = kASCOM_Err_InvalidValue; - CONSOLE_DEBUG(alpacaErrMsg); - CONSOLE_DEBUG(reqData->contentData); - } + cSaveAllImages = IsTrueFalse(saveAllFoundString); + alpacaErrCode = kASCOM_Err_Success; } else { - alpacaErrCode = kASCOM_Err_InternalError; + GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "SaveAll argument not specified"); + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; + CONSOLE_DEBUG(alpacaErrMsg); + CONSOLE_DEBUG(reqData->contentData); } return(alpacaErrCode); } @@ -6042,8 +6094,9 @@ char saveAsFitsString[32]; } else { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "saveasfits argument not specified"); - alpacaErrCode = kASCOM_Err_InvalidValue; CONSOLE_DEBUG(alpacaErrMsg); CONSOLE_DEBUG(reqData->contentData); } @@ -6095,8 +6148,9 @@ char saveAsJPEGString[32]; } else { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "saveasjpeg argument not specified"); - alpacaErrCode = kASCOM_Err_InvalidValue; CONSOLE_DEBUG(alpacaErrMsg); CONSOLE_DEBUG(reqData->contentData); } @@ -6148,8 +6202,9 @@ char saveAsPNGString[32]; } else { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "saveaspng argument not specified"); - alpacaErrCode = kASCOM_Err_InvalidValue; CONSOLE_DEBUG(alpacaErrMsg); CONSOLE_DEBUG(reqData->contentData); } @@ -6198,8 +6253,9 @@ char saveAsRawString[32]; } else { + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "saveasraw argument not specified"); - alpacaErrCode = kASCOM_Err_InvalidValue; CONSOLE_DEBUG(alpacaErrMsg); CONSOLE_DEBUG(reqData->contentData); } @@ -7139,10 +7195,10 @@ TYPE_IMAGE_TYPE myImageType; } else { + alpacaErrCode = kASCOM_Err_InvalidValue; strcpy(cLastCameraErrMsg, "Unsupported image type-"); strcat(cLastCameraErrMsg, newImageTypeString); CONSOLE_DEBUG_W_STR("cLastCameraErrMsg\t=", cLastCameraErrMsg); - alpacaErrCode = kASCOM_Err_InvalidValue; } if (alpacaErrCode != 0) { @@ -8098,7 +8154,8 @@ bool foundKeyWord; } else { - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "argument not specified"); } } @@ -8147,7 +8204,8 @@ bool foundKeyWord; } else { - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "argument not specified"); } } @@ -8320,7 +8378,8 @@ int newFlipMode; } else { - alpacaErrCode = kASCOM_Err_InvalidValue; + alpacaErrCode = kASCOM_Err_InvalidValue; + reqData->httpRetCode = 400; GENERATE_ALPACAPI_ERRMSG(alpacaErrMsg, "Invalid flip value"); } } diff --git a/src/cameradriver_ASI.cpp b/src/cameradriver_ASI.cpp index 37a649a..19b6ebd 100755 --- a/src/cameradriver_ASI.cpp +++ b/src/cameradriver_ASI.cpp @@ -84,6 +84,7 @@ //* Apr 30, 2023 Added Read_SensorTargetTemp() & Write_SensorTargetTemp() //* Sep 9, 2023 Moved read thread stuff to parent class //* Sep 9, 2023 Deleted _USE_THREADS_FOR_ASI_CAMERA_ +//* Jun 25, 2024 Changed all kASCOM_Err_FailedUnknown to kASCOM_Err_UnspecifiedError //***************************************************************************** //* Length: unspecified [text/plain] //* Saving to: "imagearray.1" @@ -735,7 +736,7 @@ bool cameraIsBusy; else { CONSOLE_DEBUG_W_NUM("Camera is not idle, status\t=", asiErrorCode); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; strcpy(cLastCameraErrMsg, "Failed to start exposure"); CONSOLE_DEBUG_W_STR("Error Msg\t=", cLastCameraErrMsg); } @@ -745,7 +746,7 @@ bool cameraIsBusy; { CheckForClosedError(asiErrorCode); CONSOLE_DEBUG_W_NUM("ASIGetExpStatus->asiErrorCode\t=", asiErrorCode); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; strcpy(cLastCameraErrMsg, "Failed to get status"); } } @@ -753,7 +754,7 @@ bool cameraIsBusy; { CheckForClosedError(asiErrorCode); CONSOLE_DEBUG_W_NUM("ASISetControlValue->asiErrorCode\t=", asiErrorCode); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; strcpy(cLastCameraErrMsg, "Failed to set exposure"); } } @@ -794,7 +795,7 @@ ASI_ERROR_CODE asiErrorCode; } else { - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; sprintf(cLastCameraErrMsg, "Failed to stop exposure. asiErrorCode=%d", asiErrorCode); CONSOLE_DEBUG(cLastCameraErrMsg); } @@ -915,7 +916,7 @@ ASI_BOOL bAuto = ASI_FALSE; } else { - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; strcpy(cLastCameraErrMsg, "Failed to start video capture"); CONSOLE_DEBUG(cLastCameraErrMsg); } @@ -942,12 +943,12 @@ char asiErrorMsgString[64]; switch(cInternalCameraState) { case kCameraState_Idle: - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; strcpy(cLastCameraErrMsg, "Camera not taking video"); break; case kCameraState_TakingPicture: - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; strcpy(cLastCameraErrMsg, "Single frame exposure in progress"); break; @@ -1140,7 +1141,7 @@ int bytesPerRow; else { CONSOLE_DEBUG_W_NUM("ASIGetVideoData() returned asiErrorCode\t=", asiErrorCode); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; } } else @@ -1321,7 +1322,7 @@ bool timeToStop; else { CONSOLE_DEBUG_W_NUM("ASIGetVideoData() returned asiErrorCode\t=", asiErrorCode); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; } } else @@ -1850,7 +1851,7 @@ bool returnFlag; //***************************************************************************** TYPE_ASCOM_STATUS CameraDriverASI::SetImageTypeCameraOpen(TYPE_IMAGE_TYPE newImageType) { -TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_FailedUnknown; +TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_UnspecifiedError; ASI_ERROR_CODE asiErrorCode; int currentROIwidth; int currentROIheight; @@ -2588,7 +2589,7 @@ char asiErrorMsgString[64]; Get_ASI_ErrorMsg(asiErrorCode, asiErrorMsgString); strcpy(cLastCameraErrMsg, "Failed to open ASI camera:, asiErr="); strcat(cLastCameraErrMsg, asiErrorMsgString); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; } return(alpacaErrCode); } @@ -2609,7 +2610,7 @@ char asiErrorMsgString[64]; SETUP_TIMING(); // CONSOLE_DEBUG(__FUNCTION__); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; if ((cCameraID >= 0) && (cCameraID < kMaxCameraCnt)) { asiErrorCode = OpenASIcameraIfNeeded(cCameraID); @@ -2682,7 +2683,7 @@ char asiErrorMsgString[64]; Get_ASI_ErrorMsg(asiErrorCode, asiErrorMsgString); strcpy(cLastCameraErrMsg, "Failed to open ASI camera:, asiErr="); strcat(cLastCameraErrMsg, asiErrorMsgString); - alpacaErrCode = kASCOM_Err_FailedUnknown; + alpacaErrCode = kASCOM_Err_UnspecifiedError; } } else diff --git a/src/cameradriver_QSI.cpp b/src/cameradriver_QSI.cpp index a81679f..41c8b91 100644 --- a/src/cameradriver_QSI.cpp +++ b/src/cameradriver_QSI.cpp @@ -40,6 +40,7 @@ //* May 18, 2022 SUPPORTED: QSI cameras //* Jun 7, 2022 Added maxbinx/y override until binning is implemented //* Jun 17, 2024 Fixed bug in CreateCameraObjects_QSI() invalid camera count +//* Jun 21, 2024 Added Read_SensorTargetTemp() & Write_SensorTargetTemp() to QSI camera //***************************************************************************** #if defined(_ENABLE_CAMERA_) && defined(_ENABLE_QSI_) @@ -836,6 +837,26 @@ std::string lastError(""); return(alpacaErrCode); } +//************************************************************************** +TYPE_ASCOM_STATUS CameraDriverQSI::Read_SensorTargetTemp(void) +{ +TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_NotImplemented; + + GENERATE_ALPACAPI_ERRMSG(cLastCameraErrMsg, "Not implemented"); +// CONSOLE_DEBUG(cLastCameraErrMsg); + return(alpacaErrCode); +} + +//************************************************************************** +TYPE_ASCOM_STATUS CameraDriverQSI::Write_SensorTargetTemp(const double newCCDtargetTemp) +{ +TYPE_ASCOM_STATUS alpacaErrCode = kASCOM_Err_NotImplemented; + + GENERATE_ALPACAPI_ERRMSG(cLastCameraErrMsg, "Not implemented"); + CONSOLE_DEBUG(cLastCameraErrMsg); + return(alpacaErrCode); +} + //***************************************************************************** TYPE_ASCOM_STATUS CameraDriverQSI::Write_BinX(const int newBinXvalue) { diff --git a/src/cameradriver_QSI.h b/src/cameradriver_QSI.h index 7df0881..5e4783b 100644 --- a/src/cameradriver_QSI.h +++ b/src/cameradriver_QSI.h @@ -79,6 +79,8 @@ class CameraDriverQSI: public CameraDriver virtual TYPE_ASCOM_STATUS Cooler_TurnOff(void); virtual TYPE_ASCOM_STATUS Read_SensorTemp(void); virtual TYPE_ASCOM_STATUS Write_SensorTemp(const double newCCDtemp); + virtual TYPE_ASCOM_STATUS Read_SensorTargetTemp(void); + virtual TYPE_ASCOM_STATUS Write_SensorTargetTemp(const double newCCDtargetTemp); virtual TYPE_ASCOM_STATUS Read_CoolerState(bool *coolerOnOff); virtual TYPE_ASCOM_STATUS Read_CoolerPowerLevel(void); diff --git a/src/cameradriver_save.cpp b/src/cameradriver_save.cpp index aa57746..1e8427f 100755 --- a/src/cameradriver_save.cpp +++ b/src/cameradriver_save.cpp @@ -76,7 +76,6 @@ void CameraDriver::SaveImageData(void) { int iii; -int bytesPerPixel; CONSOLE_DEBUG_W_NUM("cSaveNextImage\t=", cSaveNextImage); @@ -119,6 +118,7 @@ int bytesPerPixel; #if defined(_ENABLE_JPEGLIB_) +int bytesPerPixel; bytesPerPixel = cOpenCV_ImagePtr->step[1]; if (cSaveAsJPEG && (bytesPerPixel!= 2)) { diff --git a/src/eventlogging.c b/src/eventlogging.c index e000d08..176bf33 100755 --- a/src/eventlogging.c +++ b/src/eventlogging.c @@ -174,12 +174,12 @@ const char gHtmlTitleLog[] = }; -#define kMaxErrors 32 +#define kMaxErrors 256 //***************************************************************************** void SendHtmlLog(int mySocketFD) { char lineBuff[256]; -int ii; +int iii; struct tm *linuxTime; int errorTotal; int errorCounts[kMaxErrors]; @@ -195,6 +195,7 @@ int errIndx; SocketWriteData(mySocketFD, gHtmlNightMode); SocketWriteData(mySocketFD, gHtmlTitleLog); + //------------------------------------------------------------------- SocketWriteData(mySocketFD, "
\r\n"); SocketWriteData(mySocketFD, "\r\n"); @@ -206,10 +207,10 @@ int errIndx; SocketWriteData(mySocketFD, "\r\n"); SocketWriteData(mySocketFD, "\r\n"); - for (ii=0; ii\r\n"); - linuxTime = localtime(&gEventLog[ii].eventTime); + linuxTime = localtime(&gEventLog[iii].eventTime); sprintf(lineBuff, "\t", (1 + linuxTime->tm_mon), linuxTime->tm_mday, @@ -219,19 +220,19 @@ int errIndx; linuxTime->tm_sec); SocketWriteData(mySocketFD, lineBuff); - sprintf(lineBuff, "", gEventLog[ii].eventName); + sprintf(lineBuff, "", gEventLog[iii].eventName); SocketWriteData(mySocketFD, lineBuff); - sprintf(lineBuff, "", gEventLog[ii].eventDescription); + sprintf(lineBuff, "", gEventLog[iii].eventDescription); SocketWriteData(mySocketFD, lineBuff); - if (gEventLog[ii].alpacaErrCode != 0) + if (gEventLog[iii].alpacaErrCode != 0) { - sprintf(lineBuff, "", gEventLog[ii].alpacaErrCode, gEventLog[ii].alpacaErrCode); + sprintf(lineBuff, "", gEventLog[iii].alpacaErrCode, gEventLog[iii].alpacaErrCode); errorTotal++; - errIndx = gEventLog[ii].alpacaErrCode - kASCOM_Err_NotImplemented; + errIndx = gEventLog[iii].alpacaErrCode - kASCOM_Err_NotImplemented; if ((errIndx >= 0) && (errIndx < kMaxErrors)) { errorCounts[errIndx]++; @@ -243,7 +244,7 @@ int errIndx; } SocketWriteData(mySocketFD, lineBuff); - sprintf(lineBuff, "", gEventLog[ii].errorString); + sprintf(lineBuff, "", gEventLog[iii].errorString); SocketWriteData(mySocketFD, lineBuff); @@ -258,9 +259,11 @@ int errIndx; SocketWriteData(mySocketFD, "
Error/Comment
%d/%d/%d %02d:%02d:%02d%s%s%s%s0x%03X/%d0x%03X/%d%s%s
\r\n"); SocketWriteData(mySocketFD, "

\r\n"); - + //-------------------------------------------------------------------- //* print out the error code meanings SocketWriteData(mySocketFD, "\r\n"); + SocketWriteData(mySocketFD, "\r\n"); + SocketWriteData(mySocketFD, "\r\n"); sprintf(lineBuff, "", kASCOM_Err_NotImplemented, kASCOM_Err_NotImplemented); SocketWriteData(mySocketFD, lineBuff); @@ -339,6 +342,24 @@ int errIndx; SocketWriteData(mySocketFD, lineBuff); SocketWriteData(mySocketFD, "\r\n"); + SocketWriteData(mySocketFD, "\r\n"); + sprintf(lineBuff, "", kASCOM_Err_NotInCacheException, kASCOM_Err_NotInCacheException); + SocketWriteData(mySocketFD, lineBuff); + SocketWriteData(mySocketFD, ""); + errIndx = kASCOM_Err_NotInCacheException - kASCOM_Err_NotImplemented; + sprintf(lineBuff, "", errorCounts[errIndx]); + SocketWriteData(mySocketFD, lineBuff); + SocketWriteData(mySocketFD, "\r\n"); + + SocketWriteData(mySocketFD, "\r\n"); + sprintf(lineBuff, "", kASCOM_Err_UnspecifiedError, kASCOM_Err_UnspecifiedError); + SocketWriteData(mySocketFD, lineBuff); + SocketWriteData(mySocketFD, ""); + errIndx = kASCOM_Err_UnspecifiedError - kASCOM_Err_NotImplemented; + sprintf(lineBuff, "", errorCounts[errIndx]); + SocketWriteData(mySocketFD, lineBuff); + SocketWriteData(mySocketFD, "\r\n"); + SocketWriteData(mySocketFD, "
Error Counts
0x%03X/%d
0x%03X/%dNotInCacheException%d
0x%03X/%dUnspecifiedError%d
\r\n");