File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
src/devices/deviceBundler Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,12 @@ bool DeviceBundler::open(yarp::os::Searchable& config)
7676 return false ;
7777 }
7878
79+ ret = m_pdev_wrapper.view (m_iService);
80+ if (ret)
81+ {
82+ yCInfo (DEVICEBUNDLER, " The device implements the IService iterface" );
83+ }
84+
7985 ret = m_iWrapper->attach (&m_pdev_subdevice);
8086 if (!ret)
8187 {
@@ -93,6 +99,7 @@ bool DeviceBundler::close()
9399 {
94100 m_iWrapper->detach ();
95101 m_iWrapper = nullptr ;
102+ m_iService = nullptr ;
96103 }
97104
98105 if (m_pdev_wrapper.isValid ())
@@ -107,3 +114,30 @@ bool DeviceBundler::close()
107114
108115 return true ;
109116}
117+
118+ bool DeviceBundler::startService ()
119+ {
120+ if (m_iService)
121+ {
122+ return m_iService->startService ();
123+ }
124+ return true ; // If not implemented, emulate running in background
125+ }
126+
127+ bool DeviceBundler::updateService ()
128+ {
129+ if (m_iService)
130+ {
131+ return m_iService->updateService ();
132+ }
133+ return false ;
134+ }
135+
136+ bool DeviceBundler::stopService ()
137+ {
138+ if (m_iService)
139+ {
140+ return m_iService->stopService ();
141+ }
142+ return false ;
143+ }
Original file line number Diff line number Diff line change 99#include < yarp/dev/DeviceDriver.h>
1010#include < yarp/dev/PolyDriver.h>
1111#include < yarp/dev/IWrapper.h>
12+ #include < yarp/dev/ServiceInterfaces.h>
1213#include " DeviceBundler_ParamsParser.h"
1314
1415/* *
2526*/
2627
2728class DeviceBundler : public yarp ::dev::DeviceDriver,
29+ public yarp::dev::IService,
2830 public DeviceBundler_ParamsParser
2931{
3032public:
@@ -39,10 +41,16 @@ class DeviceBundler : public yarp::dev::DeviceDriver,
3941 bool open (yarp::os::Searchable& config) override ;
4042 bool close () override ;
4143
44+ // yarp::dev::IService methods
45+ virtual bool startService () override ;
46+ virtual bool updateService () override ;
47+ virtual bool stopService () override ;
48+
4249private:
4350 yarp::dev::PolyDriver m_pdev_wrapper;
4451 yarp::dev::PolyDriver m_pdev_subdevice;
4552 yarp::dev::IWrapper* m_iWrapper=nullptr ;
53+ yarp::dev::IService* m_iService=nullptr ;
4654};
4755
4856#endif // YARP_DEVICEBUNDLER_H
You can’t perform that action at this time.
0 commit comments