Skip to content

Add standard properties to device documentation #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions _pages/DeviceAdapterTutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,33 @@ int MyNewCameraDevice::OnGain(MM::PropertyBase* pProp, MM::ActionType eAct)
```


### Standard Properties

Micro-Manager includes a system of "standard properties" which ensures consistent property naming and behavior across different device adapters. These properties are prefixed with `"api//"` to distinguish them from regular properties.

Benefits of standard properties include:
- Consistent naming and behavior across different device adapters
- Automatic validation of property types and allowed values
- Standardized access for applications using the API

For device adapter developers, standard properties work like regular properties but with specialized creation methods for each standard property.

#### Implementing Standard Properties
To implement a standard property in your device adapter:

1. Determine if your device type supports the standard property (each property is linked to specific device types). An up to date list of standard properties can be found in [MMDevice.h](https://github.com/micro-manager/mmCoreAndDevices/blob/main/MMDevice/MMDevice.h)
2. Use the dedicated creation method for that standard property

For example, a camera device adapter supporting trigger functionality would use:

```cpp
// In Initialize() method
int ret = CreateTriggerTypeStandardProperty("Internal", pAct);
if (ret != DEVICE_OK)
return ret;
```

When implementing standard properties, consider whether your device's functionality truly matches the standardized definition. If it doesn't, it's better to create a custom property instead of using a standard property in a non-standard way.


## Constructor and destructor
Expand Down