/****************************************************************************** * * Title : primFunc_setErrmsgMask.c * Version 0.0, * * Description: set errmsg mask primitive function. * Related files: * * Author: Lukas Tomasek, tomasekl@fzu.cz * ******************************************************************************/ /****************************************************************************** * Header files * ******************************************************************************/ #include #include "primFunc_setErrmsgMask.h" #include "fileUtility.h" #include "globalDefinitions.h" #include "uirUtility.h" #include "primParamsUir.h" #include "mainUir.h" #include #include "primFunctionInit.h" /****************************************************************************** * Global functions * ******************************************************************************/ /*============================================================================= * primFunction_setErrmsgMask() *============================================================================= * * Set errmsg mask primitive function. * */ ERROR_ID primFunction_setErrmsgMask(PRIM_FUNC_OPTION funcOption, struct PRIM_TABLE *primTable, void *primitive, UINT32 inputParameter, UINT8 slotNumber){ FILE *file; struct MSG_HEAD* primHeader=(struct MSG_HEAD*) primitive; UINT32 *primDataPtr=(UINT32*)((UINT32)primHeader+sizeof(struct MSG_HEAD)); ERROR_ID errorId=SUCCESS; char errorMessage[200]; int status; UINT32 primBodyLength; UINT32 primitiveId; struct SET_ERRMSG_MASK_IN *errmsgMask=&primTable->params.errmsgMask; const int panel=global.panel.primEdit[getPrimArrayId(SET_MESSAGE_MASK)]; UINT32 i; UINT32 dataLength; struct SET_ERRMSG_MASK_IN *errmsgMaskIn; struct SET_ERRMSG_MASK_OUT *errmsgMaskOut; struct HOST *host; char textMessage[200]; char errorText[100]; UINT32 listIndex; int ringIndex; if(R_SET_MESSAGE_MASK!=R_SET_ERRMSG_MASK_HOST){ ERROR_CHECK(PROGRAM_ERROR, primitive SET_ERRMSG_MASK - wrong revision number); return(PROGRAM_ERROR); } switch(funcOption){ case PRIM_PANEL_TO_TABLE: GetCtrlVal(panel, SET_ERRMSK_ERRMSG_MASK, (UINT32*)&errmsgMask->messageMask); /* NO BREAK HERE!!!*/ case PRIM_PARAMS_TO_TABLE: /* add table headers - don't set indexes!!! */ primTable->inPrimHeader.length=SIZEOF(struct SET_ERRMSG_MASK_IN)+SIZEOF(struct MSG_HEAD); primTable->inPrimHeader.id= SET_MESSAGE_MASK; primTable->inPrimHeader.primRevision=R_SET_MESSAGE_MASK; primTable->replyLength= 0; break; case PRIM_TABLE_TO_PANEL: if(primTable->inPrimHeader.primRevision!=R_SET_MESSAGE_MASK){ ERROR_CHECK(PROGRAM_ERROR, primitive SET_MESSAGE_MASK - wrong revision number); return(PROGRAM_ERROR); } SetCtrlVal(panel, SET_ERRMSK_ERRMSG_MASK, errmsgMask->messageMask); break; case PRIM_BUILD: /* copy mask */ *(struct SET_ERRMSG_MASK_IN*)(primDataPtr)=*errmsgMask; // or *(SINT*)(primDataPtr)=errmsgMask->errMsgMask; break; case REP_DATA_PROCESS: break; case WRITE_TO_FILE: file=(FILE*)inputParameter; fprintf(file, "errMsgMask= 0x%X\n", errmsgMask->messageMask); break; case READ_FROM_FILE: file=(FILE*)inputParameter; status=fscanf(file, "errMsgMask= 0x%X\n", &errmsgMask->messageMask); if(status==-1) {ERROR_CHECK(FATAL_ERROR, Read from prim file error!); return(FATAL_ERROR);} break; default: ;//error } return(SUCCESS); } /******************************************************************************/