Open unref-ptr opened 10 months ago
I like the suggestion of the facade pattern. I was going to add the smarts for port configuration in the master class where if the port type changed it would destroy the old instance of the port and construct a new on of the new type. Let me germinate on this and I will work on implementing something this week.
I looked quickly at the Classes you defined for
IOLink::Port
andIOLink::SIOPort
. I imported them to Enterprise Architect to have a look at the UML class diagrams and I have some suggestions that could improve the architecture of the software.The current architecture assumes that the
IOLink::SIOPort
class is in charge of changing communication settings. In reality I think the Parent Class Port should have these methods or a specialized class such asIOLink::SDCIPort
. Please refer to spec v1.1.3 Figure 101 and Figure 102. The CM state machine does not interact with theSystem Management
(which in turn interacts with thePHY
andDL
) when in SIO Mode (i.e., StatePort_DIDO_6
of theCM
state machine in Figure 101).The wakeup feature and all the other communication functionality of the SDCI are only available when the Port is set to IOL_MANUAL or IOL_AUTOCOM.
Also I think it would be better that a
IOLink::Port
has both an instance of class typeIOLink::SIOPort
andIOLink::SDCIPort
. This is because the Port has both types of functionalities. I would suggest a simple facade pattern to group all the port types, this would simplify object management.