Another Attempt With A Wrapper

ceaser

Active Member
Licensed User
Hi Agraham

Thank you very much for your help in getting me this far:sign0188:

I have also managed to be able to set the Horizontal Angle on the Instrument from my software, but I am giving up on this project, as I still cannot figure out how to activate the instrument to read distances.:BangHead::BangHead:

Anyway...

Thanks again.

Regards
Michael
 

ceaser

Active Member
Licensed User
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
 

agraham

Expert
Licensed User
Longtime User
You should have seen several warnings when you compiled this. Always take notice of these and sort them out.

MeasureStopDist and MeasureStartDist are static methods but you are trying to access them through an instance (Tstn), use TSControl.

There is a Return keyword missing in Public Function MeasureStartDist.

Public ReadOnly Property MeasureDistStartStatus tries to return itself. It should be Return TStn.MeasureDistStartStatus()
 

Attachments

  • Class1.zip
    995 bytes · Views: 263

ceaser

Active Member
Licensed User
Hi Agraham

Thank you once again for your help:sign0188:

Everything is working fine now and orders are starting to come in....I will certainly make a contribution in the next couple of days.

Regards
Michael
 

squowse

New Member
Thanks for all your work on this guys, I am also looking to write my own software for this device - Nikon Nivo C and am amazed that some of the work seems to have been done already. I will do some programming and see if I can get some results.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…