From c05b0f8e0d0299434afe7980db3cc66b0a97b9ca Mon Sep 17 00:00:00 2001 From: jwlodek Date: Mon, 5 Nov 2018 15:08:57 -0500 Subject: [PATCH] added report function for reporting device status to log file --- adUVCApp/src/ADUVC.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++ adUVCApp/src/ADUVC.h | 3 +++ 2 files changed, 47 insertions(+) diff --git a/adUVCApp/src/ADUVC.cpp b/adUVCApp/src/ADUVC.cpp index ead70c0..f1fa8ee 100755 --- a/adUVCApp/src/ADUVC.cpp +++ b/adUVCApp/src/ADUVC.cpp @@ -497,6 +497,50 @@ asynStatus ADUVC::writeInt32(asynUser* pasynUser, epicsInt32 value){ + +/* + * Function used for reporting ADUVC device and library information to a external + * log file. The function first prints all libuvc specific information to the file, + * then continues on to the base ADDriver 'report' function + * + * @params: fp -> pointer to log file + * @params: details -> number of details to write to the file + * @return: void + */ +void ADUVC::report(FILE* fp, int details){ + const char* functionName = "report"; + int framerate; + int height; + int width; + asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s::%s reporting to file %s.\n",driverName, functionName, fp); + if(details > 0){ + fprintf(fp, " LIBUVC Version -> %s.%s.%s\n", LIBUVC_VERSION_MAJOR, LIBUVC_VERSION_MINOR, LIBUVC_VERSION_PATCH); + fprintf(fp, " -------------------------------------------------------------------\n"); + if(!connected){ + fprintf(fp, " No connected devices\n"); + ADDriver::report(fp, details); + return; + } + fprintf(fp, " Connected Device Information\n"); + fprintf(fp, " Serial number -> %s\n", pdeviceInfo->serialNumber); + fprintf(fp, " VendorID -> %d\n", pdeviceInfo->idVendor); + fprintf(fp, " ProductID -> %d\n", pdeviceInfo->idProduct); + fprintf(fp, " UVC Compliance Level -> %d\n", pdeviceInfo->bcdUVC); + getIntegerParam(ADUVC_Framerate, &framerate); + getIntegerParam(ADSizeX, &width); + getIntegerParam(ADSizeY, &height); + fprintf(fp, " Camera Framerate -> %d\n", framerate); + fprintf(fp, " Image Width -> %d\n", width); + fprintf(fp, " Image Height -> %d\n", height); + fprintf(fp, " -------------------------------------------------------------------\n"); + fprintf(fp, "\n"); + + ADDriver::report(fp, details); + } +} + + + /* * Constructor for ADUVC driver. Most params are passed to the parent ADDriver constructor. * Connects to the camera, then gets device information, and is ready to aquire images. diff --git a/adUVCApp/src/ADUVC.h b/adUVCApp/src/ADUVC.h index b783b50..14e8cd6 100755 --- a/adUVCApp/src/ADUVC.h +++ b/adUVCApp/src/ADUVC.h @@ -109,6 +109,9 @@ class ADUVC : ADDriver{ //function used to report errors in uvc operations void reportUVCError(uvc_error_t status, const char* functionName); + // reports device and driver info into a log file + void report(FILE* fp, int details); + //function used for connecting to a UVC device asynStatus connectToDeviceUVC(int connectionType, const char* serialNumber, int productID);