How to communicate with IP weight scale
-
Hello
I am trying to read data from a Mettler toledo ics465 or ics 685 weight scale interface .My initial thaught was to connect with an tcpsocket and then give the ip adress and port number but that didn't seem to work. So does anyone have an idea / example / tips on how I can communicate with an IP weight scale?
Kind regards
Yina -
@Yina said in How to communicate with IP weight scale:
My initial thaught was to connect with an tcpsocket and then give the ip adress and port number but that didn't seem to work.
I don't know anything about this device. But unless you get a better answer from someone: since it says it speaks TCP/IP, perhaps you'd better look at/explain what you did and what exactly "but that didn't seem to work" might mean?
UPDATE @artwaw has replied below. He knows more than the 0% I know about this device, so I would follow his advice! :)
-
I did this to connect to the weight scale:
and as you can see he connects:
this is how I would read the data if I would het some data:
but that function never gets called which it normally should do.
I also used the same setup to read data from a serialPort (using QSerialPort) and that worked like a charm.I have documentation but it doesn't say on how to connect to the scale via ip it only gives me the commands I need to write to get the weight data.
kind regards
Yina -
The reason I did it is because I am new to communicating via IP and I didn't know that connecting was enough.
the code://creating socker tcpSocket = new QTcpSocket(this); //connecting socket to host tcpSocket->connectToHost(QHostAddress("192.168.18.84"),4305,QIODevice::ReadWrite); qDebug() << tcpSocket->state(); //see if he is connected => always succeeds if(tcpSocket->waitForConnected()) { qDebug() << tcpSocket->state(); } connect(tcpSocket, &QAbstractSocket::readyRead, this, &WeighingScale::updateClientProgress); QByteArray arr = "SI"; tcpSocket->write(arr); void WeighingScale::updateClientProgress() { qDebug() << "Read All : " << tcpSocket->readAll(); tcpSocket->write("SI"); }
How wold you handle tcp communication?
kind regards
Yina -