Project

General

Profile

Introduction

There are numerous driver classes in Nomad that would take time to migrate manually to modules. A tool to automate the migration is developed.
The migrated classed are in the legacy directory of the NomadModules project.

In the following, to simplify:
NS = NomadServer/src
NM = NomadModules/src

During the migration transition phase, the concerned directories and files:
  • NS/DeviceContainer/Def copied in NM/drivers/legacy/def
    • must not evolve
  • NS/DeviceContainer/Status/*.h copied in NM/drivers/legacy/status
    • must not evolve
  • NS/DeviceContainer/Status/*.cpp modified to prepare their transfer in NomadModules
    • must not evolve
  • .DeviceProperty.xml analysed
    • must not increment, removal of drivers is ok
  • DeviceDriverCreator.cpp cleaned
    • can be modified

The code migration is based on the project NomadSourceAnalyser.

Categories

The driver categories are transformed into classes inheriting DeviceDriver.
  • manual example : class AxisCommon
  • generated example : class Attenuator in NM/drivers/legacy/category/Attenuator.h,cpp

The generation of categories is made with the script migratecategories.sh

For instance, from the category "attenuator" defined in .DeviceProperty.xml

namespace driver {

class Attenuator : public virtual DeviceDriver {

public:
    static const std::string TYPE;

    Attenuator(const std::string& name);

    Property<std::string> wantedValue;
    Property<std::string> actualValue;
    Property<int32> attenuatorStatus;
};

}

Driver Class Migration

The migration of driver P (= parent directory) D (= driver name) is made by the script migratedriver.sh:
  • move the sources from NS/DeviceContainer/Drivers/P/D to NM/drivers/legacy/p/d (lower case)
  • source transformation
  • includes change
  • the categories of the driver (defined in DeviceDriverCreator) become base classes
    • example : IllSec has category "sample_temperature" becomes:
      class IllSec : public driver::SampleTemperature {
      ...
      
    • The class driver::SampleTemperature was previously generated
  • possible multiple inheritance
  • add the TYPE member
  • change the signature of the constructor (only name)
  • add the properties Property<> in the class D
  • status with registerStatus()
  • static_cast<D*> become dynamic_cast<D*>
  • the conversion is made driver by driver
  • conversion rules to be refined for each driver
  • configuration tests

Once the migratedriver.sh script run and the compilation of the new module successful, the NomadServer project can be cleaned.
The script migrateserver.sh is used for this. It cleans DeviceDriverCreator.cpp, Makefile.am, removes the driver directory.

Once all the drivers migrated:
  • NS/DeviceContainer/Status/*.cpp moved to NM/drivers/legacy/status
  • NS/DeviceContainer/Def removed
  • .DeviceProperty.xml removed

Controller Properties Migration

Run the migratecontroller.sh script to generate the declaration and initialisation of properties from the .AbstractProperty.xml file.
Usage:

> ./migratecontroller.sh peak_scan