diff --git a/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.cpp b/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.cpp index 9e1eff8bdd7f2353e54d460140917f24bdbd98fa..03112b769c6145cce8fe89a2019b2d03758fec85 100644 --- a/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.cpp +++ b/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.cpp @@ -149,3 +149,32 @@ void BLEProthesisInterface::sendFingerPWM(uint64_t v, uint64_t mxPWM, uint64_t p str << 'M' << 3 << ',' << v << ',' << mxPWM << ',' << pos << '\n'; sendRaw(str.str()); } +std::string to_string(BLEProthesisInterface::State s) +{ + switch (s) + { + case BLEProthesisInterface::State::Created: + return "Created"; + case BLEProthesisInterface::State::DiscoveringDevices: + return "DiscoveringDevices"; + case BLEProthesisInterface::State::DiscoveringDevicesDone: + return "DiscoveringDevicesDone"; + case BLEProthesisInterface::State::Disconnected: + return "Disconnected"; + case BLEProthesisInterface::State::Connecting: + return "Connecting"; + case BLEProthesisInterface::State::ConnectingDone: + return "ConnectingDone"; + case BLEProthesisInterface::State::DiscoveringServices: + return "DiscoveringServices"; + case BLEProthesisInterface::State::DiscoveringServicesDone: + return "DiscoveringServicesDone"; + case BLEProthesisInterface::State::ConnectingService: + return "ConnectingService"; + case BLEProthesisInterface::State::Running: + return "Running"; + case BLEProthesisInterface::State::Killed: + return "Killed"; + } + return "UNKNOWN VALUE FOR BLEProthesisInterface::State: " + std::to_string(static_cast<int>(s)); +} diff --git a/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.h b/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.h index 9daab0a2b38947e20c18f9a72abd90498ff30ee8..eb02ffbea2d673604fc4acd983f2aaee575583eb 100644 --- a/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.h +++ b/source/RobotAPI/drivers/KITProstheticHandDriver/BLEProthesisInterface.h @@ -74,100 +74,4 @@ public: } }; -inline std::string to_string(BLEProthesisInterface::State s) -{ - switch (s) - { - case BLEProthesisInterface::State::Created: - return "Created"; - case BLEProthesisInterface::State::DiscoveringDevices: - return "DiscoveringDevices"; - case BLEProthesisInterface::State::DiscoveringDevicesDone: - return "DiscoveringDevicesDone"; - case BLEProthesisInterface::State::Disconnected: - return "Disconnected"; - case BLEProthesisInterface::State::Connecting: - return "Connecting"; - case BLEProthesisInterface::State::ConnectingDone: - return "ConnectingDone"; - case BLEProthesisInterface::State::DiscoveringServices: - return "DiscoveringServices"; - case BLEProthesisInterface::State::DiscoveringServicesDone: - return "DiscoveringServicesDone"; - case BLEProthesisInterface::State::ConnectingService: - return "ConnectingService"; - case BLEProthesisInterface::State::Running: - return "Running"; - case BLEProthesisInterface::State::Killed: - return "Killed"; - } - return "UNKNOWN VALUE FOR BLEProthesisInterface::State: " + std::to_string(static_cast<int>(s)); -} - - - - - - - -//#include <QBluetoothDeviceDiscoveryAgent> -//#include <QBluetoothDeviceInfo> -//#include <QBluetoothSocket> -//#include <QLowEnergyController> - - -//class BLEProthesisInterface : public QObject -//{ -// Q_OBJECT -//public: -// explicit BLEProthesisInterface(const QString& mac, QObject *parent = 0); -// ~BLEProthesisInterface(); - -//// void startClient(const QBluetoothServiceInfo &remoteService); -//// void stopClient(); -//private: -// void removeAll(); -//public slots: -//// void sendMessage(const QString &message); - -// void reset(QString mac); - -//signals: -//// void messageReceived(const QString &sender, const QString &message); -//// void connected(const QString &name); -//// void disconnected(); - -//private slots: -// void deviceDiscovered(const QBluetoothDeviceInfo &info); -// void deviceDiscoverFinished(); -// void discoveryFinished(); -//// void readSocket(); -// void connected(); -// void disconnected() -// { - -// } -// void stateChanged(QLowEnergyController::ControllerState state); -// void serviceDiscovered(const QBluetoothUuid &newService); -// void controllerError(QLowEnergyController::Error error); - -// void serviceCharacteristicChanged(const QLowEnergyCharacteristic& cha, const QByteArray& arr) -// { - -// } -// void serviceDescriptorWritten(const QLowEnergyDescriptor& des, const QByteArray& arr) -// { - -// } -// void serviceStateChanged(const QLowEnergyService::ServiceState& state); - -//private: -// QBluetoothDeviceDiscoveryAgent* _discoveryAgent{nullptr}; -// QString _mac; -// QBluetoothSocket* _socket{nullptr}; -// QLowEnergyController* _leController{nullptr}; -// QLowEnergyService* _service{nullptr}; -// bool _connected{false}; -// bool _reconnect{true}; -// bool _serviceUp{false}; -//}; +std::string to_string(BLEProthesisInterface::State s);