Merge branch 'master' of https://bitbucket.org/jfmartel/systemgui
Conflicts: Sources/Sprinkler/SprinklerDevice.cpp Sources/Sprinkler/SprinklerDevice.h SystemGui.pro ui_SprinklerGui.h
This commit is contained in:
commit
59fd7f5932
15
.qmake.stash
Normal file
15
.qmake.stash
Normal file
@ -0,0 +1,15 @@
|
||||
QMAKE_DEFAULT_INCDIRS = \
|
||||
/usr/include/c++/5 \
|
||||
/usr/include/x86_64-linux-gnu/c++/5 \
|
||||
/usr/include/c++/5/backward \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/5/include \
|
||||
/usr/local/include \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed \
|
||||
/usr/include/x86_64-linux-gnu \
|
||||
/usr/include
|
||||
QMAKE_DEFAULT_LIBDIRS = \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/5 \
|
||||
/usr/lib/x86_64-linux-gnu \
|
||||
/usr/lib \
|
||||
/lib/x86_64-linux-gnu \
|
||||
/lib
|
||||
BIN
Ico/switch-off-icon.png
Normal file
BIN
Ico/switch-off-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
BIN
Ico/switch-on-icon.png
Normal file
BIN
Ico/switch-on-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
@ -11,9 +11,10 @@ CSMSMasterCtrlInterface::CSMSMasterCtrlInterface(CSMSClient *ProgramHandle)
|
||||
{
|
||||
mDeviceAddress = 1;
|
||||
mNetworkPort = 2182;
|
||||
mMasterCtrlAddress = "127.0.0.1";
|
||||
// mMasterCtrlAddress = "127.0.0.1";
|
||||
// mNetworkPort = 6463;
|
||||
// mMasterCtrlAddress = "192.168.0.112";
|
||||
// mMasterCtrlAddress = "192.168.0.100";
|
||||
mMasterCtrlAddress = "mortel.myftp.org";
|
||||
mNetworkCommSocket = 0;
|
||||
mMyDeviceID = ID_SMS_CLIENT;
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "SprinklerDevice.h"
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
CSprinklerDevice::CSprinklerDevice()
|
||||
{
|
||||
@ -29,4 +30,9 @@ int CSprinklerDevice::SetFlow(unsigned short flow)
|
||||
unsigned short CSprinklerDevice::GetFlow()
|
||||
{
|
||||
return mFlowMeter;
|
||||
=======
|
||||
CSprinklerDevice::CSprinklerDevice(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
>>>>>>> 2c22dda0f4b581f6a3d2d892b18202b64b8bc289
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
#ifndef CSPRINKLERDEVICE_H
|
||||
#define CSPRINKLERDEVICE_H
|
||||
#include <QString>
|
||||
@ -25,3 +26,22 @@ public:
|
||||
};
|
||||
|
||||
#endif // CSPRINKLERDEVICE_H
|
||||
=======
|
||||
#ifndef SPRINKLERDEVICE_H
|
||||
#define SPRINKLERDEVICE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class CSprinklerDevice : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CSprinklerDevice(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // SPRINKLERDEVICE_H
|
||||
>>>>>>> 2c22dda0f4b581f6a3d2d892b18202b64b8bc289
|
||||
|
||||
13
Sources/Sprinkler/SprinklerDeviceGuiItem.cpp
Normal file
13
Sources/Sprinkler/SprinklerDeviceGuiItem.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "SprinklerDeviceGuiItem.h"
|
||||
|
||||
|
||||
CSprinklerDeviceGuiItem::CSprinklerDeviceGuiItem(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
CSprinklerDeviceGuiItem::~CSprinklerDeviceGuiItem()
|
||||
{
|
||||
|
||||
}
|
||||
22
Sources/Sprinkler/SprinklerDeviceGuiItem.h
Normal file
22
Sources/Sprinkler/SprinklerDeviceGuiItem.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef SPRINKLERDEVICEGUIITEM_H
|
||||
#define SPRINKLERDEVICEGUIITEM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_SprinklerDeviceGuiItem.h"
|
||||
|
||||
namespace Ui {
|
||||
class CSprinklerDeviceGuiItem;
|
||||
}
|
||||
|
||||
class CSprinklerDeviceGuiItem : public QWidget, public Ui::CSprinklerDeviceGuiItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CSprinklerDeviceGuiItem(QWidget *parent = 0);
|
||||
~CSprinklerDeviceGuiItem();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SPRINKLERDEVICEGUIITEM_H
|
||||
74
Sources/Sprinkler/SprinklerDeviceGuiItem.ui
Normal file
74
Sources/Sprinkler/SprinklerDeviceGuiItem.ui
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CSprinklerDeviceGuiItem</class>
|
||||
<widget class="QWidget" name="CSprinklerDeviceGuiItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>540</width>
|
||||
<height>399</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="SprinklerAddress">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>101</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Address : </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="SprinklerFlowSpeed">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>131</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flow speed :</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>100</y>
|
||||
<width>54</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>State : </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>20</y>
|
||||
<width>80</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -23,7 +23,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sprinklers</string>
|
||||
<string>Sprinklers network</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="CToggleSwitch" name="mValveSwitch" native="true">
|
||||
|
||||
111
Sources/Sprinkler/SprinklerMasterCtrlInterface.cpp.autosave
Normal file
111
Sources/Sprinkler/SprinklerMasterCtrlInterface.cpp.autosave
Normal file
@ -0,0 +1,111 @@
|
||||
#include "SprinklerMasterCtrlInterface.h"
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QBuffer>
|
||||
#include "SystemGui.h"
|
||||
#include "Sprinkler.h"
|
||||
|
||||
|
||||
|
||||
CSprinklerMasterCtrlInterface::CSprinklerMasterCtrlInterface(CSprinkler *ProgramHandle)
|
||||
{
|
||||
mDeviceAddress = 1;
|
||||
mNetworkPort = 2182;
|
||||
mMasterCtrlAddress = "127.0.0.1";
|
||||
// mNetworkPort = 6463;
|
||||
// mMasterCtrlAddress = "192.168.0.112";
|
||||
mNetworkCommSocket = 0;
|
||||
mMyDeviceID = ID_SPRINKLER_INTERFACE;
|
||||
|
||||
mProgramHandle = ProgramHandle;
|
||||
}
|
||||
|
||||
CSprinklerMasterCtrlInterface::~CSprinklerMasterCtrlInterface()
|
||||
{
|
||||
// if(mNetworkCommSocket !=0)
|
||||
// {
|
||||
//// mNetworkCommSocket->disconnectFromHost();
|
||||
// // delete mNetworkCommSocket;
|
||||
// }
|
||||
}
|
||||
|
||||
int CSprinklerMasterCtrlInterface::DeviceConnectedToMaster(bool Connected)
|
||||
{
|
||||
if(Connected)
|
||||
{
|
||||
mNetworkCommSocket->write(GetTxPacket(SPRINKLER_INTERFACE_GET_SPRINKLERS_REQUEST,0,0,0,1,ID_MASTER,mMyDeviceID,mDeviceAddress));
|
||||
}
|
||||
else
|
||||
{
|
||||
//???
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CSprinklerMasterCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderDeviceID, int SenderAddress, int MessageID, int DataSize, QByteArray Data)
|
||||
{
|
||||
Q_UNUSED(DataSize)
|
||||
|
||||
|
||||
if(TargetDeviceID == mMyDeviceID && (TargetDeviceAddress == BROADCAST_VALUE || TargetDeviceAddress == mDeviceAddress))
|
||||
{
|
||||
switch(MessageID)
|
||||
{
|
||||
case SPRINKLER_INTERFACE_ACK:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case SPRINKLER_INTERFACE_STATUS_REQUEST:
|
||||
{
|
||||
QByteArray Frame,ResponseData;
|
||||
ResponseData.append(ACK);
|
||||
ResponseData.append((char)SPRINKLER_INTERFACE_STATUS_RESPONSE);
|
||||
Frame = GetTxPacket(SPRINKLER_INTERFACE_STATUS_RESPONSE,0,ResponseData.data(),ResponseData.size(),1,ID_MASTER,ID_SPRINKLER_INTERFACE,mDeviceAddress);
|
||||
mNetworkCommSocket->write(Frame);
|
||||
break;
|
||||
}
|
||||
case SPRINKLER_INTERFACE_GET_SPRINKLERS_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case SPRINKLER_INTERFACE_GET_SPRINKLER_DATA_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case SPRINKLER_INTERFACE_SET_SPRINKLER_DATA_ACK:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case SPRINKLER_INTERFACE_GET_SPRINKLER_STATE_RESPONSE:
|
||||
{
|
||||
for(int i = 0; i < Data.at(0); i++)
|
||||
{
|
||||
mProgramHandle->SetSprinklerState(Data.at(1+(i+1)*i)),Data.at(2+((i+1)*i)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPRINKLER_INTERFACE_SET_SPRINKLER_STATE_ACK:
|
||||
{
|
||||
QByteArray Frame,RequestData;
|
||||
RequestData.append(1); //device address
|
||||
Frame = GetTxPacket(SPRINKLER_INTERFACE_GET_SPRINKLER_STATE_REQUEST,0,RequestData.data(),RequestData.size(),1,ID_MASTER,ID_SPRINKLER_INTERFACE,mDeviceAddress);
|
||||
mNetworkCommSocket->write(Frame);
|
||||
break;
|
||||
}
|
||||
case SPRINKLER_INTERFACE_STATUS_RESPONSE:
|
||||
case SPRINKLER_INTERFACE_GET_SPRINKLERS_REQUEST:
|
||||
case SPRINKLER_INTERFACE_GET_SPRINKLER_DATA_REQUEST:
|
||||
case SPRINKLER_INTERFACE_SET_SPRINKLER_DATA_REQUEST:
|
||||
case SPRINKLER_INTERFACE_GET_SPRINKLER_STATE_REQUEST:
|
||||
case SPRINKLER_INTERFACE_SET_SPRINKLER_STATE_REQUEST:
|
||||
default:
|
||||
{
|
||||
qDebug("Sprinkler: Invalid Ethernet MSg received: %d",MessageID);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
28
Sources/Sprinkler/SprinklerMasterCtrlInterface.h
Normal file
28
Sources/Sprinkler/SprinklerMasterCtrlInterface.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef CSPRINKLERMASTERCTRLINTERFACE_H
|
||||
#define CSPRINKLERMASTERCTRLINTERFACE_H
|
||||
|
||||
#include "MasterCtrlInterface.h"
|
||||
|
||||
|
||||
//class CSystemGui;
|
||||
class CSprinkler;
|
||||
|
||||
|
||||
class CSprinklerMasterCtrlInterface: public CMasterCtrlInterface
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
|
||||
|
||||
CSprinkler *mProgramHandle;
|
||||
|
||||
CSprinklerMasterCtrlInterface(CSprinkler *ProgramHandle);
|
||||
~CSprinklerMasterCtrlInterface();
|
||||
|
||||
virtual int DeviceFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderID, int SenderAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
virtual int DeviceConnectedToMaster(bool Connected);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // CSPRINKLERMASTERCTRLINTERFACE_H
|
||||
@ -43,9 +43,13 @@ SOURCES += \
|
||||
Sources/SMSClient/ContactRepository.cpp \
|
||||
Sources/SystemTrayManager.cpp \
|
||||
Sources/Sprinkler/SprinklerGui.cpp \
|
||||
<<<<<<< HEAD
|
||||
Sources/ToggleSwitch.cpp \
|
||||
Sources/Sprinkler/Sprinkler.cpp \
|
||||
Sources/Sprinkler/SprinklerMasterCtrlInterface.cpp \
|
||||
=======
|
||||
Sources/Sprinkler/SprinklerDeviceGuiItem.cpp \
|
||||
>>>>>>> 2c22dda0f4b581f6a3d2d892b18202b64b8bc289
|
||||
Sources/Sprinkler/SprinklerDevice.cpp
|
||||
|
||||
HEADERS += Sources/AbstractNetworkInterface.h \
|
||||
@ -65,11 +69,17 @@ HEADERS += Sources/AbstractNetworkInterface.h \
|
||||
Sources/SMSClient/ContactRepository.h \
|
||||
Sources/SystemTrayManager.h \
|
||||
Sources/Sprinkler/SprinklerGui.h \
|
||||
<<<<<<< HEAD
|
||||
Sources/ToggleSwitch.h \
|
||||
Sources/Sprinkler/Sprinkler.h \
|
||||
Sources/Sprinkler/SprinklerDevice.h \
|
||||
Sources/Sprinkler/SprinklerMasterCtrlInterface.h
|
||||
=======
|
||||
Sources/Sprinkler/SprinklerDeviceGuiItem.h \
|
||||
Sources/Sprinkler/SprinklerDevice.h
|
||||
>>>>>>> 2c22dda0f4b581f6a3d2d892b18202b64b8bc289
|
||||
|
||||
FORMS += \
|
||||
SMSGui.ui \
|
||||
Sources/Sprinkler/SprinklerGui.ui
|
||||
Sources/Sprinkler/SprinklerGui.ui \
|
||||
Sources/Sprinkler/SprinklerDeviceGuiItem.ui
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user