Added class ControllerManager
This commit is contained in:
parent
72910644e5
commit
f6b13ea489
4 changed files with 57 additions and 8 deletions
|
@ -5,12 +5,13 @@ ENDIF(COMMAND cmake_policy)
|
|||
######## Non configurable options ########
|
||||
SET( telldus-service_SRCS
|
||||
ClientCommunicationHandler.cpp
|
||||
Controller.cpp
|
||||
ControllerManager.cpp
|
||||
Device.cpp
|
||||
DeviceManager.cpp
|
||||
Event.cpp
|
||||
Settings.cpp
|
||||
TelldusMain.cpp
|
||||
DeviceManager.cpp
|
||||
Device.cpp
|
||||
Controller.cpp
|
||||
)
|
||||
SET( telldus-service_protocol_SRCS
|
||||
Protocol.h
|
||||
|
@ -21,13 +22,14 @@ SET( telldus-service_protocol_SRCS
|
|||
SET( telldus-service_HDRS
|
||||
ClientCommunicationHandler.h
|
||||
ConnectionListener.h
|
||||
Controller.h
|
||||
ControllerManager.h
|
||||
Device.h
|
||||
DeviceManager.h
|
||||
Event.h
|
||||
EventHandler.h
|
||||
Settings.h
|
||||
TelldusMain.h
|
||||
DeviceManager.h
|
||||
Device.h
|
||||
Controller.h
|
||||
)
|
||||
FIND_PACKAGE(Threads)
|
||||
LIST(APPEND telldus-service_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
|
28
telldus-core/service/ControllerManager.cpp
Normal file
28
telldus-core/service/ControllerManager.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include "ControllerManager.h"
|
||||
#include "Controller.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
typedef std::map<int, Controller *> ControllerMap;
|
||||
|
||||
class ControllerManager::PrivateData {
|
||||
public:
|
||||
int lastControllerId;
|
||||
ControllerMap controllers;
|
||||
};
|
||||
|
||||
ControllerManager::ControllerManager(){
|
||||
d = new PrivateData;
|
||||
d->lastControllerId = 0;
|
||||
}
|
||||
|
||||
ControllerManager::~ControllerManager(void) {
|
||||
for (ControllerMap::iterator it = d->controllers.begin(); it != d->controllers.end(); ++it) {
|
||||
delete( it->second );
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void ControllerManager::loadControllers() {
|
||||
//TODO: Do something
|
||||
}
|
17
telldus-core/service/ControllerManager.h
Normal file
17
telldus-core/service/ControllerManager.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef CONTROLLERMANAGER_H
|
||||
#define CONTROLLERMANAGER_H
|
||||
|
||||
class ControllerManager {
|
||||
public:
|
||||
ControllerManager(void);
|
||||
~ControllerManager(void);
|
||||
|
||||
protected:
|
||||
void loadControllers();
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
PrivateData *d;
|
||||
};
|
||||
|
||||
#endif //CONTROLLERMANAGER_H
|
|
@ -3,6 +3,7 @@
|
|||
#include "EventHandler.h"
|
||||
#include "ClientCommunicationHandler.h"
|
||||
#include "DeviceManager.h"
|
||||
#include "ControllerManager.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <list>
|
||||
|
@ -19,8 +20,7 @@ TelldusMain::TelldusMain(void)
|
|||
d->stopEvent = d->eventHandler.addEvent();
|
||||
}
|
||||
|
||||
TelldusMain::~TelldusMain(void)
|
||||
{
|
||||
TelldusMain::~TelldusMain(void) {
|
||||
delete d->stopEvent;
|
||||
delete d;
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ void TelldusMain::start(void) {
|
|||
Event *clientEvent = d->eventHandler.addEvent();
|
||||
|
||||
DeviceManager deviceManager;
|
||||
ControllerManager controllerManager;
|
||||
|
||||
ConnectionListener clientListener(L"TelldusClient", clientEvent);
|
||||
//TODO: eventlistener
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue