Skip to content

About

DeepskyLog in an Android app that sends the objects of your observing list to your telescope mount (GoTo)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DeepskyLog GoTo (Android)

The companion app of DeepskyLog (source: the DeepskyLog repository, deepskylog/), which holds the web side: the At the eyepiece page with its GoTo link, the list of lists the app starts on, and the app login.

DeepskyLog in an app that can steer the telescope. The app shows DeepskyLog in a web view, starting on the lists to take to the telescope (/observing-lists/eyepiece). Each list opens its At the eyepiece page (/observing-list/{slug}/eyepiece), whose GoTo button slews the mount at once. A slew shows the object, the mount's answer and Stop at the bottom of the screen. Lists in the top bar goes back to the lists, and Mount opens the mount settings and the address of DeepskyLog (default https://www.deepskylog.org).

A web page can't open the raw network connection a mount expects, so the page's GoTo button is a link the app takes:

dslgoto://goto?name=M%2031&ra=10.68458&dec=41.26875&epoch=J2000

RA and declination are in degrees. epoch=J2000 is used for deep-sky objects, and epoch=date for planets, comets, asteroids and the Moon (DeepskyLog's apparent position at the object's time in the list). The app converts the position to the equinox the mount expects (setting: of date (JNow) or J2000). The same link opened in Chrome shows the object in the app with a GoTo button, without slewing.

Everything else is the website itself: Log it, Quick note, the charts, the red night mode, the offline saving of a list (service worker), uploading a drawing, and downloading a list's exports (to Downloads, e.g. the .skylist for the Nexus's microSD card).

Logging in

With a password: on DeepskyLog's login page in the app, as on the website. The app keeps the session.

With Google or GitHub: Google refuses to log in inside an app's web view, so the app opens the login in the browser (a Custom Tab), on DeepskyLog's /app/login (AppLoginController). After the login, that page hands a one-time code back to the app through dslgoto://login?code=…, and the app redeems it in the web view (/app/login/redeem), which logs you in there. As in OAuth for apps (PKCE, RFC 7636), the app first sends the SHA-256 of a secret of its own and redeems the code with that secret. Another app that catches the link therefore can't use the code. A code is valid for 5 minutes and only once.

Mount drivers

mount/MountDriver.kt is the interface the app uses (connect, position, goTo). Each protocol is a driver of its own, chosen with MountProtocol:

Protocol Driver Mounts
LX200_TCP Lx200Driver + Lx200TcpTransport Nexus DSC / DSC Pro (10.0.0.1:4060), OnStep, SkyFi and other LX200-over-WiFi adapters

To add a mount, add a MountProtocol entry and a driver class. Possible next ones are Celestron NexStar/SkyPortal WiFi, Sky-Watcher SynScan WiFi (UDP 11880), iOptron and ASCOM Alpaca (HTTP). Lx200Driver reads from an Lx200Transport, so LX200 over Bluetooth or a USB serial line only needs another transport.

A driver also has stop() (LX200 :Q#). The app opens a new connection for every command and closes it afterwards, so SkySafari can still connect to the mount in between. Whether the Nexus DSC accepts this app while SkySafari is connected has not been tested yet.

The WiFi of the Nexus has no internet, so Android keeps mobile data as the default network. WifiSocketConnector therefore opens the socket on the WiFi network itself: without that, the connection to 10.0.0.1 would go out over mobile data.

Android 17 blocks connections to the local network for apps that target it, unless the app has the permission ACCESS_LOCAL_NETWORK (shown as Nearby devices): without it the connection just times out. The app asks for it before its first command to the mount.

Build and run

Requirements: Android Studio (SDK in ~/Android/Sdk) and JDK 17 or newer.

cd deepskylog-goto
./gradlew testDebugUnitTest     # unit tests: LX200 commands, precession, link
./gradlew installDebug          # install on the connected phone/tablet (adb)

Or open this folder in Android Studio and press Run.

Testing without a telescope

On the computer, run a fake mount with nc -lk 4060. In the app, under Mount, enter the computer's IP address and tap Test the connection, or GoTo on a page: the LX200 commands (:GR#, :Sr…#, :Sd…#, :MS#, :Q#) show up in the terminal. Netcat doesn't answer, so the app reports a time-out after 3 s.

From the computer, a link can be sent to the phone directly:

adb shell am start -a android.intent.action.VIEW -d 'dslgoto://goto?name=M%2031&ra=10.68458&dec=41.26875&epoch=J2000'

Testing against DeepskyLog on the computer

The debug build also allows plain http. With the phone on USB:

adb reverse tcp:8000 tcp:80

Then, under Mount, set the address of DeepskyLog to http://localhost:8000: the phone's port 8000 now leads to the computer's web server. Logging in with Google only works on the real site, because Google only accepts its own registered return addresses.

Licence

GPL-3.0, as DeepskyLog: see LICENSE.

About

DeepskyLog in an Android app that sends the objects of your observing list to your telescope mount (GoTo)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages