/** * Called when discovery completes */ void DiscoveryAgentTest::DiscoverySuccessful(const UIDSet *expected, bool successful, const UIDSet &received) { OLA_INFO << "in discovery callback, size is " << received.Size() << ", state: " << successful; CPPUNIT_ASSERT(successful); CPPUNIT_ASSERT_EQUAL(*expected, received); m_callback_run = true; }
/** * Called when discovery completes and fails for some reason. */ void DiscoveryAgentTest::DiscoveryFailed(const UIDSet *expected, bool successful, const UIDSet &received) { OLA_INFO << "in discovery callback, size is " << received.Size() << ", state: " << successful; OLA_ASSERT_FALSE(successful); OLA_ASSERT_EQ(*expected, received); m_callback_run = true; }
/* * Test the UIDSet */ void UIDTest::testUIDSet() { UIDSet set1; OLA_ASSERT_EQ(0u, set1.Size()); UID uid(1, 2); UID uid2(2, 10); set1.AddUID(uid); OLA_ASSERT_EQ(1u, set1.Size()); OLA_ASSERT_EQ(string("0001:00000002"), set1.ToString()); OLA_ASSERT_TRUE(set1.Contains(uid)); OLA_ASSERT_FALSE(set1.Contains(uid2)); set1.AddUID(uid); OLA_ASSERT_EQ(1u, set1.Size()); set1.AddUID(uid2); OLA_ASSERT_EQ(2u, set1.Size()); OLA_ASSERT_EQ(string("0001:00000002,0002:0000000a"), set1.ToString()); OLA_ASSERT_TRUE(set1.Contains(uid)); OLA_ASSERT_TRUE(set1.Contains(uid2)); UIDSet set2(set1); OLA_ASSERT_EQ(set1, set2); UIDSet set3; OLA_ASSERT_EQ(0u, set3.Size()); set3 = set2; OLA_ASSERT_EQ(set1, set2); set3.RemoveUID(uid2); OLA_ASSERT_EQ(1u, set3.Size()); OLA_ASSERT_EQ(string("0001:00000002"), set3.ToString()); UIDSet difference = set1.SetDifference(set3); OLA_ASSERT_EQ(1u, difference.Size()); OLA_ASSERT_TRUE(set1.Contains(uid)); OLA_ASSERT_TRUE(set1.Contains(uid2)); difference = set3.SetDifference(set1); OLA_ASSERT_EQ(0u, difference.Size()); }
void ShowUIDs() { UIDSet::Iterator iter = m_uids.Begin(); cout << "---------- " << m_uids.Size() << " UIDs -------" << endl; char c = 'A'; for (; iter != m_uids.End(); ++iter) { if (c <= 'Z') { cout << *iter << " (" << c++ << ")" << endl; } else { cout << *iter << endl; } } cout << "-------------------------" << endl; }
void SetIdentify(bool identify_on) { JaRuleWidget *widget = m_widget_manager->GetWidget(); if (!widget) { return; } if (m_uids.Size() == 0) { OLA_WARN << "No UIDs"; return; } uint8_t param_data = identify_on; RDMSetRequest *request = new RDMSetRequest( m_widget_uid, m_selected_uid, 0, 0, 0, ola::rdm::PID_IDENTIFY_DEVICE, ¶m_data, sizeof(param_data)); widget->SendRDMRequest(request, NULL); }