#include "MStarguider.h"
/*
#include <iostream.h>
#include <signal.h>

#include <TROOT.h>
#include <TSystem.h>
#include <TCanvas.h>
#include <TApplication.h>

#include "timer.h"
#include "Writer.h"
#include "grab-v4l.h"
#include "StarDisplay.h"
#include "CameraDisplay.h"
*/
/* ---------------------------------------------------------------------- */
/*
void MStarguider::ReadoutLoop()
{
    //disp->Update();

    //---    WriterPng png(768, 576);
    //---    Writer task1(&png, 25*5/1);  // one png per five seconds

    // ---
    fCcd = new Camera;
    CameraDisplay *task=new CameraDisplay(gClient->GetRoot());

    fCcd->SetIntegrationNum(1);
//    fCcd->Loop(task, 25*60*15); // 15min

    //
    // Stop Application Loop
    //

    //
    // FIXME! stupid workaround for tasks without a gui!
    //
    //---
    // TCanvas *c = new TCanvas("Dummy", "Dummy");

//    gStopLoop= 1;
//    while (fCcd->IsRunning())
//        sleep(1);

    delete fCcd;
    //delete task;

    gSystem->ExitLoop();
    gSystem->DispatchOneEvent(kTRUE);
    // ReturnFromRun(); // SetReturnFromRun();


    cout << "Event Loop Done." << endl;
}

void *MStarguider::MapReadoutLoop(void *arg)
{
    MStarguider *starg = (MStarguider*)arg;

    starg->ReadoutLoop();

    return NULL;
}

void MStarguider::StartReadoutLoop()
{
    pthread_t thread;
    if (pthread_create(&thread, NULL, MapReadoutLoop, this))
    {
        cout << "Error starting main thread." << endl;
        exit(0);
    }
    pthread_detach(thread);
}

MStarguider::MStarguider(int *argc, char **argv, void *options=0,
                         int numOptions=0)
: TApplication("Starguider", argc, argv, options, numOptions), fCcd(NULL)
{

    signal(SIGINT, SignalRcvd);

    //---

    StartReadoutLoop();
}

MStarguider::~MStarguider()
{
    //---
}

*/
