#!/bin/bash
# This is an example how to run GPS emulator 
# The scope can be controlled from the Hand Controler.
# This emulates celestron gps module.
# Run the following command:
#
# LANG=C indiserver -v -p 7777 indi_nexstarevo_telescope indi_gpsd
#
# and then execute this script to activate the emulator
# You need to have running gpsd driver and saved proper configuration
# for both drivers (just manually connect to the scope and save the config)
# I am using this on raspberry pi as a gpsemulator.

export LANG=C 

INDIPORT='7777'
INDIHOST='localhost'

SETPROP="indi_setprop -h $INDIHOST -p $INDIPORT "
GETPROP="indi_getprop -h $INDIHOST -p $INDIPORT "

SCOPEDRV="NexStar Evolution"
GPSDRV="GPSD"

# Activate and connect Scope
$SETPROP -s "$SCOPEDRV.CONFIG_PROCESS.CONFIG_LOAD=On"
$SETPROP -s "$SCOPEDRV.CONNECTION.CONNECT=On;DISCONNECT=Off"
$SETPROP -s "$SCOPEDRV.CONFIG_PROCESS.CONFIG_LOAD=On"

# Activate and connect GPSD
$SETPROP -s "$GPSDRV.CONNECTION.CONNECT=On;DISCONNECT=Off"
$SETPROP -s "$GPSDRV.GPS_REFRESH.REFRESH=On"

sleep 1

$GETPROP "$SCOPEDRV.GEOGRAPHIC_COORD.*"
$GETPROP "$SCOPEDRV.TIME_UTC.*"
$GETPROP "$GPSDRV.GEOGRAPHIC_COORD.*"
$GETPROP "$GPSDRV.TIME_UTC.*"





