Partager via


EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM fonction de rappel (acxelements.h)

Le rappel EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM définit l’état de bras du spotter de mot clé.

Syntaxe

EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM EvtAcxKeywordspotterAssignArm;

NTSTATUS EvtAcxKeywordspotterAssignArm(
  ACXKEYWORDSPOTTER KeywordSpotter,
  GUID *EventId,
  BOOLEAN Arm
)
{...}

Paramètres

KeywordSpotter

Objet ACXKEYWORDSPOTTER existant, initialisé. Pour plus d’informations sur les objets ACX, consultez Résumé des objets ACX. Consultez également la fonction AcxKeywordSpotterCreate.

EventId

Pointeur vers un GUID qui représente l’EventId.

Arm

Valeur booléenne indiquant si la détection de mot clé est armée.

Valeur de retour

Retourne STATUS_SUCCESS si l’appel a réussi. Sinon, elle retourne un code d’erreur approprié. Pour plus d’informations, consultez Using NTSTATUS Values.

Remarques

Pour plus d’informations générales sur la détection de mots clés, consultez d’activation vocale et d’Assistant vocal multiple.

Exemple

L’exemple d’utilisation est illustré ci-dessous.

EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM       DspC_EvtAcxKeywordSpotterAssignArm;

PAGED_CODE_SEG
NTSTATUS DspC_EvtAcxKeywordSpotterAssignArm(
    _In_    ACXKEYWORDSPOTTER   KeywordSpotter,
    _In_    GUID *              EventId,
    _In_    BOOLEAN             Arm
)
{
    PAGED_CODE();
    PDSP_KEYWORDSPOTTER_CONTEXT     keywordSpotterCtx;
    CKeywordDetector *              keywordDetector = NULL;

    keywordSpotterCtx = GetDspKeywordSpotterContext(KeywordSpotter);

    keywordDetector = (CKeywordDetector*)keywordSpotterCtx->KeywordDetector;

    RETURN_NTSTATUS_IF_FAILED(keywordDetector->SetArmed(*EventId, Arm));

    // the following code is for example only, after arming the
    // requested keyword we immediately trigger a detection
    // so that the automated tests do not block.
    if (Arm)
    {
        CONTOSO_KEYWORDDETECTIONRESULT detectionResult;

        // notify the keyword detector that we have a notification, to populate
        // timestamp information for this detection.
        keywordDetector->NotifyDetection();

        // fill in the detection specific information
        detectionResult.EventId = *EventId;
        detectionResult.Header.Size = sizeof(CONTOSO_KEYWORDDETECTIONRESULT);
        detectionResult.Header.PatternType = CONTOSO_KEYWORDCONFIGURATION_IDENTIFIER2;
        detectionResult.KeywordStartTimestamp = keywordDetector->GetStartTimestamp();
        detectionResult.KeywordStopTimestamp = keywordDetector->GetStopTimestamp();
        keywordDetector->GetDetectorData(*EventId, &(detectionResult.ContosoDetectorResultData));

        RETURN_NTSTATUS_IF_FAILED(AcxPnpEventGenerateEvent(keywordSpotterCtx->Event, &detectionResult, sizeof(CONTOSO_KEYWORDDETECTIONRESULT)));
    }

    return STATUS_SUCCESS;
}

Configuration requise pour ACX

version minimale d’ACX : 1.0

Pour plus d’informations sur les versions ACX, consultez vue d’ensemble de la version ACX.

Exigences

Exigence Valeur
d’en-tête acxelements.h
IRQL PASSIVE_LEVEL

Voir aussi