diff --git a/Protocol/README.md b/Protocol/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fe79b61c99a219714546b11a329152199678dab1 --- /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