| 1 | #include "MStarguider.h" | 
|---|
| 2 | /* | 
|---|
| 3 | #include <iostream.h> | 
|---|
| 4 | #include <signal.h> | 
|---|
| 5 |  | 
|---|
| 6 | #include <TROOT.h> | 
|---|
| 7 | #include <TSystem.h> | 
|---|
| 8 | #include <TCanvas.h> | 
|---|
| 9 | #include <TApplication.h> | 
|---|
| 10 |  | 
|---|
| 11 | #include "timer.h" | 
|---|
| 12 | #include "Writer.h" | 
|---|
| 13 | #include "grab-v4l.h" | 
|---|
| 14 | #include "StarDisplay.h" | 
|---|
| 15 | #include "CameraDisplay.h" | 
|---|
| 16 | */ | 
|---|
| 17 | /* ---------------------------------------------------------------------- */ | 
|---|
| 18 | /* | 
|---|
| 19 | void MStarguider::ReadoutLoop() | 
|---|
| 20 | { | 
|---|
| 21 | //disp->Update(); | 
|---|
| 22 |  | 
|---|
| 23 | //---    WriterPng png(768, 576); | 
|---|
| 24 | //---    Writer task1(&png, 25*5/1);  // one png per five seconds | 
|---|
| 25 |  | 
|---|
| 26 | // --- | 
|---|
| 27 | fCcd = new Camera; | 
|---|
| 28 | CameraDisplay *task=new CameraDisplay(gClient->GetRoot()); | 
|---|
| 29 |  | 
|---|
| 30 | fCcd->SetIntegrationNum(1); | 
|---|
| 31 | //    fCcd->Loop(task, 25*60*15); // 15min | 
|---|
| 32 |  | 
|---|
| 33 | // | 
|---|
| 34 | // Stop Application Loop | 
|---|
| 35 | // | 
|---|
| 36 |  | 
|---|
| 37 | // | 
|---|
| 38 | // FIXME! stupid workaround for tasks without a gui! | 
|---|
| 39 | // | 
|---|
| 40 | //--- | 
|---|
| 41 | // TCanvas *c = new TCanvas("Dummy", "Dummy"); | 
|---|
| 42 |  | 
|---|
| 43 | //    gStopLoop= 1; | 
|---|
| 44 | //    while (fCcd->IsRunning()) | 
|---|
| 45 | //        sleep(1); | 
|---|
| 46 |  | 
|---|
| 47 | delete fCcd; | 
|---|
| 48 | //delete task; | 
|---|
| 49 |  | 
|---|
| 50 | gSystem->ExitLoop(); | 
|---|
| 51 | gSystem->DispatchOneEvent(kTRUE); | 
|---|
| 52 | // ReturnFromRun(); // SetReturnFromRun(); | 
|---|
| 53 |  | 
|---|
| 54 |  | 
|---|
| 55 | cout << "Event Loop Done." << endl; | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 | void *MStarguider::MapReadoutLoop(void *arg) | 
|---|
| 59 | { | 
|---|
| 60 | MStarguider *starg = (MStarguider*)arg; | 
|---|
| 61 |  | 
|---|
| 62 | starg->ReadoutLoop(); | 
|---|
| 63 |  | 
|---|
| 64 | return NULL; | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | void MStarguider::StartReadoutLoop() | 
|---|
| 68 | { | 
|---|
| 69 | pthread_t thread; | 
|---|
| 70 | if (pthread_create(&thread, NULL, MapReadoutLoop, this)) | 
|---|
| 71 | { | 
|---|
| 72 | cout << "Error starting main thread." << endl; | 
|---|
| 73 | exit(0); | 
|---|
| 74 | } | 
|---|
| 75 | pthread_detach(thread); | 
|---|
| 76 | } | 
|---|
| 77 |  | 
|---|
| 78 | MStarguider::MStarguider(int *argc, char **argv, void *options=0, | 
|---|
| 79 | int numOptions=0) | 
|---|
| 80 | : TApplication("Starguider", argc, argv, options, numOptions), fCcd(NULL) | 
|---|
| 81 | { | 
|---|
| 82 |  | 
|---|
| 83 | signal(SIGINT, SignalRcvd); | 
|---|
| 84 |  | 
|---|
| 85 | //--- | 
|---|
| 86 |  | 
|---|
| 87 | StartReadoutLoop(); | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 | MStarguider::~MStarguider() | 
|---|
| 91 | { | 
|---|
| 92 | //--- | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 | */ | 
|---|