Commit e65b5617 authored by golgoj4's avatar golgoj4

refs #1767 - i have gone dumb apparently. back at it tomorrow.

parent cea4451b
......@@ -10,7 +10,7 @@
#include "../pluto_main/Define_Event.h"
#include "../pluto_main/Define_EventParameter.h"
#include "../pluto_main/Define_DeviceData.h"
#include <QObject>
/**
* THESE CLASSES ARE AUTOGENERATED WITH PLUTO DCEGEN APPLICATION
......@@ -122,10 +122,10 @@ public:
// OUR COMMAND CLASS
class Hue_Controller_Command : public Command_Impl
class Hue_Controller_Command : public Command_Impl, public QObject
{
public:
Hue_Controller_Command(int DeviceID, string ServerAddress,bool bConnectEventHandler=true,bool bLocalMode=false,class Router *pRouter=NULL)
Hue_Controller_Command(int DeviceID, string ServerAddress,bool bConnectEventHandler=true,bool bLocalMode=false,class Router *pRouter=NULL, QObject *parent=0)
: Command_Impl(DeviceID, ServerAddress, bLocalMode, pRouter)
{
}
......@@ -209,7 +209,7 @@ public:
PostConfigCleanup();
return true;
};
Hue_Controller_Command(Command_Impl *pPrimaryDeviceCommand, DeviceData_Impl *pData, Event_Impl *pEvent, Router *pRouter) : Command_Impl(pPrimaryDeviceCommand, pData, pEvent, pRouter) {};
Hue_Controller_Command(Command_Impl *pPrimaryDeviceCommand, DeviceData_Impl *pData, Event_Impl *pEvent, Router *pRouter) : Command_Impl(pPrimaryDeviceCommand, pData, pEvent, pRouter) {};
virtual ~Hue_Controller_Command() {};
Hue_Controller_Event *GetEvents() { return (Hue_Controller_Event *) m_pEvent; };
Hue_Controller_Data *GetData() { return (Hue_Controller_Data *) m_pData; };
......
# -------------------------------------------------
# Project created by QtCreator 2013-05-04T14:36:21
# -------------------------------------------------
QT += network \
script
QT -= gui
QT += core
QT += network
QT += thread
#QT -= gui
TARGET = HueController
CONFIG +=sharedlib
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += /usr/include/qjson/ \
../../ \
../../DCE/
LIBS += -lqjson
SOURCES += ../Main.cpp \
../../PlutoUtils/uuencode.cpp \
../../PlutoUtils/ThreadedClass.cpp \
......
#############################################################################
# Makefile for building: HueController
# Generated by qmake (2.01a) (Qt 4.6.2) on: Sun May 5 11:03:52 2013
# Generated by qmake (2.01a) (Qt 4.6.2) on: Sun May 5 19:38:28 2013
# Project: HueController.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile HueController.pro
......@@ -10,13 +10,13 @@
CC = gcc
CXX = g++
DEFINES = -DQT_SCRIPT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
DEFINES = -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtScript -I/usr/include/qt4 -I/usr/include/qjson -I../.. -I../../DCE -I.
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/qjson -I../.. -I../../DCE -I.
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -lQtScript -lQtNetwork -lQtCore -lpthread
LIBS = $(SUBLIBS) -L/usr/lib -lqjson -lQtGui -lQtNetwork -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
......@@ -72,7 +72,7 @@ SOURCES = ../Main.cpp \
../../DCE/DeviceData_Impl.cpp \
../../PlutoUtils/getch.cpp \
../../Gen_Devices/Hue_ControllerBase.cpp \
../Hue_Controller.cpp
../Hue_Controller.cpp moc_Hue_Controller.cpp
OBJECTS = Main.o \
uuencode.o \
ThreadedClass.o \
......@@ -102,7 +102,8 @@ OBJECTS = Main.o \
DeviceData_Impl.o \
getch.o \
Hue_ControllerBase.o \
Hue_Controller.o
Hue_Controller.o \
moc_Hue_Controller.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
......@@ -173,7 +174,7 @@ Makefile: HueController.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/sh
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtScript.prl \
/usr/lib/libQtGui.prl \
/usr/lib/libQtNetwork.prl \
/usr/lib/libQtCore.prl
$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile HueController.pro
......@@ -196,7 +197,7 @@ Makefile: HueController.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/sh
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtScript.prl:
/usr/lib/libQtGui.prl:
/usr/lib/libQtNetwork.prl:
/usr/lib/libQtCore.prl:
qmake: FORCE
......@@ -223,8 +224,12 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all:
compiler_moc_header_make_all: moc_Hue_Controller.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_Hue_Controller.cpp
moc_Hue_Controller.cpp: ../Hue_Controller.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) ../Hue_Controller.h -o moc_Hue_Controller.cpp
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
......@@ -240,7 +245,7 @@ compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
compiler_clean: compiler_moc_header_clean
####### Compile
......@@ -429,6 +434,9 @@ Hue_ControllerBase.o: ../../Gen_Devices/Hue_ControllerBase.cpp ../../Gen_Devices
Hue_Controller.o: ../Hue_Controller.cpp ../Hue_Controller.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o Hue_Controller.o ../Hue_Controller.cpp
moc_Hue_Controller.o: moc_Hue_Controller.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_Hue_Controller.o moc_Hue_Controller.cpp
####### Install
install: FORCE
......
#include "huebridge.h"
HueBridge::HueBridge(Hue_Controller* dceObject, QObject *parent) :
QObject(parent), mp_dceController(dceObject)
{
}
#ifndef HUEBRIDGE_H
#define HUEBRIDGE_H
#include <QObject>
#include "qjson/parser.h"
#include "qjson/qobjecthelper.h"
#include "qjson/serializer.h"
#include "qnetworkaccessmanager.h"
#include "Hue_Controller/Hue_Controller.h"
class HueBridge : public QObject
{
Q_OBJECT
public:
explicit HueBridge(DCE::Hue_Controller* dceObject, QObject *parent = 0 );
signals:
public slots:
private:
DCE::Hue_Controller *mp_dceController;
};
#endif // HUEBRIDGE_H
This diff is collapsed.
......@@ -19,38 +19,50 @@
#include "Gen_Devices/Hue_ControllerBase.h"
//<-dceag-d-e->
#include <QObject>
#include <qjson/serializer.h>
#include <qjson/parser.h>
#include <QNetworkAccessManager>
//<-dceag-decl-b->
namespace DCE
{
class Hue_Controller : public Hue_Controller_Command
{
//<-dceag-decl-e->
class Hue_Controller : public Hue_Controller_Command, public QObject
{
Q_OBJECT
//<-dceag-decl-e->
// Private member variables
bool mb_isNew;
bool validated;
QString targetIpAddress;
QString authUser;
QNetworkAccessManager *communicator;
// Private methods
public:
// Public member variables
signals:
void responseRecieved();
void initiateConfigDownload();
//<-dceag-const-b->
public:
// Constructors/Destructor
Hue_Controller(int DeviceID, string ServerAddress,bool bConnectEventHandler=true,bool bLocalMode=false,class Router *pRouter=NULL);
virtual ~Hue_Controller();
virtual bool GetConfig();
virtual bool Register();
virtual void ReceivedCommandForChild(DeviceData_Impl *pDeviceData_Impl,string &sCMD_Result,Message *pMessage);
virtual void ReceivedUnknownCommand(string &sCMD_Result,Message *pMessage);
//<-dceag-const-e->
public:
// Constructors/Destructor
Hue_Controller(int DeviceID, string ServerAddress,bool bConnectEventHandler=true,bool bLocalMode=false,class Router *pRouter=NULL, QObject *parent=0);
virtual ~Hue_Controller();
virtual bool GetConfig();
virtual bool Register();
virtual void ReceivedCommandForChild(DeviceData_Impl *pDeviceData_Impl,string &sCMD_Result,Message *pMessage);
virtual void ReceivedUnknownCommand(string &sCMD_Result,Message *pMessage);
//<-dceag-const-e->
void initBridgeConnection();
bool findControllers();
//<-dceag-const2-b->
// The following constructor is only used if this a class instance embedded within a DCE Device. In that case, it won't create it's own connection to the router
// You can delete this whole section and put an ! after dceag-const2-b tag if you don't want this constructor. Do the same in the implementation file
Hue_Controller(Command_Impl *pPrimaryDeviceCommand, DeviceData_Impl *pData, Event_Impl *pEvent, Router *pRouter);
//<-dceag-const2-e->
// The following constructor is only used if this a class instance embedded within a DCE Device. In that case, it won't create it's own connection to the router
// You can delete this whole section and put an ! after dceag-const2-b tag if you don't want this constructor. Do the same in the implementation file
Hue_Controller(Command_Impl *pPrimaryDeviceCommand, DeviceData_Impl *pData, Event_Impl *pEvent, Router *pRouter);
//<-dceag-const2-e->
//<-dceag-h-b->
/*
......@@ -74,8 +86,8 @@ public:
/** @brief COMMAND: #184 - Set Level */
/** Sets the brightness of the light. The value is 0 for off, up to 100 for full brightness. Several devices such as Drapes Switch can accept relative levels (+1 to step forward/-1 to step backword). */
/** @param #76 Level */
/** The level to set, as a value between 0 (off) and 100 (full). It can be preceeded with a - or + indicating a relative value. +20 means up 20%. */
/** @param #76 Level */
/** The level to set, as a value between 0 (off) and 100 (full). It can be preceeded with a - or + indicating a relative value. +20 means up 20%. */
virtual void CMD_Set_Level(string sLevel) { string sCMD_Result; CMD_Set_Level(sLevel.c_str(),sCMD_Result,NULL);};
virtual void CMD_Set_Level(string sLevel,string &sCMD_Result,Message *pMessage);
......@@ -83,10 +95,10 @@ public:
/** @brief COMMAND: #192 - On */
/** Turn on the device */
/** @param #97 PK_Pipe */
/** Normally when a device is turned on all the inputs and outputs are selected automatically. If this parameter is specified, only the settings along this pipe will be set. */
/** @param #98 PK_Device_Pipes */
/** Normally when a device is turned on the corresponding "pipes" are enabled by default. if this parameter is blank. If this parameter is 0, no pipes will be enabled. This can also be a comma seperated list of devices, meaning only the pipes to those devic */
/** @param #97 PK_Pipe */
/** Normally when a device is turned on all the inputs and outputs are selected automatically. If this parameter is specified, only the settings along this pipe will be set. */
/** @param #98 PK_Device_Pipes */
/** Normally when a device is turned on the corresponding "pipes" are enabled by default. if this parameter is blank. If this parameter is 0, no pipes will be enabled. This can also be a comma seperated list of devices, meaning only the pipes to those devic */
virtual void CMD_On(int iPK_Pipe,string sPK_Device_Pipes) { string sCMD_Result; CMD_On(iPK_Pipe,sPK_Device_Pipes.c_str(),sCMD_Result,NULL);};
virtual void CMD_On(int iPK_Pipe,string sPK_Device_Pipes,string &sCMD_Result,Message *pMessage);
......@@ -94,8 +106,8 @@ public:
/** @brief COMMAND: #193 - Off */
/** Turn off the device */
/** @param #97 PK_Pipe */
/** Normally when a device is turned on all the inputs and outputs are selected automatically. If this parameter is specified, only the settings along this pipe will be set. */
/** @param #97 PK_Pipe */
/** Normally when a device is turned on all the inputs and outputs are selected automatically. If this parameter is specified, only the settings along this pipe will be set. */
virtual void CMD_Off(int iPK_Pipe) { string sCMD_Result; CMD_Off(iPK_Pipe,sCMD_Result,NULL);};
virtual void CMD_Off(int iPK_Pipe,string &sCMD_Result,Message *pMessage);
......@@ -110,8 +122,8 @@ public:
/** @brief COMMAND: #757 - Download Configuration */
/** Download new configuration data for this device */
/** @param #9 Text */
/** Any information the device may want to do the download */
/** @param #9 Text */
/** Any information the device may want to do the download */
virtual void CMD_Download_Configuration(string sText) { string sCMD_Result; CMD_Download_Configuration(sText.c_str(),sCMD_Result,NULL);};
virtual void CMD_Download_Configuration(string sText,string &sCMD_Result,Message *pMessage);
......@@ -119,12 +131,12 @@ public:
/** @brief COMMAND: #760 - Send Command To Child */
/** After reporting new child devices, there may be children we want to test, but we haven't done a quick reload router and can't send them messages directly. This way we can send 'live' messages to children */
/** @param #10 ID */
/** The internal ID used for this device--not the Pluto device ID. */
/** @param #154 PK_Command */
/** The command to send */
/** @param #202 Parameters */
/** Parameters for the command in the format:
/** @param #10 ID */
/** The internal ID used for this device--not the Pluto device ID. */
/** @param #154 PK_Command */
/** The command to send */
/** @param #202 Parameters */
/** Parameters for the command in the format:
PK_CommandParameter|Value|... */
virtual void CMD_Send_Command_To_Child(string sID,int iPK_Command,string sParameters) { string sCMD_Result; CMD_Send_Command_To_Child(sID.c_str(),iPK_Command,sParameters.c_str(),sCMD_Result,NULL);};
......@@ -133,8 +145,8 @@ PK_CommandParameter|Value|... */
/** @brief COMMAND: #776 - Reset */
/** Reset device. */
/** @param #51 Arguments */
/** Argument string
/** @param #51 Arguments */
/** Argument string
NOEMON or CANBUS */
virtual void CMD_Reset(string sArguments) { string sCMD_Result; CMD_Reset(sArguments.c_str(),sCMD_Result,NULL);};
......@@ -143,8 +155,8 @@ NOEMON or CANBUS */
/** @brief COMMAND: #788 - StatusReport */
/** Test comand. Asq a report */
/** @param #51 Arguments */
/** Argument string */
/** @param #51 Arguments */
/** Argument string */
virtual void CMD_StatusReport(string sArguments) { string sCMD_Result; CMD_StatusReport(sArguments.c_str(),sCMD_Result,NULL);};
virtual void CMD_StatusReport(string sArguments,string &sCMD_Result,Message *pMessage);
......@@ -152,18 +164,25 @@ NOEMON or CANBUS */
/** @brief COMMAND: #980 - Set Color RGB */
/** set the rgb color of a device */
/** @param #279 Red Level */
/** The red level for the device */
/** @param #280 Green Level */
/** The green level for the device */
/** @param #281 Blue Level */
/** The blue level for the device */
/** @param #279 Red Level */
/** The red level for the device */
/** @param #280 Green Level */
/** The green level for the device */
/** @param #281 Blue Level */
/** The blue level for the device */
virtual void CMD_Set_Color_RGB(int iRed_Level,int iGreen_Level,int iBlue_Level) { string sCMD_Result; CMD_Set_Color_RGB(iRed_Level,iGreen_Level,iBlue_Level,sCMD_Result,NULL);};
virtual void CMD_Set_Color_RGB(int iRed_Level,int iGreen_Level,int iBlue_Level,string &sCMD_Result,Message *pMessage);
//<-dceag-h-e->
//<-dceag-h-e->
public slots:
void initResponse();
void getHueDataStore();
void downloadConfigResponse();
void dummySlot();
};
......
......@@ -11,8 +11,10 @@
See the GNU General Public License for more details.
*/
//<-dceag-incl-b->
#include "Hue_Controller.h"
#include <QCoreApplication>
//<-dceag-incl-b->
#include "DCE/Logger.h"
#include "ServerLogger.h"
......@@ -112,6 +114,7 @@ extern "C" {
//<-dceag-main-b->
int main(int argc, char* argv[])
{
QCoreApplication a(argc, argv);
g_sBinary = FileUtils::FilenameWithoutPath(argv[0]);
g_sBinaryPath = FileUtils::BasePath(argv[0]);
......@@ -234,6 +237,8 @@ int main(int argc, char* argv[])
bReload=true;
delete pHue_Controller;
return a.exec();
}
catch(string s)
{
......
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