From b6d5d14bb1aa7e6827461b9ed59e8c030dff57aa Mon Sep 17 00:00:00 2001 From: Hoop77 <p.badenhoop@gmx.de> Date: Sun, 3 Dec 2017 13:47:36 +0100 Subject: [PATCH] added README --- Protocol/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Protocol/README.md diff --git a/Protocol/README.md b/Protocol/README.md new file mode 100644 index 00000000..fe79b61c --- /dev/null +++ b/Protocol/README.md @@ -0,0 +1,31 @@ +# Building + +1. Download the boost framework http://www.boost.org/users/download/ +2. Set environment variable `BOOST_ROOT` to the boost root directory +3. In the Protocol directory create a build directory: + + `mkdir cmake-build-debug` + +4. Run cmake: + + `cmake --build "cmake-build-debug" --target Protocol -- -j 2` + +# Documentation + +Run leader: + + ```cpp + // Create a leader vehicle instance. + LeaderVehicle leader(1); // 1 = vehicle id + // Starts the vehicle thread so this method returns instantly. + // All operations like createPlatoon(), leavePlatoon() are asynchronous operations. + // This means they either return instantly with return value "true" or are ignored with return value "false". + leader.run(); + // Automatically tries to create a platoon with a vehicle specified in the method Vehicle::scanAvailableVehicles(). + leader.createPlatoon(); + // Do stuff ... + // No need to call leader.stop(), since destructor does all the disconnection and cleanup work automatically. + ``` + +Run follower: +Just replace the class `LeaderVehicle` with `FollowerVehicle`. \ No newline at end of file -- GitLab