-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Currently, CMMCore::getDeviceName(label)
returns the string that the device's GetName()
returns.
Every device needs to manually implement GetName()
to return its name, which, by convention, is supposed to (?) match the name used to create the device (via the module's CreateDevice()
). This is error-prone.
But the Core, of course, can remember the name used to create the device, so all of this is unnecessary.
Some devices triple-redundantly also add a property with the name g_Keyword_Name
. This should probably be removed, since getDeviceName()
is available, but it is true that in some cases it's nice to see the name in the property browser. So maybe eventually replace it with a standardized property (#584) but always provide it from the Core without calling into the device.
There is an analogous situation with GetDescription()
, except that the Core calls the device's SetDescription()
to set the text obtained from the module interface. These two functions are not implemented by most devices because DeviceBase provides implementations. Again, this information can be kept in the Core (in DeviceInstance
).
There is just one problem with making this change: hub devices' DetectInstalledDevices()
abuses MM::Device
as a (name, description) pair. (It uses GetName()
and GetDescription()
, not the properties.) So that will need to be fixed first.
We could do a simpler change, just to eliminate the need for each device to manually implement GetName()
, by providing a default implementation in DeviceBase (returning empty string) and using the name stored by the Core when the device doesn't set one.