pub struct DialogServiceConnector {
pub properties: PropertyCollection,
pub handle: SmartHandle<SPXRECOHANDLE>,
/* private fields */
}
Expand description
DialogServiceConnector connects to a speech enabled dialog backend.
Fields
properties: PropertyCollection
handle: SmartHandle<SPXRECOHANDLE>
Implementations
sourceimpl DialogServiceConnector
impl DialogServiceConnector
sourcepub fn from_config(
dialog_service_config: impl DialogServiceConfig,
audio_config: Option<AudioConfig>
) -> Result<Self>
pub fn from_config(
dialog_service_config: impl DialogServiceConfig,
audio_config: Option<AudioConfig>
) -> Result<Self>
NewDialogServiceConnectorFromConfig creates a dialog service connector from a dialog service config and an audio config. Users should use this function to create a dialog service connector.
pub async fn connect_async(&self) -> Result<()>
pub async fn disconnect_async(&self) -> Result<()>
sourcepub async fn send_activity_async(
&self,
message: String
) -> Result<SendActivityOutcome>
pub async fn send_activity_async(
&self,
message: String
) -> Result<SendActivityOutcome>
Sends an activity to the backing dialog.
sourcepub async fn listen_once_async(&self) -> Result<SpeechRecognitionResult>
pub async fn listen_once_async(&self) -> Result<SpeechRecognitionResult>
ListenOnceAsync starts a listening session that will terminate after the first utterance.
sourcepub async fn start_keyword_recognition_async(
&self,
model: &KeywordRecognitionModel
) -> Result<()>
pub async fn start_keyword_recognition_async(
&self,
model: &KeywordRecognitionModel
) -> Result<()>
StartKeywordRecognitionAsync initiates keyword recognition.
sourcepub async fn stop_keyword_recognition_async(&self) -> Result<()>
pub async fn stop_keyword_recognition_async(&self) -> Result<()>
StopKeywordRecognitionAsync stops keyword recognition.
pub fn get_auth_token(&self) -> Result<String>
sourcepub fn set_auth_token(&mut self, auth_token: String) -> Result<()>
pub fn set_auth_token(&mut self, auth_token: String) -> Result<()>
Sets the authorization token that will be used for connecting to the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the connector will encounter errors during its operation.
pub fn get_speech_activity_template(&self) -> Result<String>
sourcepub fn set_speech_activity_template(
&mut self,
speech_activity_template: String
) -> Result<()>
pub fn set_speech_activity_template(
&mut self,
speech_activity_template: String
) -> Result<()>
Sets the speech activity template. It is used to stamp properties from the template on the service generated activty for speech.
pub fn set_session_started_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SessionEvent) + 'static + Send,
pub fn set_session_stopped_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SessionEvent) + 'static + Send,
pub fn set_canceled_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechRecognitionCanceledEvent) + 'static + Send,
pub fn set_recognizing_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechRecognitionEvent) + 'static + Send,
pub fn set_recognized_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechRecognitionEvent) + 'static + Send,
pub fn set_activity_received_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechRecognitionEvent) + 'static + Send,
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for DialogServiceConnector
impl Send for DialogServiceConnector
impl !Sync for DialogServiceConnector
impl Unpin for DialogServiceConnector
impl !UnwindSafe for DialogServiceConnector
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more