@@ -62,26 +62,30 @@ Public Class Telescope
62
62
Friend Shared traceStateProfileName As String = "Trace Level"
63
63
Friend Shared latitudeProfileName As String = "Latitude"
64
64
Friend Shared longitudeProfileName As String = "Longitude"
65
+ Friend Shared elevationProfileName As String = "Elevation"
65
66
66
67
Friend Shared comPortDefault As String = "COM1"
67
68
Friend Shared traceStateDefault As String = "False"
68
69
Friend Shared latitudeDefault As Double = 39.8283
69
70
Friend Shared longitudeDefault As Double = - 98.5795
71
+ Friend Shared elevationDefault As Integer = 1
70
72
71
73
Friend Shared comPort As String ' Variables to hold the currrent device configuration
72
74
Friend Shared portNum As String
73
75
Friend Shared traceState As Boolean
74
76
Friend Shared latitude As Double
75
77
Friend Shared longitude As Double
78
+ Friend Shared elevation As Integer
76
79
77
80
Private connectedState As Boolean ' Private variable to hold the connected state
78
81
Private utilities As Util ' Private variable to hold an ASCOM Utilities object
79
82
Private astroUtilities As AstroUtils ' Private variable to hold an AstroUtils object to provide the Range method
80
83
Private TL As TraceLogger ' Private variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
81
84
Private objSerial As ASCOM.Utilities.Serial
82
85
Private isParked As Boolean = False
86
+ Private targetRA As Double , targetDec As Double , targetRASet As Boolean = False , targetDecSet As Boolean = False
83
87
Dim mutexBlind As Mutex, mutexCommand As Mutex
84
- Private m_TrackingRates(- 1 ) As DriveRates
88
+ ' Private m_TrackingRates(-1) As DriveRates
85
89
86
90
'
87
91
' Constructor - Must be public for COM registration!
@@ -702,14 +706,16 @@ Public Class Telescope
702
706
703
707
Public Property SiteElevation() As Double Implements ITelescopeV3.SiteElevation
704
708
Get
705
- TL.LogMessage( "SiteElevation Get" , "0 - Hardcoded" )
706
- ' Used by SiderealTIme
707
- ' Throw New ASCOM.PropertyNotImplementedException("SiteElevation", False)
708
- Return 0
709
+ TL.LogMessage( "SiteElevation Get" , elevation.ToString)
710
+ Return elevation
709
711
End Get
710
712
Set (value As Double )
711
- TL.LogMessage( "SiteElevation Set" , "Not implemented" )
712
- Throw New ASCOM.PropertyNotImplementedException( "SiteElevation" , True )
713
+ If value >= - 300 And value <= 10000 Then
714
+ TL.LogMessage( "SiteElevation Set" , value.ToString)
715
+ elevation = value
716
+ Else
717
+ Throw New ASCOM.InvalidValueException( "SiteElevation" )
718
+ End If
713
719
End Set
714
720
End Property
715
721
@@ -799,9 +805,7 @@ Public Class Telescope
799
805
End Sub
800
806
801
807
Public Sub SlewToTarget() Implements ITelescopeV3.SlewToTarget
802
- ' When do we want to use slew to target?
803
- TL.LogMessage( "SlewToTarget" , "Not implemented" )
804
- Throw New ASCOM.MethodNotImplementedException( "SlewToTarget" )
808
+ SlewToCoordinates(TargetRightAscension, TargetDeclination)
805
809
End Sub
806
810
807
811
Public Sub SlewToTargetAsync() Implements ITelescopeV3.SlewToTargetAsync
@@ -834,29 +838,59 @@ Public Class Telescope
834
838
835
839
Public Property TargetDeclination() As Double Implements ITelescopeV3.TargetDeclination
836
840
Get
837
- Dim declination__t As Double = 0.0
838
- Dim targetDec As String = CommandString( ":Gd" )
839
- TL.LogMessage( "TargetDeclination" , "Get - " & targetDec)
840
- declination__t = utilities.DMSToDegrees(targetDec)
841
- Return declination__t
841
+ If targetDecSet Then
842
+ TL.LogMessage( "TargetDeclination Get" , targetDec.ToString)
843
+ Return targetDec
844
+ Else
845
+ TL.LogMessage( "TargetDeclination Get" , "Value not set" )
846
+ Throw New ASCOM.ValueNotSetException( "TargetDeclination" )
847
+ End If
848
+ 'Dim declination__t As Double = 0.0
849
+ 'Dim targetDec As String = CommandString(":Gd")
850
+ 'TL.LogMessage("TargetDeclination", "Get - " & targetDec)
851
+ 'declination__t = utilities.DMSToDegrees(targetDec)
852
+ 'Return declination__t
842
853
End Get
843
854
Set (value As Double )
844
- TL.LogMessage( "TargetDeclination Set" , "Not implemented" )
845
- Throw New ASCOM.PropertyNotImplementedException( "TargetDeclination" , True )
855
+ If value >= - 90 And value <= 90 Then
856
+ TL.LogMessage( "TargetDeclination Set" , value.ToString)
857
+ targetDec = value
858
+ targetDecSet = True
859
+ Else
860
+ TL.LogMessage( "TargetDeclination Set" , "Invalid Value " + value.ToString)
861
+ Throw New ASCOM.InvalidValueException( "TargetDeclination" )
862
+ End If
863
+ 'TL.LogMessage("TargetDeclination Set", "Not implemented")
864
+ 'Throw New ASCOM.PropertyNotImplementedException("TargetDeclination", True)
846
865
End Set
847
866
End Property
848
867
849
868
Public Property TargetRightAscension() As Double Implements ITelescopeV3.TargetRightAscension
850
869
Get
851
- Dim rightAscension__t As Double = 0.0
852
- Dim targetRA As String = CommandString( ":Gr" )
853
- TL.LogMessage( "TargetRightAscension" , "Get - " + targetRA)
854
- rightAscension__t = utilities.HMSToHours(targetRA)
855
- Return rightAscension__t
870
+ If targetRASet Then
871
+ TL.LogMessage( "TargetRightAscension Get" , targetRA.ToString)
872
+ Return targetRA
873
+ Else
874
+ TL.LogMessage( "TargetRightAscension Get" , "Value not set" )
875
+ Throw New ASCOM.ValueNotSetException( "TargetRightAscension" )
876
+ End If
877
+ 'Dim rightAscension__t As Double = 0.0
878
+ 'Dim targetRA As String = CommandString(":Gr")
879
+ 'TL.LogMessage("TargetRightAscension", "Get - " + targetRA)
880
+ 'rightAscension__t = utilities.HMSToHours(targetRA)
881
+ 'Return rightAscension__t
856
882
End Get
857
883
Set (value As Double )
858
- TL.LogMessage( "TargetRightAscension Set" , "Not implemented" )
859
- Throw New ASCOM.PropertyNotImplementedException( "TargetRightAscension" , True )
884
+ If value >= 0 And value <= 24 Then
885
+ TL.LogMessage( "TargetRightAscension Set" , value.ToString)
886
+ targetRA = value
887
+ targetRASet = True
888
+ Else
889
+ TL.LogMessage( "TargetRightAscension Set" , "Invalid Value " + value.ToString)
890
+ Throw New ASCOM.InvalidValueException( "TargetRightAscension" )
891
+ End If
892
+ 'TL.LogMessage("TargetRightAscension Set", "Not implemented")
893
+ 'Throw New ASCOM.PropertyNotImplementedException("TargetRightAscension", True)
860
894
End Set
861
895
End Property
862
896
@@ -979,6 +1013,7 @@ Public Class Telescope
979
1013
comPort = driverProfile.GetValue(driverID, comPortProfileName, String .Empty, comPortDefault)
980
1014
latitude = driverProfile.GetValue(driverID, latitudeProfileName, String .Empty, latitudeDefault)
981
1015
longitude = driverProfile.GetValue(driverID, longitudeProfileName, String .Empty, longitudeDefault)
1016
+ elevation = driverProfile.GetValue(driverID, elevationProfileName, String .Empty, elevationDefault)
982
1017
End Using
983
1018
End Sub
984
1019
@@ -992,6 +1027,7 @@ Public Class Telescope
992
1027
driverProfile.WriteValue(driverID, comPortProfileName, comPort.ToString())
993
1028
driverProfile.WriteValue(driverID, latitudeProfileName, latitude.ToString())
994
1029
driverProfile.WriteValue(driverID, longitudeProfileName, longitude.ToString())
1030
+ driverProfile.WriteValue(driverID, elevationProfileName, elevation.ToString)
995
1031
End Using
996
1032
997
1033
End Sub
0 commit comments