1 | #include "MDriveCom.h"
|
---|
2 |
|
---|
3 | #include <iostream>
|
---|
4 |
|
---|
5 | #include "coord.h"
|
---|
6 | #include "Slalib.h"
|
---|
7 |
|
---|
8 | using namespace std;
|
---|
9 |
|
---|
10 | bool MDriveCom::InterpreteCmd(TString cmd, TString str)
|
---|
11 | {
|
---|
12 | if (cmd==(TString)"STOP!")
|
---|
13 | {
|
---|
14 | cout << "Stop! " << str << endl;
|
---|
15 | return true;
|
---|
16 | }
|
---|
17 |
|
---|
18 | if (cmd==(TString)"RADEC")
|
---|
19 | {
|
---|
20 | cout << "RaDec: " << str << endl;
|
---|
21 | return true;
|
---|
22 | }
|
---|
23 | if (cmd==(TString)"ZDAZ")
|
---|
24 | {
|
---|
25 | cout << "ZdAz: " << str << endl;
|
---|
26 | return true;
|
---|
27 | }
|
---|
28 | if (cmd==(TString)"PREPS")
|
---|
29 | {
|
---|
30 | cout << "Preposs: " << str << endl;
|
---|
31 | return true;
|
---|
32 | }
|
---|
33 | cout << "Unknown Command: " << cmd << str << endl;
|
---|
34 | return false;
|
---|
35 | }
|
---|
36 |
|
---|
37 | void MDriveCom::Print(TString &str, Double_t deg) const
|
---|
38 | {
|
---|
39 | Char_t sgn;
|
---|
40 | UShort_t d, m, s;
|
---|
41 |
|
---|
42 | Slalib::Deg2Dms(deg, sgn, d, m, s);
|
---|
43 |
|
---|
44 | str += Form("%c %03d %02d %03d ", sgn, d, m, s);
|
---|
45 | }
|
---|
46 |
|
---|
47 | bool MDriveCom::SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er)
|
---|
48 | {
|
---|
49 | // so [rad]
|
---|
50 | // is [deg]
|
---|
51 | // er [rad]
|
---|
52 |
|
---|
53 | so *= kRad2Deg;
|
---|
54 | er *= kRad2Deg;
|
---|
55 |
|
---|
56 | // Set status flag
|
---|
57 | if (stat&kError)
|
---|
58 | SetStatus(0);
|
---|
59 | if (stat&kStopped)
|
---|
60 | SetStatus(1);
|
---|
61 | if (stat&kStopping || stat&kMoving)
|
---|
62 | SetStatus(3);
|
---|
63 | if (stat&kTracking)
|
---|
64 | SetStatus(4);
|
---|
65 |
|
---|
66 | Timer t;
|
---|
67 | t.Now();
|
---|
68 |
|
---|
69 | TString str;
|
---|
70 | Print(str, rd.Ra()); // Ra
|
---|
71 | Print(str, rd.Dec()); // Dec
|
---|
72 | Print(str, 0); // HA
|
---|
73 | str += Form("%12.6f ", t.GetMjd()); // mjd
|
---|
74 | Print(str, so.Zd());
|
---|
75 | Print(str, so.Az());
|
---|
76 | Print(str, is.Zd());
|
---|
77 | Print(str, is.Az());
|
---|
78 | str += Form("%08.3f ", er.Zd());
|
---|
79 | str += Form("%08.3f", er.Az());
|
---|
80 |
|
---|
81 | return Send(str);
|
---|
82 | }
|
---|