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. Real Time data and Json File
Forum Updated to NodeBB v4.3 + New Features

Real Time data and Json File

Scheduled Pinned Locked Moved Unsolved General and Desktop
31 Posts 7 Posters 4.3k Views 2 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.
  • J jsulm
    22 Mar 2021, 06:52

    @suslucoder said in Real Time data and Json File:

    so i dont know how can i handle with that issue

    You could explain to him the disadvantages shown by @JKSH

    D Offline
    D Offline
    deleted286
    wrote on 22 Mar 2021, 06:54 last edited by
    #13

    @jsulm thank you

    J 1 Reply Last reply 22 Mar 2021, 07:04
    0
    • D deleted286
      22 Mar 2021, 06:54

      @jsulm thank you

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 22 Mar 2021, 07:04 last edited by
      #14

      @suslucoder well, you could only save the data as a json file, on program close, or something similar.

      Fits your requirement and he will never know that the actual data processing/storage is something different.

      Doesn't hurt to have redundancies either.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      J J 2 Replies Last reply 22 Mar 2021, 07:09
      2
      • J J.Hilk
        22 Mar 2021, 07:04

        @suslucoder well, you could only save the data as a json file, on program close, or something similar.

        Fits your requirement and he will never know that the actual data processing/storage is something different.

        Doesn't hurt to have redundancies either.

        J Offline
        J Offline
        JKSH
        Moderators
        wrote on 22 Mar 2021, 07:09 last edited by
        #15

        @J-Hilk said in Real Time data and Json File:

        you could only save the data as a json file, on program close, or something similar.

        Good idea; this helps avoid the performance issues and hard drive wearing. Beware though: If the program crashes, all of the data will be lost.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        D 1 Reply Last reply 22 Mar 2021, 07:11
        0
        • J JKSH
          22 Mar 2021, 07:09

          @J-Hilk said in Real Time data and Json File:

          you could only save the data as a json file, on program close, or something similar.

          Good idea; this helps avoid the performance issues and hard drive wearing. Beware though: If the program crashes, all of the data will be lost.

          D Offline
          D Offline
          deleted286
          wrote on 22 Mar 2021, 07:11 last edited by
          #16

          @JKSH i spoke with him, he says he wants a config file with json.

          It should include the name of the data, and the type. Like
          Name: string
          Age: int
          Height:float etc.

          I dont know how to create such a file

          K 1 Reply Last reply 22 Mar 2021, 08:27
          0
          • J J.Hilk
            22 Mar 2021, 07:04

            @suslucoder well, you could only save the data as a json file, on program close, or something similar.

            Fits your requirement and he will never know that the actual data processing/storage is something different.

            Doesn't hurt to have redundancies either.

            J Offline
            J Offline
            JonB
            wrote on 22 Mar 2021, 08:19 last edited by
            #17

            @J-Hilk

            and he will never know that the actual data processing/storage is something different.

            ROFL. Are you now advising Qt programmers to deceive their bosses? ;-)

            @suslucoder

            I dont know how to create such a file

            What don't you know how to do? You have done JSON stuff, haven't you, so what is different about this task?

            J D 2 Replies Last reply 22 Mar 2021, 08:34
            0
            • D deleted286
              22 Mar 2021, 07:11

              @JKSH i spoke with him, he says he wants a config file with json.

              It should include the name of the data, and the type. Like
              Name: string
              Age: int
              Height:float etc.

              I dont know how to create such a file

              K Offline
              K Offline
              KroMignon
              wrote on 22 Mar 2021, 08:27 last edited by
              #18

              @suslucoder said in Real Time data and Json File:

              I dont know how to create such a file

              Have you tried to read JSON documentation?
              ==> https://doc.qt.io/qt-5/json.html
              ==> https://doc.qt.io/qt-5/qtcore-serialization-savegame-example.html

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              1 Reply Last reply
              1
              • J JonB
                22 Mar 2021, 08:19

                @J-Hilk

                and he will never know that the actual data processing/storage is something different.

                ROFL. Are you now advising Qt programmers to deceive their bosses? ;-)

                @suslucoder

                I dont know how to create such a file

                What don't you know how to do? You have done JSON stuff, haven't you, so what is different about this task?

                J Offline
                J Offline
                J.Hilk
                Moderators
                wrote on 22 Mar 2021, 08:34 last edited by
                #19

                @JonB said in Real Time data and Json File:

                ROFL. Are you now advising Qt programmers to deceive their bosses? ;-)

                😱 me, never!

                The boss will get what he want's, in the end. Bosses always only care about the end result 🤷‍♂️


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                D 1 Reply Last reply 22 Mar 2021, 10:29
                2
                • J J.Hilk
                  22 Mar 2021, 08:34

                  @JonB said in Real Time data and Json File:

                  ROFL. Are you now advising Qt programmers to deceive their bosses? ;-)

                  😱 me, never!

                  The boss will get what he want's, in the end. Bosses always only care about the end result 🤷‍♂️

                  D Offline
                  D Offline
                  deleted286
                  wrote on 22 Mar 2021, 10:29 last edited by
                  #20

                  @J-Hilk ahahahha you made me laugh so much

                  I create the file, but i dont know how to read such a complex json :D
                  Can anybody help?

                     {
                  "GPS": [
                      {
                  
                          "GPS ID": ["integer", "0"],
                          "GPS Mod": ["integer", "1"],
                          "GPS Utc": ["float", "2"],
                          "GPS Latitude": ["float", "3"],
                          "GPS Longitude": ["float", "4"],
                          "GPS Alt":  ["float", "5"],
                          "GPS Yer Hızı":  ["float", "6"],
                          "GPS Dikey Hız":["float", "7"],
                          "GPS Yatay Doğruluk":  ["float", "8"],
                          "GPS Dikey Doğruluk": ["float", "9"],
                          "GPS Yer Başı":  ["float", "10"],
                          "GPS Hdop": ["float", "11"],
                          "GPS Vdop": ["float", "12"],
                          "GPS Uydu Sayısı": ["integer", "13"],
                          "GPS Boy":  ["integer", "14"]
                      } 
                    ],
                  
                  
                  "Imu": [
                   {
                       
                      "HW ID": ["integer", "0"],
                          "HW Motor": ["float", "1"],
                          "HW Motor1": ["float", "2"],
                          "HW Motor2": ["float", "3"],
                          "HW Motor3": ["float", "4"],
                          "HW Motor4": ["float", "5"],
                          "HW P": ["float", "6"],
                          "HW R": ["float", "7"],
                          "HW Y": ["float", "8"],
                          "HW Boy": ["float", "9"]
                         }
                     ]
                       }
                  
                  1 Reply Last reply
                  0
                  • J JonB
                    22 Mar 2021, 08:19

                    @J-Hilk

                    and he will never know that the actual data processing/storage is something different.

                    ROFL. Are you now advising Qt programmers to deceive their bosses? ;-)

                    @suslucoder

                    I dont know how to create such a file

                    What don't you know how to do? You have done JSON stuff, haven't you, so what is different about this task?

                    D Offline
                    D Offline
                    deleted286
                    wrote on 22 Mar 2021, 10:32 last edited by
                    #21

                    @JonB actually, ı know, i created it with hand, but my question is we have something like

                    #define TM_AP_ID				0
                    #define TM_AP_durum 			1
                    #define TM_AP_hava_hizi			2
                    #define TM_AP_IMU_pitch			3
                    #define TM_AP_IMU_roll			4
                    #define TM_AP_IMU_yaw			5
                    #define TM_AP_IMU_barometre		6
                    #define TM_AP_rpm				7
                    
                    

                    and in my code, i will do some operations like

                    imu[TM_IMU_pitch].f
                    
                    

                    The issue is, that definitions should be in json, and i will call them from my json

                    J 1 Reply Last reply 22 Mar 2021, 10:35
                    0
                    • D deleted286
                      22 Mar 2021, 10:32

                      @JonB actually, ı know, i created it with hand, but my question is we have something like

                      #define TM_AP_ID				0
                      #define TM_AP_durum 			1
                      #define TM_AP_hava_hizi			2
                      #define TM_AP_IMU_pitch			3
                      #define TM_AP_IMU_roll			4
                      #define TM_AP_IMU_yaw			5
                      #define TM_AP_IMU_barometre		6
                      #define TM_AP_rpm				7
                      
                      

                      and in my code, i will do some operations like

                      imu[TM_IMU_pitch].f
                      
                      

                      The issue is, that definitions should be in json, and i will call them from my json

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 22 Mar 2021, 10:35 last edited by
                      #22

                      @suslucoder said in Real Time data and Json File:

                      The issue is, that definitions should be in json, and i will call them from my json

                      What definitions? You can't call anything from JSON. JSON is just a data format. Please be more precise when asking...

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

                      D 2 Replies Last reply 22 Mar 2021, 10:39
                      0
                      • J jsulm
                        22 Mar 2021, 10:35

                        @suslucoder said in Real Time data and Json File:

                        The issue is, that definitions should be in json, and i will call them from my json

                        What definitions? You can't call anything from JSON. JSON is just a data format. Please be more precise when asking...

                        D Offline
                        D Offline
                        deleted286
                        wrote on 22 Mar 2021, 10:39 last edited by
                        #23

                        @jsulm

                        im talking about them

                        #define TM_AP_ID				        0
                        #define TM_AP_durum 			        1
                        #define TM_AP_hava_hizi			2
                        #define TM_AP_IMU_pitch			3
                        #define TM_AP_IMU_roll			4
                        #define TM_AP_IMU_yaw			5
                        #define TM_AP_IMU_barometre	6
                        #define TM_AP_rpm				7
                        
                        J 1 Reply Last reply 22 Mar 2021, 11:03
                        0
                        • J jsulm
                          22 Mar 2021, 10:35

                          @suslucoder said in Real Time data and Json File:

                          The issue is, that definitions should be in json, and i will call them from my json

                          What definitions? You can't call anything from JSON. JSON is just a data format. Please be more precise when asking...

                          D Offline
                          D Offline
                          deleted286
                          wrote on 22 Mar 2021, 10:41 last edited by
                          #24

                          @jsulm said in Real Time data and Json File:

                              You can't call anything from JSON. JSON is just a data format. 
                          

                          Hmm, so im just read json and write json. I cant do anything apart from these

                          K 1 Reply Last reply 22 Mar 2021, 11:01
                          0
                          • D deleted286
                            22 Mar 2021, 10:41

                            @jsulm said in Real Time data and Json File:

                                You can't call anything from JSON. JSON is just a data format. 
                            

                            Hmm, so im just read json and write json. I cant do anything apart from these

                            K Offline
                            K Offline
                            KroMignon
                            wrote on 22 Mar 2021, 11:01 last edited by
                            #25

                            @suslucoder said in Real Time data and Json File:

                            I cant do anything apart from these

                            I can not follow you, what did you expect to do?
                            Do you know what JSON is? ==> https://en.wikipedia.org/wiki/JSON

                            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                            1 Reply Last reply
                            0
                            • D deleted286
                              22 Mar 2021, 10:39

                              @jsulm

                              im talking about them

                              #define TM_AP_ID				        0
                              #define TM_AP_durum 			        1
                              #define TM_AP_hava_hizi			2
                              #define TM_AP_IMU_pitch			3
                              #define TM_AP_IMU_roll			4
                              #define TM_AP_IMU_yaw			5
                              #define TM_AP_IMU_barometre	6
                              #define TM_AP_rpm				7
                              
                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 22 Mar 2021, 11:03 last edited by
                              #26

                              @suslucoder said in Real Time data and Json File:

                              im talking about them

                              So, all these definitions should be defined in your JSON? Then do so. Define them there, read and use the values.

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

                              D 1 Reply Last reply 22 Mar 2021, 11:47
                              1
                              • J jsulm
                                22 Mar 2021, 11:03

                                @suslucoder said in Real Time data and Json File:

                                im talking about them

                                So, all these definitions should be defined in your JSON? Then do so. Define them there, read and use the values.

                                D Offline
                                D Offline
                                deleted286
                                wrote on 22 Mar 2021, 11:47 last edited by
                                #27

                                @jsulm I defined it in json.
                                I want to do that: Here is an example of my json

                                {
                                         "GPS":[
                                            {
                                               "GPS ID":[
                                                  "integer",
                                                  "0"
                                               ],
                                               "GPS Mod":[
                                                  "integer",
                                                  "1"
                                               ],
                                               "GPS Utc":[
                                                  "float",
                                                  "2"
                                               ],
                                               "GPS Latitude":[
                                                  "float",
                                                  "3"
                                               ]
                                }
                                
                                If, Gps id has integer, 
                                assign gps[TM_GPS_ID].i
                                
                                if Gps latitude has float
                                assign  gps[TM_GPS_lat].f
                                
                                J 1 Reply Last reply 22 Mar 2021, 13:08
                                0
                                • D deleted286
                                  22 Mar 2021, 11:47

                                  @jsulm I defined it in json.
                                  I want to do that: Here is an example of my json

                                  {
                                           "GPS":[
                                              {
                                                 "GPS ID":[
                                                    "integer",
                                                    "0"
                                                 ],
                                                 "GPS Mod":[
                                                    "integer",
                                                    "1"
                                                 ],
                                                 "GPS Utc":[
                                                    "float",
                                                    "2"
                                                 ],
                                                 "GPS Latitude":[
                                                    "float",
                                                    "3"
                                                 ]
                                  }
                                  
                                  If, Gps id has integer, 
                                  assign gps[TM_GPS_ID].i
                                  
                                  if Gps latitude has float
                                  assign  gps[TM_GPS_lat].f
                                  
                                  J Offline
                                  J Offline
                                  JonB
                                  wrote on 22 Mar 2021, 13:08 last edited by JonB
                                  #28

                                  @suslucoder
                                  So algorithmically you will want something like:

                                  if "GPS" object  has "GPS ID" array
                                      if "GPS ID" array[0] == "integer"
                                          gps[TM_GPS_ID].i = "GPS ID" array[1].toInt()
                                  if "GPS" object  has "GPS Latitude" array
                                      if "GPS Latitude" array[0] == "float"
                                          gps[TM_GPS_lat].f = "GPS Latitude" array[1].toFloat()
                                  
                                  D 1 Reply Last reply 22 Mar 2021, 13:18
                                  1
                                  • J JonB
                                    22 Mar 2021, 13:08

                                    @suslucoder
                                    So algorithmically you will want something like:

                                    if "GPS" object  has "GPS ID" array
                                        if "GPS ID" array[0] == "integer"
                                            gps[TM_GPS_ID].i = "GPS ID" array[1].toInt()
                                    if "GPS" object  has "GPS Latitude" array
                                        if "GPS Latitude" array[0] == "float"
                                            gps[TM_GPS_lat].f = "GPS Latitude" array[1].toFloat()
                                    
                                    D Offline
                                    D Offline
                                    deleted286
                                    wrote on 22 Mar 2021, 13:18 last edited by
                                    #29

                                    @JonB Let me edit it like

                                    if "GPS" object has arrays contains "float"
                                         gps[TM_GPS_lat].f == "GPS ID" array[1].toInt()
                                         gps[TM_GPS_lat].f  == "GPS ID" array[1].toInt()
                                    
                                     if "GPS " object has arrays contains "integer"
                                         gps[TM_GPS_ID].i = "GPS ID" array[1].toInt()
                                    
                                    gps[TM_GPS_lat].f
                                    ```  this f refers to float
                                    
                                    gps[TM_GPS_ID].i
                                    ``` this i refers to int
                                    
                                    J 1 Reply Last reply 22 Mar 2021, 13:23
                                    0
                                    • D deleted286
                                      22 Mar 2021, 13:18

                                      @JonB Let me edit it like

                                      if "GPS" object has arrays contains "float"
                                           gps[TM_GPS_lat].f == "GPS ID" array[1].toInt()
                                           gps[TM_GPS_lat].f  == "GPS ID" array[1].toInt()
                                      
                                       if "GPS " object has arrays contains "integer"
                                           gps[TM_GPS_ID].i = "GPS ID" array[1].toInt()
                                      
                                      gps[TM_GPS_lat].f
                                      ```  this f refers to float
                                      
                                      gps[TM_GPS_ID].i
                                      ``` this i refers to int
                                      
                                      J Offline
                                      J Offline
                                      JonB
                                      wrote on 22 Mar 2021, 13:23 last edited by JonB
                                      #30

                                      @suslucoder said in Real Time data and Json File:

                                      if "GPS" object has arrays contains "float"

                                      if "GPS " object has arrays contains "integer"

                                      So implement exactly these tests. Someone has even typed in code for you in your stackoverflow post. I don't know what else to say.

                                      D 1 Reply Last reply 22 Mar 2021, 13:26
                                      1
                                      • J JonB
                                        22 Mar 2021, 13:23

                                        @suslucoder said in Real Time data and Json File:

                                        if "GPS" object has arrays contains "float"

                                        if "GPS " object has arrays contains "integer"

                                        So implement exactly these tests. Someone has even typed in code for you in your stackoverflow post. I don't know what else to say.

                                        D Offline
                                        D Offline
                                        deleted286
                                        wrote on 22 Mar 2021, 13:26 last edited by
                                        #31

                                        @JonB okey thank you. And you found me in every where...

                                        1 Reply Last reply
                                        0

                                        22/31

                                        22 Mar 2021, 10:35

                                        • Login

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