Hi Agraham
I am sorry for being a pain in the backside and I refuse to accept defeat, but I need your help please. I know that you said you cannot help me anymore, but please hear me out. I have asked Trimble for help, but they do not even answer my emails. They have a program called "SurveyPro" on their instruments, which is very similar to my program and I think they see me as a threat on sales of surveying programs in Africa.
Everything is 99% finished, except for reading the distance from the instrument. The entire program was copied over from the PDA version and I only had to change the screen size, as all the Total Stations use Windows CE.
I have now managed to activate the EDM (the part of the instrument that reads distances) and I can hear that there is activity, but I am missing something, as it would not display the distance to me.
Please have a look at the following:
Imports NikonTrimble.Mobile.Communications
Imports NikonTrimble.Mobile.Common
Imports System.ComponentModel
Public Class Nikon
Implements IDisposable
Private WithEvents TStn As TSControl
Private TStnContainer As Container
Public Ha As Double, Va As Double, SDist As Double, SetHa As Double, Pi As Double
Public Sub New()
'Create new instance
TStnContainer = New Container
TStn = New TSControl(TStnContainer)
'Port = New BaseSerialPort
Pi = 180 / 3.1415926536
'Port.Open()
End Sub
#Region "*******************************Variables"
#End Region
Public Property ReceiveAngleRawData() As Boolean
Get
Return TStn.ReceiveAngleRawData
End Get
Set(ByVal value As Boolean)
TStn.ReceiveAngleRawData = value
End Set
End Property
Public ReadOnly Property MeasureDistStartStatus() As Boolean
Get
Return MeasureDistStartStatus
End Get
End Property
#Region "****************************** Methods"
Public Sub MeasureHAngle()
TStn.ReceiveAngleRawData = True
Ha = TStn.MeasureAngleData.HA
Ha = Ha * Pi
End Sub
Sub MeasureVAngle()
TStn.ReceiveAngleRawData = True
Va = TStn.MeasureAngleData.VA
Va = Va * Pi
End Sub
Public Enum MsrMode As Integer
Accurate = 1
Normal = 2
End Enum
Public Enum MsrDistEventType
GetAveDist = 4
GetDistData = 3
ResetMsr = 6
StartAccMsr = 0
StartNormalMsr = 1
StartTrackingMsr = 2
StopMsr = 5
End Enum
Sub MeasureDist()
Dim i As Integer, i1 As Integer
MeasureStartDist(2, True)
ReadAgain:
SDist = TStn.MeasureDistData.SD
For i = 1 To 15000 : Next i
i1 = i1 + 1
If SDist = 0 Then
If i1 < 50 Then GoTo readagain
ElseIf SDist > 0 Then
TStn.MeasureStopDist()
ElseIf i1 >= 50 Then
TStn.MeasureStopDist()
End If
End Sub
Public Function MeasureStartDist(ByVal MsrMode As Integer, ByVal mode As Boolean) As Boolean
TStn.MeasureStartDist(MsrMode, True)
End Function
Public Sub SetHAngle(ByVal SetHa As Double)
TStn.SetHAngle(SetHa)
End Sub
#End Region
Public Sub Dispose() Implements System.IDisposable.Dispose
If Not TStn Is Nothing Then
TStn.Dispose()
End If
End Sub
End Class
Please have a look at it.
Regards
Michael