ASCOM Users Guide
ASCOM Users Guide
ASCOM Users Guide
Users Guide
Rob Morgan
2011
ASCOM
Table of Contents
Why are Drivers Important? ....................................................................................... 4 Why Use COM? .......................................................................................................... 5 How COM Works........................................................................................................ 5 What ASCOM is not ................................................................................................... 6 ASCOM Initiative Mission Statement ....................................................................... 6 Who uses ASCOM ...................................................................................................... 7 Choosing and Configuring the Driver ........................................................................ 9 The Standards .............................................................................................................. 9 Driver Guidelines ........................................................................................................ 9 Installing Drivers ....................................................................................................... 10 Scriptable Components and Programs Guidelines .................................................. 11 Scripting Interface Requirements ............................................................................. 13 Client Programs Guidelines ...................................................................................... 14 Logo Usage ................................................................................................................ 14 The Standards Process............................................................................................... 15 Core Components ...................................................................................................... 16 Core Assemblies ........................................................................................................ 17 Tools ........................................................................................................................... 19
What is ASCOM?
There are a number of items or entities associated to the acronym ASCOM. The first is to know that it stands for Astronomy Common Object Model. It was originally invented in late 1997 and early 1998 by Bob Denny, when he released two commercial programs and several freeware utilities that showcased the technology. The ASCOM Initiative was formed as a small group of software developers from around the world to give oversight and continue the development effort of the ASCOM Platform. Their website can be found at ascom-standards.org. The ASCOM Platform is a collection of programs to standardize the core functionality for normal operations and observing in astronomy hardware and bring these together in a common implementation for use in client software applications. ASCOM is a many-to-many and language-independent architecture, supported by most astronomy devices which connect to computers. The first observatory to adopt ASCOM was Junk Bond Observatory, in early 1998. It was used at this facility to implement a robotic telescope dedicated to observing asteroids. The successful use of ASCOM there was covered in an article in Sky & Telescope magazine. This helped ASCOM to become more widely adopted. As of today the ASCOM platform is on its 6th version of major releases. Figure 1 shows the layer interactions with compliant astronomy instruments and compliant software architectures.
Languages
Programs
Software
ASCOM Drivers
Device Drivers
Device Drivers
Device Drivers
Figure 1 An ASCOM driver acts as an abstraction layer between the client and hardware thus removing any hardware dependency in the client, and making the client automatically compatible with all devices that supports the minimum required properties and methods. For example, this abstraction allows an ASCOM client to use an imaging device without needing to know whether the device is attached via a serial or network connection.
fact any language that supports access to Microsoft COM objects can interface with ASCOM. Figure 2 shows a breakout of the typical layers used by the Clients, ASCOM, Manufacturer Driver, and the hardware devices.
COM Clients ASCOM Com Helpers .Net Clients ASCOM Wrapper Interfaces
ASCOM Platform Functionality ASCOM COM and .Net INterfaces ASCOM/Manufacture Com Language Driver ASCOM/Manufacturer .Net Drivers
Manufacturer Hardware
Figure 2 The ASCOM initiate is dedicated in keeping as much compatibility with Microsofts Component Object Model (COM) as possible. This allows a veriety of languages to be compatible with the ASCOM architecture. This book cant possibly show all examples for all the languages so weve select one compiled language, C# and one scripting language, VBScript for the examples.
ASCOM
constructor is called. Thereafter it is ready for use by the app. Multiple instances of a component can be used by different apps simultaneously. The OS call that activates the component returns a reference to the activated component. The component reference is kept in a variable and used just like a reference to an object created in the app's native language. Thus the applications code sees the component as identical to one of its own objects and uses it identically. Perhaps you can now see how powerful the component concept is, and why it was a natural choice for ASCOM drivers.
7. Provide general requirements for quality and behavior of application scripting interfaces, aimed at making script writers' experiences consistent and robust.
ASCOM
Consume ASCOM Drivers
Driver Developer
Figure 3 Activity diagrams are graphical representations of workflows of stepwise activities and actions with support for choice, iteration and concurrency. The activity diagram in Figure four depicts the flow of a typical use case. The client
ASCOM
application can call the ASCOM Chooser at anytime to select the appropriate device driver for configuration. Dont worry about knowing what the Chooser is right now. Just think of it as a way to select a device or driver. The client may at anytime call the ASCOM interfaces and use the device interface or other ASCOM functionality. This figure also shows that the Client application may optionally use the Manufacturer Hardware Driver at any time without using the ASCOM components. It would be up to the manufacturer to expose any additional functionality not used in the ASCOM standards. It is also optional for the manufacturer to implement their driver before the hardware and after the ASCOM driver.
Client Application
ASCOM Functionallity No
Hardware Driver
Hardware Device
Figure 4
The Standards
The ASCOM Initiative has published a number of standards and guidelines that describe the ways in which the ASCOM Platform would interact with the Client Software and the Drivers the manufacturers write or create. In order to be called "ASCOM compliant", a driver, component, or application scripting interface must meet all of the applicable guidelines and standards. Only then drivers, interfaces, or a components packaging and user interface, carry the ASCOM logo.
Driver Guidelines
1. The driver must install and run on Microsoft Windows 7, Vista, and XP with the latest service packs at the time of driver release. It should work on both 32- and 64-bit systems. Windows 2000 is not supported in Platform 6. 2. The driver must implement the published standard interface for the device type via a scriptable dispatch ("Automation") interface per the Microsoft Component Object Model (COM). Drivers should also implement "dual" interfaces which have both dispatch and early/VTBL binding (using the appropriate abstract standard interface that is part of the ASCOM Platform). See Driver Development Notes.
ASCOM
3. The driver must never "extend" the standard interface (add private members - properties and/or methods). If private members are desired, they must be exposed through a separate non-standard interface. 4. The driver must never display a modal window which requires user interaction to dismiss. All errors must be raised/thrown back to the client. 5. The driver must use the Helper component's Profile.Register() method for ASCOM registration. It is recommended that drivers also use the Helper's Profile object for storage of their persistent configuration, state data, etc., as well as the Helper's Serial object for serial port I/O. The Helper components are part of the ASCOM Platform and serve to isolate drivers from changes in Platform architecture. They also make development easier by providing high level functionality commonly needed by drivers. 6. Prior to release, the driver must pass the Conform tests using the current/latest version of the Conformance Checker test tool. 7. The driver must be delivered as a self-contained installer. It is unacceptable to ask users to copy files, edit the registry, run BAT files, etc. See Creating a Driver Installer. There are a number of help files available on the ASCOM website for each type of driver that is supported. Within each are the properties and methods that are considered the standards.
Installing Drivers
Now that you have the platform installed youll need driver(s) for the various equipment you have. These drivers will probably come the manufacturers and be marked for ASCOM compatibility but if not, you might find them here: http://ascom-standards.org/Downloads/Index.htm.
10
Once you locate the drivers, go ahead and install each one that you need. Each may come with specific instructions, so be sure to read any included files after installing.
ASCOM
5. The product must implement scriptable dispatch ("Automation") interface(s) via the Microsoft Component Object Model (COM), and use only automation-compatible data types (see the data type requirements below). 6. Errors within your product must raise Automation exceptions (via IErrorInfo). The error info must contain both an error number that is based on FACILITY_ITF and an informative error message in English and optionally other languages. Optionally, methods which do not return values should return VARIANT_BOOL indicating success or failure. This allows clients to determine status while ignoring exceptions (e.g. On Error Resume Next and try/catch). IErrorInfo support is essential to providing client writers with the behavior they rely on. Very few of these people manually test return values for errors with 'if' logic. They depend on their client environment to pop a meaningful alert box (or catch an exception with try/catch) when things go wrong. 7. Components must be 100% usable from an automation client without user interaction. For example, it is not permitted to require a user to dismiss an error alert window when the program is being controlled through a component automation interface. On the other hand, it is permitted to require the user to use a program's configuration features to set preferences. Another example of non-compliant behavior is a component server whose behavior changes or stops depending on whether it is a foreground or background window. The point of this requirement is to assure that, when used from a script, the program will never hang awaiting some user action such as a window shuffle, or clearing an error message box or selector dialog. Raise an exception and return to the client for handling the error or establishing the selection. 8. The product must be delivered as a self-contained installer. It is unacceptable to ask users to copy files, edit the registry, etc. See Creating a Driver Installer. 9. Executable components must self-register when first started, and must support the command line options /REGSERVER and /UNREGSERVER to manually register and unregister them. Invocation with either of these options must immediately exit and must not start the program.
12
10. Any executable component must start automatically if one of the objects it serves is created by a client. Furthermore, it must exit automatically when the last reference to any object it is serving is deleted. Unless there is a good reason to do otherwise, an executable component should start in a minimized window. This is not a hard requirement as a component may benefit from displaying information as it operates. Unless this is the case, though, the component should remain out of sight (minimized) unless manually made visible by the user.
ASCOM
possible to use the interface from scripting languages which support only dispatch binding, and it must be possible to implement the interface with a Windows Script Component ("scriptlet"), which cannot expose a VTBL. 6. All properties, method parameters, and method return values must be Automation-compatible types such as INT, LONG, DOUBLE, SINGLE, BSTR, DATE, VARIANT_BOOL, and VARIANT/VT_DISPATCH. Any arrays produced and consumed by your product must be SAFEARRAY of VARIANT. In short, all data items must be 100% compatible with Automation, and specifically with ActiveX Scripting engines including both VBScript V5 and JScript V5 (or later) and with Visual Basic for Applications V5 (or later). 7. Method parameters must be passed only by value, as required by some ActiveX Scripting engines (notably JScript). Consider passing object references (VT_DISPATCH) by value as a way to have methods work on arbitrary (non-Automation) data owned by the client.
Logo Usage
14
If you have a driver or an astronomy product that conforms to these requirements, feel free to use the logo on your web site and product packaging, as long as you do the following: 1. If you use the logo on a web site, please link it back to this site http://ascom-standards.org/ 2. Post a note to ASCOM-Talk indicating your product, company, and URL. The moderator or other responsible person will add you to the partners page and link to your web site.
Logo usage is on the honor system, there are no contracts or other covenants required. Please don't undermine this effort by ASCOM-labeling software that doesn't meet the above requirements. Make the effort and your software will be better for it!
ASCOM
4. Refine the specification and simulator as dictated by experience, again reaching an interface agreement brokered by the author. Discussion is closed at this point. 5. The author posts a poll on ASCOM-Talk, giving the community several weeks to vote yes or no. Further suggestions and other feedback will be rejected at this point. 6. If the majority votes yes, the specification is considered "adopted and the author is responsible for writing the final standard document. If not, go back to step 4 or drop the spec entirely and possibly start over. The most important goal of the standards process is to avoid the "design and decree" process that has caused so many failures and financial damage in the past. Typically employed by academics, design-and-decree just plain doesn't work. Professional engineers know it's essential to prototype, refine, and plan to throw the first one away or maybe start over. Another important aspect of the standards process is that the author is responsible for brokering the interface agreement, a difficult task requiring sensitivity and above all the strength to reject "it would be nice if" suggestions which have no clear use-case.
Core Components
Simulators
Simulators have been created for a number of devices that mimic the use of drivers and the client applications that access them. These simulators test each of the internal ASCOM drivers to insure integrity of the installed ASCOM platform. These simulators provide a convenient tool for application software developers to test their programs with known good drivers under controlled conditions. The simulators also serve driver developers as reference implementations of the driver standards. If there is a question about the behavior of a property or method, the behavior of the appropriate simulator serves as the reference.
Diagnostics
16
The Diagnostics application will evaluate the current ASCOM platform installed on the local computer to create a log file that can be used for troubleshooting issues. This text file can then be sent to the ASCOM Initiative developers or others for evaluation of the issues.
Profile Explorer
The Profile Explorer allows viewing of the ASCOM Profile. The ASCOM profile, figure five, stores information about the devices and drivers installed. Drivers are normally registered in the profile store during the setup process. ASCOM specifically stores the COM ProgID of the driver. All drivers must register with the ASCOM profile and may use the profile to store other configuration or runtime information.
Cilent Application
Driver Hardware
Figure 5
Core Assemblies
All the listed assemblies are installed into the Global Assembly Cache (GAC) as part of the platform installation process. ASCOM.Astrometry- This encapsulates the Naval Observatory Vector Astrometry Software (NOVAS) and Keplers Laws of Planetary Motion. ASCOM.Attributes - Used by the ASCOM LocalServer and the SettingsProvider to load settings. The LocalServer uses this to control which assemblies to load. ASCOM.Controls - This contains a common set of user interface elements for use by all developers. ASCOM.DriverAccess - This is a .NET assembly that provides high-level simplified access to ASCOM drivers for developers writing client applications. This provides automatic switching between the preferred early-binding interfaces and, for older drivers that don't support it, late-binding. Support includes the following Camera Dome
ASCOM
Filter Wheel Focuser Rotator Switch Telescope
ASCOM.Exceptions - This contains common exception classes used by the ASCOM platform and for internal exceptions. Drivers are permitted to directly throw this exception as well as any derived exceptions. ASCOM.IConform - Driver interface to inform Conform of valid driver commands and returned error codes. ASCOM.Interfaces - Master interfaces are installed in a registered COM type library and a .NET primary interop assembly (in the GAC). For .NET, a registered master primary interop assembly (PIA) is provided. It appears in the .NET References window, COM tab, as "ASCOM Master Interfaces for .NET and COM (V1.0)" (the same friendly name as seen in COM from OLEView etc.). Once referenced in a .NET project, it will show as ASCOM.Interfaces, the namespace containing the interfaces (e.g. ASCOM.Interface.ITelescope). ASCOM.SettingsProvider - SettingsProvider integrates the ASCOM Profile store with the Visual Studio settings designer and the application settings architecture. It is intended for use by driver developers and is incorporated into the VS template projects. ASCOM.Utilities - Contains things like the Serial, Profile, Chooser and other items like date and time conversions, Chooser - The Chooser object provides a way for users to select a device to work with within an application. The Chooser can be configured to choose any ASCOM device type. The default is "Telescope", but you can change the Chooser.DeviceType property to something else (e.g. "Focuser") and the Chooser will then work for that device type.
18
Profile The profile is the store for Driver and Device information. Used by the Chooser to locate the Windows registered ProgID of drivers. The profile can be access directly by the drivers or by using the Profile Explorer. ASCOM does not mandate that all drivers have to use the Profile component to store their configuration information but it does mandate that the Profile is used to register the device so that Chooser always knows where device registration information is located.
Tools
Driver Templates - Driver templates come in four basic formats for projects in Visual Studio 2005 or later. Two formats are for the Driver projects in both C# and VB and two are in the Local Server formats for both C# and VB. Those individuals or companies wanting to write a driver for their hardware would use
ASCOM
one of the Driver projects for a single hardware interface or the Local Server if their hardware interface supports more than one driver on the same interface. .NET Client Toolkit - The client toolkit is a Visual Studio 2005 C# project that shows how to use the ASCOM .NET Client Toolkit. This console application contains code that shows how to access each type of driver, using the chooser and pre-selecting the simulator for each. Some info is printed out to the console window. This is a separate download from the platform Driver Conformance Checker - This tool performs a comprehensive set of tests on a driver to determine its conformance with the relevant ASCOM interface standard. It also tests some aspects of driver behavior against the reference implementation. Use this tool to test your driver before each release (even preproduction).
20