Page 1 of 2 12 LastLast
Results 1 to 10 of 11

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

  1. #1
    Super Moderator xBrady's Avatar
    Join Date
    Apr 2004
    Location
    USA
    Posts
    3,687

    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. #2
    Map Monkey Creator Ninja Monkey's Avatar
    Join Date
    Aug 2003
    Location
    Warrington, UK
    Posts
    1,012
    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/

  3. #3
    Super Moderator xBrady's Avatar
    Join Date
    Apr 2004
    Location
    USA
    Posts
    3,687
    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.

  4. #4
    Raw Wave rando's Avatar
    Join Date
    Mar 2004
    Location
    Redondo Beach, CA
    Posts
    1,973
    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 ...

  5. #5
    Super Moderator xBrady's Avatar
    Join Date
    Apr 2004
    Location
    USA
    Posts
    3,687
    Quote 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.

  6. #6
    Super Moderator xBrady's Avatar
    Join Date
    Apr 2004
    Location
    USA
    Posts
    3,687
    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.

  7. #7
    Map Monkey Creator Ninja Monkey's Avatar
    Join Date
    Aug 2003
    Location
    Warrington, UK
    Posts
    1,012
    hmmm...try another approach

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

  8. #8
    Super Moderator xBrady's Avatar
    Join Date
    Apr 2004
    Location
    USA
    Posts
    3,687
    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.

  9. #9
    Map Monkey Creator Ninja Monkey's Avatar
    Join Date
    Aug 2003
    Location
    Warrington, UK
    Posts
    1,012
    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/

  10. #10
    Raw Wave rando's Avatar
    Join Date
    Mar 2004
    Location
    Redondo Beach, CA
    Posts
    1,973
    Quote 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.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •