//------------------------------------------------------------------------------
tOplkError ProcessThread::processEvent(tOplkApiEventType eventType_p,
                                       tOplkApiEventArg* pEventArg_p,
                                       void* pUserArg_p)
{
    tOplkError  ret = kErrorOk;

    switch (eventType_p)
    {
        case kOplkApiEventNmtStateChange:
            ret = processStateChangeEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventCriticalError:
        case kOplkApiEventWarning:
            ret = processErrorWarningEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventHistoryEntry:
            ret = processHistoryEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventNode:
            ret = processNodeEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventPdoChange:
            ret = processPdoChangeEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventCfmProgress:
            ret = processCfmProgressEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventCfmResult:
            ret = processCfmResultEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;

#if !defined(CONFIG_INCLUDE_CFM)
        // Configuration Manager is not available,
        // so process SDO events
        case kOplkApiEventSdo:
            ret = processSdoEvent(eventType_p, pEventArg_p, pUserArg_p);
            break;
#else
        case kOplkApiEventSdo:
            emit sdoFinished(pEventArg_p->sdoInfo);
            break;
#endif

        case kOplkApiEventUserDef:
            emit userDefEvent(pEventArg_p->pUserArg);

        default:
            break;
    }

    return ret;
}
示例#2
0
//------------------------------------------------------------------------------
tOplkError processEvents(tOplkApiEventType EventType_p,
                         tOplkApiEventArg* pEventArg_p,
                         void* pUserArg_p)
{
    tOplkError          ret = kErrorOk;

    UNUSED_PARAMETER(pUserArg_p);

    // check if NMT_GS_OFF is reached
    switch (EventType_p)
    {
        case kOplkApiEventNmtStateChange:
            ret = processStateChangeEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventCriticalError:
        case kOplkApiEventWarning:
            ret = processErrorWarningEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventHistoryEntry:
            ret = processHistoryEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventNode:
            ret = processNodeEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventPdoChange:
            ret = processPdoChangeEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

#ifdef CONFIG_INCLUDE_CFM
        case kOplkApiEventCfmProgress:
            ret = processCfmProgressEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventCfmResult:
            ret = processCfmResultEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;
#else
        // Configuration Manager is not available,
        // so process SDO events
        case kOplkApiEventSdo:
            ret = processSdoEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;
#endif

        default:
            break;
    }
    return ret;
}
//------------------------------------------------------------------------------
tOplkError processEvents(tOplkApiEventType EventType_p, tOplkApiEventArg* pEventArg_p, void* pUserArg_p)
{
    tOplkError          ret = kErrorOk;

    UNUSED_PARAMETER(pUserArg_p);

    // check if NMT_GS_OFF is reached
    switch (EventType_p)
    {
        case kOplkApiEventNmtStateChange:
            ret = processStateChangeEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventCriticalError:
        case kOplkApiEventWarning:
            ret = processErrorWarningEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventHistoryEntry:
            ret = processHistoryEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventNode:
            ret = processNodeEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

#ifdef CONFIG_INCLUDE_CFM
        case kOplkApiEventCfmProgress:
            ret = processCfmProgressEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;

        case kOplkApiEventCfmResult:
            ret = processCfmResultEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;
#else
        // Configuration Manager is not available,
        // so process SDO events
        case kOplkApiEventSdo:
            ret = processSdoEvent(EventType_p, pEventArg_p, pUserArg_p);
            break;
#endif

        case kOplkApiEventLed:
            /* POWERLINK S/E LED needs to be changed */
            switch (pEventArg_p->ledEvent.ledType)
            {
                case kLedTypeStatus:
                    gpio_setStatusLed(pEventArg_p->ledEvent.fOn);
                    break;

                case kLedTypeError:
                    gpio_setErrorLed(pEventArg_p->ledEvent.fOn);
                    break;

                default:
                    break;
            }
            break;

        default:
            break;
    }

    // call user event call back
    if ((ret == kErrorOk) && (pfnEventCb_l != NULL))
        ret = pfnEventCb_l(EventType_p, pEventArg_p, pUserArg_p);

    return ret;
}