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

Method SetupEvents

cpp/src/command_classes/Alarm.cpp:526–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524 return false;
525}
526void Alarm::SetupEvents
527(
528 uint32 type,
529 uint32 index,
530 vector<ValueList::Item> *_items,
531 uint32 const _instance
532)
533{
534 if (const NotificationCCTypes::NotificationEvents *ne = NotificationCCTypes::Get()->GetAlarmNotificationEvents(type, index)) {
535 Log::Write( LogLevel_Info, GetNodeId(), "\tEvent Type %d: %s ", ne->id, ne->name.c_str());
536 ValueList::Item item;
537 item.m_value = ne->id;
538 item.m_label = ne->name;
539 _items->push_back( item );
540 /* If there are Params - Lets create the correct types now */
541 if ( Node* node = GetNodeUnsafe() ) {
542 for (std::map<uint32, NotificationCCTypes::NotificationEventParams* >::const_iterator it = ne->EventParams.begin(); it != ne->EventParams.end(); it++ ) {
543 switch (it->second->type) {
544 case NotificationCCTypes::NEPT_Location: {
545 node->CreateValueString( ValueID::ValueGenre_User, GetCommandClassId(), _instance, it->first, it->second->name, "", true, false, "", 0);
546 break;
547 }
548 case NotificationCCTypes::NEPT_List: {
549 vector<ValueList::Item> _Paramitems;
550 for (std::map<uint32, string>::iterator it2 = it->second->ListItems.begin(); it2 != it->second->ListItems.end(); it2++) {
551 ValueList::Item Paramitem;
552 Paramitem.m_value = ne->id;
553 Paramitem.m_label = ne->name;
554 _Paramitems.push_back( Paramitem );
555 }
556 node->CreateValueList( ValueID::ValueGenre_User, GetCommandClassId(), _instance, it->first, it->second->name, "", true, false, (uint8_t)(_Paramitems.size() & 0xFF), _Paramitems, 0, 0 );
557 break;
558 }
559 case NotificationCCTypes::NEPT_UserCodeReport: {
560 node->CreateValueByte( ValueID::ValueGenre_User, GetCommandClassId(), _instance, it->first, it->second->name, "", true, false, 0, 0);
561 node->CreateValueString(ValueID::ValueGenre_User, GetCommandClassId(), _instance, it->first+1, it->second->name, "", true, false, "", 0);
562 break;
563 }
564 case NotificationCCTypes::NEPT_Byte: {
565 node->CreateValueByte( ValueID::ValueGenre_User, GetCommandClassId(), _instance, it->first, it->second->name, "", true, false, 0, 0);
566 break;
567 }
568 case NotificationCCTypes::NEPT_String: {
569 node->CreateValueString( ValueID::ValueGenre_User, GetCommandClassId(), _instance, it->first, it->second->name, "", true, false, "", 0);
570 break;
571 }
572 case NotificationCCTypes::NEPT_Time: {
573 node->CreateValueInt( ValueID::ValueGenre_User, GetCommandClassId(), _instance, it->first, it->second->name, "", true, false, 0, 0);
574 break;
575 }
576 }
577 }
578 }
579 } else {
580 Log::Write (LogLevel_Info, GetNodeId(), "\tEvent Type %d: Unknown", index);
581 ValueList::Item item;
582 item.m_value = index;
583 item.m_label = string("Unknown");

Callers

nothing calls this directly

Calls 13

WriteFunction · 0.85
GetCommandClassIdFunction · 0.85
CreateValueStringMethod · 0.80
CreateValueListMethod · 0.80
CreateValueByteMethod · 0.80
CreateValueIntMethod · 0.80
GetNodeIdFunction · 0.70
GetFunction · 0.50
c_strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected