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