Skip to content
Snippets Groups Projects
Commit 64cf13cd authored by yanmorin's avatar yanmorin
Browse files

Sending a response when there is a zeroconf request (100 not implemented)
parent 85581832
No related branches found
No related tags found
No related merge requests found
......@@ -216,11 +216,17 @@ GuiFramework::getZeroconf(const std::string& sequenceId)
}
bool
GuiFramework::attachZeroconfEvents(const std::string& sequenceId, Observer& observer)
GuiFramework::attachZeroconfEvents(const std::string& sequenceId, Pattern::Observer& observer)
{
return Manager::instance().attachZeroconfEvents(sequenceId, observer);
}
bool
GuiFramework::detachZeroconfEvents(Pattern::Observer& observer)
{
return Manager::instance().detachZeroconfEvents(observer);
}
bool
GuiFramework::getCallStatus(const std::string& sequenceId)
{
......
......@@ -25,6 +25,7 @@
#include <string>
#include "server/argtokenizer.h"
#include "../observer.h"
class GuiFramework {
public:
......@@ -81,7 +82,8 @@ public:
// config
bool getZeroconf(const std::string& sequenceId);
bool attachZeroconfEvents(const std::string& sequenceId, Observer& observer);
bool attachZeroconfEvents(const std::string& sequenceId, Pattern::Observer& observer);
bool detachZeroconfEvents(Pattern::Observer& observer);
bool getCallStatus(const std::string& sequenceId);
bool getConfigAll(const std::string& sequenceId);
bool getConfig(const std::string& section, const std::string& name, TokenList& arg);
......
......@@ -42,7 +42,7 @@ ResponseMessage
RequestZeroconfEvent::execute()
{
if (GUIServer::instance().attachZeroconfEvents(_sequenceId, *this)) {
return message("200", "OK");
return message("000", "Zeroconf Events are running");
} else {
return message("501","Zeroconf not enabled or activated");
}
......@@ -50,13 +50,14 @@ RequestZeroconfEvent::execute()
RequestZeroconfEvent::~RequestZeroconfEvent()
{
GUIServer::instance.removeZeroconfEvents(*this);
GUIServer::instance().detachZeroconfEvents(*this);
}
ResponseMessage
void
RequestZeroconfEvent::update()
{
return message("100", "New Zeroconf events - Not Implemented");
TokenList tk; tk.push_back("New Zeroconf events - Not Implemented");
GUIServer::instance().sendMessage("100", _sequenceId, tk);
}
ResponseMessage
......
......@@ -41,6 +41,7 @@ public:
RequestZeroconfEvent(const std::string &sequenceId, const TokenList& argList) : RequestGlobal(sequenceId,argList) {}
~RequestZeroconfEvent();
ResponseMessage execute();
void update();
};
......
......@@ -1340,8 +1340,10 @@ ManagerImpl::detachZeroconfEvents(Pattern::Observer& observer)
{
bool returnValue = false;
#ifdef USE_ZEROCONF
_DNSService->detach(observer);
returnValue = true;
if (_DNSService) {
_DNSService->detach(observer);
returnValue = true;
}
#endif
return returnValue;
}
......
......@@ -192,7 +192,7 @@ public:
// configuration function requests
bool getZeroconf(const std::string& sequenceId);
bool attachZeroconfEvents(const std::string& sequenceId, Pattern::Observer& observer);
bool removeZeroconfEvents(Pattern::Observer& observer);
bool detachZeroconfEvents(Pattern::Observer& observer);
bool getCallStatus(const std::string& sequenceId);
bool getConfigAll(const std::string& sequenceId);
bool getConfig(const std::string& section, const std::string& name, TokenList& arg);
......
......@@ -43,7 +43,9 @@ Subject::notify()
{
std::list<Observer*>::iterator iter = _observers.begin();
while( iter != _observers.end()) {
(*iter)->update();
if (*iter) {
(*iter)->update();
}
iter++;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment