/****************************************************************************** * * Title : commandFunc_sendPrimList.c * Version 0.0 * * Description: Sends primitive list to related rod. * Related files: * * Author: Lukas Tomasek, tomasekl@fzu.cz * ******************************************************************************/ /****************************************************************************** * Header files * ******************************************************************************/ #include #include #include "commandListDefinitions.h" #include "commandFunc_sendPrimList.h" #include "uirUtility.h" #include "globalDefinitions.h" #include "commandParamsUir.h" #include "hostUtility.h" #include "mainUir.h" #include "threadUtility.h" #include "RWlists.h" /****************************************************************************** * Global functions * ******************************************************************************/ /*============================================================================= * commandFunction_sendPrimList() *============================================================================= * * * */ ERROR_ID commandFunction_sendPrimList(COMMAND_FUNC_OPTION funcOption, struct COMMAND *command, UINT8 slotNumber, FILE *file){ struct HOST *host; const int panel=global.panel.commandEdit[SEND_PRIM_LIST_COMMAND_ID]; struct SEND_PRIM_LIST_PARAMS *sendList=&command->params.sendPrimList; int status; ERROR_ID errorId=SUCCESS; unsigned int fileSize; char text[300]; UINT32 tempVar; int strLength; switch(funcOption){ case COMMAND_TO_LIST: GetCtrlVal(panel, SEND_PLIST_INP_FILE, sendList->fileName); GetCtrlVal(panel, SEND_PLIST_REPEAT_BUILD_EXEC, &sendList->repeatExecNotBuild); if(sendList->fileName[0]==0) { status = MessagePopup ("WARNING", "No list selected!"); UIR_STATUS_CHECK(status, MessagePopup()); return(PROGRAM_WARNING); } break; case LIST_TO_COMMAND: SetCtrlVal(panel, SEND_PLIST_INP_FILE, sendList->fileName); SetCtrlVal(panel, SEND_PLIST_REPEAT_BUILD_EXEC, sendList->repeatExecNotBuild); break; case COMMAND_EXECUTION: host=global.host[HOST_INDEX(slotNumber)]; errorId=executePrimListFile(slotNumber, sendList->fileName, command->numRepetitions, !sendList->repeatExecNotBuild, 1); ERROR_CHECK(errorId, executePrimListFile()); if((global.option.programExit==TRUE)||(host->option.hostExit==TRUE)){ return(SUCCESS); } break; case SAVE_CMD_TO_FILE: fprintf(file, "repeatExecNotBuild= %d\n", sendList->repeatExecNotBuild); fprintf(file, "fileName[]= %s\n", sendList->fileName); break; case LOAD_CMD_FROM_FILE: status=fscanf(file, "repeatExecNotBuild= %d\n", &sendList->repeatExecNotBuild); if(status==-1) {ERROR_CHECK(FATAL_ERROR, Read from cmd file error!); return(FATAL_ERROR);} status=readLineFromIndex(file, strlen("fileName[]= "), PATHNAME_LENGTH, sendList->fileName); if(status!=0) {ERROR_CHECK(FATAL_ERROR, Read from cmd file error!); return(FATAL_ERROR);} break; default: ; } return(errorId); } /******************************************************************************/