EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM回调函数 (acxelements.h)

EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM回调设置关键字 (keyword) 发现器的状态。

语法

EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM EvtAcxKeywordspotterAssignArm;

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

参数

KeywordSpotter

一个已初始化的现有 ACXKEYWORDSPOTTER 对象。 有关 ACX 对象的详细信息,请参阅 ACX 对象的摘要。 另请参阅 AcxKeywordSpotterCreate 函数。

EventId

指向表示 EventId 的 GUID 的指针。

Arm

一个布尔值,指示关键字 (keyword) 检测是否为武装。

返回值

STATUS_SUCCESS如果调用成功,则返回 。 否则,它将返回相应的错误代码。 有关详细信息,请参阅 使用 NTSTATUS 值

注解

有关关键字 (keyword) 检测的常规信息,请参阅语音激活多语音助理

示例

示例用法如下所示。

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;
}

ACX 要求

最低 ACX 版本: 1.0

有关 ACX 版本的详细信息,请参阅 ACX 版本概述

要求

要求
Header acxelements.h
IRQL PASSIVE_LEVEL

另请参阅