MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / refreshNodeConfig

Method refreshNodeConfig

cpp/src/Driver.cpp:7376–7421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7374}
7375
7376bool Driver::refreshNodeConfig
7377(
7378 uint8 _nodeId
7379)
7380{
7381 LockGuard LG(m_nodeMutex);
7382 string action;
7383 Options::Get()->GetOptionAsString("ReloadAfterUpdate",&action);
7384 if (ToUpper(action) == "NEVER") {
7385 Notification* notification = new Notification( Notification::Type_UserAlerts );
7386 notification->SetUserAlertNofification(Notification::Alert_NodeReloadReqired);
7387 QueueNotification( notification );
7388 return true;
7389 } else if (ToUpper(action) == "IMMEDIATE") {
7390 Log::Write(LogLevel_Info, _nodeId, "Reloading Node after new Config File loaded");
7391 /* this will reload the Node, ignoring any cache that exists etc */
7392 ReloadNode(_nodeId);
7393 return true;
7394 } else if (ToUpper(action) == "AWAKE") {
7395 Node *node = GetNode(_nodeId);
7396 if( !node->IsListeningDevice() )
7397 {
7398 if( WakeUp* wakeUp = static_cast<WakeUp*>( node->GetCommandClass( WakeUp::StaticGetCommandClassId() ) ) )
7399 {
7400 if( !wakeUp->IsAwake() )
7401 {
7402 /* Node is Asleep. Queue it for WakeUp */
7403 Log::Write(LogLevel_Info, _nodeId, "Queuing Sleeping Node Reload after New Config File Loaded");
7404 MsgQueueItem item;
7405 item.m_command = MsgQueueCmd_ReloadNode;
7406 item.m_nodeId = _nodeId;
7407 wakeUp->QueueMsg( item );
7408 } else {
7409 /* Node is Awake. Reload it */
7410 Log::Write(LogLevel_Info, _nodeId, "Reloading Awake Node after new Config File loaded");
7411 ReloadNode(_nodeId);
7412 return true;
7413 }
7414 }
7415 } else {
7416 Log::Write(LogLevel_Info, _nodeId, "Reloading Node after new Config File Loaded");
7417 ReloadNode(_nodeId);
7418 }
7419 }
7420 return false;
7421}
7422
7423//-----------------------------------------------------------------------------
7424// <Driver::SendQueryStageComplete>

Callers 1

configDownloadedMethod · 0.80

Calls 8

ToUpperFunction · 0.85
WriteFunction · 0.85
GetOptionAsStringMethod · 0.80
IsListeningDeviceMethod · 0.80
GetCommandClassMethod · 0.80
IsAwakeMethod · 0.80
QueueMsgMethod · 0.80
GetFunction · 0.70

Tested by 1

configDownloadedMethod · 0.64