Commit d93745ac authored by Jussi Lindgren's avatar Jussi Lindgren

Modules: Added NULL string handling to StimulusSender

parent b8e880f1
......@@ -25,6 +25,7 @@ namespace TCPTagging
virtual ~CStimulusSender();
// Connect to the TCP Tagging plugin of the Acquisition Server
// If sAddress is empty string, the StimulusSender will be inactive and connect() will not print an error but returns false.
virtual TCPTagging::boolean connect(const char* sAddress, const char* sStimulusPort);
// Send a stimulation. Set Timestamp to 0 for immediate tagging (also the default).
......
......@@ -13,7 +13,8 @@ namespace TCPTagging
class OV_API IStimulusSender {
public:
// Connect to the TCP Tagging plugin of the Acquisition Server
// Connect to the TCP Tagging plugin of the Acquisition Server.
// If sAddress is empty string, the StimulusSender will be inactive and connect() will not print an error but returns false.
virtual TCPTagging::boolean connect(const char* sAddress, const char* sStimulusPort) = 0;
// Send a stimulation. Set Timestamp to 0 for immediate tagging (also the default).
......@@ -27,6 +28,11 @@ namespace TCPTagging
// Clients are constructed via this call.
extern OV_API TCPTagging::IStimulusSender* createStimulusSender(void);
/*
* \class IStimulusSender
* \author Thierry Gaugry / Inria
* \brief @todo Describe...
*/
class OV_API IStimulusMultiSender {
public:
virtual TCPTagging::boolean connect(const char* sAddress, const char* sStimulusPort) = 0;
......
......@@ -22,7 +22,18 @@ CStimulusSender::~CStimulusSender()
boolean CStimulusSender::connect(const char* sAddress, const char* sStimulusPort)
{
tcp::resolver resolver(m_ioService);
if (!sAddress || !sStimulusPort)
{
std::cout << "Error: Do not pass NULL pointers to CStimulusSender::connect()\n";
return false;
}
if (sAddress[0] == 0)
{
// Empty string is ok, in that case Stimulus Sender is disabled
return false;
}
// Stimulus port
std::cout << "Connecting to Acquisition Server's TCP Tagging [" << sAddress << " , port " << sStimulusPort << "]\n";
try
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment