Commit 175f8119 authored by golgoj4's avatar golgoj4

refs #1767 - checking in progress so far. On/ off functioning now end to end,...

refs #1767 - checking in progress so far. On/ off functioning now end to end, time to roll in additional features.
parent e77f22a5
......@@ -49,7 +49,8 @@ SOURCES += ../Main.cpp \
../../Gen_Devices/Hue_ControllerBase.cpp \
../Hue_Controller.cpp \
hueinterface.cpp \
huecontrollerhardware.cpp
huecontrollerhardware.cpp \
huebulb.cpp
HEADERS += ../../PlutoUtils/ThreadedClass.h \
../../PlutoUtils/MultiThreadIncludes.h \
......@@ -74,4 +75,5 @@ HEADERS += ../../PlutoUtils/ThreadedClass.h \
../../Gen_Devices/Hue_ControllerBase.h \
../Hue_Controller.h \
hueinterface.h \
huecontrollerhardware.h
huecontrollerhardware.h \
huebulb.h
#############################################################################
# Makefile for building: HueController
# Generated by qmake (2.01a) (Qt 4.6.2) on: Wed May 8 18:47:18 2013
# Generated by qmake (2.01a) (Qt 4.6.2) on: Sat May 11 16:32:31 2013
# Project: HueController.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix -o Makefile HueController.pro
......@@ -74,9 +74,11 @@ SOURCES = ../Main.cpp \
../../Gen_Devices/Hue_ControllerBase.cpp \
../Hue_Controller.cpp \
hueinterface.cpp \
huecontrollerhardware.cpp moc_Hue_Controller.cpp \
huecontrollerhardware.cpp \
huebulb.cpp moc_Hue_Controller.cpp \
moc_hueinterface.cpp \
moc_huecontrollerhardware.cpp
moc_huecontrollerhardware.cpp \
moc_huebulb.cpp
OBJECTS = Main.o \
uuencode.o \
ThreadedClass.o \
......@@ -109,9 +111,11 @@ OBJECTS = Main.o \
Hue_Controller.o \
hueinterface.o \
huecontrollerhardware.o \
huebulb.o \
moc_Hue_Controller.o \
moc_hueinterface.o \
moc_huecontrollerhardware.o
moc_huecontrollerhardware.o \
moc_huebulb.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
......@@ -213,7 +217,7 @@ qmake: FORCE
dist:
@$(CHK_DIR_EXISTS) .tmp/HueController1.0.0 || $(MKDIR) .tmp/HueController1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/HueController1.0.0/ && $(COPY_FILE) --parents ../../PlutoUtils/ThreadedClass.h ../../PlutoUtils/MultiThreadIncludes.h ../../PlutoUtils/StringUtils.h ../../PlutoUtils/CommonIncludes.h ../../PlutoUtils/Other.h ../../PlutoUtils/getch.h ../../PlutoUtils/MyStl.h ../../DCE/DeviceData_Base.h ../../DCE/Message.h ../../DCE/ServerLogger.h ../../DCE/Logger.h ../../DCE/Virtual_Device_Translator.h ../../DCE/PlutoLockLogger.h ../../DCE/ClientSocket.h ../../DCE/PlainClientSocket.h ../../DCE/AlarmManager.h ../../SerializeClass/SerializeClass.h ../../PlutoUtils/FileUtils.h ../../pluto_main/Define_DeviceCategory.h ../../pluto_main/Define_DeviceTemplate.h ../../Gen_Devices/Hue_ControllerBase.h ../Hue_Controller.h hueinterface.h huecontrollerhardware.h .tmp/HueController1.0.0/ && $(COPY_FILE) --parents ../Main.cpp ../../PlutoUtils/uuencode.cpp ../../PlutoUtils/ThreadedClass.cpp ../../PlutoUtils/Other.cpp ../../PlutoUtils/MultiThreadIncludes.cpp ../../PlutoUtils/minilzo.cpp ../../PlutoUtils/md5c.cpp ../../PlutoUtils/FileUtils.cpp ../../PlutoUtils/CommonIncludes.cpp ../../SerializeClass/SerializeClass.cpp ../../DCE/Virtual_Device_Translator.cpp ../../DCE/Socket.cpp ../../DCE/ServerLogger.cpp ../../DCE/PlainClientSocket.cpp ../../DCE/MessageBuffer.cpp ../../DCE/Message.cpp ../../DCE/HandleRequestSocket.cpp ../../DCE/Logger.cpp ../../DCE/Event_Impl.cpp ../../DCE/DCEConfig.cpp ../../DCE/DataGrid.cpp ../../DCE/Command_Impl.cpp ../../DCE/AlarmManager.cpp ../../PlutoUtils/StringUtils.cpp ../../DCE/ClientSocket.cpp ../../DCE/DeviceData_Base.cpp ../../DCE/DeviceData_Impl.cpp ../../PlutoUtils/getch.cpp ../../Gen_Devices/Hue_ControllerBase.cpp ../Hue_Controller.cpp hueinterface.cpp huecontrollerhardware.cpp .tmp/HueController1.0.0/ && (cd `dirname .tmp/HueController1.0.0` && $(TAR) HueController1.0.0.tar HueController1.0.0 && $(COMPRESS) HueController1.0.0.tar) && $(MOVE) `dirname .tmp/HueController1.0.0`/HueController1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/HueController1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/HueController1.0.0/ && $(COPY_FILE) --parents ../../PlutoUtils/ThreadedClass.h ../../PlutoUtils/MultiThreadIncludes.h ../../PlutoUtils/StringUtils.h ../../PlutoUtils/CommonIncludes.h ../../PlutoUtils/Other.h ../../PlutoUtils/getch.h ../../PlutoUtils/MyStl.h ../../DCE/DeviceData_Base.h ../../DCE/Message.h ../../DCE/ServerLogger.h ../../DCE/Logger.h ../../DCE/Virtual_Device_Translator.h ../../DCE/PlutoLockLogger.h ../../DCE/ClientSocket.h ../../DCE/PlainClientSocket.h ../../DCE/AlarmManager.h ../../SerializeClass/SerializeClass.h ../../PlutoUtils/FileUtils.h ../../pluto_main/Define_DeviceCategory.h ../../pluto_main/Define_DeviceTemplate.h ../../Gen_Devices/Hue_ControllerBase.h ../Hue_Controller.h hueinterface.h huecontrollerhardware.h huebulb.h .tmp/HueController1.0.0/ && $(COPY_FILE) --parents ../Main.cpp ../../PlutoUtils/uuencode.cpp ../../PlutoUtils/ThreadedClass.cpp ../../PlutoUtils/Other.cpp ../../PlutoUtils/MultiThreadIncludes.cpp ../../PlutoUtils/minilzo.cpp ../../PlutoUtils/md5c.cpp ../../PlutoUtils/FileUtils.cpp ../../PlutoUtils/CommonIncludes.cpp ../../SerializeClass/SerializeClass.cpp ../../DCE/Virtual_Device_Translator.cpp ../../DCE/Socket.cpp ../../DCE/ServerLogger.cpp ../../DCE/PlainClientSocket.cpp ../../DCE/MessageBuffer.cpp ../../DCE/Message.cpp ../../DCE/HandleRequestSocket.cpp ../../DCE/Logger.cpp ../../DCE/Event_Impl.cpp ../../DCE/DCEConfig.cpp ../../DCE/DataGrid.cpp ../../DCE/Command_Impl.cpp ../../DCE/AlarmManager.cpp ../../PlutoUtils/StringUtils.cpp ../../DCE/ClientSocket.cpp ../../DCE/DeviceData_Base.cpp ../../DCE/DeviceData_Impl.cpp ../../PlutoUtils/getch.cpp ../../Gen_Devices/Hue_ControllerBase.cpp ../Hue_Controller.cpp hueinterface.cpp huecontrollerhardware.cpp huebulb.cpp .tmp/HueController1.0.0/ && (cd `dirname .tmp/HueController1.0.0` && $(TAR) HueController1.0.0.tar HueController1.0.0 && $(COMPRESS) HueController1.0.0.tar) && $(MOVE) `dirname .tmp/HueController1.0.0`/HueController1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/HueController1.0.0
clean:compiler_clean
......@@ -232,10 +236,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: moc_Hue_Controller.cpp moc_hueinterface.cpp moc_huecontrollerhardware.cpp
compiler_moc_header_make_all: moc_Hue_Controller.cpp moc_hueinterface.cpp moc_huecontrollerhardware.cpp moc_huebulb.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_Hue_Controller.cpp moc_hueinterface.cpp moc_huecontrollerhardware.cpp
moc_Hue_Controller.cpp: ../Hue_Controller.h
-$(DEL_FILE) moc_Hue_Controller.cpp moc_hueinterface.cpp moc_huecontrollerhardware.cpp moc_huebulb.cpp
moc_Hue_Controller.cpp: huecontrollerhardware.h \
huebulb.h \
../Hue_Controller.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) ../Hue_Controller.h -o moc_Hue_Controller.cpp
moc_hueinterface.cpp: hueinterface.h
......@@ -244,6 +250,9 @@ moc_hueinterface.cpp: hueinterface.h
moc_huecontrollerhardware.cpp: huecontrollerhardware.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) huecontrollerhardware.h -o moc_huecontrollerhardware.cpp
moc_huebulb.cpp: huebulb.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) huebulb.h -o moc_huebulb.cpp
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
......@@ -264,6 +273,8 @@ compiler_clean: compiler_moc_header_clean
####### Compile
Main.o: ../Main.cpp ../Hue_Controller.h \
huecontrollerhardware.h \
huebulb.h \
hueinterface.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o Main.o ../Main.cpp
......@@ -446,7 +457,9 @@ Hue_ControllerBase.o: ../../Gen_Devices/Hue_ControllerBase.cpp ../../Gen_Devices
../../pluto_main/Define_DeviceData.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o Hue_ControllerBase.o ../../Gen_Devices/Hue_ControllerBase.cpp
Hue_Controller.o: ../Hue_Controller.cpp ../Hue_Controller.h
Hue_Controller.o: ../Hue_Controller.cpp ../Hue_Controller.h \
huecontrollerhardware.h \
huebulb.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o Hue_Controller.o ../Hue_Controller.cpp
hueinterface.o: hueinterface.cpp hueinterface.h
......@@ -455,6 +468,9 @@ hueinterface.o: hueinterface.cpp hueinterface.h
huecontrollerhardware.o: huecontrollerhardware.cpp huecontrollerhardware.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o huecontrollerhardware.o huecontrollerhardware.cpp
huebulb.o: huebulb.cpp huebulb.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o huebulb.o huebulb.cpp
moc_Hue_Controller.o: moc_Hue_Controller.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_Hue_Controller.o moc_Hue_Controller.cpp
......@@ -464,6 +480,9 @@ moc_hueinterface.o: moc_hueinterface.cpp
moc_huecontrollerhardware.o: moc_huecontrollerhardware.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_huecontrollerhardware.o moc_huecontrollerhardware.cpp
moc_huebulb.o: moc_huebulb.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_huebulb.o moc_huebulb.cpp
####### Install
install: FORCE
......
#include "huebulb.h"
HueBulb::HueBulb(QObject *parent) :
QObject(parent)
{
powerState="";
int lightId =0 ;
int linuxmceId =0;
QString powerState = "";
quint8 bri = 0;
quint16 hue =0;
quint8 sat = 0;
QMap<QString*, float> xy;
quint16 colorTemp = 0;
QString alertStatus = "";
QString effectStatus ="";
QString currentColorMode = "";
bool reachable = true;
QString lightType = "";
QString lightName = "";
QString modelId = "";
QString swVersion = "";
QString controller= "";
}
#ifndef HUEBULB_H
#define HUEBULB_H
//On bool On/Off state of the light. On=true, Off=false
//Bri uint8 Brightness of the light. This is a scale from the minimum brightness the light is capable of, 0, to the maximum capable brightness, 255. Note a brightness of 0 is not off.
//Hue uint16w Hue of the light. This is a wrapping value between 0 and 65535. Both 0 and 65535 are red, 25500 is green and 46920 is blue.
//sat uint8 Saturation of the light. 255 is the most saturated (colored) and 0 is the least saturated (white).
//xy list 2..2 of float 4 The x and y coordinates of a color in CIE color space.
//The first entry is the x coordinate and the second entry is the y coordinate. Both x and y are between 0 and 1.
//ct uint16 The Mired Color temperature of the light. 2012 connected lights are capable of 153 (6500K) to 500 (2000K).
//alert string The alert effect, which is a temporary change to the bulb’s state. This can take one of the following values:
//“none” – The light is not performing an alert effect.
//“select” – The light is performing one breathe cycle.
//“lselect” – The light is performing breathe cycles for 30 seconds or until an "alert": "none" command is received.
//Note that in version 1.0 this contains the last alert sent to the light and not its current state. This will be changed to contain the current state in an upcoming patch.
//effect string The dynamic effect of the light, can either be “none” or “colorloop”.
//If set to colorloop, the light will cycle through all hues using the current brightness and saturation settings.
//colormode string 2, 2 Indicates the color mode in which the light is working, this is the last command type it received. Values are “hs” for Hue and Saturation, “xy” for XY and “ct” for Color Temperature. This parameter is only present when the light supports at least one of the values.
//reachable bool Indicates if a light can be reached by the bridge. Currently always returns true, functionality will be added in a future patch.
#include <QObject>
#include <QMap>
class HueBulb : public QObject
{
Q_OBJECT
public:
explicit HueBulb(QObject *parent = 0);
enum alert {
NOALERT,BLINK,FLASH
};
enum effect {
NOEFFECT,COLORLOOP
};
enum colormode{
HUESAT,COLORTEMP,XY
};
int lightId;
int linuxmceId;
QString powerState;
quint8 bri;
quint16 hue;
quint8 sat;
QMap<QString*, float> xy;
quint16 colorTemp;
QString alertStatus;
QString effectStatus;
QString currentColorMode;
bool reachable;
QString lightType;
QString lightName;
QString modelId;
QString swVersion;
QString controller;
signals:
public slots:
int getInternalId() {return lightId;}
int getLinuxMceId() {return linuxmceId;}
QString getController() {return controller;}
};
#endif // HUEBULB_H
......@@ -20,6 +20,10 @@ signals:
public slots:
QString getIpAddress() {return m_ipAddress;}
QString getMacAddress() {return m_macAddress;}
QString getInternalId() {return m_phillips_id;}
};
......
This diff is collapsed.
......@@ -26,6 +26,7 @@
#include <QVariant>
#include <QUrl>
#include <huecontrollerhardware.h>
#include <huebulb.h>
//<-dceag-decl-b->
namespace DCE
{
......@@ -41,10 +42,11 @@ namespace DCE
QString targetIpAddress;
QString authUser;
QNetworkAccessManager *communicator;
QList<HueControllerHardware*> hueControllers;
QVariantMap lights;
QList<HueBulb*> hueBulbs;
// Private methods
public:
......@@ -60,9 +62,11 @@ namespace DCE
virtual bool Register();
virtual void ReceivedCommandForChild(DeviceData_Impl *pDeviceData_Impl,string &sCMD_Result,Message *pMessage);
virtual void ReceivedUnknownCommand(string &sCMD_Result,Message *pMessage);
virtual void CreateChildren();
//<-dceag-const-e->
void initBridgeConnection();
bool findControllers();
bool downloadControllerConfig(QUrl deviceIp, int index);
//<-dceag-const2-b->
......@@ -199,6 +203,7 @@ NOEMON or CANBUS */
protected:
bool sendPowerMessage(QUrl message, QVariant params);
};
......
......@@ -201,30 +201,13 @@ int main(int argc, char* argv[])
bool bAppError=false;
bool bReload=false;
QThread *hueThread = new QThread;
Hue_Controller *pHue_Controller = new Hue_Controller(PK_Device, sRouter_IP,true,bLocalMode);
pHue_Controller->moveToThread(hueThread);
HueInterface *interface = new HueInterface();
Hue_Controller *pHue_Controller = new Hue_Controller(PK_Device, sRouter_IP,true,bLocalMode);
//interface->moveToThread(hueThread);
QObject::connect(pHue_Controller, SIGNAL(initiateConfigDownload(QUrl)), interface, SLOT(getDeviceDatabase(QUrl)), Qt::AutoConnection);
QObject::connect(interface, SIGNAL(newDataStore(QByteArray)), pHue_Controller, SLOT(processDataStore(QByteArray)), Qt::QueuedConnection);
hueThread->start();
if ( pHue_Controller->GetConfig() && pHue_Controller->Connect(pHue_Controller->PK_DeviceTemplate_get()) )
{
LoggerWrapper::GetInstance()->Write(LV_STATUS, "Connect OK");
pHue_Controller->CreateChildren();
// if( bLocalMode )
// pHue_Controller->RunLocalMode();
// else
// {
// if(pHue_Controller->m_RequestHandlerThread)
// pthread_join(pHue_Controller->m_RequestHandlerThread, NULL); // This function will return when the device is shutting down
// }
return a.exec();
}
else
......
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