telldus/telldus-core/client/Client.h
Micke Prag 148fd52c76 Create one generic callback dispatcher that can handle all our
callbacks.

This minimize code duplication and allows us much easier to add and
maintain callbacks.
2012-02-24 16:47:30 +01:00

42 lines
1 KiB
C++

#ifndef CLIENT_H
#define CLIENT_H
#include "Message.h"
#include "telldus-core.h"
#include "Thread.h"
#include "CallbackDispatcher.h"
namespace TelldusCore {
class Client : public Thread
{
public:
~Client(void);
static Client *getInstance();
static void close();
int registerEvent(CallbackStruct::CallbackType type, void *eventFunction, void *context );
void stopThread(void);
bool unregisterCallback( int callbackId );
int getSensor(char *protocol, int protocolLen, char *model, int modelLen, int *id, int *dataTypes);
int getController(int *controllerId, int *controllerType, char *name, int nameLen, int *available);
static bool getBoolFromService(const Message &msg);
static int getIntegerFromService(const Message &msg);
static std::wstring getWStringFromService(const Message &msg);
protected:
void run(void);
private:
Client();
static std::wstring sendToService(const Message &msg);
class PrivateData;
PrivateData *d;
static Client *instance;
};
}
#endif //CLIENT_H