-
-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle multiple components: Add integration test
This adds integration test to verify whether DroneCore can recognize different type of components. Below is the procedure to test it. 1. Connect a camera to Linux system 2. Launch Camera streaming Daemon 3. Launch PX4 SITL 4. Run SitlTest.DiscoverOneAutopilotAndCamera test The test discovers two componets (autopilot and camera).
- Loading branch information
Shakthi Prashanth M
committed
Mar 7, 2018
1 parent
53203f8
commit e3a96bd
Showing
3 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <iostream> | ||
#include "integration_test_helper.h" | ||
#include "global_include.h" | ||
#include "dronecore.h" | ||
|
||
using namespace dronecore; | ||
using namespace std::chrono; | ||
using namespace std::this_thread; | ||
using namespace std::placeholders; | ||
static size_t _component_count = 0; | ||
|
||
static void on_component_discover(uint64_t uuid, uint8_t component_id) | ||
{ | ||
if (uuid && int(component_id)) { | ||
_component_count++; | ||
} | ||
std::cout << "Discovered component " << int(component_id) | ||
<< " on vehicle " << uuid << std::endl; | ||
} | ||
|
||
TEST_F(SitlTest, DiscoverOneAutopilotAndCamera) | ||
{ | ||
DroneCore connection; | ||
std::cout << "started" << std::endl; | ||
|
||
connection.add_udp_connection(); | ||
connection.register_on_discover(std::bind(on_component_discover, _1, _2)); | ||
|
||
sleep_for(seconds(5)); | ||
EXPECT_EQ(_component_count, 2); | ||
std::cout << "exiting" << std::endl; | ||
} |