48 PeriodicThread::setPeriod(0.010);
51 std::string pImg_Name =
m_name;
52 std::string rpcPort_Name = pImg_Name +
"/rpc";
54 if (!rpcPort.
open(rpcPort_Name)) {
55 yCError(FRAMEWRITER_NWS_YARP) <<
"Unable to open rpc Port" << rpcPort_Name.c_str();
59 if (!m_portProc.
open(pImg_Name)) {
60 yCError(FRAMEWRITER_NWS_YARP) <<
"Unable to open image input Port" << pImg_Name.c_str();
65 yCInfo(FRAMEWRITER_NWS_YARP) <<
"Running, waiting for attach...";
73 yCError(FRAMEWRITER_NWS_YARP) <<
"Device " << poly <<
" to attach to is not valid ... cannot proceed";
77 poly->
view(iFrameWriterImage);
79 return PeriodicThread::start();
89 iFrameWriterImage =
nullptr;
102 std::vector<yarp::sig::FlexImage> vec;
105 for (
auto it = vec.begin(); it != vec.end(); it++)
113 yCError(FRAMEWRITER_NWS_YARP) <<
"Unsupported image type received";
static constexpr double DEFAULT_THREAD_PERIOD
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool detach() override
Detach the object (you must have first called attach).
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
void run() override
Loop function.
~FrameWriter_nws_yarp() override
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
bool threadInit() override
Initialization method.
bool view(T *&x)
Get an interface to the device driver.
virtual bool putImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image)=0
Write an image to the device.
A container for a device driver.
bool isValid() const
Check if device is valid.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
bool isRunning() const
Returns true when the thread is started, false otherwise.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A base class for nested structures that can be searched.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)