laith-dosinfection / lwIOlinkMaster

This repository is a work in progress with the intent to create a IO-link master stack which can extract data from IO-link Devices
GNU General Public License v3.0
1 stars 0 forks source link

Restructure of Port class #6

Open unref-ptr opened 10 months ago

unref-ptr commented 10 months ago

I looked quickly at the Classes you defined for IOLink::Port and IOLink::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.

grafik

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 as IOLink::SDCIPort. Please refer to spec v1.1.3 Figure 101 and Figure 102. The CM state machine does not interact with the System Management (which in turn interacts with the PHYand DL) when in SIO Mode (i.e., State Port_DIDO_6of the CM 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 type IOLink::SIOPort and IOLink::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.

laith-dosinfection commented 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.