File Information
Library: IoT/Devices
Package: Generated
Header: IoT/Devices/SerialDeviceServerHelper.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);
Member Summary
Member Functions: createRemoteObject, enableEvents, registerObject, registerRemoteObject, shutdown, unregisterObject
Types Aliases
Service
using Service = IoT::Devices::SerialDevice;
Constructors
SerialDeviceServerHelper
Creates a SerialDeviceServerHelper.
Destructor
~SerialDeviceServerHelper
Destroys the SerialDeviceServerHelper.
Member Functions
createRemoteObject
static Poco::AutoPtr < IoT::Devices::SerialDeviceRemoteObject > createRemoteObject(
Poco::SharedPtr < IoT::Devices::SerialDevice > pServiceObject,
const Poco::RemotingNG::Identifiable::ObjectId & oid
);
Creates and returns a RemoteObject wrapper for the given IoT::Devices::SerialDevice instance.
enableEvents
static void enableEvents(
const std::string & uri,
const std::string & protocol
);
Enables remote events for the RemoteObject identified by the given URI.
Events will be delivered using the Transport for the given protocol. Can be called multiple times for the same URI with different protocols.
registerObject
static std::string registerObject(
Poco::SharedPtr < IoT::Devices::SerialDevice > pServiceObject,
const Poco::RemotingNG::Identifiable::ObjectId & oid,
const std::string & listenerId
);
Creates a RemoteObject wrapper for the given IoT::Devices::SerialDevice instance and registers it with the ORB and the Listener instance uniquely identified by the Listener's ID.
Returns the URI created for the object.
registerRemoteObject
static std::string registerRemoteObject(
Poco::AutoPtr < IoT::Devices::SerialDeviceRemoteObject > pRemoteObject,
const std::string & listenerId
);
Registers the given RemoteObject with the ORB and the Listener instance uniquely identified by the Listener's ID.
Returns the URI created for the object.
shutdown
static void shutdown();
Removes the Skeleton for IoT::Devices::SerialDevice from the ORB.
unregisterObject
static void unregisterObject(
const std::string & uri
);
Unregisters a service object identified by URI from the ORB.