28 #include <boost/regex.hpp>
37 std::vector<std::string> devices = getDevices();
39 for (std::vector<std::string>::iterator it = devices.begin(); it != devices.end(); ++it)
42 this->sensors.push_back(sensor);
45 std::cout <<
"Connect Interfaces" << std::endl;
47 for (std::vector<std::shared_ptr<WeissHapticSensor> >::iterator it = sensors.begin(); it != sensors.end(); ++it)
54 std::vector< std::string > WeissHapticUnit::getDevices()
56 const std::string target_path(
"/dev/");
57 const boost::regex my_filter(
"ttyACM[0-9]+");
59 std::vector< std::string >
files;
61 std::filesystem::directory_iterator end_itr;
63 for (std::filesystem::directory_iterator i(target_path); i != end_itr; ++i)
71 if (!boost::regex_match(i->path().filename().string(), what, my_filter))
78 files.push_back(
"/dev/" + i->path().filename().string());
83 if (
files.size() == 0)
91 for (std::string file :
files)
104 if (sensor->getDeviceName() == deviceName)
107 sensor->scheduleSetDeviceTag(
tag);
128 for (std::vector<std::shared_ptr<WeissHapticSensor> >::iterator it = sensors.begin(); it != sensors.end(); ++it)
131 (*it)->startSampling();
138 for (std::vector<std::shared_ptr<WeissHapticSensor> >::iterator it = sensors.begin(); it != sensors.end(); ++it)