MMDevice
Loading...
Searching...
No Matches
Macros | Functions
ModuleInterface.h File Reference
#include "MMDevice.h"

Go to the source code of this file.

Macros

#define MODULE_INTERFACE_VERSION   10
 Module interface version.
 
#define MODULE_API   __attribute__((visibility("default")))
 

Functions

MODULE_API void InitializeModuleData ()
 Initialize the device adapter module.
 
MODULE_API MM::DeviceCreateDevice (const char *name)
 Instantiate the named device.
 
MODULE_API void DeleteDevice (MM::Device *pDevice)
 Destroy a device instance.
 
MODULE_API long GetModuleVersion ()
 
MODULE_API long GetDeviceInterfaceVersion ()
 
MODULE_API unsigned GetNumberOfDevices ()
 
MODULE_API bool GetDeviceName (unsigned deviceIndex, char *name, unsigned bufferLength)
 
MODULE_API bool GetDeviceType (const char *deviceName, int *type)
 
MODULE_API bool GetDeviceDescription (const char *deviceName, char *name, unsigned bufferLength)
 
void RegisterDevice (const char *deviceName, MM::DeviceType deviceType, const char *description)
 Register a device class provided by the device adapter library.
 

Macro Definition Documentation

◆ MODULE_API

#define MODULE_API   __attribute__((visibility("default")))

◆ MODULE_INTERFACE_VERSION

#define MODULE_INTERFACE_VERSION   10

Module interface version.

The Core ensures that any loaded device adapter modules have a matching version, to ensure ABI compatibility.

Function Documentation

◆ CreateDevice()

MODULE_API MM::Device * CreateDevice ( const char * name)

Instantiate the named device.

Device adapter modules must provide an implementation of this function.

The implementation of this function should create an instance of the device and return a raw pointer to it.

See also
DeleteDevice()

◆ DeleteDevice()

MODULE_API void DeleteDevice ( MM::Device * pDevice)

Destroy a device instance.

Device adapter modules must provide an implementation of this function.

The implementation of this function should deallocate (delete) the given device instance (which is guaranteed to be one that was previously returned by CreateDevice()).

See also
CreateDevice()

◆ GetDeviceDescription()

MODULE_API bool GetDeviceDescription ( const char * deviceName,
char * name,
unsigned bufferLength )

◆ GetDeviceInterfaceVersion()

MODULE_API long GetDeviceInterfaceVersion ( )

◆ GetDeviceName()

MODULE_API bool GetDeviceName ( unsigned deviceIndex,
char * name,
unsigned bufferLength )

◆ GetDeviceType()

MODULE_API bool GetDeviceType ( const char * deviceName,
int * type )

◆ GetModuleVersion()

MODULE_API long GetModuleVersion ( )

◆ GetNumberOfDevices()

MODULE_API unsigned GetNumberOfDevices ( )

◆ InitializeModuleData()

MODULE_API void InitializeModuleData ( )

Initialize the device adapter module.

Device adapter modules must provide an implementation of this function.

The implementation of this function should call RegisterDevice() to indicate the set of available devices in the module. The body of the function normally should not do any other processing.

This function may be called multiple times and therefore must be idempotent (since RegisterDevice() is idempotent, nothing special has to be done in most cases).

See also
RegisterDevice()

◆ RegisterDevice()

void RegisterDevice ( const char * deviceName,
MM::DeviceType deviceType,
const char * description )

Register a device class provided by the device adapter library.

To be called in the device adapter module's implementation of InitializeModuleData().

Calling this function indicates that the module provides a device with the given name and type, and provides a user-visible description string.

See also
InitializeModuleData()