160 likes | 303 Views
Microscope Middleware. Stand 29. Mai 2012. Microscope Manager Design. 1 class , 244 methods 6306 loc , 199kByte. Redesign. Responsibilities. Holds Device Loader / Device Manager. Loads libraries , enumerates drivers. Loads / holds / unloads devices.
E N D
Microscope Middleware Stand 29. Mai 2012
Microscope Manager Design 1 class, 244 methods 6306 loc, 199kByte
Responsibilities Holds Device Loader / Device Manager Loadslibraries, enumeratesdrivers Loads / holds / unloadsdevices Interactwithactualdevices Enableloadingofdevicesbydevicemanager Change / readdeviceproperties
Interface / Implementation • Implementation • Interface: Implementedbyproxiestotheactualimplementation
Proxy design • Proxies hold weakpointers (tr1::weak_ptr) tothesharedpointersusedwithintheimplementation (tr1::shared_ptr) • Devices maybeunloadedwhile in use • weak_ptristhen NULL • ProxiesthrowException • Exception: Proxy tocoreholdsshared_ptr. • Whencoreimplementationisnolongerusedbyanyproxy (all proxiesgarbagecollected), entirecoreimplementationisunloadedautomatically
Wrapping MM::Devices • MM::Devices areinstantiatedusing a «factorymethod» in Manager devicelibraries • Microscope Middleware instantiates a wrapperthatcallsthefactorymethod in itsconstructor, andthedestructormethod in itsdestructor • Wrapper isinstantiatedbydevicefactory • Createstheillusionofunderlying OO-style deviceobjects
Wrapping MM::Devices • MM::Devices have a «Core» callback • Used e.g. forcontinuousimaging • Also usedbydevices in ordertoget • The defaultcamera, shutter, … • Access toserialports • Microscope Middleware implements a minimal per-deviceversionofthis • Default devicesare user-configurable(and not setbydefault)
Device Interfaces • Eachdevicegetsitsowninterface • Devices ofunknown type have a genericinterface (e.g. Arduinoboards)
Device Interfaces • Implementation Priorities: • Camera • SerialPort, Hub • State, Stage, Axis • Everythingelse
Unsupporteddevices • MM::ImageProcessor • MM::ImageStreamer • Both not supportedastheyare not actualdevices • MM::CommandDispatch • This is a logger, not a device!
Unsupporteddevicefeatures • Sequenceability • Automatizationshould happen on top ofMicroscope Middleware, not withinthedevicedrivers! • Programmabledelays • Java/Python/… cansleep, too • «Auto Shutter Mode»
To Do List • Add supportfor all ofthepreviouslymentioneddevicetypes • SWIG Wrapper • Makeprojectcross-compilable (CMake) • Testing on POSIX systems • Write & Compiledoxygendocumentation
To Do List (cont’d) • Swallow/redirectexceptionsfromdevicedrivers • Somedevicedriversthrowstringsorints, howto handle this? • catch(…) • Bad, because all informationabouttheexception(exceptthatitoccurred) is lost… • Allowfor Java/… listeners • Ifwe pass a derivedobjectto Java, itmaybelieveitis an objectofthebaseclass • SWIG hasnowayofknowingwhatwe pass in a Base* pointer