File Information
Library: IoT/Devices
Package: Generated
Header: IoT/Devices/SerialDeviceEventDispatcher.h
Description
This class provides a simple interface for accessing a serial port.
There are two modes of operation for receiving data: polling (blocking) mode (default) and events (callback) mode.
In polling mode, repeatedly call poll() to detect if data is available, then call one of the read() methods to receive available data. The read() methods can also be called if no data is available, but will block until at least one character can be read.
In event mode the class will start a thread that polls and reads available data from the serial port, and fires the lineReceived event whenever something has been read. Since callback mode uses readLine() to receive entire lines (if possible), delimiter characters and timeout can be set via the "delimiters" (string) and "timeout" (double) properties.
Clients of the class can switch between polling and event mode by enabling or disabling the "events" feature:
setFeature("events", true);
Inheritance
Direct Base Classes: Poco::RemotingNG::EventDispatcher
All Base Classes: Poco::RefCountedObject, Poco::RemotingNG::EventDispatcher
Member Summary
Member Functions: event__lineReceived, event__statusChanged, remoting__typeId
Inherited Functions: accept, attributes, duplicate, protocol, referenceCount, release, removeEventFilter, setEventFilter, setEventFilterImpl, subscribe, transportForSubscriber, unsubscribe
Constructors
SerialDeviceEventDispatcher
SerialDeviceEventDispatcher(
ISerialDevice * pInterface,
const Poco::RemotingNG::Identifiable::ObjectId & objectId,
const std::string & protocol
);
Creates a SerialDeviceEventDispatcher.
Destructor
~SerialDeviceEventDispatcher
virtual ~SerialDeviceEventDispatcher();
Destroys the SerialDeviceEventDispatcher.
Member Functions
event__lineReceived
void event__lineReceived(
const void * pSender,
const std::string & data
);
event__statusChanged
void event__statusChanged(
const void * pSender,
const IoT::Devices::DeviceStatusChange & data
);
remoting__typeId
virtual const Poco::RemotingNG::Identifiable::TypeId & remoting__typeId() const;