----------------------------------------------------------------------------- Notify any watching objects of a value change -----------------------------------------------------------------------------
| 6221 | // Notify any watching objects of a value change |
| 6222 | //----------------------------------------------------------------------------- |
| 6223 | void Driver::NotifyWatchers |
| 6224 | ( |
| 6225 | ) |
| 6226 | { |
| 6227 | list<Notification*>::iterator nit = m_notifications.begin(); |
| 6228 | while( nit != m_notifications.end() ) |
| 6229 | { |
| 6230 | Notification* notification = m_notifications.front(); |
| 6231 | m_notifications.pop_front(); |
| 6232 | |
| 6233 | /* check the any ValueID's sent as part of the Notification are still valid */ |
| 6234 | switch (notification->GetType()) { |
| 6235 | case Notification::Type_ValueChanged: |
| 6236 | case Notification::Type_ValueRefreshed: { |
| 6237 | Value *val = GetValue(notification->GetValueID()); |
| 6238 | if (!val) { |
| 6239 | Log::Write(LogLevel_Info, notification->GetNodeId(), "Dropping Notification as ValueID does not exist"); |
| 6240 | nit = m_notifications.begin(); |
| 6241 | delete notification; |
| 6242 | val->Release(); |
| 6243 | continue; |
| 6244 | } |
| 6245 | break; |
| 6246 | } |
| 6247 | default: |
| 6248 | break; |
| 6249 | } |
| 6250 | |
| 6251 | Log::Write(LogLevel_Detail, notification->GetNodeId(), "Notification: %s", notification->GetAsString().c_str()); |
| 6252 | |
| 6253 | Manager::Get()->NotifyWatchers( notification ); |
| 6254 | |
| 6255 | delete notification; |
| 6256 | nit = m_notifications.begin(); |
| 6257 | } |
| 6258 | m_notificationsEvent->Reset(); |
| 6259 | } |
| 6260 | |
| 6261 | //----------------------------------------------------------------------------- |
| 6262 | // <Driver::HandleRfPowerLevelSetResponse> |