Files
RoboGlue_QT/libURcom/URCLinterface.h
2019-10-21 11:37:31 +02:00

55 lines
1008 B
C++

/*
* URCLinterface.h
*
* Created on: Jan 14, 2019
* Author: emanuele
*/
#ifndef URCLINTERFACE_H_
#define URCLINTERFACE_H_
#include "clientMessage.h"
#include <ctime>
#include <iostream>
#include <arpa/inet.h>
#include <spdlog/spdlog.h>
#include <boost/asio.hpp>
#include <boost/format.hpp>
using namespace std;
using namespace boost::asio;
using ip::tcp;
class UR_CLinterface {
public:
UR_CLinterface(shared_ptr<spdlog::logger>);
virtual ~UR_CLinterface();
bool connect(const char* ip, uint16_t port);
void disconnect();
void sendCommand(std::string command);
void sendPose(pose_t pos);
void sendJointPose(jointPose_t pos);
void readData();
void parseData();
clientData_t clientData;
private:
shared_ptr<spdlog::logger> log;
boost::asio::io_service io_service;
boost::asio::streambuf receive_buffer;
boost::system::error_code error;
tcp::socket* rsocket;
uint32_t lastDataLen=0;
unsigned char* lastData=NULL;
bool firstMessage=true;
};
#endif /* URCLINTERFACE_H_ */