Announcement

Collapse
No announcement yet.

how to use genieReadObj();

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to use genieReadObj();

    Hi,

    I am using the ViSi-Genie-RaspberryPi-Library and I am trying to find out how the genieReadObj function works:

    In particular I want to read a string, so I do this:

    genieWriteStr(3, "This is a text");

    int number=genieReadObj(17,3) ;
    printf("%d\n",number);


    So the display shows the text "This is a Text", however, I always get 65525 as an output. How can I read the string?

    Thanks in advance !

  • #2
    Hello Baxter

    genieReadObj does not return your answer. It is a command to request data from the display. The actual data comes via your event handler.
    So you cannot do what you have done, as genieReadObj doesn't return anything, and therefore your printf will have nothing to print.

    So in your event handler function, instead of filtering out the commands for a GENIE_REPORT_EVENT, you need a separate filter to filter out commands for GENIE_REPORT_OBJ.
    You then process the data that comes in like normal.
    GENIE_REPORT_EVENT comes from objects from the display which have their events set to 'Reported Message'. GENIE_REPORT_OBJ comes from the display when you request a genieReadObj on a specific object, which is what you are trying to do now.

    I am not sure if we have a demo on this or not, I will get my colleague to reply with more information.

    Hopefully this is of some help though

    Regards
    James

    Comment


    • #3
      Regardless, you cannot read a dynamic string, it doesn't exist in the display once it is written to the display, it is just pixels, it no longer exists as a string.

      However, if you use static strings you can read the index of the static string, using the correct code, of course.
      Mark

      Comment


      • #4
        Hi James,

        yes your answer helped me, thanks. I was wondering if you were able to ask your colleagues for a demo? Thanks!

        Comment


        • #5
          Hi Baxter,

          Please refer to what Mark has written.

          " Regardless, you cannot read a dynamic string, it doesn't exist in the display once it is written to the display, it is just pixels, it no longer exists as a string.

          However, if you use static strings you can read the index of the static string, using the correct code, of course."

          Also, the GENIE_REPORT_OBJ for strings does not return the string content.


          Comment

          Working...
          X