// // idlPvAttrList // // List all the attributes applicable to a camera. // // command line arguments // argv[0]: IN/FLAG debug // argv[1]: IN camera index // argv[2]: OUT array of attribute names int idlPvAttrList (int argc, char *argv[]) { unsigned long n; unsigned long err; unsigned long count; tPvAttrListPtr list; IDL_STRING *idllist; int i; debug = *(IDL_INT *) argv[0]; n = *(unsigned long *) argv[1]; idllist = (IDL_STRING *) argv[2]; CHECKINDEX(n); err = PvAttrList(camera[n], &list, &count); if (err == ePvErrSuccess) { for (i = 0; i < count; i++) { IDL_StrStore(&idllist[i], (char *) list[i]); } } return idlPvErrCode(err); }
/* * Method: DoCameraExport() * Purpose: export the setup of a given camera * Comments: none */ bool CMainWindow::ExportCamera(tPvHandle aHandle,const wxString& aFilename) { FILE* lFile = fopen(aFilename.mb_str(wxConvUTF8),"w+"); if(lFile) { bool lRet = true; tPvAttrListPtr lAttrs; tPvUint32 lCount; if(!PvAttrList(aHandle,&lAttrs,&lCount)) { for(tPvUint32 i=0;i<lCount;i++) WriteAttribute(aHandle,lAttrs[i],lFile); } else lRet = false; fclose(lFile); return lRet; } else return false; }
// save the setup of a camera from the given file bool SetupSave(tPvHandle aCamera,const char* aFile) { FILE* lFile = fopen(aFile,"w+"); if(lFile) { bool lRet = true; tPvAttrListPtr lAttrs; tPvUint32 lCount; if(!PvAttrList(aCamera,&lAttrs,&lCount)) { for(tPvUint32 i=0;i<lCount;i++) WriteAttribute(aCamera,lAttrs[i],lFile); } else lRet = false; fclose(lFile); return lRet; } else return false; }
// Test validity of all attribute values. void attributeTest(diagnostic_updater::DiagnosticStatusWrapper& status) { status.name = "Attribute Test"; tPvAttrListPtr list_ptr; unsigned long list_length; if (PvAttrList(cam_->handle(), &list_ptr, &list_length) == ePvErrSuccess) { status.summary(0, "All attributes in valid range"); for (unsigned int i = 0; i < list_length; ++i) { const char* attribute = list_ptr[i]; tPvErr e = PvAttrIsValid(cam_->handle(), attribute); if (e != ePvErrSuccess) { status.summary(2, "One or more invalid attributes"); if (e == ePvErrOutOfRange) status.add(attribute, "Out of range"); else if (e == ePvErrNotFound) status.add(attribute, "Does not exist"); else status.addf(attribute, "Unexpected error code %u", e); } } } else { status.summary(2, "Unable to retrieve attribute list"); } }
// list all the attributes void ListAttributes() { tPvUint32 lCount; tPvAttrListPtr lAttrs; if(!PvAttrList(GCamera.Handle,&lAttrs,&lCount)) { for(tPvUint32 i=0;i<lCount;i++) QueryAttribute(lAttrs[i]); } else printf("failed get the attributes list\n"); }
// list all attributes void ListAttributes() { tPvUint32 lCount; tPvAttrListPtr lAttrs; //Get all attributes if(PvAttrList(GCamera.Handle,&lAttrs,&lCount) == ePvErrSuccess) { //Get info and display each attribute for(tPvUint32 i=0;i<lCount;i++) QueryAttribute(lAttrs[i]); } else printf("failed get the attributes list\n"); }
//========================================================= // // ATTRIBUTES // //========================================================= // // idlPvCountAttributes // // Return the number of attributes applicable to a camera. // // command line arguments // argv[0]: IN/FLAG debug // argv[1]: IN camera index // argv[2]: OUT number of attributes int idlPvCountAttributes (int argc, char *argv[]) { unsigned long n; unsigned long err; tPvAttrListPtr list; unsigned long * count; debug = *(IDL_INT *) argv[0]; n = *(unsigned long *) argv[1]; count = (unsigned long *) argv[2]; CHECKINDEX(n); err = PvAttrList(camera[n], &list, count); return idlPvErrCode(err); }