openiolink / io-link-master-shield-hat-sw

Software for the IO-Link Master Shield/Hat for Arduino and Raspberry Pi
Apache License 2.0
25 stars 6 forks source link

exposure of services of the "Application Layer" to the user application #47

Open gammeter opened 3 years ago

gammeter commented 3 years ago

In the current design, the class GenericIOLDevice implements the Application Layer (according to the IO-Link Interface and System Specification) beside other things. Each class that implements / abstracts a specific device (e.g. BNI0088 implements a SmartLight from Balluff GmbH) inherits from GenericIOLDevice. Because these Device classes are the interface between the master stack and the user application, all public methods of GenericIOLDevice are exposed to the user application, which is not necessarily desirable.

  1. Declaring the methods of GenericIOLDevice protected (such that only inheriting objects can access them) is not possibe, because the user needs to instantiate and use GenericIOLDevice directly, if his/her Device is not implemented (i.e. no Device class is available for it (yet)).
  2. However, the Device classes could inherit protected (instead of public, which is the default) from GenericIOLDevice
  3. An other idea would be to add an additional layer over the "Application Layer". This layer would consist of the Device classes which would use "the Application Layer" but hide it from the user.