Using RSC services

You have the option of using the already registered RSC services of the SDK via the ServiceManager. The ServiceManager acts as the RSC API and is used to request services.

  • Use the #include command in the header file to include the  ServiceManager class and the desired service interface (e.g., IDeviceStatusService). 
    Header file exampleClick to see an example header file
    #pragma once
    #include "Arp/System/Core/Arp.h"
    #include "Arp/System/Acf/ComponentBase.hpp"
    #include "Arp/System/Acf/IApplication.hpp"
    #include "Arp/System/Acf/IControllerComponent.hpp"
    #include "Arp/System/Commons/Logging.h"
    #include "Arp/System/Rsc/ServiceManager.hpp"
    #include "Arp/System/Commons/Threading/WorkerThread.hpp"
    #include "Arp/Device/Interface/Services/IDeviceStatusService.hpp"
  • Initialize a pointer to the object matching the desired service by calling the GetService() method of the ServiceManager.
  • Pass on the name of the corresponding interface as the template argument.

 

You can place this call in the SubscribeServices() method of your component, for example:

class ExampleComponent : public .....
    {
   ...
   private: //services
 IDeviceStatusService::Ptr deviceStatusService;
  ...
   }
#include....
    using namespace Arp::System::Rsc;
  using namespace Arp ...
   void ExampleComponent::SubscribeServices()
    {
   
  // Get service handle
  this->deviceStatusService = ServiceManager::GetService<IDeviceStatusService>();
}

 

Note: The execution of RSC services can take some time (in particular Axioline and PROFINET services). For this reason, avoid direct calls from ESM tasks.

 

RSC services are available for the following areas:

  • Axioline services: Read and write access to data and information from Axioline devices
  • PROFINET services: Read and write access to data and information from PROFINET devices
  • Device interface services: Access to information and properties of the Operating System and controller hardware 
  • GDS services: Read and write access to the data of the GDS