21 std::ifstream infile(CommandFile);
24 std::cout <<
"Parsing command file: " << CommandFile << std::endl;
28 std::istringstream iss(line);
29 std::vector<std::string> tokens;
31 std::copy(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>(),
32 std::back_inserter(tokens));
33 if (tokens.size() > 0)
35 std::string command = tokens[0];
36 if (command ==
"LIST")
56 if (tokens.size() > 2)
58 uint32_t period =
static_cast<uint32_t
>(std::stoul(tokens[1]));
60 std::vector<uint16_t> counters;
62 std::transform(tokens.begin() + 2, tokens.end(), std::back_inserter(counters),
63 [](
const std::string& str)
64 {
return static_cast<uint16_t
>(std::stoul(str)); });
70 std::cerr <<
"Invalid SET command. Format is: SET <polling period> <id list>" << std::endl;
73 else if (command ==
"WAIT")
82 if (tokens.size() > 1)
84 uint32_t timeout =
static_cast<uint32_t
>(std::stoul(tokens[1]));
89 std::cerr <<
"Invalid WAIT command. Format is: WAIT <interval>" << std::endl;
void ParseFile(std::string CommandFile, GatordMockService &mockService)
Copyright (c) 2020 ARM Limited.
void SendRequestCounterDir()
Send a request counter directory packet back to the client.
bool ReceiveThreadRunning()
A class that implements a Mock Gatord server.
void WaitCommand(uint32_t timeout)
Execute the WAIT command from the comamnd file.
void SendPeriodicCounterSelectionList(uint32_t period, std::vector< uint16_t > counters)
Send the counter list to ArmNN.