470,641 Members | 1,606 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

Franson GPS Tools & C#

Hi Guys,

I am trying to get a fix from a GPS using a SDK called Franson GPS
tools. http://www.franson.com/gpstools

I have gotten quite far on my own but am stuck - when I create a
instance of class called GpsFix i get a compile error that no
constructors are defined.

It appears to me that I must set the position property of gpsfix before
I use it? But I also see that position is a class in itself?

My code is below. If someone can see where I am going wrong please
advise.

Thanks heaps.

-Al
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

GpsToolsNET.License objLicense = new GpsToolsNET.License();
objLicense.LicenseKey = "o8h1j88qlSqkaJHiu27oixldj7redk4YoCh3";

// Create parser
GpsToolsNET.NmeaParser objparser = new GpsToolsNET.NmeaParser();
GpsToolsNET.GpsFix objFix = new GpsToolsNET.GpsFix();

objparser.NoEvents = true;
objparser.PortEnabled = true;

objparser.GetGpsFix(3000, 2);
}

private void btnConvert_Click(object sender, EventArgs e)
{
MessageBox.Show(textBoxLatitude.Text + " " + textBoxLongitude.Text);
}
}
}

Aug 15 '06 #1
3 3715
I see now that I get access to the GpsFix object with a line like:

GpsToolsNET.GpsFix objFix = objparser.GetGpsFix(3000, 2);

What I dont understand is why the syntax is different, I mean so far I
have seen that instances of classes are created with:

GpsToolsNET.GpsFix objFix = new GpsToolsNET.GpsFix();

So why does creating this object (instance) differ from the syntax
above?

Cheers

-Al

Aug 15 '06 #2
GpsFix might not have a default contructor.

chanmm

<Bi******@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
>I see now that I get access to the GpsFix object with a line like:

GpsToolsNET.GpsFix objFix = objparser.GetGpsFix(3000, 2);

What I dont understand is why the syntax is different, I mean so far I
have seen that instances of classes are created with:

GpsToolsNET.GpsFix objFix = new GpsToolsNET.GpsFix();

So why does creating this object (instance) differ from the syntax
above?

Cheers

-Al

Aug 16 '06 #3
Bi******@gmail.com wrote:
I see now that I get access to the GpsFix object with a line like:

GpsToolsNET.GpsFix objFix = objparser.GetGpsFix(3000, 2);

What I dont understand is why the syntax is different, I mean so far I
have seen that instances of classes are created with:

GpsToolsNET.GpsFix objFix = new GpsToolsNET.GpsFix();

So why does creating this object (instance) differ from the syntax
above?
Constructors are special methods that are defined and invoked with a
particular syntax. But there's nothing to stop other methods of the
class returning an instance of the class. For example, String.Replace
returns a new String.

And some classes might hide their constructors and require clients to
call a factory method if they want an instance. The same effect can
sometimes be achieved by having no parameterless constructor, and
therefore requiring clients to provide parameters, but having an
explicit factory method makes it more obvious what's happening.

For example, the Graphics class in WinForms cannot be directly created,
because there's not really any such thing as a standalone Graphics - if
you want one, you have to provide an Image, or a window, or a DC, for
the Graphics to be tied to. So the Graphics class has:

public static Graphics FromImage(Image image)
public static Graphics FromHwnd(IntPtr hwnd)
public static Graphics FromHdc(IntPtr hdc)

Note that in this case we couldn't readily use parameterised
constructors instead, because both the latter two take an IntPtr and
there would be no way to tell what it was if we just had

public Graphics(IntPtr handle) // handle to what?

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Grzegorz ¶lusarek | last post: by
14 posts views Thread by Arne | last post: by
reply views Thread by BigAl.NZ | last post: by
1 post views Thread by Korara | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.