diff --git a/examples/bootloader/poe_set_ip.cpp b/examples/bootloader/poe_set_ip.cpp index ef2309366..5fd8e88c1 100644 --- a/examples/bootloader/poe_set_ip.cpp +++ b/examples/bootloader/poe_set_ip.cpp @@ -1,32 +1,32 @@ #include -#include #include +#include #include "depthai/depthai.hpp" #include "depthai/xlink/XLinkConnection.hpp" // for string delimiter -std::vector split (std::string s, std::string delimiter) { +std::vector split(std::string s, std::string delimiter) { size_t pos_start = 0, pos_end, delim_len = delimiter.length(); std::string token; std::vector res; - while ((pos_end = s.find (delimiter, pos_start)) != std::string::npos) { - token = s.substr (pos_start, pos_end - pos_start); + while((pos_end = s.find(delimiter, pos_start)) != std::string::npos) { + token = s.substr(pos_start, pos_end - pos_start); pos_start = pos_end + delim_len; - res.push_back (stoi(token)); + res.push_back(stoi(token)); } res.push_back(stoi(s.substr(pos_start))); return res; } std::string checkStr(std::string str) { - std::vector v = split (str, "."); + std::vector v = split(str, "."); if(v.size() != 4) { std::cout << "Entered value " << str << " doesn't contain 3 dots. Value has to be in the following format: '255.255.255.255'" << std::endl; exit(0); } - for (auto i : v) { + for(auto i : v) { if(i < 0 || 255 < i) { std::cout << "Entered values can't be above 255!" << std::endl; exit(0); @@ -79,19 +79,23 @@ int main(int argc, char** argv) { return 0; } auto conf = dai::DeviceBootloader::Config(); - if (key == '1') conf.setStaticIPv4(ip, mask, gateway); - else conf.setDynamicIPv4(ip, mask, gateway); + if(key == '1') { + conf.setStaticIPv4(ip, mask, gateway); + } else { + conf.setDynamicIPv4(ip, mask, gateway); + } std::tie(success, error) = bl.flashConfig(conf); - } - else if(key == '3') { + } else if(key == '3') { std::tie(success, error) = bl.flashConfigClear(); - } - else { + } else { std::cout << "Entered value should either be '1', '2' or '3'!"; return 0; } - if(success) std::cout << "Flashing successful." << std::endl; - else std::cout << "Flashing failed: " << error << std::endl; + if(success) { + std::cout << "Flashing successful." << std::endl; + } else { + std::cout << "Flashing failed: " << error << std::endl; + } } \ No newline at end of file