Example Code
Main.cpp Application Code
364
Agilent 81250 Parallel Bit Error Ratio Tester, Programming Reference, March 2006
printf(“press any key to continue\n”);
(void)getchar();
}
else
fclose(fp);
return 0;
}
// Connect to 81200 server on local machine or “theServerName”.
// Creates a handle for the system “theSystemName”.
// This handle is internally handled, so that we do not need
// to specify it with each command.
bool HP81200::Init(
const char* theServerName,
const char* theHandleSuggestion,
const char* theSystemName,
FILE* theErrorFile)
{
bool b;
char aCmd[128];
int ret;
// remember error log file
itsErrorFile = theErrorFile;
// connect to firmware server
// if already connected do nothing
ret = Connect_HP81200(theServerName);
itsConnected = (ret == 0);
if (!itsConnected && (ret != -4))
{
WriteErrorLog(ret);
return false;
}
// create a handle
sprintf(aCmd, “:dvt:inst:hand:cre? %s,’DSR’,’%s’”,
theHandleSuggestion, theSystemName);
b = Call(aCmd);
strcpy(itsHandle, itsResultBuffer);
return b;
}
// Release the handle, disconnect from the system
bool HP81200::Exit()
{
if (strcmp(itsHandle, ““) != 0)
{
bool b;
char aCmd[128];
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com