AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T > Class Template Referenceabstract

#include <CommunicationPropertiesHandlerInterface.h>

Inheritance diagram for alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >:
Inheritance graph
[legend]

Public Member Functions

virtual ~CommunicationPropertiesHandlerInterface ()=default
 
virtual std::shared_ptr< CommunicationProperty< T > > registerProperty (const std::string &propertyName, T initValue, const std::shared_ptr< CommunicationPropertyValidatorInterface< T >> &writeValidator=nullptr)=0
 
virtual void deregisterProperty (const std::string &propertyName, const std::shared_ptr< CommunicationProperty< T >> &property)=0
 
virtual bool writeProperty (const std::string &propertyName, T newValue)=0
 
virtual bool readProperty (const std::string &propertyName, T &value)=0
 
virtual bool subscribeToPropertyChangeEvent (const std::string &propertyName, const std::weak_ptr< CommunicationPropertyChangeSubscriber< T >> &subscriber)=0
 
virtual bool unsubscribeToPropertyChangeEvent (const std::string &propertyName, const std::shared_ptr< CommunicationPropertyChangeSubscriber< T >> &subscriber)=0
 

Detailed Description

template<typename T>
class alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >

The CommunicationPropertiesHandlerInterface is used to register, deregister, write property, read property, subscribe to property change events, and unsubscribe to change events. The implementation will allow multiple different components to have access to properties without have explict ownership. The CommunicationPropertiesHandlerInterface isn't responsible for property ownership.

Constructor & Destructor Documentation

◆ ~CommunicationPropertiesHandlerInterface()

Virtual destructor to assure proper cleanup of derived types.

Member Function Documentation

◆ deregisterProperty()

template<typename T>
virtual void alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >::deregisterProperty ( const std::string &  propertyName,
const std::shared_ptr< CommunicationProperty< T >> &  property 
)
pure virtual

deregister the property, deregistration of the property only occurs when the property can be found and the passed in property matches the registered property.

Parameters
nameName of the property to deregister
propertyThe property that we are deregistering. This is used to prove ownership of the property. the parameter can be a nullptr.

◆ readProperty()

template<typename T>
virtual bool alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >::readProperty ( const std::string &  propertyName,
T &  value 
)
pure virtual

Read the value from a property.

Parameters
nameName of the property we are trying to read.
[out]valueThe reference where we will populate the read value.
Returns
true if successful, false otherwise.

Implemented in alexaClientSDK::acsdkCommunication::InMemoryCommunicationPropertiesHandler< T >, alexaClientSDK::acsdkCommunication::InMemoryCommunicationPropertiesHandler< std::string >, and alexaClientSDK::acsdkCommunication::InMemoryCommunicationPropertiesHandler< int >.

◆ registerProperty()

template<typename T>
virtual std::shared_ptr<CommunicationProperty<T> > alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >::registerProperty ( const std::string &  propertyName,
initValue,
const std::shared_ptr< CommunicationPropertyValidatorInterface< T >> &  writeValidator = nullptr 
)
pure virtual

Register a new Property

Parameters
nameThe name of the new property
initValueThe initial value that the property will have.
writeValidatorThe class that we will use to validate the write operation. If a nullptr the property will be read only.
Returns
std::shared_ptr<Property<T>> The component that registers the property will be the owner and be in charge of keeping the pointer alive.

◆ subscribeToPropertyChangeEvent()

template<typename T>
virtual bool alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >::subscribeToPropertyChangeEvent ( const std::string &  propertyName,
const std::weak_ptr< CommunicationPropertyChangeSubscriber< T >> &  subscriber 
)
pure virtual

Subscribe to change events for a specific property. No value will be passed back. The user should read the value of the property after subscribing.

Parameters
propertyNameName of property we want to subscribe to.
subscriberThe subscriber that will define the action for on change event.
Returns
true if successfully subscribed, false otherwise.

◆ unsubscribeToPropertyChangeEvent()

template<typename T>
virtual bool alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >::unsubscribeToPropertyChangeEvent ( const std::string &  propertyName,
const std::shared_ptr< CommunicationPropertyChangeSubscriber< T >> &  subscriber 
)
pure virtual

Unsubscribe to change events for a specific property.

Parameters
propertyNameName of property we want to unsubscribe from.
subscriberThe subscriber that will be unsubscribed from the change events.
Returns
true if successfully unsubscribed, false otherwise.

◆ writeProperty()

template<typename T>
virtual bool alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertiesHandlerInterface< T >::writeProperty ( const std::string &  propertyName,
newValue 
)
pure virtual

Write a new value to the property, this will be validated by the writeValidator.

Parameters
nameThe property that we are writing the newValue to.
newValueThe new value for the property.
Returns
true if write succeeds, false otherwise.

Implemented in alexaClientSDK::acsdkCommunication::InMemoryCommunicationPropertiesHandler< T >, alexaClientSDK::acsdkCommunication::InMemoryCommunicationPropertiesHandler< std::string >, and alexaClientSDK::acsdkCommunication::InMemoryCommunicationPropertiesHandler< int >.


The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0