----------------------------------------------------------------------------- Set the device class data for the node based on the Zwave+ info report -----------------------------------------------------------------------------
| 3315 | // Set the device class data for the node based on the Zwave+ info report |
| 3316 | //----------------------------------------------------------------------------- |
| 3317 | bool Node::SetPlusDeviceClasses |
| 3318 | ( |
| 3319 | uint8 const _role, |
| 3320 | uint8 const _nodeType, |
| 3321 | uint16 const _deviceType |
| 3322 | ) |
| 3323 | { |
| 3324 | if ( m_nodePlusInfoReceived ) |
| 3325 | { |
| 3326 | return false; // already set |
| 3327 | } |
| 3328 | |
| 3329 | if( !s_deviceClassesLoaded ) |
| 3330 | { |
| 3331 | ReadDeviceClasses(); |
| 3332 | } |
| 3333 | |
| 3334 | m_nodePlusInfoReceived = true; |
| 3335 | m_role = _role; |
| 3336 | m_deviceType = _deviceType; |
| 3337 | m_nodeType = _nodeType; |
| 3338 | |
| 3339 | Log::Write (LogLevel_Info, m_nodeId, "ZWave+ Info Received from Node %d", m_nodeId); |
| 3340 | map<uint8,DeviceClass*>::iterator nit = s_nodeTypes.find( m_nodeType ); |
| 3341 | if (nit != s_nodeTypes.end()) |
| 3342 | { |
| 3343 | DeviceClass* deviceClass = nit->second; |
| 3344 | |
| 3345 | Log::Write( LogLevel_Info, m_nodeId, " Zwave+ Node Type (0x%.2x) - %s. Mandatory Command Classes:", m_nodeType, deviceClass->GetLabel().c_str() ); |
| 3346 | uint8 const *_commandClasses = deviceClass->GetMandatoryCommandClasses(); |
| 3347 | |
| 3348 | /* no CommandClasses to add */ |
| 3349 | if (_commandClasses != NULL) |
| 3350 | { |
| 3351 | int i = 0; |
| 3352 | while (uint8 ccid = _commandClasses[i++]) |
| 3353 | { |
| 3354 | if( CommandClasses::IsSupported( ccid ) ) |
| 3355 | { |
| 3356 | Log::Write( LogLevel_Info, m_nodeId, " %s", CommandClasses::GetName(ccid).c_str()); |
| 3357 | } |
| 3358 | else |
| 3359 | { |
| 3360 | Log::Write( LogLevel_Info, m_nodeId, " 0x%.2x (Not Supported)", ccid); |
| 3361 | } |
| 3362 | } |
| 3363 | |
| 3364 | |
| 3365 | // Add the mandatory command classes for this Roletype |
| 3366 | AddMandatoryCommandClasses( deviceClass->GetMandatoryCommandClasses() ); |
| 3367 | } |
| 3368 | else |
| 3369 | { |
| 3370 | Log::Write( LogLevel_Info, m_nodeId, " NONE"); |
| 3371 | } |
| 3372 | } |
| 3373 | else |
| 3374 | { |