
Page 33
Application Programming Interface (API)
From v4.5. The MHP can be scripted or operated through user written scripts or
customized applications.
We cannot provide support for programming the MHP. It is your responsibility to
understand how to program in whatever programming language you choose. The
documentation below assumes you are using vb.net. Of course any other object
oriented programming language can be used.
The MHP API leverages the ASCOM profile store. The basic process to operate a
feature of the MHP is as follows.
Create an ins
tance of the ASCOM “Profile” object and set its
.devicetype to either
“Focuser” or “Switch”
Set the appropriate
Ascom Connected profile key to string value “True”
Write the appropriate value to the correct profile key.
The MHP software will monitor these keys while the ASCOM Connected key is set
to
“
True
”. To stop the software monitoring, set the key to string Value “False” (all
of this is case sensitive.)
Before using any .net interfaces ensure you have set a reference to
ASCOM.Utilities in your project or script
Basic Connection example;
Vb.net
Connect to the Focuser
Imports
ASCOM.Utilities
Public
Class
Form1
Private
Sub
Form1_Load(sender
As
Object
, e
As
EventArgs)
Handles
Me
.Load
Dim
p
As
New
Profile()
Dim
DriverID
As
String
=
"ASCOM.MHPV4.Focuser"
p.DeviceType =
"Focuser"
p.WriteValue(DriverID,
"S_AscomConnect_Focus"
,
"True"
)
End
Sub
End
Class