ConversationalAgentSession Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The communication channel between the digital assistant and the Windows Conversational Agent platform.
public ref class ConversationalAgentSession sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 524288)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ConversationalAgentSession final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 524288)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ConversationalAgentSession : System.IDisposable
Public NotInheritable Class ConversationalAgentSession
Implements IDisposable
- Inheritance
- Attributes
- Implements
Windows requirements
Device family |
Windows 10, version 1903 (introduced in 10.0.18362.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v8.0)
|
Remarks
The ConversationalAgentSession is typically created through voice activation when a keyword utterance such as "Hey Cortana" or "Alexa" is recognized.
A ConversationalAgentSession can be created in various other ways, including Bluetooth (when a keyword utterance is transmitted through a headset or microphone), system keyboard accelerators (such as Win+C for Cortana), and initiation of speech interactions from within your app (perhaps through some kind of press-to-talk UI).
Properties
AgentState |
Gets the state of the digital assistant. |
IsIndicatorLightAvailable |
Gets whether the indicator light is available. |
IsInterrupted |
Gets whether the ConversationalAgentSession is being interrupted. |
IsInterruptible |
Gets whether the ConversationalAgentSession can be interrupted. |
IsScreenAvailable |
Gets whether the screen can be turned on. |
IsUserAuthenticated |
Gets whether the user is authenticated (for example, the device is locked). |
IsVoiceActivationAvailable |
Gets whether the digital assistant can be activated by speech input. |
Signal |
The Signal that activated the digital assistant, such as a keyword utterance, Bluetooth transmission, system keyboard accelerator, in-app speech recognition, or other sounds (door slam, smoke detector). |
Methods
Close() |
Terminates the ConversationalAgentSession. |
CreateAudioDeviceInputNode(AudioGraph) |
Synchronously creates an audio graph input node. Important To avoid possible concurrency issues, we recommend using CreateAudioDeviceInputNodeAsync instead. |
CreateAudioDeviceInputNodeAsync(AudioGraph) |
Asynchronously creates an audio graph input node. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
GetAudioCaptureDeviceId() |
Synchronously retrieves the device ID for the current speech input device. Important To avoid possible concurrency issues, we recommend using GetAudioCaptureDeviceIdAsync instead. |
GetAudioCaptureDeviceIdAsync() |
Asynchronously retrieves the device ID for the current speech input device. |
GetAudioClient() |
Synchronously retrieves an IAudioClient object that creates and initializes an audio stream between your application and the audio rendering device. Important To avoid possible concurrency issues, we recommend using GetAudioClientAsync instead. |
GetAudioClientAsync() |
Asynchronously retrieves an IAudioClient object that creates and initializes an audio stream between your application and the audio rendering device. |
GetAudioRenderDeviceId() |
Synchronously retrieves the device ID for the current speech output device. Important To avoid possible concurrency issues, we recommend using GetAudioRenderDeviceIdAsync instead. |
GetAudioRenderDeviceIdAsync() |
Asynchronously retrieves the device ID for the current speech output device. |
GetCurrentSessionAsync() |
Asynchronously retrieves a reference to the current ConversationalAgentSession. |
GetCurrentSessionSync() |
Synchronously retrieves a reference to the current ConversationalAgentSession. Important To avoid possible concurrency issues, we recommend using GetCurrentSessionAsync instead. |
GetMissingPrerequisites() |
Gets missing prerequisites that are required for voice activation to become available and function properly. |
GetMissingPrerequisitesAsync() |
Gets missing prerequisites for voice activation to become available and function properly. |
GetSignalModelId() |
Retrieves the unique model identifier of the Signal that activated the conversational agent. Important To avoid possible concurrency issues, we recommend using GetSignalModelIdAsync instead. |
GetSignalModelIdAsync() |
Asynchronously retrieves the unique model identifier of the Signal that activated the conversational agent. |
GetSupportedSignalModelIds() |
Retrieves the collection of unique Signal model identifiers supported by the conversational agent. Important To avoid possible concurrency issues, we recommend using GetSupportedSignalModelIdsAsync instead. |
GetSupportedSignalModelIdsAsync() |
Asynchronously retrieves the collection of unique Signal model identifiers supported by the conversational agent. |
RequestActivation(ConversationalAgentActivationKind) |
Requests that the digital assistant be activated to the foreground. |
RequestActivationAsync(ConversationalAgentActivationKind) |
Asynchronously requests that the digital assistant be activated to the foreground. |
RequestAgentStateChange(ConversationalAgentState) |
Synchronously requests a state change for the current ConversationalAgentSession. Important To avoid possible concurrency issues, we recommend using RequestAgentStateChangeAsync instead. |
RequestAgentStateChangeAsync(ConversationalAgentState) |
Asynchronously requests a state change for the current ConversationalAgentSession. |
RequestForegroundActivation() |
Synchronously requests that the digital assistant be activated to the foreground. Important To avoid possible concurrency issues, we recommend using RequestForegroundActivationAsync instead. |
RequestForegroundActivationAsync() |
Asynchronously requests that the digital assistant be activated to the foreground. |
RequestInterruptible(Boolean) |
Synchronously requests that this ConversationalAgentSession be interruptible if the keyword for another digital assistant is detected. Important To avoid possible concurrency issues, we recommend using RequestInterruptibleAsync instead. |
RequestInterruptibleAsync(Boolean) |
Asynchronously requests that this ConversationalAgentSession be interruptible if the keyword for another digital assistant is detected. |
SetSignalModelId(UInt32) |
Assigns a unique identifier to the model representing the activation audio signal for the conversational agent. Important To avoid possible concurrency issues, we recommend using SetSignalModelIdAsync instead. |
SetSignalModelIdAsync(UInt32) |
Asynchronously assigns a unique identifier to the model representing the activation audio signal for the conversational agent. |
SetSupportLockScreenActivation(Boolean) |
Enables or disables support for lock screen activation of the conversational agent. |
SetSupportLockScreenActivationAsync(Boolean) |
Asynchronously enables or disables support for lock screen activation of the conversational agent. |
Events
SessionInterrupted |
Occurs when another digital assistant activation signal has been detected. |
SignalDetected |
Occurs when a Signal for activating a digital assistant is detected. |
SystemStateChanged |
Occurs when either the system or the user changes a setting that restricts the ability of the digital assistant to perform one or more actions. |