Merge lp:~petr-kubanek/stellarium/stellarium into lp:stellarium

Proposed by Petr Kubánek
Status: Merged
Merged at revision: 9263
Proposed branch: lp:~petr-kubanek/stellarium/stellarium
Merge into: lp:stellarium
Diff against target: 876 lines (+478/-43)
13 files modified
plugins/TelescopeControl/CMakeLists.txt (+1/-1)
plugins/TelescopeControl/resources/device_models.json (+1/-1)
plugins/TelescopeControl/src/CMakeLists.txt (+2/-0)
plugins/TelescopeControl/src/TelescopeControl.cpp (+63/-16)
plugins/TelescopeControl/src/TelescopeControl.hpp (+3/-3)
plugins/TelescopeControl/src/TelescopeControlGlobals.hpp (+1/-0)
plugins/TelescopeControl/src/clients/TelescopeClient.cpp (+5/-0)
plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp (+175/-0)
plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp (+61/-0)
plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.cpp (+46/-16)
plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.hpp (+1/-0)
plugins/TelescopeControl/src/gui/TelescopeDialog.cpp (+8/-1)
plugins/TelescopeControl/src/gui/telescopeConfigurationDialog.ui (+111/-5)
To merge this branch: bzr merge lp:~petr-kubanek/stellarium/stellarium
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
gzotti Approve
Petr Kubánek (community) Approve
Bogdan Marinov Pending
Review via email: mp+322106@code.launchpad.net

This proposal supersedes a proposal from 2017-03-23.

Commit message

Support for RTS2 JSON API telescopes.

Description of the change

I added support for RTS2 JSON API protocols. All RTS2 supported telescopes can now have position shown in Stellarium, with goto abilities as well.

Also configuration dialog for telescope plugin was modified, so it hides irrelevant parts.

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote : Posted in a previous version of this proposal

Please resolve conflict (see stars/default/stars_hip_sp_0v0_0.cat.THIS file)

review: Needs Fixing
Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

Hi!
In
void TelescopeClientJsonRts2::telescopeGoto(const Vec3d &j2000Pos)

you can use SteUtils::void rectToSphe(double *lng, double *lat, const Vec3d& v);

I must install RTS2 before I can further comment.

Revision history for this message
Petr Kubánek (petr-kubanek) wrote : Posted in a previous version of this proposal

Hi,

I removed old catalogue version, which caused the conflict. I also use now rectToSphe, which seems to work as a charm (although the calculations done in this function seems to be different from what I had in code).

However, other telescope clients still use make-up version of conversion. Shall I rewrite others clients to use rectToSphe as well?

Revision history for this message
Petr Kubánek (petr-kubanek) wrote : Posted in a previous version of this proposal

> Please resolve conflict (see stars/default/stars_hip_sp_0v0_0.cat.THIS file)

Fixed, hope this will propagate to merge request as well.

Revision history for this message
Petr Kubánek (petr-kubanek) wrote : Posted in a previous version of this proposal

> Please resolve conflict (see stars/default/stars_hip_sp_0v0_0.cat.THIS file)

review: Needs Resubmitting
Revision history for this message
Petr Kubánek (petr-kubanek) wrote : Posted in a previous version of this proposal

> Hi!
> In
> void TelescopeClientJsonRts2::telescopeGoto(const Vec3d &j2000Pos)
>
> you can use SteUtils::void rectToSphe(double *lng, double *lat, const Vec3d&
> v);
>
> I must install RTS2 before I can further comment.

You can work with RTS2 dummy - grab source from GitHub, compile (I am working on Debian packages, but that's still a long way) and you should have dummy T0 in rts2-mon. Then connect (you will need to run rts2-httpd). Let me know if you hit any problems.

Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

Hi! I was not aware the other telescope clients also have this code. We should be able to fix that, thanks.

I have compiled RTS2 from github on my Ubuntu 16.04 notebook (CoreDuo from 2009), following instructions. Install worked well so far. I was totally unaware of this amazing project! I am also (far too seldom) observer, but only with a small EQ3 and (modified) DSLR, nothing stationary. (I have access to an EQ6 occasionally.) As a total beginner with RTS2, any intro manual you have available would be helpful. I will try to continue again on weekend.

Revision history for this message
Alexander Wolf (alexwolf) wrote : Posted in a previous version of this proposal

It's OK for me now. Some visual improvements may be added after merge.

Georg?

review: Approve
Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

We will fix the GUI to only show the relevant settings depending on which type of telescope is being configured.

Petr, I was able to install on Ubuntu 16.04, sudo services rts2 start, and see (dummy) T0 and can write commands into the rts2 console. (park, move 90 0, etc. ) rts2-httpd requires database, I have installed the stars database as described in RUN, retried starting rts2-httpd, but rts2-mon still complains that I shall check that root can connect to database. (could not connect to database "stars" on line 162.) I am also not really familiar with postgresql usage, maybe I am doing something wrong.

On the other side, I have set up an RTS2 telescope on my Windows PC with your version.

from the logfile:

connectionType: 5 initString: "RTS2 dummy Telescope:RTS2:J2000:http://gzotti:PASSWORD@192.168.xxx.yyy:8889"
Creating telescope "RTS2 dummy Telescope:RTS2:J2000:http://gzotti:PASSWORD@192.168.xxx.yyy:8889" ; name/type/equinox/params: "RTS2 dummy Telescope" "RTS2" J2000 "http://gzotti:XXXXXX@192.168.xxx.yyy:8889"
TelescopeRTS2 paramaters: "http://gzotti:PASSWORD@192.168.xxx.yyy:8889"
request url: "http://gzotti:PASSWORD@192.168.xxx.yyy:8889/api/devbytype?t=2"
TelescopeRTS2 error QNetworkReply::NetworkError(ConnectionRefusedError)

The telescope overview panel in Stellarium states "connected", and I see a telescope control panel for my RTS2 dummy telescope, but it shows default all-0 coordinates, not the currently set 6h00/0° RA/DEC (from rts2-mon move 90 0). So it seems more than likely that connection has not been properly established and "ConnectionRefused" is not properly handled yet. As I understand, this would connect to the running rts2-httpd, but it does not run...

When I am connected (or not) to RTS2 like this, quitting Stellarium results in a crash.

Sorry, I am total beginner with RTS2 and automated telescopes. A guide book "RTS2 for dummies" or so would be helpful. And then a thorough book about robotic observatories with RTS2 with instructions, sectioned by topic, not alphabetized (where to start reading the manpages?))

It would be perfect if you can add a section on RTS2 to the Guide: in guide/plg_atTheTelescope.tex. Not a complete RTS2 manual, but things to take case of, etc. Don't bother with too much formatting, we will likely edit a bit, but just to get info from you on what is important, like having rts2-httpd running.

I will try to follow the postgresql instructions now, maybe I can get this to work.

review: Needs Fixing
Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

I restarted with the database part and instructions from RUN and rts2.org/faq.html. When I add myself as database user, I can look into the database, fine. But rts2-https must be started by root, and then there is an error

gzotti@alcyone:~/DEV/rts2/src$ sudo rts2-httpd
[sudo] Passwort für gzotti:
2017-04-01T23:41:29.319 CET rts2-httpd 1 cannot connect to DB 'stars'. Please check if the database server is running (on specified port, or on port 5432, which is the default one; please be aware that RTS2 does not parse PostgreSQL configuration, so if the database is running on the non-default port, it will not be accessible unless you specify the port). Also please make sure that the current user, root(0) can log into database: could not connect to database "stars" on line 162
2017-04-01T23:41:29.320 CET rts2-httpd 1 cannot init daemon, exiting

gzotti@alcyone:~/DEV/rts2/src$ rts2-httpd
2017-04-01T23:42:05.060 CET rts2-httpd 1 cannot create lock file /var/run/rts2_HTTPD: Permission denied - do you have correct permission? Try to run daemon as root (sudo,..)

I finally made /var/run write-all, deleted rts2_HTTPD (as root), and was able to start rts2-httpd as myself, but this seems sub-optimal. Now I have an error in Stellarium's log.txt

TelescopeRTS2 error QNetworkReply::NetworkError(AuthenticationRequiredError)

User and password are visible in the Stellarium logfile like in the previous report and are correct.

Interesting: I wanted to connect to this webserver in Firefox. I see the menu, but a click on a menu entry opened the auth panel. my login&password don't work. I may have overlooked this: do I have another name when using rts2, and where would I have configured this? (I assue these are the auth. data I also need to give in Stellarium...) In the database I use the same username that I use in Ubuntu.

I am getting closer, but must have overlooked something.

review: Needs Information
Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

Hah, I have found the rts2 wiki, and rts2-user -a <name>, finally. I still would like to find a complete beginner's guide to RTS2: When to use Linux user account, Database user name (and what to do as root, what as postgres, what as regular user -- I can have 20 years of Linux experience, never used postgresql!), rts2 user name. Basically an advanced amateur's guide to building a remote robotic observatory with RTS2, is there something available? (May be some affordable print-on-demand book, or even a €15 PDF to download a current doc (this may give you some gratification), it would just have to be complete and correct.) RTS2 seems very complete, but the settings overwhelm me.

Now I have connection, and messages in log.txt like

request url: "http://gzotti:PASSWORD@192.168.xxx.yyy:8889/api/get?d=T0"
TelescopeRTS2 error QNetworkReply::NetworkError(NoError)
TelescopeRTS2 object false "no error occurred" 0 120 0
TelescopeRTS2 RADEC 2.0944 0
request url: "http://gzotti:PASSWORD@192.168.xxx.yyy:8889/api/get?d=T0"
TelescopeRTS2 error QNetworkReply::NetworkError(NoError)
TelescopeRTS2 object false "no error occurred" 0 120 0
TelescopeRTS2 RADEC 2.0944 0
request url: "http://gzotti:PASSWORD@192.168.xxx.yyy:8889/api/get?d=T0"

The 0 120 0 may come from the move 120 0 issued earlier in rts2-mon.

I assumed the rts2 was in OFF mode, switched ON in rts2-mon. In Stellarium, I tried in the telescope panel "Move telescope to [current object], [SLEW]". The entries in the logfile get more, but no change. rts2-mon shows the OBJ coordinates 2h/15° from another command given "move 30 15", and the logfile has

TelescopeRTS2 error QNetworkReply::NetworkError(NoError)
TelescopeRTS2 object false "no error occurred" 0 30 15
TelescopeRTS2 RADEC 0.523599 0.261799

It appears the SLEW command is not transferred to RTS2. But I also don't see a telescope marker on screen at 30°/15°. I don't know whether RTS2 has disabled the T0 telescope for safety during daylight or something (I have switched State:ON in rts2-mon before). I can apparently issue move commands in rts2-mon, these coordinates are displayed in rts2-mon, are transferred to Stellarium, but no telescope marker is visible, and I cannot isssue a GOTO command from Stellarium that would impress rts2-mon in any way.

So I see some connection is established, but something is likely still misconfigured.

review: Needs Information
Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

I just observed: when I freshly connect to the RTS dummy telescope, I have a telescope marker at the coordinates which I have set in rts2-mon. Any slew commmand from stellarium makes the marker disappear, and rts2-mon shows no change in position (command ignored). Disconnect/connect shows it at the old location.

When I issue a "move" command in rts2-mon, the telescope marker in Stellarium moves! So the telescope pointing record is properly transmitted, at least.

Revision history for this message
Petr Kubánek (petr-kubanek) wrote : Posted in a previous version of this proposal

In users database is (added) column, which describes which devices a user can command. Default is NULL, meaning none. When you set it to all (*) as this:
<pre>
psql stars
update users set allowed_devices = '*';
</pre>
you will be able to command devices. It looks as connection brokes after error and is not reconnected. I will investigate this issue.

Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

Ah, that sounds like it. I hope I can try tonight, maybe only on Wednesday. Please handle the connection errors at least with diagnostic messages to the logfile like "cannot connect, is rts2-httpd running on <IP address>?"; "User XXX unknown. Use rts2-user -a XXX to create"; "User XXX cannot control telescope. See manual for details." and please write this section for our guide (there is a \sectionauthor*{} macro to mark personal contributions). You made incredible software, but is is quite advanced and users will flood us *or you* with emails with always the same questions when these are not easily answered in manuals :-) When you write a general manual for RTS2, I am afraid this should include a short intro to psql. If you don't have the time (I understand we are all busy), maybe some DIY observatory maker can write such intro booklet for beginners while he is building it, based on his own experiences and pitfalls. The telescope parameters look impressive alone, all those mount tweaks, ...

Is there a useful scenario for RTS2 with mobile telescope? Just to run an automated night of captures from an object list? (No dome, no weather sensors, ... just a mount, DSLR or CCD, optional filter wheel, optional autofocuser?) Not sure about the resources, but they don't look too big. RTS2 could maybe run on a small low-power ARM SBC or so (think Raspberry Pi3?).

Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

OK, after this database update I was able to slew the dummy RTS2 telescope.

However, the crash-on-exit persists. I have only Telescope plugin active. When I exit immediately after program start, all is OK. When I press the telescope button and see the panel "No telescopes connected", I press "configure", I see the unconnected RTS2 and an unconnected Stellarium Dummy telescope. When I quit Stellarium at this point, already here I have a crash. So it does not even require connection, only being (partially?) loaded. Maybe some uninitialized pointer?

review: Needs Fixing
Revision history for this message
gzotti (georg-zotti) wrote : Posted in a previous version of this proposal

Strange: The logfile indicates Telescope plugin has been successfully unloaded. We did have a few days recently where trunk crashed on exit. Maybe your latest merge was in these days. Can you merge from trunk again before resubmitting, maybe the problem is somewhere entirely else.

review: Needs Fixing
Revision history for this message
Petr Kubánek (petr-kubanek) wrote : Posted in a previous version of this proposal

I merged again from trunk, and also I made parts irrelevant for the setting to be hidden from the dialog box. So if you choose local, you will see only serial port & type, remote hostname and port, and RTS2 URL, username and password.

I do not see any crash, Stellarium exits cleanly without core dump on all ocassion. If you can please try again, and if you see a crash, try to be as specific as possible about conditions causing it.

9262. By Alexander Wolf

Added context support for constellations and asterisms names

Revision history for this message
Petr Kubánek (petr-kubanek) :
review: Approve
Revision history for this message
Petr Kubánek (petr-kubanek) wrote :

Regarding low power ARM boards: we run RTS2 on SAAO 1m autoguiders, so code compiles and run on ARM as well.

Is there any hint where to put documentation/translation? Thanks.

Revision history for this message
gzotti (georg-zotti) wrote :

Documentation: as I wrote, please add a section to the Guide. The LaTeX files are in the guide subdirectory. Your guidelines should go into ch_atTheTelescope.tex. Don't bother too much about our formatting macros, just write the relevant text, and I will reformat as needed. But please cover the required steps for RTS2 beginners, and how to avoid trouble.

I will try your branch later today.

Revision history for this message
gzotti (georg-zotti) wrote :

OK, it works, and exits nicely. The GUI selection/hiding is well done, just what I had in mind. I might reduce its debug output, but we can merge it. Maybe we should think about particular debugging with startup flags (Florian enabled such possibility recently). Thanks a lot for a fine contribution!

review: Approve
Revision history for this message
Alexander Wolf (alexwolf) :
review: Approve
9263. By Alexander Wolf

Added support RTS2 for Telescope Control Plugin

Revision history for this message
Petr Kubánek (petr-kubanek) wrote :

I plan to add documentation and cleanup debug logs, so I changed my branch back to mature.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/TelescopeControl/CMakeLists.txt'
2--- plugins/TelescopeControl/CMakeLists.txt 2016-04-23 13:33:16 +0000
3+++ plugins/TelescopeControl/CMakeLists.txt 2017-04-06 13:21:42 +0000
4@@ -3,7 +3,7 @@
5 # otherwise the local copy will be overwritten each time Stellarium is started.
6 SET(TELESCOPE_CONTROL_MAJOR "0")
7 SET(TELESCOPE_CONTROL_MINOR "2")
8-SET(TELESCOPE_CONTROL_PATCH "11")
9+SET(TELESCOPE_CONTROL_PATCH "12")
10 SET(TELESCOPE_CONTROL_VERSION "${TELESCOPE_CONTROL_MAJOR}.${TELESCOPE_CONTROL_MINOR}.${TELESCOPE_CONTROL_PATCH}")
11
12 IF(APPLE)
13
14=== modified file 'plugins/TelescopeControl/resources/device_models.json'
15--- plugins/TelescopeControl/resources/device_models.json 2016-04-23 13:33:16 +0000
16+++ plugins/TelescopeControl/resources/device_models.json 2017-04-06 13:21:42 +0000
17@@ -1,5 +1,5 @@
18 {
19- "version": "0.2.11",
20+ "version": "0.2.12",
21 "list" :
22 [
23 {
24
25=== modified file 'plugins/TelescopeControl/src/CMakeLists.txt'
26--- plugins/TelescopeControl/src/CMakeLists.txt 2016-06-21 14:43:30 +0000
27+++ plugins/TelescopeControl/src/CMakeLists.txt 2017-04-06 13:21:42 +0000
28@@ -22,6 +22,8 @@
29 clients/TelescopeClientDirectLx200.cpp
30 clients/TelescopeClientDirectNexStar.hpp
31 clients/TelescopeClientDirectNexStar.cpp
32+ clients/TelescopeClientJsonRts2.hpp
33+ clients/TelescopeClientJsonRts2.cpp
34 TelescopeControl.hpp
35 TelescopeControl.cpp
36 gui/SlewDialog.hpp
37
38=== modified file 'plugins/TelescopeControl/src/TelescopeControl.cpp'
39--- plugins/TelescopeControl/src/TelescopeControl.cpp 2016-11-28 14:24:21 +0000
40+++ plugins/TelescopeControl/src/TelescopeControl.cpp 2017-04-06 13:21:42 +0000
41@@ -101,6 +101,7 @@
42 connectionTypeNames.insert(ConnectionInternal, "internal");
43 connectionTypeNames.insert(ConnectionLocal, "local");
44 connectionTypeNames.insert(ConnectionRemote, "remote");
45+ connectionTypeNames.insert(ConnectionRTS2, "RTS2");
46 }
47
48 TelescopeControl::~TelescopeControl()
49@@ -746,6 +747,9 @@
50 int delay = 0;
51 QString deviceModelName;
52 QString portSerial;
53+ QString rts2Url("localhost");
54+ QString rts2Username("");
55+ QString rts2Password("");
56
57 if (connectionType == ConnectionInternal)
58 {
59@@ -789,15 +793,32 @@
60 }
61 }
62
63+ if (connectionType == ConnectionRTS2)
64+ {
65+ //Validation: Host name
66+ rts2Url = telescope.value("url").toString();
67+ if(rts2Url.isEmpty())
68+ {
69+ qDebug() << "[TelescopeControl] loadTelescopes(): No URL at slot" << key;
70+ map.remove(key);
71+ continue;
72+ }
73+ rts2Username = telescope.value("username").toString();
74+ rts2Password = telescope.value("password").toString();
75+ }
76+
77 if (connectionType != ConnectionVirtual)
78 {
79- //Validation: TCP port
80- portTCP = telescope.value("tcp_port").toInt();
81- if(!telescope.contains("tcp_port") || !isValidPort(portTCP))
82+ if (connectionType != ConnectionRTS2)
83 {
84- qDebug() << "[TelescopeControl] Unable to load telescope: No valid TCP port at slot" << key;
85- map.remove(key);
86- continue;
87+ //Validation: TCP port
88+ portTCP = telescope.value("tcp_port").toInt();
89+ if(!telescope.contains("tcp_port") || !isValidPort(portTCP))
90+ {
91+ qDebug() << "[TelescopeControl] Unable to load telescope: No valid TCP port at slot" << key;
92+ map.remove(key);
93+ continue;
94+ }
95 }
96
97 //Validation: Delay
98@@ -879,7 +900,7 @@
99 }
100 else
101 {
102- if(!startClientAtSlot(slot, connectionType, name, equinox, hostName, portTCP, delay, internalCircles))
103+ if(!startClientAtSlot(slot, connectionType, name, equinox, hostName, portTCP, delay, internalCircles, deviceModelName, portSerial, rts2Url, rts2Username, rts2Password))
104 {
105 qDebug() << "[TelescopeControl] Unable to create a telescope client at slot" << slot;
106 //Unnecessary due to if-else construction;
107@@ -903,7 +924,7 @@
108 telescopeDescriptions = result;
109 }
110
111-bool TelescopeControl::addTelescopeAtSlot(int slot, ConnectionType connectionType, QString name, QString equinox, QString host, int portTCP, int delay, bool connectAtStartup, QList<double> circles, QString deviceModelName, QString portSerial)
112+bool TelescopeControl::addTelescopeAtSlot(int slot, ConnectionType connectionType, QString name, QString equinox, QString host, int portTCP, int delay, bool connectAtStartup, QList<double> circles, QString deviceModelName, QString portSerial, QString rts2Url, QString rts2Username, QString rts2Password)
113 {
114 //Validation
115 if(!isValidSlotNumber(slot) || name.isEmpty() || equinox.isEmpty() || connectionType <= ConnectionNA || connectionType >= ConnectionCount)
116@@ -923,6 +944,15 @@
117 telescope.insert("host_name", host);
118 }
119
120+ if(connectionType == ConnectionRTS2)
121+ {
122+ if (rts2Url.isEmpty())
123+ return false;
124+ telescope.insert("url", rts2Url);
125+ telescope.insert("username", rts2Username);
126+ telescope.insert("password", rts2Password);
127+ }
128+
129 if(connectionType == ConnectionInternal)
130 {
131 if (!deviceModels.contains(deviceModelName))
132@@ -936,9 +966,12 @@
133
134 if (connectionType != ConnectionVirtual)
135 {
136- if (!isValidPort(portTCP))
137- return false;
138- telescope.insert("tcp_port", portTCP);
139+ if (connectionType != ConnectionRTS2)
140+ {
141+ if (!isValidPort(portTCP))
142+ return false;
143+ telescope.insert("tcp_port", portTCP);
144+ }
145
146 if (!isValidDelay(delay))
147 return false;
148@@ -960,7 +993,7 @@
149 return true;
150 }
151
152-bool TelescopeControl::getTelescopeAtSlot(int slot, ConnectionType& connectionType, QString& name, QString& equinox, QString& host, int& portTCP, int& delay, bool& connectAtStartup, QList<double>& circles, QString& deviceModelName, QString& portSerial)
153+bool TelescopeControl::getTelescopeAtSlot(int slot, ConnectionType& connectionType, QString& name, QString& equinox, QString& host, int& portTCP, int& delay, bool& connectAtStartup, QList<double>& circles, QString& deviceModelName, QString& portSerial, QString& rts2Url, QString& rts2Username, QString& rts2Password)
154 {
155 //Validation
156 if(!isValidSlotNumber(slot))
157@@ -996,6 +1029,12 @@
158 deviceModelName = telescope.value("device_model").toString();
159 portSerial = telescope.value("serial_port").toString();
160 }
161+ if(connectionType == ConnectionRTS2)
162+ {
163+ rts2Url = telescope.value("url").toString();
164+ rts2Username = telescope.value("username").toString();
165+ rts2Password = telescope.value("password").toString();
166+ }
167
168 return true;
169 }
170@@ -1027,7 +1066,10 @@
171 QList<double> circles;
172 QString deviceModelName;
173 QString portSerial;
174- if(!getTelescopeAtSlot(slot, connectionType, name, equinox, host, portTCP, delay, connectAtStartup, circles, deviceModelName, portSerial))
175+ QString rts2Url;
176+ QString rts2Username;
177+ QString rts2Password;
178+ if(!getTelescopeAtSlot(slot, connectionType, name, equinox, host, portTCP, delay, connectAtStartup, circles, deviceModelName, portSerial, rts2Url, rts2Username, rts2Password))
179 {
180 //TODO: Add debug
181 return false;
182@@ -1063,7 +1105,7 @@
183 }
184 else
185 {
186- if (startClientAtSlot(slot, connectionType, name, equinox, host, portTCP, delay, circles))
187+ if (startClientAtSlot(slot, connectionType, name, equinox, host, portTCP, delay, circles, deviceModelName, portSerial, rts2Url, rts2Username, rts2Password))
188 {
189 emit clientConnected(slot, name);
190 return true;
191@@ -1199,7 +1241,7 @@
192 return true;
193 }
194
195-bool TelescopeControl::startClientAtSlot(int slotNumber, ConnectionType connectionType, QString name, QString equinox, QString host, int portTCP, int delay, QList<double> circles, QString deviceModelName, QString portSerial)
196+bool TelescopeControl::startClientAtSlot(int slotNumber, ConnectionType connectionType, QString name, QString equinox, QString host, int portTCP, int delay, QList<double> circles, QString deviceModelName, QString portSerial, QString rts2Url, QString rts2Username, QString rts2Password)
197 {
198 //Validation
199 if(!isValidSlotNumber(slotNumber))
200@@ -1230,13 +1272,18 @@
201 initString = QString("%1:TCP:%2:%3:%4:%5").arg(name, equinox, "localhost", QString::number(portTCP), QString::number(delay));
202 break;
203
204+ case ConnectionRTS2:
205+ if (!rts2Url.isEmpty())
206+ initString = QString("%1:RTS2:%2:http://%3:%4@%5").arg(name, equinox, rts2Username, rts2Password, rts2Url);
207+ break;
208+
209 case ConnectionRemote:
210 default:
211 if (isValidPort(portTCP) && !host.isEmpty())
212 initString = QString("%1:TCP:%2:%3:%4:%5").arg(name, equinox, host, QString::number(portTCP), QString::number(delay));
213 }
214
215- //qDebug() << "initString:" << initString;
216+ qDebug() << "connectionType:" << connectionType << " initString:" << initString;
217
218 TelescopeClient* newTelescope = TelescopeClient::create(initString);
219 if (newTelescope)
220
221=== modified file 'plugins/TelescopeControl/src/TelescopeControl.hpp'
222--- plugins/TelescopeControl/src/TelescopeControl.hpp 2016-07-10 03:16:07 +0000
223+++ plugins/TelescopeControl/src/TelescopeControl.hpp 2017-04-06 13:21:42 +0000
224@@ -119,9 +119,9 @@
225 //These are public, but not slots, because they don't use sufficient validation. Scripts shouldn't be able to add/remove telescopes, only to point them.
226 //! Adds a telescope description containing the given properties. DOES NOT VALIDATE its parameters. If serverName is specified, portSerial should be specified too. Call saveTelescopes() to write the modified configuration to disc. Call startTelescopeAtSlot() to start this telescope.
227 //! @param portSerial must be a valid serial port name for the particular platform, e.g. "COM1" for Microsoft Windows of "/dev/ttyS0" for Linux
228- bool addTelescopeAtSlot(int slot, ConnectionType connectionType, QString name, QString equinox, QString host = QString("localhost"), int portTCP = DEFAULT_TCP_PORT, int delay = DEFAULT_DELAY, bool connectAtStartup = false, QList<double> circles = QList<double>(), QString serverName = QString(), QString portSerial = QString());
229+ bool addTelescopeAtSlot(int slot, ConnectionType connectionType, QString name, QString equinox, QString host = QString("localhost"), int portTCP = DEFAULT_TCP_PORT, int delay = DEFAULT_DELAY, bool connectAtStartup = false, QList<double> circles = QList<double>(), QString serverName = QString(), QString portSerial = QString(), QString rts2Url = QString(), QString rts2Username = QString(), QString rts2Password = QString());
230 //! Retrieves a telescope description. Returns false if the slot is empty. Returns empty serverName and portSerial if the description contains no server.
231- bool getTelescopeAtSlot(int slot, ConnectionType& connectionType, QString& name, QString& equinox, QString& host, int& portTCP, int& delay, bool& connectAtStartup, QList<double>& circles, QString& serverName, QString& portSerial);
232+ bool getTelescopeAtSlot(int slot, ConnectionType& connectionType, QString& name, QString& equinox, QString& host, int& portTCP, int& delay, bool& connectAtStartup, QList<double>& circles, QString& serverName, QString& portSerial, QString& rts2Url, QString& rts2Username, QString& rts2Password);
233 //! Removes info from the tree. Should it include stopTelescopeAtSlot()?
234 bool removeTelescopeAtSlot(int slot);
235
236@@ -338,7 +338,7 @@
237 bool stopServerAtSlot(int slot);
238
239 //! A wrapper for TelescopeClient::create(). Used internally by loadTelescopes() and startTelescopeAtSlot(). Does not perform any validation on its arguments.
240- bool startClientAtSlot(int slot, ConnectionType connectionType, QString name, QString equinox, QString host, int portTCP, int delay, QList<double> circles, QString serverName = QString(), QString portSerial = QString());
241+ bool startClientAtSlot(int slot, ConnectionType connectionType, QString name, QString equinox, QString host, int portTCP, int delay, QList<double> circles, QString serverName = QString(), QString portSerial = QString(), QString rts2Url = QString(), QString rts2Username = QString(), QString rts2Password = QString());
242
243 //! Returns true if the TelescopeClient at this slot has been stopped successfully or doesn't exist
244 bool stopClientAtSlot(int slot);
245
246=== modified file 'plugins/TelescopeControl/src/TelescopeControlGlobals.hpp'
247--- plugins/TelescopeControl/src/TelescopeControlGlobals.hpp 2016-01-08 21:01:34 +0000
248+++ plugins/TelescopeControl/src/TelescopeControlGlobals.hpp 2017-04-06 13:21:42 +0000
249@@ -52,6 +52,7 @@
250 ConnectionInternal,
251 ConnectionLocal,
252 ConnectionRemote,
253+ ConnectionRTS2,
254 ConnectionCount
255 };
256
257
258=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClient.cpp'
259--- plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2017-03-13 11:34:19 +0000
260+++ plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2017-04-06 13:21:42 +0000
261@@ -24,6 +24,7 @@
262 */
263
264 #include "TelescopeClient.hpp"
265+#include "TelescopeClientJsonRts2.hpp"
266 #include "TelescopeClientDirectLx200.hpp"
267 #include "TelescopeClientDirectNexStar.hpp"
268 #include "StelUtils.hpp"
269@@ -93,6 +94,10 @@
270 {
271 newTelescope = new TelescopeTCP(name, params, eq);
272 }
273+ else if (type == "RTS2")
274+ {
275+ newTelescope = new TelescopeClientJsonRts2(name, params, eq);
276+ }
277 else if (type == "TelescopeServerLx200") //BM: One of the rare occasions of painless extension
278 {
279 newTelescope= new TelescopeClientDirectLx200(name, params, eq);
280
281=== added file 'plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp'
282--- plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp 1970-01-01 00:00:00 +0000
283+++ plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp 2017-04-06 13:21:42 +0000
284@@ -0,0 +1,175 @@
285+/*
286+ * RTS2 Json stellarium plugin
287+ *
288+ * Copyright (C) 2014-2016 Petr Kubanek
289+ *
290+ * This program is free software; you can redistribute it and/or
291+ * modify it under the terms of the GNU General Public License
292+ * as published by the Free Software Foundation; either version 2
293+ * of the License, or (at your option) any later version.
294+ *
295+ * This program is distributed in the hope that it will be useful,
296+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
297+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
298+ * GNU General Public License for more details.
299+ *
300+ * You should have received a copy of the GNU General Public License
301+ * along with this program; if not, write to the Free Software
302+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
303+ */
304+
305+#include "StelUtils.hpp"
306+
307+#include "QByteArray"
308+#include "QJsonArray"
309+#include "QJsonDocument"
310+#include "QJsonParseError"
311+#include "QJsonObject"
312+#include "QUrlQuery"
313+
314+#include "TelescopeClientJsonRts2.hpp"
315+
316+TelescopeClientJsonRts2::TelescopeClientJsonRts2(const QString &name, const QString &params, Equinox eq)
317+ : TelescopeClient(name)
318+ , networkManager(new QNetworkAccessManager)
319+ , equinox(eq)
320+ , baseurl("http://localhost:8889/")
321+ , telName("")
322+ , time_delay(500)
323+{
324+ // Example params:
325+ // petr:test@localhost:8889/tel
326+
327+ qDebug() << "TelescopeRTS2 paramaters: " << params;
328+
329+ baseurl.setUrl(params);
330+ if (!baseurl.isValid())
331+ {
332+ qWarning() << "TelescopeRTS2 invalid URL";
333+ return;
334+ }
335+
336+ QUrl rurl(baseurl);
337+
338+ rurl.setPath(baseurl.path() + "/api/devbytype");
339+
340+ QUrlQuery query;
341+ query.addQueryItem("t", "2");
342+ rurl.setQuery(query);
343+
344+ QNetworkRequest cfgRequest;
345+
346+ cfgRequest.setUrl(rurl);
347+
348+ qDebug() << "request url:" << rurl.toString();
349+
350+ connect(&networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
351+
352+ networkManager.get(cfgRequest);
353+}
354+
355+TelescopeClientJsonRts2::~TelescopeClientJsonRts2(void)
356+{
357+}
358+
359+void TelescopeClientJsonRts2::replyFinished(QNetworkReply *reply)
360+{
361+ qDebug() << "TelescopeRTS2 error" << reply->error();
362+ if (reply->error() != QNetworkReply::NoError)
363+ {
364+ telName = "";
365+ return;
366+ }
367+
368+ QByteArray data = reply->readAll();
369+ //qDebug() << "TelescopeRTS2 data" << (QString) data;
370+
371+ QJsonDocument doc;
372+ QJsonParseError jsonError;
373+ doc = QJsonDocument::fromJson(data, &jsonError);
374+
375+ if (reply->url().path().endsWith("/api/devbytype"))
376+ {
377+ QJsonArray arr = doc.array();
378+ telName = arr[0].toString();
379+
380+ QUrl rurl(baseurl);
381+
382+ rurl.setPath(baseurl.path() + "/api/get");
383+
384+ QUrlQuery query;
385+ query.addQueryItem("d", telName);
386+ rurl.setQuery(query);
387+
388+ request.setUrl(rurl);
389+
390+ qDebug() << "request url:" << rurl.toString();
391+
392+ networkManager.get(request);
393+ }
394+ else if (reply->url().path().endsWith("/api/get"))
395+ {
396+ QJsonObject docObject = doc.object();
397+ QJsonObject dObject = docObject["d"].toObject();
398+ QJsonObject telObject = dObject["TEL"].toObject();
399+
400+ qDebug() << "TelescopeRTS2 object" << doc.isNull() << jsonError.errorString() << jsonError.offset << telObject["ra"].toDouble() << telObject["dec"].toDouble();
401+
402+ const double ra = telObject["ra"].toDouble() * M_PI / 180.0;
403+ const double dec = telObject["dec"].toDouble() * M_PI / 180.0;
404+ const double cdec = cos(dec);
405+
406+ qDebug() << "TelescopeRTS2 RADEC" << ra << dec;
407+
408+ Vec3d pos(cos(ra)*cdec, sin(ra)*cdec, sin(dec));
409+ interpolatedPosition.add(pos, getNow(), getNow(), 0);
410+
411+ qDebug() << "request url:" << request.url().toString();
412+
413+ networkManager.get(request);
414+ }
415+ else
416+ {
417+ qWarning() << "unhandled reply: " << reply->url().toString();
418+ }
419+}
420+
421+bool TelescopeClientJsonRts2::isConnected(void) const
422+{
423+ return telName.isEmpty() == false;
424+}
425+
426+Vec3d TelescopeClientJsonRts2::getJ2000EquatorialPos(const StelCore* core) const
427+{
428+ const qint64 now = getNow() - time_delay;
429+ return interpolatedPosition.get(now);
430+}
431+
432+void TelescopeClientJsonRts2::telescopeGoto(const Vec3d &j2000Pos)
433+{
434+ if (!isConnected())
435+ return;
436+
437+ double ra, dec;
438+ StelUtils::rectToSphe(&ra, &dec, j2000Pos);
439+
440+ QUrl set(baseurl);
441+ set.setPath(baseurl.path() + "/api/cmd");
442+
443+ QUrlQuery query;
444+ query.addQueryItem("d", telName);
445+ query.addQueryItem("c", QString("move+%1+%2").arg(ra * 180 / M_PI).arg(dec * 180 / M_PI));
446+ set.setQuery(query);
447+
448+ QNetworkRequest setR;
449+ setR.setUrl(set);
450+
451+ qDebug() << "GoTo request: " << set.toString();
452+
453+ networkManager.get(setR);
454+}
455+
456+bool TelescopeClientJsonRts2::hasKnownPosition(void) const
457+{
458+ return interpolatedPosition.isKnown();
459+}
460
461=== added file 'plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp'
462--- plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp 1970-01-01 00:00:00 +0000
463+++ plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp 2017-04-06 13:21:42 +0000
464@@ -0,0 +1,61 @@
465+/*
466+ * RTS2 Json stellarium plugin
467+ *
468+ * Copyright (C) 2014-2016 Petr Kubanek
469+ *
470+ * This program is free software; you can redistribute it and/or
471+ * modify it under the terms of the GNU General Public License
472+ * as published by the Free Software Foundation; either version 2
473+ * of the License, or (at your option) any later version.
474+ *
475+ * This program is distributed in the hope that it will be useful,
476+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
477+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
478+ * GNU General Public License for more details.
479+ *
480+ * You should have received a copy of the GNU General Public License
481+ * along with this program; if not, write to the Free Software
482+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
483+ */
484+
485+#ifndef _TELESCOPE_CLIENT_JSON_RTS2_HPP_
486+#define _TELESCOPE_CLIENT_JSON_RTS2_HPP_
487+
488+#include "QNetworkAccessManager"
489+#include "QNetworkRequest"
490+#include "QNetworkReply"
491+#include "QUrl"
492+
493+#include "TelescopeClient.hpp"
494+
495+#include "StelCore.hpp"
496+
497+//! RTS2 JSON telescope.
498+class TelescopeClientJsonRts2 : public TelescopeClient
499+{
500+ Q_OBJECT
501+public:
502+ TelescopeClientJsonRts2(const QString &name, const QString &params, Equinox eq = EquinoxJ2000);
503+ ~TelescopeClientJsonRts2(void);
504+ virtual bool isConnected(void) const;
505+
506+ Vec3d getJ2000EquatorialPos(const StelCore* core=0) const;
507+
508+ void telescopeGoto(const Vec3d &j2000Pos);
509+ bool hasKnownPosition(void) const;
510+
511+private:
512+ QNetworkAccessManager networkManager;
513+ Equinox equinox;
514+ QUrl baseurl;
515+ QString telName;
516+ QNetworkRequest request;
517+ Vec3d position;
518+ InterpolatedPosition interpolatedPosition;
519+ int time_delay;
520+
521+private slots:
522+ void replyFinished(QNetworkReply *reply);
523+};
524+
525+#endif // _TELESCOPE_CLIENT_JSON_RTS2_HPP_
526
527=== modified file 'plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.cpp'
528--- plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.cpp 2017-01-05 15:28:52 +0000
529+++ plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.cpp 2017-04-06 13:21:42 +0000
530@@ -43,7 +43,7 @@
531 , configuredSlot(0)
532 {
533 ui = new Ui_telescopeConfigurationDialog();
534-
535+
536 telescopeManager = GETSTELMODULE(TelescopeControl);
537
538 telescopeNameValidator = new QRegExpValidator (QRegExp("[^:\"]+"), this);//Test the update for JSON
539@@ -122,7 +122,7 @@
540 void TelescopeConfigurationDialog::createDialogContent()
541 {
542 ui->setupUi(dialog);
543-
544+
545 //Inherited connect
546 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
547 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(buttonDiscardPressed()));
548@@ -133,6 +133,7 @@
549 connect(ui->radioButtonTelescopeLocal, SIGNAL(toggled(bool)), this, SLOT(toggleTypeLocal(bool)));
550 connect(ui->radioButtonTelescopeConnection, SIGNAL(toggled(bool)), this, SLOT(toggleTypeConnection(bool)));
551 connect(ui->radioButtonTelescopeVirtual, SIGNAL(toggled(bool)), this, SLOT(toggleTypeVirtual(bool)));
552+ connect(ui->radioButtonTelescopeRTS2, SIGNAL(toggled(bool)), this, SLOT(toggleTypeRTS2(bool)));
553
554 connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(buttonSavePressed()));
555 connect(ui->pushButtonDiscard, SIGNAL(clicked()), this, SLOT(buttonDiscardPressed()));
556@@ -149,6 +150,10 @@
557 //Set the configuration panel in a predictable state
558 void TelescopeConfigurationDialog::initConfigurationDialog()
559 {
560+ ui->groupBoxConnectionSettings->hide();
561+ ui->groupBoxDeviceSettings->hide();
562+ ui->groupBoxRTS2Settings->hide();
563+
564 //Reusing code used in both methods that call this one
565 deviceModelNames = telescopeManager->getDeviceModels().keys();
566
567@@ -213,7 +218,7 @@
568 configuredSlot = slot;
569 initConfigurationDialog();
570 ui->stelWindowTitle->setText(q_("Configure Telescope"));
571-
572+
573 //Read the telescope properties
574 QString name;
575 ConnectionType connectionType;
576@@ -225,7 +230,10 @@
577 QList<double> circles;
578 QString deviceModelName;
579 QString serialPortName;
580- if(!telescopeManager->getTelescopeAtSlot(slot, connectionType, name, equinox, host, portTCP, delay, connectAtStartup, circles, deviceModelName, serialPortName))
581+ QString rts2Url;
582+ QString rts2Username;
583+ QString rts2Password;
584+ if(!telescopeManager->getTelescopeAtSlot(slot, connectionType, name, equinox, host, portTCP, delay, connectAtStartup, circles, deviceModelName, serialPortName, rts2Url, rts2Username, rts2Password))
585 {
586 //TODO: Add debug
587 return;
588@@ -265,10 +273,17 @@
589 ui->radioButtonTelescopeConnection->setChecked(true);
590 ui->lineEditHostName->setText("localhost");
591 }
592- else
593+ else if (connectionType == ConnectionVirtual)
594 {
595 ui->radioButtonTelescopeVirtual->setChecked(true);
596 }
597+ else if (connectionType == ConnectionRTS2)
598+ {
599+ ui->radioButtonTelescopeRTS2->setChecked(true);
600+ ui->lineEditRTS2Url->setText(rts2Url);
601+ ui->lineEditRTS2Username->setText(rts2Username);
602+ ui->lineEditRTS2Password->setText(rts2Password);
603+ }
604
605 //Equinox
606 if (equinox == "JNow")
607@@ -310,16 +325,13 @@
608 ui->lineEditHostName->setText("localhost");
609 ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(configuredSlot));
610
611- //Enable/disable controls
612- ui->labelHost->setEnabled(false);
613- ui->lineEditHostName->setEnabled(false);
614+ ui->groupBoxDeviceSettings->show();
615
616 ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties);
617 }
618 else
619 {
620- ui->labelHost->setEnabled(true);
621- ui->lineEditHostName->setEnabled(true);
622+ ui->groupBoxDeviceSettings->hide();
623 }
624 }
625
626@@ -331,25 +343,38 @@
627 ui->lineEditHostName->setText("localhost");
628 ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(configuredSlot));
629
630- ui->groupBoxDeviceSettings->setEnabled(false);
631+ ui->groupBoxConnectionSettings->show();
632
633 ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties);
634 }
635 else
636 {
637- ui->groupBoxDeviceSettings->setEnabled(true);
638+ ui->groupBoxConnectionSettings->hide();
639 }
640 }
641
642 void TelescopeConfigurationDialog::toggleTypeVirtual(bool isChecked)
643 {
644- //TODO: This really should be done in the GUI
645- ui->groupBoxDeviceSettings->setEnabled(!isChecked);
646- ui->groupBoxConnectionSettings->setEnabled(!isChecked);
647-
648 ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties);
649 }
650
651+void TelescopeConfigurationDialog::toggleTypeRTS2(bool isChecked)
652+{
653+ if(isChecked)
654+ {
655+ //Re-initialize values that may have been changed
656+ ui->lineEditRTS2Url->setText("localhost:8889");
657+
658+ ui->groupBoxRTS2Settings->show();
659+
660+ ui->scrollArea->ensureWidgetVisible(ui->groupBoxRTS2Settings);
661+ }
662+ else
663+ {
664+ ui->groupBoxRTS2Settings->hide();
665+ }
666+}
667+
668 void TelescopeConfigurationDialog::buttonSavePressed()
669 {
670 //Main telescope properties
671@@ -415,6 +440,11 @@
672 type = ConnectionVirtual;
673 telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, QString(), portTCP, delay, connectAtStartup, circles);
674 }
675+ else if (ui->radioButtonTelescopeRTS2->isChecked())
676+ {
677+ type = ConnectionRTS2;
678+ telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, host, portTCP, delay, connectAtStartup, circles, QString(), QString(), ui->lineEditRTS2Url->text(), ui->lineEditRTS2Username->text(), ui->lineEditRTS2Password->text());
679+ }
680
681 emit changesSaved(name, type);
682 }
683
684=== modified file 'plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.hpp'
685--- plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.hpp 2016-04-23 13:33:16 +0000
686+++ plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.hpp 2017-04-06 13:21:42 +0000
687@@ -63,6 +63,7 @@
688 void toggleTypeLocal(bool);
689 void toggleTypeConnection(bool);
690 void toggleTypeVirtual(bool);
691+ void toggleTypeRTS2(bool);
692
693 void deviceModelSelected(const QString&);
694 bool validateHost(QString hostName);
695
696=== modified file 'plugins/TelescopeControl/src/gui/TelescopeDialog.cpp'
697--- plugins/TelescopeControl/src/gui/TelescopeDialog.cpp 2017-01-05 15:28:52 +0000
698+++ plugins/TelescopeControl/src/gui/TelescopeDialog.cpp 2017-04-06 13:21:42 +0000
699@@ -176,7 +176,10 @@
700 QList<double> circles;
701 QString serverName;
702 QString portSerial;
703- if(!telescopeManager->getTelescopeAtSlot(slotNumber, connectionType, name, equinox, host, portTCP, delay, connectAtStartup, circles, serverName, portSerial))
704+ QString rts2Url;
705+ QString rts2Username;
706+ QString rts2Password;
707+ if(!telescopeManager->getTelescopeAtSlot(slotNumber, connectionType, name, equinox, host, portTCP, delay, connectAtStartup, circles, serverName, portSerial, rts2Url, rts2Username, rts2Password))
708 continue;
709
710 //Determine the server type
711@@ -502,6 +505,10 @@
712 // TRANSLATORS: Telescope connection type
713 typeLabel = N_("virtual");
714 break;
715+ case ConnectionRTS2:
716+ // TRANSLATORS: Telescope connection type
717+ typeLabel = N_("RTS2");
718+ break;
719 default:
720 ;
721 }
722
723=== modified file 'plugins/TelescopeControl/src/gui/telescopeConfigurationDialog.ui'
724--- plugins/TelescopeControl/src/gui/telescopeConfigurationDialog.ui 2016-04-23 15:55:46 +0000
725+++ plugins/TelescopeControl/src/gui/telescopeConfigurationDialog.ui 2017-04-06 13:21:42 +0000
726@@ -213,6 +213,28 @@
727 </widget>
728 </item>
729 <item>
730+ <widget class="QRadioButton" name="radioButtonTelescopeRTS2">
731+ <property name="sizePolicy">
732+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
733+ <horstretch>0</horstretch>
734+ <verstretch>0</verstretch>
735+ </sizepolicy>
736+ </property>
737+ <property name="minimumSize">
738+ <size>
739+ <width>0</width>
740+ <height>24</height>
741+ </size>
742+ </property>
743+ <property name="toolTip">
744+ <string>Telescope which is accessible through RTS2(.org) JSON API</string>
745+ </property>
746+ <property name="text">
747+ <string>RTS2 telescope</string>
748+ </property>
749+ </widget>
750+ </item>
751+ <item>
752 <widget class="QRadioButton" name="radioButtonTelescopeVirtual">
753 <property name="sizePolicy">
754 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
755@@ -243,9 +265,9 @@
756 <property name="geometry">
757 <rect>
758 <x>0</x>
759- <y>0</y>
760- <width>549</width>
761- <height>520</height>
762+ <y>-283</y>
763+ <width>547</width>
764+ <height>603</height>
765 </rect>
766 </property>
767 <layout class="QVBoxLayout" name="verticalLayoutScrollArea">
768@@ -580,7 +602,7 @@
769 <item row="0" column="0">
770 <widget class="QLabel" name="labelHost">
771 <property name="enabled">
772- <bool>false</bool>
773+ <bool>true</bool>
774 </property>
775 <property name="text">
776 <string>Host:</string>
777@@ -590,7 +612,7 @@
778 <item row="1" column="0">
779 <widget class="QLineEdit" name="lineEditHostName">
780 <property name="enabled">
781- <bool>false</bool>
782+ <bool>true</bool>
783 </property>
784 <property name="toolTip">
785 <string>Host name or IPv4 address of the machine that hosts the telescope server</string>
786@@ -640,6 +662,90 @@
787 </widget>
788 </item>
789 <item>
790+ <widget class="QGroupBox" name="groupBoxRTS2Settings">
791+ <property name="title">
792+ <string>RTS2 telescope settings</string>
793+ </property>
794+ <layout class="QGridLayout" name="gridLayout">
795+ <property name="leftMargin">
796+ <number>0</number>
797+ </property>
798+ <property name="topMargin">
799+ <number>0</number>
800+ </property>
801+ <property name="rightMargin">
802+ <number>0</number>
803+ </property>
804+ <property name="bottomMargin">
805+ <number>0</number>
806+ </property>
807+ <item row="0" column="0">
808+ <widget class="QLabel" name="labelRTS2Host">
809+ <property name="text">
810+ <string>URL:</string>
811+ </property>
812+ </widget>
813+ </item>
814+ <item row="2" column="0">
815+ <widget class="QLabel" name="labelRTS2Username">
816+ <property name="text">
817+ <string>Username:</string>
818+ </property>
819+ </widget>
820+ </item>
821+ <item row="2" column="1">
822+ <widget class="QLabel" name="labelRTS2Password">
823+ <property name="text">
824+ <string>Password:</string>
825+ </property>
826+ </widget>
827+ </item>
828+ <item row="3" column="0">
829+ <widget class="QLineEdit" name="lineEditRTS2Username">
830+ <property name="toolTip">
831+ <string>RTS2 username</string>
832+ </property>
833+ <property name="text">
834+ <string notr="true"/>
835+ </property>
836+ <property name="maxLength">
837+ <number>50</number>
838+ </property>
839+ </widget>
840+ </item>
841+ <item row="3" column="1">
842+ <widget class="QLineEdit" name="lineEditRTS2Password">
843+ <property name="toolTip">
844+ <string>RTS2 password</string>
845+ </property>
846+ <property name="text">
847+ <string notr="true"/>
848+ </property>
849+ <property name="maxLength">
850+ <number>50</number>
851+ </property>
852+ <property name="echoMode">
853+ <enum>QLineEdit::Password</enum>
854+ </property>
855+ </widget>
856+ </item>
857+ <item row="1" column="0" colspan="2">
858+ <widget class="QLineEdit" name="lineEditRTS2Url">
859+ <property name="toolTip">
860+ <string>URL of the machine that hosts the RTS2 JSON (httpd) server</string>
861+ </property>
862+ <property name="text">
863+ <string notr="true">localhost</string>
864+ </property>
865+ <property name="maxLength">
866+ <number>255</number>
867+ </property>
868+ </widget>
869+ </item>
870+ </layout>
871+ </widget>
872+ </item>
873+ <item>
874 <widget class="QGroupBox" name="groupBoxUserInterface">
875 <property name="title">
876 <string>User interface settings</string>