Risolto problema in libURcom
package lenght mismatch per il pacchetto tipo 8 AdditionalInfo, aggiunto uchar foo alla fine per far sparire l'errore.. chi sa perchè?
This commit is contained in:
@@ -51,7 +51,7 @@ bool UR_CLinterface::connect(const char* ip, uint16_t port) {
|
||||
try {
|
||||
rsocket->connect(
|
||||
tcp::endpoint(boost::asio::ip::address::from_string(ip), port));
|
||||
if ((bool) rsocket->is_open()) {
|
||||
if (static_cast<bool>(rsocket->is_open())) {
|
||||
log->info("Connected to {0} on port {1}", ip, port);
|
||||
return true;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ void UR_CLinterface::sendCommand(std::string command) {
|
||||
char* dataOut=NULL;
|
||||
if (rsocket->is_open()){
|
||||
command = command + '\n';
|
||||
dataOut = (char*)malloc(command.size());
|
||||
dataOut = static_cast<char*>(malloc(command.size()));
|
||||
strncpy(dataOut, command.c_str(), command.size());
|
||||
log->debug("Sending: {}, s:{}",dataOut,command.size());
|
||||
boost::asio::write(*rsocket, boost::asio::buffer(dataOut, command.size()), error);
|
||||
@@ -106,7 +106,7 @@ void UR_CLinterface::parseData(void){
|
||||
subP = new versionSub(lastData, &clientData);
|
||||
subP->parse();
|
||||
firstMessage=false;
|
||||
long t=(long)clientData.versonMessage.timestamp;
|
||||
long t=static_cast<long>(clientData.versonMessage.timestamp);
|
||||
std::string timestr=std::string(asctime(gmtime(&t)));
|
||||
timestr.pop_back();
|
||||
log->info("Connection Time: {}", timestr);
|
||||
@@ -185,7 +185,7 @@ void UR_CLinterface::parseData(void){
|
||||
subP = new toolModeSub(&lastData[currIndex], &clientData);
|
||||
break;
|
||||
case SAFETY_DATA:
|
||||
//not yet implemented
|
||||
//TODO: not yet implemented
|
||||
break;
|
||||
default:
|
||||
log->error("Unknown Subpackage: {}", subPackageType);
|
||||
@@ -194,7 +194,7 @@ void UR_CLinterface::parseData(void){
|
||||
if (subP != NULL) subP->parse();
|
||||
currIndex+=subPackageSize;
|
||||
} catch (long sizediff){
|
||||
log->error("Package Length Mismatch: {}",sizediff);
|
||||
log->error("Package Length Mismatch: type_{:d}, diff_{:d}",subPackageType,sizediff);
|
||||
currIndex+=subPackageSize;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ void UR_CLinterface::readData(void) {
|
||||
// all number are represented in network byte order, conversion required
|
||||
packlen = ntohl(packlen);
|
||||
// allocate memory for incoming package
|
||||
lastData = (unsigned char*)malloc(packlen);
|
||||
lastData = static_cast<unsigned char*>(malloc(packlen));
|
||||
// blocking read of exactly packlen bytes
|
||||
readata += boost::asio::read(*rsocket, receive_buffer,boost::asio::transfer_exactly(packlen), error);
|
||||
//retreive all data from buffer
|
||||
|
||||
Reference in New Issue
Block a user