58 throw std::invalid_argument{
"BLEProthesisInterface::sendRaw( cmd = " + cmd +
59 " ): The UART service is not connected!"};
61 _worker->sendCommand(cmd);
69 throw std::invalid_argument{
"BLEProthesisInterface::sendGrasp( n = " + std::to_string(n) +
70 " ): the maximal value for n is " + std::to_string(
getMaxG())};
72 sendRaw(
"g" + std::to_string(n) +
"\n");
80 throw std::invalid_argument{
81 "sendThumbPWM( v = " + std::to_string(v) +
" , mxPWM = " + std::to_string(mxPWM) +
82 " , pos = " + std::to_string(pos) +
" ): The interval for v is [" +
83 std::to_string(
getMinV()) +
", " + std::to_string(
getMaxV()) +
"]"};
87 throw std::invalid_argument{
88 "sendThumbPWM( v = " + std::to_string(v) +
" , mxPWM = " + std::to_string(mxPWM) +
89 " , pos = " + std::to_string(pos) +
" ): The interval for mxPWM is [0, , " +
94 throw std::invalid_argument{
95 "sendThumbPWM( v = " + std::to_string(v) +
" , mxPWM = " + std::to_string(mxPWM) +
96 " , pos = " + std::to_string(pos) +
" ): The interval for pos is [0, " +
99 std::stringstream
str;
100 str <<
'M' << 2 <<
',' << v <<
',' << mxPWM <<
',' << pos <<
'\n';
109 throw std::invalid_argument{
110 "sendThumbPWM( v = " + std::to_string(v) +
" , mxPWM = " + std::to_string(mxPWM) +
111 " , pos = " + std::to_string(pos) +
" ): The interval for v is [" +
112 std::to_string(
getMinV()) +
", " + std::to_string(
getMaxV()) +
"]"};
116 throw std::invalid_argument{
117 "sendThumbPWM( v = " + std::to_string(v) +
" , mxPWM = " + std::to_string(mxPWM) +
118 " , pos = " + std::to_string(pos) +
" ): The interval for mxPWM is [0, , " +
123 throw std::invalid_argument{
124 "sendThumbPWM( v = " + std::to_string(v) +
" , mxPWM = " + std::to_string(mxPWM) +
125 " , pos = " + std::to_string(pos) +
" ): The interval for pos is [0, " +
128 std::stringstream
str;
129 str <<
'M' << 3 <<
',' << v <<
',' << mxPWM <<
',' << pos <<
'\n';
153 return "DiscoveringDevices";
155 return "DiscoveringDevicesDone";
157 return "Disconnected";
161 return "ConnectingDone";
163 return "DiscoveringServices";
165 return "DiscoveringServicesDone";
167 return "ConnectingService";
173 return "UNKNOWN VALUE FOR BLEProthesisInterface::State: " + std::to_string(
static_cast<int>(s));
std::string to_string(BLEProthesisInterface::State s)
static constexpr std::uint64_t getMaxV()
void sendThumbPWM(std::uint64_t v, std::uint64_t maxPWM, std::uint64_t pos)
std::int64_t getFingerPos() const
std::int64_t getThumbPos() const
std::int64_t getThumbPWM() const
@ DiscoveringServicesDone
void sendGrasp(std::uint64_t n)
void verboseReceive(bool b=true)
void verboseSend(bool b=true)
static constexpr std::uint64_t getMaxPosThumb()
std::int64_t getFingerPWM() const
static constexpr std::uint64_t getMaxPosFingers()
BLEProthesisInterface(const std::string &mac, SensorValueProtocol protocol=SensorValueProtocol::mx_pos_pwm)
static constexpr std::uint64_t getMinV()
void sendFingerPWM(std::uint64_t v, std::uint64_t maxPWM, std::uint64_t pos)
static constexpr std::uint64_t getMaxPWM()
static constexpr std::uint64_t getMaxG()
void sendRaw(const std::string &cmd)