Using RSC services
You have the option of using the already registered RSC services of the SDK via theServiceManager
. TheServiceManager
acts as the RSC API and is used to request services.
Application
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
Implementation
- Use the
#include
command in the header file to include theServiceManager
class and the desired service interface (e.g.,IDeviceStatusService
).
Header file exampleClick to see an header file example#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 theServiceManager
. - Pass on the name of the corresponding interface as the template argument.
- Place this call in the
SubscribeServices()
method of your component.
Click to see an implementation exampleClick to see an implementation exampleclass 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.
Tip: Phoenix Contact provides a free-of-charge online E-Learning class for programming C++ function extensions that use RSC services.
• Published/reviewed: 2024-12-10 ☃ Revision 075 •