USB Monitoring Control - USB Device Data Monitoring ActiveX Component Library
This section contains the common conventions defined in the library.
The library has the following structure:
IUsbMonitor, IDeviceCollection, IDevice and IMonitoring interfaces are declared dual. To use their binary-compatible (local) part in native code, include the hhdusbmc.h file in your project. Remember, that the library must be loaded into your process address space to use the local interfaces without a marshaller.
The INativeListener interface is a local interface, so it can only be used in the native code. Unlike other interfaces declared in the USBMC, the library does not have any object that implement this interface. Instead, you must implement this interface in your native listener object. Each Monitor object supports adding one or more native listeners via the IMonitoring.AddNativeListener method call.
The monitor object is capable of providing two different protocols for each native listener. Your implementation must support exactly one of these protocols. If you support the first (raw) protocol, you will be able to acheive the highest possible speed, but will have to parse the monitored data in your own code. If you choose to support the second (standard) protocol, the library will parse each monitored request for you and call the appropriate method in the INativeListener interface for each request type.
Every standard protocol method in the INativeListener interface accepts the FILETIME * value as a first parameter. This parameter points to the library-allocated FILETIME structure containing the time of the monitored event. Time is stored in UTC. Do not modify the contents of the variable, treat it as read only.
Each standard protocol method in the INativeListener interface provides one or more parameters which contain or point to the parsed request data. The first parameter is always a pointer to a FILETIME structure, containing the UTC time of the event, while others (if present) contain the parsed request data. Consult the documentation for individual methods to get more information.
The general rule states that all data passed to the INativeListener methods should be considered read only.
All managed environments are capable of using dual interfaces. Unlike the native environments, which use the local, binary compatible part of the dual interface, the managed environment uses the IDispatch interface to call methods and query/set properties. IUsbMonitor, IDeviceCollection, IDevice and IMonitoring interfaces are all dual interfaces and can be easily used in managed environments.
The USB Monitoring Control library has two event interfaces: _IUsbMonitorEvents and _IMonitoringEvents. Different managed environments support different styles of connecting event handlers to event sources. Please consult your language documentation to find out how to handle OLE automation events. Native clients are also able to attach event handlers to event sources. Please consult the MSDN for more information, or look at the included sample code for an example.