# Diag Event Management Service

- [API reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_taf_diagEvent_interface_h.html#file-taf-diagevent-interface-h)

Diag Event Management Service provides APIs for applications to process diagnostic events (errors) and associated data. Further, Diag Event Management Service provides interface function for the DTC service to get fault detection counter and clear DTC information.

## IPC interfaces binding

The functions of this API are provided by the **tafDiagSvc** platform service.

The following example illustrates how to bind to the diag Event Management service.

bindings:
    {
         clientExe.clientComponent.taf_diagEvent -> tafDiagSvc.taf_diagEvent
    }
    Copy to clipboard

## Operation cycle APIs

An operation cycle reference should be got using [taf\_diagEvent\_GetOpCycle()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a870d3ffd7ec465733e58c221eebf87f6.html#Documentationa00392_1a870d3ffd7ec465733e58c221eebf87f6). Use the returned reference for subsequent operations.

The following example illustrates how to set up an operation cycle service-instance.

taf_diagEvent_OpCycleRef_t opCycleSvcRef;    // Operation cycle reference
    
    // Get the service reference.
    opCycleSvcRef = taf_diagEvent_GetOpCycle(operationCycleId);
    LE_ASSERT(opCycleSvcRef != NULL);
    Copy to clipboard

## Operation cycle state

After getting the reference, an application can call [taf\_diagEvent\_SetOpCycleState()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1aa57632a8a3daa8934dd8c293e9183a17.html#Documentationa00392_1aa57632a8a3daa8934dd8c293e9183a17) to set the operation cycle state.

le_result_t result=taf_diagEvent_SetOpCycleState(opCycleSvcRef, TAF_DIAGEVENT_CYCLE_START);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to start the operation cycle.");
       return result;
    }
    Copy to clipboard

Before starting an operation cycle, an application registers a state handler using [taf\_diagEvent\_AddOpCycleStateHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1adeae8949943426252d0fda69fc289bc6.html#Documentationa00392_1adeae8949943426252d0fda69fc289bc6). Once the operation cycle state changes, the handler will be called indicating the new state.

ocStateRef = taf_diagEvent_AddOpCycleStateHandler(opCycleSvcRef,
                     (taf_diagEvent_OpCycleStateHandlerFunc_t)opCycleHandler, NULL);
    Copy to clipboard

The following APIs are supported for operation cycle state management:

- [taf\_diagEvent\_GetOpCycle()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a870d3ffd7ec465733e58c221eebf87f6.html#Documentationa00392_1a870d3ffd7ec465733e58c221eebf87f6) — Gets the operation cycle reference.
- [taf\_diagEvent\_SetOpCycleState()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1aa57632a8a3daa8934dd8c293e9183a17.html#Documentationa00392_1aa57632a8a3daa8934dd8c293e9183a17) — Sets the state of an operation cycle.
- [taf\_diagEvent\_GetOpCycleState()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a5a6e575cea6c8a0c16b59de7740f5dfb.html#Documentationa00392_1a5a6e575cea6c8a0c16b59de7740f5dfb) — Gets the state of an operation cycle.
- [taf\_diagEvent\_AddOpCycleStateHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1adeae8949943426252d0fda69fc289bc6.html#Documentationa00392_1adeae8949943426252d0fda69fc289bc6) — Adds handler function for EVENT ‘taf\_diagEvent\_OpCycleState’
- [taf\_diagEvent\_RemoveOpCycleStateHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1ad6e2fd790f04315ead9899c7166cc674.html#Documentationa00392_1ad6e2fd790f04315ead9899c7166cc674) — Removes handler function for EVENT ‘taf\_diagEvent\_OpCycleState’.
- [taf\_diagEvent\_RemoveOpCycle()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1aba382fda2e1837206d72f64f9ec55c4f.html#Documentationa00392_1aba382fda2e1837206d72f64f9ec55c4f) — Removes the operation cycle service.

## Server-service APIs

A diag event service reference should be got using [taf\_diagEvent\_GetService()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a869438c34466a2562174961f9672ff82.html#Documentationa00392_1a869438c34466a2562174961f9672ff82). Use the returned reference for subsequent operations.

The following example illustrates how to set up a diag event server-service-instance.

taf_diagEvent_ServiceRef_t svcRef;    // Service reference
    
    // Get the service reference.
    svcRef = taf_diagEvent_GetService(eventId) = (1,2);
    LE_ASSERT(svcRef != NULL);
    Copy to clipboard

## Set event status

After getting the service reference, an application can call [taf\_diagEvent\_SetStatus()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a6ed22a84b930cb810aa7f1e029da6d3d.html#Documentationa00392_1a6ed22a84b930cb810aa7f1e029da6d3d) or [taf\_diagEvent\_SetStatusWithSupplierFaultCode()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1aab82fa48cc7fc7f36c4ddaff4c9f3bdf.html#Documentationa00392_1aab82fa48cc7fc7f36c4ddaff4c9f3bdf) to set the event status, and diag Event Management service processes the event and generates DTC/event information, including event UDS status, DTC status, fault detection counter, occurrence counter, etc.

le_result_t result=taf_diagEvent_SetStatus(svcRef,TAF_DIAGEVENT_PREFAILED);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to set event status with PREFAILED.");
       return result;
    }
    Copy to clipboard

The following APIs are supported for event management:

- [taf\_diagEvent\_GetId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a3d16b136e12b4d814126565344a88e3c.html#Documentationa00392_1a3d16b136e12b4d814126565344a88e3c) — Gets the event ID for the given service reference.
- [taf\_diagEvent\_GetOperationCycleId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a069d95ca87a19ca65d49a85aa080a6cf.html#Documentationa00392_1a069d95ca87a19ca65d49a85aa080a6cf) — Gets the operation cycle ID for the given event reference.
- [taf\_diagEvent\_GetDTCCode()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a52d4bf35a9ddc773285e13a3ddda8a64.html#Documentationa00392_1a52d4bf35a9ddc773285e13a3ddda8a64) — Gets the DTC code for the given event reference.
- [taf\_diagEvent\_GetEnableCondState()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1abfd8a0ee1dae21408eab90bc8bb6d7db.html#Documentationa00392_1abfd8a0ee1dae21408eab90bc8bb6d7db) — Gets the Enable Condition state for the given event reference.
- [taf\_diagEvent\_SetStatus()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a6ed22a84b930cb810aa7f1e029da6d3d.html#Documentationa00392_1a6ed22a84b930cb810aa7f1e029da6d3d) — Gets event status.
- [taf\_diagEvent\_SetStatusWithSupplierFaultCode()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1aab82fa48cc7fc7f36c4ddaff4c9f3bdf.html#Documentationa00392_1aab82fa48cc7fc7f36c4ddaff4c9f3bdf) — Sets event status with supplier fault code.
- [taf\_diagEvent\_GetUdsStatus()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a73816021b00e1f7d5efaaf6d6e86f345.html#Documentationa00392_1a73816021b00e1f7d5efaaf6d6e86f345) — Gets event UDS status.
- [taf\_diagEvent\_ResetDebounceStatus()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1aec3156b390d19c35db57ae6c8a2d8a7c.html#Documentationa00392_1aec3156b390d19c35db57ae6c8a2d8a7c) — Resets debounce status.
- [taf\_diagEvent\_AddUdsStatusHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1abcb341a36bbd020321669a0c8c539a48.html#Documentationa00392_1abcb341a36bbd020321669a0c8c539a48) — Adds a handler for event UDS status changes.
- [taf\_diagEvent\_RemoveUdsStatusHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a0f796d4653605fd0fbf18f935aa91685.html#Documentationa00392_1a0f796d4653605fd0fbf18f935aa91685) — Removes a handler for event UDS status changes.
- [taf\_diagEvent\_RemoveSvc()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a1f0326f0a40dd9214b59376e00775e37.html#Documentationa00392_1a1f0326f0a40dd9214b59376e00775e37) — Removes the Event Management service.
- [taf\_diagEvent\_AddEnableCondStateHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a129b8ec1a344061c869d4217e1e1d7a1.html#Documentationa00392_1a129b8ec1a344061c869d4217e1e1d7a1) — Adds a handler for Enable Condition state change.
- [taf\_diagEvent\_RemoveEnableCondStateHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00392_1a1178b3a212cdc9ec50facc6093cbe24a.html#Documentationa00392_1a1178b3a212cdc9ec50facc6093cbe24a) — Removes a handler for Enable Condition state change.

Last Published: Jun 09, 2026

[Previous Topic
Diag DTC Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafDiagDtc.md) [Next Topic
Diag IDPS Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafDiagIDPS.md)