Introduction

The original VB6 COM components remain as they are in ASCOM Platform 5 although some functionality is invisibly replaced with equivalents from the .NET components.This provides maximum compatibility as the original VB6 COM binary application interface has not been changed at all and so all existing clients and drivers should work without hitches.

Caution

Over time you should migrate away from the VB6 COM components to use the native .NET components to maximise the longevity of your drivers and applications. There is curently no "must do by" date in sight but a change to the Windows platform that renders the VB6 components unviable to repair could occur at any point in the future.

Differences to the .NET Interface

Due to limitations in the original COM specification, there are a few features of the .NET framework and recent language enhancements that canot be expressed through COM; these include static classes, overloads and generic variables. To optimise the experience for both COM and .NET developers, a varienty of approaches have been used:

ElementApproach
Static ClassesWherever possible static classes have been avoided, the only exception is the NOVAS2 component. For ease of use and because it contains no state, NOVAS2 has been implemented as a static class for .NET applications. A functionally identical, instanciable class, NOVAS2COM, has been provided for COM clients.
OverloadsIn every case the most functional overload has been made COM visible to ensure that maximum functionality is available to both .NET and COM clients. Less functional overloads i.e. those that default some parameters have been assigned to an additional interface that is .NET visible but not COM visible. The need to do this comes from a fundamental COM limitation in that it does not support overloads.
.NET Generic VariablesThese have been avoided by use of a custom KeyValuePair class in the ASCOM.Utilities namespace. This is non-generic and allows a set of string keys and associated string values to be returned to both COM and .NET clients. As for overloads, COM does not support generic data types and so the non-generic approach was adopted to ensure a single return type common to both COM and .NET clients is used.
Parameterless ConstructorsCOM needs a parameterless constructor, while .NET supports constructors with parameters. Where it is convenient to have a constructor with parameters, this is provided along with a parameterless constructor and set method for COM use. A typical example is the TraceLogger component which has a constructor that takes LogFileName and LogFileType as well as a parameterless constructor and the SetLogFile method that sets LogFileName and LogFileType.

COM Names and Type Libraries

Type libraries for all Platform 5 components are provided in the Program Files\Common Files\ASCOM\Interface directory.

Caution

With one exception, COM names of all elements are identical to the namespace names given in this help file. That exception is enum values (not overall enum names) where each value is prefixed by the enum name and an underscore in the COM interface.

For example, the serial speed enum SerialSpeed, is documented as having values ps300, ps1200 etc. and these are the names that should be used in a .NET application. However, within COM, the values are called SerialSpeed_ps300 and SerialSpeed_ps1200 respectively. Unfortunately, this is a limitation of the COM support in .NET and is not influencible by the platform developers.

A good way to get a feel for enum value names, from a COM perspective, is to use Microsoft's OLE/COM Object Viewer to examine the supplied typelibs before stating to code your application.

Known Issues

Full functionality of the NOVAS2 and NOVAS3 components is available through the .NET interface, however, recent testing (April 2012), has shown that many methods are not accessible through COM interop because a number of method parameters are passed by reference or use structures that do not pass across the COM interface (this is a technical COM limitation, not an ASCOM limitation).

The commonly required astrometric / topocentric transformations are available in the Transform component, which is fully accessible through COM. Full exposure of the NOVAS components in a COM friendly fashion is a substantial piece of work and will require specification of a very differnt interface to that of native NOVAS and that design and build task has not yet been planned.