MMDevice
Loading...
Searching...
No Matches
ModuleInterface.h
Go to the documentation of this file.
1
2// FILE: ModuleInterface.h
3// PROJECT: Micro-Manager
4// SUBSYSTEM: MMDevice - Device adapter kit
5//-----------------------------------------------------------------------------
6// DESCRIPTION: The interface to the Micro-Manager plugin modules - (device
7// adapters)
8// AUTHOR: Nenad Amodaj, nenad@amodaj.com, 08/08/2005
9//
10// NOTE: This file is also used in the main control module MMCore.
11// Do not change it unless as a part of the MMCore module
12// revision. Discrepancy between this file and the one used to
13// build MMCore will cause malfunction and likely crash.
14//
15// COPYRIGHT: University of California, San Francisco, 2006
16//
17// LICENSE: This file is distributed under the BSD license.
18// License text is included with the source distribution.
19//
20// This file is distributed in the hope that it will be useful,
21// but WITHOUT ANY WARRANTY; without even the implied warranty
22// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23//
24// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
27
28#pragma once
29
30#include "MMDevice.h"
31
38// If any of the exported module API calls (below) changes, the interface
39// version must be incremented. Note that the signature and name of
40// GetModuleVersion() must never change.
41#define MODULE_INTERFACE_VERSION 10
42
43extern "C" {
44#ifndef MMDEVICE_CLIENT_BUILD
45
46// Make the module interface functions visible from outside the module.
47#ifdef _MSC_VER
48# define MODULE_API __declspec(dllexport)
49#else
50# define MODULE_API __attribute__((visibility("default")))
51#endif
52
53 /*
54 * Exported module interface
55 */
56
73
85
98
99 // A common implementation is provided for the following functions.
100 // Individual device adapters need not concern themselves with these
101 // details.
105 MODULE_API bool GetDeviceName(unsigned deviceIndex, char* name, unsigned bufferLength);
106 MODULE_API bool GetDeviceType(const char* deviceName, int* type);
107 MODULE_API bool GetDeviceDescription(const char* deviceName, char* name, unsigned bufferLength);
108#endif // MMDEVICE_CLIENT_BUILD
109
110#ifdef MMDEVICE_CLIENT_BUILD
111 // Function pointer types for module interface functions
112 typedef void (*fnInitializeModuleData)();
113 typedef MM::Device* (*fnCreateDevice)(const char*);
114 typedef void (*fnDeleteDevice)(MM::Device*);
115 typedef long (*fnGetModuleVersion)();
116 typedef long (*fnGetDeviceInterfaceVersion) ();
117 typedef unsigned (*fnGetNumberOfDevices)();
118 typedef bool (*fnGetDeviceName)(unsigned, char*, unsigned);
119 typedef bool (*fnGetDeviceType)(const char*, int*);
120 typedef bool (*fnGetDeviceDescription)(const char*, char*, unsigned);
121#endif // MMDEVICE_CLIENT_BUILD
122}
123
124#ifndef MMDEVICE_CLIENT_BUILD
125
126/*
127 * Functions for use by the device adapter module
128 */
129
141void RegisterDevice(const char* deviceName, MM::DeviceType deviceType, const char* description);
142
143#endif // MMDEVICE_CLIENT_BUILD
void RegisterDevice(const char *deviceName, MM::DeviceType deviceType, const char *description)
Register a device class provided by the device adapter library.
Definition ModuleInterface.cpp:75
#define MODULE_API
Definition ModuleInterface.h:50
MODULE_API unsigned GetNumberOfDevices()
Definition ModuleInterface.cpp:55
MODULE_API void InitializeModuleData()
Initialize the device adapter module.
MODULE_API long GetModuleVersion()
Definition ModuleInterface.cpp:45
MODULE_API bool GetDeviceName(unsigned deviceIndex, char *name, unsigned bufferLength)
Definition ModuleInterface.cpp:60
MODULE_API long GetDeviceInterfaceVersion()
Definition ModuleInterface.cpp:50
MODULE_API MM::Device * CreateDevice(const char *name)
Instantiate the named device.
MODULE_API void DeleteDevice(MM::Device *pDevice)
Destroy a device instance.
MODULE_API bool GetDeviceDescription(const char *deviceName, char *name, unsigned bufferLength)
Definition ModuleInterface.cpp:70
MODULE_API bool GetDeviceType(const char *deviceName, int *type)
Definition ModuleInterface.cpp:65
Generic device interface.
Definition MMDevice.h:192
DeviceType
Definition MMDeviceConstants.h:236