12-04-2009 10:46 PM
{
strcpy(sCmd,sCommand);
strtok(sCommand,SCRIPT_SEPARATORS);
strcpy(sFunction,strtok(NULL,SCRIPT_SEPARATORS));
sprintf (sMsg,"SendDASCommand: sCommand = %s, sFunction = %s",sCommand,
sFunction);
DBGPRINT(sMsg);
ERROR_LOG_FILE(sMsg);
if (!strcmp(sFunction,SETFILE))
{
//Sets the file location where the real time video capture
//is going to be stored on disk
if((iErrorFlag = Set_File(sCommand))< SUCCESS)
{
const char *sErrorSettingFileName="Error setting FILE name.";
ERRPRINT(sErrorSettingFileName);
ERROR_LOG_FILE((char*)sErrorSettingFileName);
MessagePopup("Error Message",sErrorSettingFileName);
return FAILURE;
}
}
else if(!strcmp(sFunction,FRAMES))
{
strcpy (sSelectNumOfFrames,(strtok(NULL,SCRIPT_SEPARATORS)));
iNumOfFramesSelected=atoi(sSelectNumOfFrames);
//Configure the number of frames
if((iErrorFlag = Configure_Frame_Grabs(iNumOfFramesSelected))<
SUCCESS)
{
const char *sErrorConfigFrames="Error setting frames.";
ERRPRINT(sErrorConfigFrames);
ERROR_LOG_FILE((char*)sErrorConfigFrames);
MessagePopup("Error Message",sErrorConfigFrames);
return FAILURE;
}
}
else if(!strcmp(sFunction,CENTROID))
{
iCurrentFrame.WidthCoordinate=atoi(g_sInstrData[FRAMEWIDTH]);
iCurrentFrame.HeightCoordinate=atoi(g_sInstrData[FRAMEHEIGHT]);
//Configure the frame count and capture the Centroid.
//Within this function we are calculating x and y offsets
if((iErrorFlag = Set_Param_Capture_Centroid(iNumOfFramesToSel,
iCurrentFrame))< SUCCESS)
{
const char *sErrorCaptCentroid="Error capturing "
"centroid.";
ERRPRINT(sErrorCaptCentroid);
ERROR_LOG_FILE((char*)sErrorCaptCentroid);
MessagePopup("Error Message",sErrorCaptCentroid);
return FAILURE;
}
}
else if (!strcmp(sFunction,REL_MOV))
{
strcpy (sValue1,(strtok(NULL,SCRIPT_SEPARATORS)));
strcpy (sValue2,(strtok(NULL,SCRIPT_SEPARATORS)));
dAZRelMovPosX=atof(sValue1);
dELRelMovPosY=atof(sValue2);
//MOving the gimbals by making a AZ and EL relative move
//from current position
if((iErrorFlag = Rel_Mov_From_Current_Pos(&dAZRelMovPosX,
&dELRelMovPosY))
< VI_SUCCESS)
{
const char *sErrorRetrCurrentPos="Error retrieving\n\n"
"current position.";
ERRPRINT(sErrorRetrCurrentPos);
ERROR_LOG_FILE((char*)sErrorRetrCurrentPos);
MessagePopup("Error Message",sErrorRetrCurrentPos);
return FAILURE;
}
}
//errorFlag equals VI_SUCCESS
return iErrorFlag;
} //Send_DAS3000_Command
12-04-2009 10:47 PM
//I need some assistance, basically I want to add more error handling in this section . basically in each strcmp function you will see, Im pulling from a script file.
//I want to be able to make error handling for these particular section, the type of error handling i want to cover is if the commands coming from the particular file is not on the line
//I want to handle that error at the moment, Im going to post the text file, I know how to do it, but not really using the strcmp really,
script file below
DAS, FILE,
DAS, FRAMES, 17
DAS, CENTROID
DAS, REL_MOV, 0.1, 0.2
12-04-2009 10:50 PM
I cut out all my declaration, and the file is being open else where in the test set, so in this particular i didnt open the file here, so thats why you dont see, but the parameter sCommand
is pulling the commands from the script file, but i want to be able to make an error exception for each line that posted for the script file
12-05-2009 12:49 AM
nevermind you guys i fix it, I made checks for what i wanted to do, i got a question is there a function to check whether im getting a digit value from the scritp file, like the 16
I want to make an exception for someone making a mistake and put anything besides an interger like DAS, FRAMES, ?7
? is not a value , so i want to throw an exception for that
******************************************************************
DAS, FRAMES, 16
12-05-2009 08:18 AM
1 meaningless subject, 4 posts in a row, no questions asked, no solutions provided...
That is a classic! 😉
12-05-2009 11:42 AM
12-05-2009 11:42 AM