Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to communicate with IP weight scale
Forum Updated to NodeBB v4.3 + New Features

How to communicate with IP weight scale

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 4 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yina
    wrote on last edited by
    #1

    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

    JonBJ artwawA 2 Replies Last reply
    0
    • Y Offline
      Y Offline
      Yina
      wrote on last edited by
      #8

      Found the issue I forgot \r\n in my write request

      1 Reply Last reply
      1
      • Y Yina

        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

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #2

        @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! :)

        1 Reply Last reply
        0
        • Y Yina

          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

          artwawA Offline
          artwawA Offline
          artwaw
          wrote on last edited by
          #3

          @Yina Those are designed to work with data+ software. I might be wrong but the gut feeling tells me you'd need to have API documentation?

          For more information please re-read.

          Kind Regards,
          Artur

          Y 1 Reply Last reply
          0
          • artwawA artwaw

            @Yina Those are designed to work with data+ software. I might be wrong but the gut feeling tells me you'd need to have API documentation?

            Y Offline
            Y Offline
            Yina
            wrote on last edited by
            #4

            @artwaw
            @JonB

            I did this to connect to the weight scale: faa7d400-0efa-48b4-887b-54e22913350a-image.png

            and as you can see he connects:
            ce95295d-6938-44b5-b723-f825df006397-image.png

            this is how I would read the data if I would het some data:
            a03865ca-658e-41e9-867f-eb9c70edc734-image.png

            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

            jsulmJ 1 Reply Last reply
            0
            • Y Yina

              @artwaw
              @JonB

              I did this to connect to the weight scale: faa7d400-0efa-48b4-887b-54e22913350a-image.png

              and as you can see he connects:
              ce95295d-6938-44b5-b723-f825df006397-image.png

              this is how I would read the data if I would het some data:
              a03865ca-658e-41e9-867f-eb9c70edc734-image.png

              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

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #5

              @Yina Why do you call open() on the socket? connectToHost is enough.
              Please post code as text instead of pictures: this makes is easier for others to reply with code.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              Y 1 Reply Last reply
              1
              • jsulmJ jsulm

                @Yina Why do you call open() on the socket? connectToHost is enough.
                Please post code as text instead of pictures: this makes is easier for others to reply with code.

                Y Offline
                Y Offline
                Yina
                wrote on last edited by
                #6

                @jsulm

                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

                jsulmJ 1 Reply Last reply
                0
                • Y Yina

                  @jsulm

                  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

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @Yina Take a look at https://www.bogotobogo.com/Qt/Qt5_QTcpSocket_Signals_Slots.php

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • Y Offline
                    Y Offline
                    Yina
                    wrote on last edited by
                    #8

                    Found the issue I forgot \r\n in my write request

                    1 Reply Last reply
                    1

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved