/****************************************************************************** * * Title : primFunc_slaveListOp.c * Version 0.0, * * Description: Slave list option list primitive function. * Related files: * * Author: Lukas Tomasek, tomasekl@fzu.cz * ******************************************************************************/ /****************************************************************************** * Header files * ******************************************************************************/ #include #include "primFunc_slaveListOp.h" #include "globalDefinitions.h" #include "uirUtility.h" #include "primParamsUir.h" #include "mainUir.h" #include #include "primFunctionInit.h" /****************************************************************************** * Global functions * ******************************************************************************/ /*============================================================================= * primFunction_slaveListOp() *============================================================================= * * * */ ERROR_ID primFunction_slaveListOp(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 SLAVE_LIST_OP_IN *slaveListOp=&primTable->params.slaveListOp; const int panel=global.panel.primEdit[getPrimArrayId(SLAVE_LIST_OP)]; UINT32 i; UINT32 dataLength; struct SLAVE_LIST_OP_IN *slaveListOpIn; struct SLAVE_LIST_OP_OUT *slaveListOpOut; char textMessage[200]; char errorText[100]; UINT32 listIndex; int ringIndex; if(R_SLAVE_LIST_OP!=R_SLAVE_LIST_OP_HOST){ ERROR_CHECK(PROGRAM_ERROR, primitive SLAVE_LIST_OP - wrong revision number); return(PROGRAM_ERROR); } switch(funcOption){ case PRIM_PANEL_TO_TABLE: GetCtrlVal(panel, SLIST_OP_SLV_ID, &slaveListOp->slaveNumber); GetCtrlVal(panel, SLIST_OP_LIST_OP, &slaveListOp->listOp); /* NO BREAK HERE!!!*/ case PRIM_PARAMS_TO_TABLE: /* add table headers - don't set indexes!!! */ primTable->inPrimHeader.length=SIZEOF(struct SLAVE_LIST_OP_IN)+SIZEOF(struct MSG_HEAD); primTable->inPrimHeader.id=SLAVE_LIST_OP; primTable->inPrimHeader.primRevision=R_SLAVE_LIST_OP; primTable->replyLength=0; break; case PRIM_TABLE_TO_PANEL: if(primTable->inPrimHeader.primRevision!=R_SLAVE_LIST_OP){ ERROR_CHECK(PROGRAM_ERROR, primitive SLAVE_LIST_OP - wrong revision number); return(PROGRAM_ERROR); } SetCtrlVal(panel, SLIST_OP_SLV_ID, slaveListOp->slaveNumber); SetCtrlVal(panel, SLIST_OP_LIST_OP, slaveListOp->listOp); break; case PRIM_BUILD: /* copy params */ *(struct SLAVE_LIST_OP_IN*)(primDataPtr)=*slaveListOp; break; case REP_DATA_PROCESS: /* no reply */ break; case WRITE_TO_FILE: file=(FILE*)inputParameter; fprintf(file, "slaveNumber= %d, listOp= %d\n", slaveListOp->slaveNumber, slaveListOp->listOp); break; case READ_FROM_FILE: file=(FILE*)inputParameter; status=fscanf(file, "slaveNumber= %d, listOp= %d\n", &slaveListOp->slaveNumber, &slaveListOp->listOp); if(status==-1) {ERROR_CHECK(FATAL_ERROR, Read from prim file error!); return(FATAL_ERROR);} break; default: ;//error } return(SUCCESS); } /******************************************************************************/