Skip to content
Sample client code for PHD2 server API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cs
cxx
.gitignore
LICENSE
README.md

README.md

phd2client

Sample client code for PHD2 server API - C++ and C# versions. If you need a different language binding please let me know.

C++

dependencies:

#include "guider.h"

// instantiate a guider object that will connect to PHD2 running on "localhost"
Guider guider("localhost");

// connect to PHD2
bool ok = guider.Connect();
if (!ok)
    std::cerr << "could not connect to phd2: " << guider.LastError() << std::endl;

// connect gear in the equipment profile named Simulator
ok = guider.ConnectEquipment("Simulator");
if (!ok)
    std::cerr << "could not connect equipment: " << guider.LastError() << std::endl;

// start guiding with settle tolerance of 2.0 pixels, 10 second settle time, 100-second timeout
ok = guider.Guide(2.0, 10.0, 100.0);

See phd2client.cpp for a more complete example.

C# (.NET)

using guider;

...
    using (Guider guider = Guider.Factory("localhost"))
    {
        try
        {
            // connect to PHD2
            guider.Connect();

            // connect equipment in profile "Simulator"
            guider.ConnectEquipment("Simulator");

            // start guiding with settle tolerance of 2.0 pixels, 10 second settle time, 100-second timeout
            guider.Guide(2.0, 10.0, 100.0);
         }
         catch (GuiderException ex)
         {
             // Guider exception
             Console.WriteLine("Guider Error: {0}", ex.Message);
         }
    }

See SampleClient.cs for a more complete example.

You can’t perform that action at this time.