Announcement

Collapse
No announcement yet.

MonkeyTalk w/ C# A ref or out argument must be an lvalue

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

  • MonkeyTalk w/ C# A ref or out argument must be an lvalue

    I'm trying to use the RetrieveLastNMEA function from MonkeyTalk and getting: 'A ref or out argument must be an lvalue'. Perhaps I'm not doing it right but it is asking for a ref NMEA_TYPES, so I have something like this:
    string s = myMonkeyTalk.RetrieveLastNMEA(ref MonkeyTalk.NMEA_TYPES.NMEA_GGA);
    Any ideas on what I am doing wrong?
    Thanks
    AMD XP 2600+/512MB RAM/120GB hard drive
    Opus 150W/DVD/GPS/7" Lilliput TS/802.11g/Bluetooth
    Installed.


    -GPSSecure- - GPS Tracking
    -AltTabber2.2.2- - Handy touchscreen utility.

  • #2
    Try just using the integer value instead, eg

    string s = myMonkeyTalk.RetrieveLastNMEA(0);

    where...

    NMEA_GGA = 0
    NMEA_GLL = 1
    NMEA_RMC = 2
    Destinator 3 For PC! - http://www.map-monkey.co.uk/

    Comment


    • #3
      I had tried that. Then it doesn't think it is a valid argument:
      Argument '1': cannot convert from 'ref int' to 'ref MonkeyTalk.NMEA_TYPES'
      AMD XP 2600+/512MB RAM/120GB hard drive
      Opus 150W/DVD/GPS/7" Lilliput TS/802.11g/Bluetooth
      Installed.


      -GPSSecure- - GPS Tracking
      -AltTabber2.2.2- - Handy touchscreen utility.

      Comment


      • #4
        looks to me like that functions modifies it argument and therefor you need to pass a reference type. The argument type should be (ref MonkeyTalk.NMEA_TYPES). So you need to declare a variable of that type and then pass it by reference.

        Maybe something like this pseudocode:

        Dim msgType as new MonkeyTalk.NMEA_TYPES;
        string s = myMonkeyTalk.RetrieveLastNMEA(ref msgType);
        if msgType == NMEA_GGA then {
        ProcessGGA(s)
        }
        else ...
        2004 4runner

        Comment


        • #5
          Originally posted by rando
          looks to me like that functions modifies it argument and therefor you need to pass a reference type. The argument type should be (ref MonkeyTalk.NMEA_TYPES). So you need to declare a variable of that type and then pass it by reference.

          Maybe something like this pseudocode:

          Dim msgType as new MonkeyTalk.NMEA_TYPES;
          string s = myMonkeyTalk.RetrieveLastNMEA(ref msgType);
          if msgType == NMEA_GGA then {
          ProcessGGA(s)
          }
          else ...
          ahhhhh, Thank you soooooo much Rando. That compiled. I'll see if it all works when I get home. I'm sure it will all work though
          AMD XP 2600+/512MB RAM/120GB hard drive
          Opus 150W/DVD/GPS/7" Lilliput TS/802.11g/Bluetooth
          Installed.


          -GPSSecure- - GPS Tracking
          -AltTabber2.2.2- - Handy touchscreen utility.

          Comment


          • #6
            Ok, this isn't working right.
            So this code compiles and runs without exception:
            MonkeyTalk.NMEA_TYPES nn = new MonkeyTalk.NMEA_RMC;
            string s = myMonkeyTalk.RetrieveLastNMEA(ref nn);

            Problem is, the only string this function returns is "Unknown NMEA String".
            Any ideas?


            EDIT:fixed one problem but I am still getting the same error.
            AMD XP 2600+/512MB RAM/120GB hard drive
            Opus 150W/DVD/GPS/7" Lilliput TS/802.11g/Bluetooth
            Installed.


            -GPSSecure- - GPS Tracking
            -AltTabber2.2.2- - Handy touchscreen utility.

            Comment


            • #7
              hmmm...try another approach

              string s = myMonkeyTalk.Custom("GetNMEA|RMC");
              Destinator 3 For PC! - http://www.map-monkey.co.uk/

              Comment


              • #8
                string s3 = "GetNMEA|RMC";
                string s4 = "D3Request";
                string s = myMonkeyTalk.Custom(ref s3, ref s4);


                Throws an exception saying: Object referance not set to an instance of an object.
                AMD XP 2600+/512MB RAM/120GB hard drive
                Opus 150W/DVD/GPS/7" Lilliput TS/802.11g/Bluetooth
                Installed.


                -GPSSecure- - GPS Tracking
                -AltTabber2.2.2- - Handy touchscreen utility.

                Comment


                • #9
                  why do you need to reference it a string? what happens if you use my example?
                  Destinator 3 For PC! - http://www.map-monkey.co.uk/

                  Comment


                  • #10
                    Originally posted by xBrady
                    Ok, this isn't working right.
                    So this code compiles and runs without exception:
                    MonkeyTalk.NMEA_TYPES nn = new MonkeyTalk.NMEA_RMC;
                    string s = myMonkeyTalk.RetrieveLastNMEA(ref nn);

                    Problem is, the only string this function returns is "Unknown NMEA String".
                    Any ideas?


                    EDIT:fixed one problem but I am still getting the same error.
                    Sorry, I can't get you past here since I've never even looked at MonkeyTalk.
                    2004 4runner

                    Comment


                    • #11
                      Originally posted by Ninja Monkey
                      why do you need to reference it a string? what happens if you use my example?
                      It says that it takes in two referances to strings (in c# at least ). I looked at your example for the Custom command and that also shows two strings. When I try compiling your example it says there isn't an overload for this function that takes in one string.

                      Here is what it asks for. Anything else won't compile.
                      Attached Files
                      AMD XP 2600+/512MB RAM/120GB hard drive
                      Opus 150W/DVD/GPS/7" Lilliput TS/802.11g/Bluetooth
                      Installed.


                      -GPSSecure- - GPS Tracking
                      -AltTabber2.2.2- - Handy touchscreen utility.

                      Comment

                      Working...
                      X