micro-manager / mmCoreAndDevices

Micro-Manager's device control layer, written in C++
40 stars 108 forks source link

How are com-port functions in SerialInstance.cpp implemented? #426

Closed zhouchunyuan closed 9 months ago

zhouchunyuan commented 9 months ago

If we trace a serial function in MM, we end up in the SerialInstance.cpp https://github.com/micro-manager/mmCoreAndDevices/blob/main/MMCore/Devices/SerialInstance.cpp

But I can not find any detailed information of how they are realized.

Take the Purge() as an example: int SerialInstance::Purge() { RequireInitialized(__func__); return GetImpl()->Purge(); }

If we use right-click menu in VS2022 to "Go To definition", it links back only to itself.

Can anyone please tell me how to find the reallization of those functions there: GetImpl()->SetCommand(command, term);
GetImpl()->GetAnswer(txt, maxChars, term); GetImpl()->Write(buf, bufLen); GetImpl()->Read(buf, bufLen, charsRead); GetImpl()->Purge();

Thanks and best regards Chunyuan

nicost commented 9 months ago

Implementations are in device adapters that implement the CSerialBase interface. There are several (i.e, for serial, USB, TCP/IP, and HIC interfaces). You probably are most interested in SerialManager: https://github.com/micro-manager/mmCoreAndDevices/tree/main/DeviceAdapters/SerialManager

zhouchunyuan commented 9 months ago

Thanks Nico, this not only solves my problem, but also helps better understand the logic inside core/deviceAdapter.