ASCOM is a nice platform providing unified access to astronomical hardware controllable from a computer. Hardware makers provide ASCOM driver and end user apps like PHD or Nebulosity may start using it without problems or additional drivers. For developers - those that want to make drivers or use the ASCOM API - the journey to ASCOM starts at digging through raw documentation. Some help may be found also on the mailing list. It's not documented as well as Django, but still - it's usable.
We start with installing additional components that give documentation and few handy libraries. ASCOM platform uses .NET framework and provides .NET API. For other languages there is full API access via COM.
The documentation is in Program Files/ASCOM/Platform 6 Developer Components/Developer Documentation (or "Program Files (x86)" on 64-bit Windows). The most interesting is PlatformDeveloperHelp.chm containing few examples and all the namespace of the ASCOM API.
End user apps are those who use the ASCOM drivers/API to control the hardware like a mount or a camera. In most such cases we will use ASCOM.DriverAccess to do that. It gives a API to control domes, filter wheels, focuser, rotators or mounts. In PlatformDeveloperHelp.chm you will find the whole namespace for this library.
For languages outside .NET platform we have to use the COM technology. Here is a simple Python script that slews the mount:
win32com.client.Dispatch is used to load the library - a driver "id" in this case. "Celestron.Telescope" is the ID of the Celestron ASCOM driver that controls Celestron and SkyWatcher mounts. This driver has the same API as ASCOM.DriverAccess.Telescope. At start we connect to the device setting "Connected" to True. Then we set Tracking to True to order the mount to start tracking (sidereal rate by default). "SlewToCoordinates" method will slew the mount to given coordinates (RightAscension, Declination).
To use the equipment the user wants we need to give him the ability to choose it. We need the driver ID like "Celestron.Telescope" and we will get it via ASCOM.Utilities.Chooser - this class shows the choose window for every type of equipment.
Chooser supports all type of equipment handled by ASCOM. Choose method will show the choose window and will return the driver ID when user closes it. All settings applied by the user will be saved too.
IronPython is a Python implementation on the .NET platform. As such it can use .NET libraries, like so:
The API is the same, only import is different. In the folder with the script I placed the ASCOM.DriverAccess.dll that can be found in Program Files/ASCOM/Platform 6 Developer Components/Components/Platform6. The script is executed by IronPython interpreter - ipy.exeIn case of camers it looks quite similar:
The "images" is an ImageArray object which needs to be somehow saved as a FITS file (didn't made that work yet). For .NET there is CSharpFITS (and pyFITS for Python) which can be used. This library also requires nunit - install it and copy/load nunit.framework.dll in the script: