Zigbee Protocol Controller 1.6.0
smartstart::Management Class Reference

Class that provides APIs to add, update, and access SmartStart List. Also it offers callback for notifying that entries await inclusion. More...

#include <smartstart_management.hpp>

Public Member Functions

 Management (Management &other)=delete
 Disable assign and constructor. More...
 
void operator= (const Management &)=delete
 
sl_status_t init (const std::string &protocol_controller_unid, notification_function_t const &has_entries_awaiting_inclusion_callback)
 Initialize function that takes protocol controller unid and a callback function signaling when entries awaits inclusion. More...
 
sl_status_t teardown ()
 
std::vector< Entryget_cache_entries (const Query &query)
 Get the cache entries with given query conditions. More...
 
sl_status_t update_smartstart_cache (const std::string &smartstart_list)
 Update the internal cache of SmartStartList. More...
 
bool has_entries_awaiting_inclusion ()
 Polling function which returns True if there is any entries with Include == true. This could be useful e.g. when just boot. More...
 
sl_status_t notify_node_added (const std::string &dsk, const std::string &device_unid)
 Called when a node has been added and SSM will then update the cache map. More...
 
sl_status_t notify_node_removed (const std::string &unid)
 Called when a node has been removed and SSM will then update the cache map. More...
 
sl_status_t set_manual_intervention_required (const std::string &dsk, bool manual_intervention_required)
 Call this function to change the value of the "ManualInterventionRequired" field. More...
 
const std::unordered_map< std::string, Entry > & get_cache () const
 

Static Public Member Functions

static Managementget_instance ()
 Get the singleton instance. More...
 

Private Member Functions

 Management ()=default
 

Private Attributes

std::unordered_map< std::string, Entry_smartstart_cache
 SmartStart List cache map, key is DSK as a string. More...
 
std::string _protocol_controller_unid
 
notification_function_t _notify_has_entries_awaiting_inclusion
 Function called when there are entries waiting for inclusion in the SmartStart list. More...
 

Static Private Attributes

static Management_instance
 

Detailed Description

Class that provides APIs to add, update, and access SmartStart List. Also it offers callback for notifying that entries await inclusion.

Constructor & Destructor Documentation

◆ Management() [1/2]

smartstart::Management::Management ( )
privatedefault

◆ Management() [2/2]

smartstart::Management::Management ( Management other)
delete

Disable assign and constructor.

Member Function Documentation

◆ get_cache()

const std::unordered_map< std::string, Entry > & smartstart::Management::get_cache ( ) const

◆ get_cache_entries()

std::vector< Entry > smartstart::Management::get_cache_entries ( const Query query)

Get the cache entries with given query conditions.

Parameters
queryQuery criterias defined for searching.

◆ get_instance()

static Management * smartstart::Management::get_instance ( )
static

Get the singleton instance.

◆ has_entries_awaiting_inclusion()

bool smartstart::Management::has_entries_awaiting_inclusion ( )

Polling function which returns True if there is any entries with Include == true. This could be useful e.g. when just boot.

◆ init()

sl_status_t smartstart::Management::init ( const std::string &  protocol_controller_unid,
notification_function_t const &  has_entries_awaiting_inclusion_callback 
)

Initialize function that takes protocol controller unid and a callback function signaling when entries awaits inclusion.

Parameters
protocol_controller_unidProtocol Controller Unid as string in which this SmartStart Management belongs to.
has_entries_awaiting_inclusion_callbackFunction callback regsitered and called when there are entries awaiting inclusion in the SmartStart List.

◆ notify_node_added()

sl_status_t smartstart::Management::notify_node_added ( const std::string &  dsk,
const std::string &  device_unid 
)

Called when a node has been added and SSM will then update the cache map.

Parameters
dskDSK as string to be added.
device_unidDevice Unid as string to be updated in the corresponding entry.

◆ notify_node_removed()

sl_status_t smartstart::Management::notify_node_removed ( const std::string &  unid)

Called when a node has been removed and SSM will then update the cache map.

Parameters
unidUnid as string to be removed.

◆ operator=()

void smartstart::Management::operator= ( const Management )
delete

◆ set_manual_intervention_required()

sl_status_t smartstart::Management::set_manual_intervention_required ( const std::string &  dsk,
bool  manual_intervention_required 
)

Call this function to change the value of the "ManualInterventionRequired" field.

Parameters
dskDSK of the entry to be modified
manual_intervention_requiredSet to true if the entry needs some network exclusion before it can join our network. False otherwise
Returns
SL_STATUS_OK if the entry was updated SL_STATUS_NOT_FOUND If the DSK is not in the list. SL_STATUS_FAIL If the DSK returns more than 1 entry in the list

◆ teardown()

sl_status_t smartstart::Management::teardown ( )

◆ update_smartstart_cache()

sl_status_t smartstart::Management::update_smartstart_cache ( const std::string &  smartstart_list)

Update the internal cache of SmartStartList.

This function parses the SmartStartList to internal representation, stores the data in smartstart_cache, and signals other components if there are entries waiting for inclusion for the protocol controller by calling notify_has_entries_for_inclusion.

Parameters
smartstart_listString with JSON representation of SmartStart list.

Member Data Documentation

◆ _instance

Management* smartstart::Management::_instance
staticprivate

◆ _notify_has_entries_awaiting_inclusion

notification_function_t smartstart::Management::_notify_has_entries_awaiting_inclusion
private

Function called when there are entries waiting for inclusion in the SmartStart list.

◆ _protocol_controller_unid

std::string smartstart::Management::_protocol_controller_unid
private

◆ _smartstart_cache

std::unordered_map<std::string, Entry> smartstart::Management::_smartstart_cache
private

SmartStart List cache map, key is DSK as a string.


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