DEFINE_FIRMWARE_FB(E_RESTART, g_nStringIdE_RESTART) const CStringDictionary::TStringId E_RESTART::scm_aunEONameIds[] = {g_nStringIdCOLD, g_nStringIdWARM, g_nStringIdSTOP}; const TEventID E_RESTART::csmCOLDID; const TEventID E_RESTART::csmWARMID; const TEventID E_RESTART::csmSTOPID; const SFBInterfaceSpec E_RESTART::scm_stFBInterfaceSpec = { 0, 0, 0, 0, 3, scm_aunEONameIds, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; void E_RESTART::executeEvent(int pa_nEIID) { if(cg_nExternalEventID == pa_nEIID && cg_nInvalidEventID != mEventToSend) { sendOutputEvent(mEventToSend); if(csmSTOPID == mEventToSend) { //stop event is sent put the FB finally into the stopped state CFunctionBlock::changeFBExecutionState(cg_nMGM_CMD_Stop); // release semaphore to indicate that the stop event was sent now mSuspendSemaphore.inc(); } } } EMGMResponse E_RESTART::changeFBExecutionState(EMGMCommandType pa_unCommand){ EMGMResponse eRetVal = CFunctionBlock::changeFBExecutionState(pa_unCommand); if(e_RDY == eRetVal){ switch(pa_unCommand){ case cg_nMGM_CMD_Start: mEventToSend = (csmSTOPID == mEventToSend) ? csmWARMID : csmCOLDID; getResource().getDevice().getDeviceExecution().startNewEventChain(this); break; case cg_nMGM_CMD_Stop: mEventToSend = csmSTOPID; CFunctionBlock::changeFBExecutionState(cg_nMGM_CMD_Start); //keep FB in running state until stop event is delivered. getResource().getDevice().getDeviceExecution().startNewEventChain(this); // wait until semaphore is released, after STOP eventExecution was completed mSuspendSemaphore.waitIndefinitely(); break; default: mEventToSend = cg_nInvalidEventID; break; } } return eRetVal; }
struct SFBInterfaceSpec { TForteUInt8 m_nNumEIs; //!< Number of event inputs (max 254) const CStringDictionary::TStringId *m_aunEINames; //!< List of the event input names const TDataIOID *m_anEIWith; //!< Input WITH reference list. This list contains an array of input data ids. For each input event the associated data inputs are listed. The start for each input event is specified in the m_anEIWithIndexes field. The end is defined trough the value 255. const TForteInt16 *m_anEIWithIndexes; //!< Index list for each input event. This list gives for each input event an entry in the m_anEIWith. Input events are numbered starting from 0. if the input event has no assciated data inputs -1 is the entry at this event inputs postion. TForteUInt8 m_nNumEOs; //!< Number of event outputs (max 254) const CStringDictionary::TStringId *m_aunEONames; //!< List of the event output names const TDataIOID *m_anEOWith; //!< Output WITH reference list. This list contains an array of output data ids. For each output event the associated data outputs are listed. The start for each output event is specified in the m_anEOWithIndexes field. The end is defined trough the value 255. const TForteInt16 *m_anEOWithIndexes; //!< Index list for each output event. This list gives for each output event an entry in the m_anEOWith. Output events are numbered starting from 0. if the output event has no assciated data outputs -1 is the entry at this event outputs postion. Additionally at the postion m_nNumEOs in this list an index to an own list in the m_anEOWith list is stored specifying all output data port that are not associated with any output event. That values will be updated on every FB invocation. TForteUInt8 m_nNumDIs; //!< Number of data inputs (max 254) const CStringDictionary::TStringId *m_aunDINames; //!< List of the data input names const CStringDictionary::TStringId *m_aunDIDataTypeNames; //!< List of the data type names for the data inputs TForteUInt8 m_nNumDOs; //!< Number of data outputs (max 254) const CStringDictionary::TStringId *m_aunDONames; //!< List of the data output names const CStringDictionary::TStringId *m_aunDODataTypeNames; //!< List of the data type names for the data outputs TForteUInt8 m_nNumAdapters; //!< Number of Adapters const SAdapterInstanceDef *m_pstAdapterInstanceDefinition; //!< List of adapter instances };
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)