diff --git a/main.cpp b/main.cpp index fb1dee5..f668745 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,8 @@ #include #include +#include + #include "MyClient.h" // Numéro du GPIO connecté à la tirette @@ -28,9 +30,13 @@ int main(int argc, char* argv[]) { pullUpDnControl(TIRETTE_GPIO, PUD_UP); - int port = std::atoi(argv[2]); + CLParser clParser(argc, argv); - MyClient client("127.0.0.1", port); + int port = clParser.getOption("port", 8080); + + auto host = clParser.getOption("host", "127.0.0.1"); + + MyClient client(host, port); client.setTiretteState(true);