EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS fonction de rappel (acxelements.h)

Le rappel EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS affecte des modèles de détection pour mot clé détection à utiliser par le spotter mot clé.

Syntaxe

EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS EvtAcxKeywordspotterAssignPatterns;

NTSTATUS EvtAcxKeywordspotterAssignPatterns(
  ACXKEYWORDSPOTTER KeywordSpotter,
  GUID *EventId,
  PVOID Pattern,
  ULONG PatternSize
)
{...}

Paramètres

KeywordSpotter

Objet ACXKEYWORDSPOTTER initialisé existant. 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.

Pattern

GUID identifiant le modèle de détection de spotter mot clé.

PatternSize

Longueur, en octets, du modèle de détection mot clé.

Valeur retournée

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

Remarques

Pour obtenir des informations générales sur la détection mot clé, consultez Activation vocale et Assistant vocal multiple.

Exemple

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

EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS  CodecC_EvtAcxKeywordSpotterAssignPatterns;

NTSTATUS
NTAPI
CodecC_EvtAcxKeywordSpotterAssignPatterns(
    _In_    ACXKEYWORDSPOTTER   KeywordSpotter,
    _In_    GUID *              EventId,
    _In_    PVOID               Pattern,
    _In_    ULONG               PatternSize
    )
{
    KSMULTIPLE_ITEM *               itemsHeader = nullptr;
    SOUNDDETECTOR_PATTERNHEADER *   patternHeader;
    CONTOSO_KEYWORDCONFIGURATION *  pattern;
    ULONG                           cbRemaining = 0;
    PCODEC_KEYWORDSPOTTER_CONTEXT   keywordSpotterCtx;
    CKeywordDetector *              keywordDetector = NULL;

    PAGED_CODE();

    keywordSpotterCtx = GetCodecKeywordSpotterContext(KeywordSpotter);

    keywordDetector = (CKeywordDetector*)keywordSpotterCtx->KeywordDetector;

    cbRemaining = PatternSize;

    // The SYSVADPROPERTY_ITEM for this property ensures the value size is at
    // least sizeof KSMULTIPLE_ITEM.
    if (cbRemaining < sizeof(KSMULTIPLE_ITEM))
    {
        return STATUS_INVALID_PARAMETER;
    }

    itemsHeader = (KSMULTIPLE_ITEM*)Pattern;

    // Verify property value is large enough to include the items
    if (itemsHeader->Size > cbRemaining)
    {
        return STATUS_INVALID_PARAMETER;
    }

    // No items so clear the configuration.
    if (itemsHeader->Count == 0)
    {
        keywordDetector->ResetDetector(*EventId);
        return STATUS_SUCCESS;
    }

    // This sample supports only 1 pattern type.
    if (itemsHeader->Count > 1)
    {
        return STATUS_NOT_SUPPORTED;
    }

    // Bytes remaining after the items header
    cbRemaining = itemsHeader->Size - sizeof(*itemsHeader);

    // Verify the property value is large enough to include the pattern header.
    if (cbRemaining < sizeof(SOUNDDETECTOR_PATTERNHEADER))
    {
        return STATUS_INVALID_PARAMETER;
    }

    patternHeader = (SOUNDDETECTOR_PATTERNHEADER*)(itemsHeader + 1);

    // Verify the pattern type is supported.
    if (patternHeader->PatternType != CONTOSO_KEYWORDCONFIGURATION_IDENTIFIER2)
    {
        return STATUS_NOT_SUPPORTED;
    }

    // Verify the property value is large enough for the pattern.
    if (cbRemaining < patternHeader->Size)
    {
        return STATUS_INVALID_PARAMETER;
    }

    // Verify the pattern is large enough.
    if (patternHeader->Size != sizeof(CONTOSO_KEYWORDCONFIGURATION))
    {
        return STATUS_INVALID_PARAMETER;
    }

    pattern = (CONTOSO_KEYWORDCONFIGURATION*)(patternHeader);

    return keywordDetector->DownloadDetectorData(*EventId, pattern->ContosoDetectorConfigurationData);
}

Configuration requise pour ACX

Version ACX minimale : 1.0

Pour plus d’informations sur les versions d’ACX, consultez Vue d’ensemble des versions d’ACX.

Configuration requise

Condition requise Valeur
En-tête acxelements.h
IRQL PASSIVE_LEVEL

Voir aussi