Compare commits

...

11 Commits

  1. 26
      QCPShow.pro.user
  2. 111
      deviceservice.cpp
  3. 15
      deviceservice.h
  4. 1
      httpservice.cpp
  5. 10
      main.cpp
  6. 134
      mainwidget.cpp
  7. 21
      mainwidget.h
  8. 12
      mainwidget.ui
  9. 27
      setting.ini

26
QCPShow.pro.user

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.2.1, 2021-10-21T17:16:06. -->
<!-- Written by QtCreator 4.2.1, 2021-11-29T19:03:38. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{fe03815e-74e2-457e-b60c-e66368cd4ce4}</value>
<value type="QByteArray">{0d351c1e-abb6-427c-8d0b-30ca23826ed5}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -66,7 +66,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -90,7 +90,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -106,7 +106,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -144,7 +144,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -160,7 +160,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -198,7 +198,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -214,7 +214,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -231,7 +231,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
@ -285,14 +285,14 @@
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QCPShow</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/Qt/QtSpace/QCPShow/QCPShow.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QCPShow2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Qt/QtSpace/qt_qcp_show/QCPShow.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">QCPShow.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">E:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">D:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>

111
deviceservice.cpp

@ -8,13 +8,16 @@
#define WIRING_PIN_LED 4 //GPIO.4
#define WIRING_PIN_KEY 3 //GPIO.3
#define Click_Overtime 50
#define Press_Overtime 1500
#define DblClick_Difftime 500
DeviceService::DeviceService(QObject *parent) : QObject(parent)
{
key.flag = None;
key.lastState = KEY_Up;
key.state = KEY_Up;
m_ledStatus = 0;
m_keyStatus = 0;
lastStateTime = QTime::currentTime();
#ifdef Q_OS_LINUX
wiringPiSetup();
@ -27,13 +30,16 @@ DeviceService::DeviceService(QObject *parent) : QObject(parent)
qDebug() << "pinMode(WIRING_PIN_BTN,INPUT)";
#endif
//按键灯闪烁
timer1.setInterval(1000);
timer1.start();
connect(&timer1,&QTimer::timeout,[=](){
m_ledStatus ^= 1;
ledSet(m_ledStatus);
});
// timer1.start();
// connect(&timer1,&QTimer::timeout,[=](){
// m_ledStatus ^= 1;
// ledSet(m_ledStatus);
// });
//扫描按键状态,发送
timer2.setInterval(50);
timer2.start();
connect(&timer2,&QTimer::timeout,[=](){
@ -42,12 +48,13 @@ DeviceService::DeviceService(QObject *parent) : QObject(parent)
// m_keyStatus = keyStatus;
// qDebug() << "m_keyStatus " << m_keyStatus;
// }
key.flag = (KeyFlag)keyDetection();
if(key.flag != None){
if(key.flag == Click){
emit keyClicked();
}
}
// key.flag = (KeyFlag)keyDetection();
// if(key.flag != None){
// if(key.flag == Click){
// emit keyClicked();
// }
// }
keyDetection();
});
}
@ -77,6 +84,7 @@ quint8 DeviceService::keyReadOnce()
quint8 DeviceService::keyDetection()
{
#if 0
key.flag = None; //清空按键标志
quint8 status = keyReadOnce();
if ((status == KEY_Down) && (key.lastState == KEY_Up))
@ -90,4 +98,83 @@ quint8 DeviceService::keyDetection()
}
key.lastState = status;
return key.flag;
#else
//判定上次有行为,且上次行为产生时间间隔大于组合行为最长时间间隔,说明行为结束(不在判定组合行为),发送行为信号,并清空key.flag
if(key.flag != None && lastFlagTime.msecsTo(QTime::currentTime()) >= DblClick_Difftime)
{
emit keyWorked(key.flag);
qDebug() << "keyWorked = " << key.flag;
key.flag = None;
}
KeyFlag flag = None; //清空按键标志(行为)
//获取当前按键状态
// quint8 status = getbtnstatus();//获取当前按键状态********注意替换为防抖后的按键函数getbtnstatus()
quint8 status = keyReadOnce();
//判定标志行为
if(status == KEY_Up)
{
if(key.state == KEY_Down)
{
int difftime = lastStateTime.msecsTo(QTime::currentTime());
if(difftime >= Press_Overtime)
{
flag = Press;
}else if(difftime >= Click_Overtime)
{
flag = Click;
}
}
}
//判定组合行为
if(flag == Click)
{
if(key.flag == Click)
{
flag = Dbl_Click;
}else if(key.flag == Dbl_Click)
{
flag = Tri_Click;
}
}
//记录上一行为及时间
if(flag != None && flag != key.flag)
{
key.flag = flag;
lastFlagTime = QTime::currentTime();
}
//记录按键按下时间
if(status != key.state)
{
key.state = status;
lastStateTime = QTime::currentTime();
if(key.state != KEY_Up)
{
emit keyDown();//发送至mainwidget,用于记录按下时操作的患者是哪个
qDebug() << "key.state = " << key.state;
}
}
return key.flag;
#endif
}
quint8 DeviceService::getbtnstatus()
{
quint8 keyRead = keyReadOnce();
if(keyRead == KEY_Down)
{
uint16_t i = Click_Overtime;
while(i--);
if(keyRead == keyReadOnce())
{
return keyRead;
}
}
}

15
deviceservice.h

@ -3,6 +3,7 @@
#include <QObject>
#include <QTimer>
#include <QTime>
typedef enum{
GPIO_PIN_RESET = 0u,
@ -22,7 +23,7 @@ typedef enum{
typedef struct{
KeyFlag flag;
quint8 lastState;
quint8 state;
}KeyType;
class DeviceService : public QObject
@ -30,17 +31,23 @@ class DeviceService : public QObject
Q_OBJECT
public:
explicit DeviceService(QObject *parent = 0);
private:
KeyType key;
int m_ledStatus,m_keyStatus;
QTimer timer1,timer2;
QTimer timer1;
KeyType key;
private:
QTimer timer2;
QTime lastFlagTime, lastStateTime;
signals:
void keyClicked();
void keyDown();
void keyWorked(KeyFlag);
public slots:
void ledSet(int status);
quint8 keyReadOnce();
quint8 keyDetection();
quint8 getbtnstatus();
};
#endif // DEVICESERVICE_H

1
httpservice.cpp

@ -181,6 +181,7 @@ void HttpService::sendIdcardInfo(QString idcard,QString name, QString sex, QStri
if (jerror.error != QJsonParseError::NoError || !jdoc.isObject() || !jdoc.object().contains("code"))
{
qDebug() << QString::fromUtf8("sendIdcardInfo请求失败");
qDebug() << jdoc;
return;
}
jobj = jdoc.object();

10
main.cpp

@ -28,7 +28,7 @@ int main(int argc, char *argv[])
DeviceService deviceService;
//创建主窗体
MainWidget w;
MainWidget w(&httpService,&websocketService,&deviceService);
//绑定信号与槽
QObject::connect(&websocketService,&WebsocketService::wsConnectedStatusChanged,
@ -39,12 +39,16 @@ int main(int argc, char *argv[])
&w,&MainWidget::onPatientMergencyStatusChanged);
QObject::connect(&deviceService,&DeviceService::keyClicked,
&w,&MainWidget::onKeyClicked);
QObject::connect(&deviceService,&DeviceService::keyDown,
&w,&MainWidget::onKeyDown);
QObject::connect(&deviceService,&DeviceService::keyWorked,
&w,&MainWidget::onKeyWorked);
QObject::connect(&w,&MainWidget::statusChanged,&httpService,&HttpService::updateStatus);
QObject::connect(&w,&MainWidget::complexOneKeyStart,&httpService,&HttpService::onComplexOneKeyStart);
w.show();
// w.showFullScreen();
// w.show();
w.showFullScreen();
return a.exec();
}

134
mainwidget.cpp

@ -4,10 +4,16 @@
#include "mainconfig.h"
#define NAMELIST_LENGTH 4
QString namelist[] = {"立春","立夏","立秋","立冬"};
QString namelist[] = {"十一","十三","十五","十七"};
qint8 gindex = 0;
MainWidget::MainWidget(QWidget *parent) :
MainWidget::MainWidget(HttpService *httpService,
WebsocketService *websocketService,
DeviceService *deviceService,
QWidget *parent) :
m_httpService(httpService),
m_websocketService(websocketService),
m_deviceService(deviceService),
QWidget(parent),
ui(new Ui::MainWidget)
{
@ -16,6 +22,7 @@ MainWidget::MainWidget(QWidget *parent) :
m_wsConnectedStatus = 0;
m_maxPatientNum = MainConfig::maxPatientNum.toInt();
m_switchPatientInterval = MainConfig::switchPatientInterval.toInt();
keyDownPInfo = Q_NULLPTR;//zhixiang kongzhizhen
//1s倒计时
m_countDownTimer.setInterval(1000);
@ -37,14 +44,22 @@ MainWidget::MainWidget(QWidget *parent) :
m_patientIndex = 0;
}
updateUi();
m_curX = 0;
});
//LED闪烁
m_ledTurnTimer.setInterval(1000);
connect(&m_ledTurnTimer, &QTimer::timeout,[=](){
m_deviceService->m_ledStatus ^= 1;
m_deviceService->ledSet(m_deviceService->m_ledStatus);
});
//显示连接状态
ui->statusLabel->setText("Not Connected");
//显示设置
font1.setPointSize(240);
font2.setPointSize(240);
font1.setPointSize(180);
font2.setPointSize(180);
font3.setPointSize(20);
ui->textLabel->setFont(font1);
ui->countdownLabel->setFont(font2);
@ -56,9 +71,12 @@ MainWidget::MainWidget(QWidget *parent) :
// ui->countdownLabel->setAlignment(Qt::AlignHCenter);
// ui->statusLabel->setAlignment(Qt::AlignRight);
isFenzhen = false;
m_curX = 0;
connect(&m_lableScrollTimer,SIGNAL(timeout()),this,SLOT(lableScrollDisplay()));
m_lableScrollTimer.start(10);
this->setCursor(Qt::BlankCursor);
}
MainWidget::~MainWidget()
@ -68,19 +86,23 @@ MainWidget::~MainWidget()
void MainWidget::updateUi()
{
m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动
// m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动
//更新statusLabel
// ui->statusLabel->setText(QString("%1 | %2")
// .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接")
// .arg(m_patientEmergencyInfos.length())
// );
// ui->statusLabel->setText(QString("%1 | %2")
// .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接")
// .arg(m_patientEmergencyInfos.length())
// );
if(m_wsConnectedStatus){
ui->LEDLabel->setStyleSheet("border-image: url(:/image/1LED_green.png);");
}else{
ui->LEDLabel->setStyleSheet("border-image: url(::/image/1LED_gray.png);");
}
ui->statusLabel->setText(QString::number(m_patientEmergencyInfos.length()));
if(m_patientEmergencyInfos.length() == 0){
ui->statusLabel->setText(QString::number(m_patientEmergencyInfos.length()));
}else{
ui->statusLabel->setText(QString::number(m_patientIndex+1) + "/" + QString::number(m_patientEmergencyInfos.length()));
}
if(m_patientEmergencyInfos.length() == 0){
//不显示
@ -102,6 +124,7 @@ void MainWidget::updateUi()
QString str = "";
if(pInfo->realCountDownInSeconds < 0){
str = "";
isFenzhen = true;
}else{
int hour,min,sec,nTotalSecs;
nTotalSecs = pInfo->realCountDownInSeconds;
@ -130,28 +153,38 @@ void MainWidget::resizeEvent(QResizeEvent *event)
QWidget::resizeEvent(event);
//标题
// ui->textLabel->setGeometry(0,0,this->width(),(this->height()-30)/2);
// ui->textLabel->setGeometry(0,0,this->width(),(this->height()-30)/2);
ui->countdownLabel->setGeometry(0,(this->height()-30)/2,this->width(),(this->height()-30)/2);
ui->LEDLabel->setGeometry(this->width()-120,this->height()-30,20,30);
ui->statusLabel->setGeometry(this->width()-80,this->height()-30,20,30);
ui->LEDLabel->setGeometry(this->width()-110,this->height()-30,30,30);
ui->statusLabel->setGeometry(this->width()-80,this->height()-30,55,30);
}
void MainWidget::lableScrollDisplay()
{
// qDebug()<<"m_curX = "<<m_curX;
if(m_patientEmergencyInfos.length() == 0){
return;
}
QFontMetrics fm(font1);
m_width = fm.width(ui->textLabel->text());
m_height = ui->textLabel->height();
if(isFenzhen){
m_y = (this->height()-m_height)/2;
}
else{
int m_y = 0;
}
if(this->width() > m_width){
ui->textLabel->setGeometry((this->width()-m_width)/2, 0,m_width,(this->height()-30)/2);
ui->textLabel->setGeometry((this->width()-m_width)/2, m_y,m_width,(this->height()-30)/2);
}
else{
m_curX ++;
ui->textLabel->setGeometry(20-m_curX,0,m_width,(this->height()-30)/2);
// qDebug()<<"move" <<m_curX;
ui->textLabel->setGeometry(150-m_curX*5,m_y,m_width,(this->height()-30)/2);
}
if(m_curX > (m_width - this->width())){
if(m_curX > m_width){
m_curX = 0;
}
}
void MainWidget::onWsConnectedStatusChanged(int status)
@ -167,6 +200,7 @@ void MainWidget::onNewPatientMergencyInfo(QString firstAidId, QString name, QStr
PatientEmergencyInfo *pInfo = new PatientEmergencyInfo(firstAidId,name,content,realCountDownInSeconds);
addPatientToList(pInfo);
qDebug() << "MainWidget::onNewPatientMergencyInfo " << firstAidId << name << content << realCountDownInSeconds;
m_ledTurnTimer.start();
}
void MainWidget::onPatientMergencyStatusChanged(QString firstAidId,QString time, QString status)
@ -200,6 +234,41 @@ void MainWidget::onKeyClicked()
}
}
void MainWidget::onKeyDown()
{
qDebug() << "emit keyDown()";
if(m_patientEmergencyInfos.length() > 0){
keyDownPInfo = m_patientEmergencyInfos[m_patientIndex];
}
}
void MainWidget::onKeyWorked(KeyFlag flag)
{
qDebug() << "emit keyWork()" << flag;
if(flag == Click){
m_ledTurnTimer.stop();
m_deviceService->m_ledStatus = 0;
m_deviceService->ledSet(m_deviceService->m_ledStatus);
onKeyClicked();
}else if(flag == Dbl_Click){
qDebug()<<"Key Dbl_Clicked";
//切换病人
if(++m_patientIndex >= m_patientEmergencyInfos.length()){
m_patientIndex = 0;
}
updateUi();
m_curX = 0;
}else if(flag == Press){
qDebug()<<"Key Press";
if(keyDownPInfo != Q_NULLPTR){
deletePatientFromList(keyDownPInfo->id);
keyDownPInfo = Q_NULLPTR;
}
m_deviceService->m_ledStatus = 1;
m_deviceService->ledSet(m_deviceService->m_ledStatus);
}
}
void MainWidget::addPatientToList(PatientEmergencyInfo *info)
{
//1.如果有就删除,以保证同一个病人按两次应该重新开始计时
@ -213,6 +282,8 @@ void MainWidget::addPatientToList(PatientEmergencyInfo *info)
//3.加入链表
m_patientEmergencyInfos.push_back(info);
onKeyDown();//模拟按键按下
}
void MainWidget::deletePatientFromList(QString firstAidId)
@ -226,12 +297,37 @@ void MainWidget::deletePatientFromList(QString firstAidId)
}
}
void MainWidget::mousePressEvent(QMouseEvent *event)
{
if(event->button()==Qt::LeftButton){
//TODO
}
else if(event->button()==Qt::RightButton){
}
}
//鼠标左键双击,代替按键一下
//鼠标右键双击,代替按键两下
void MainWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
if(event->button()==Qt::LeftButton){
//TODO
m_deviceService->key.flag = Click;
onKeyWorked(m_deviceService->key.flag);
}
else if(event->button()==Qt::RightButton){
onKeyClicked();
m_deviceService->key.flag = Dbl_Click;
onKeyWorked(m_deviceService->key.flag);
}
}
//鼠标滚动,代替长按
void MainWidget::wheelEvent(QWheelEvent *event)
{ // 当滚轮远离使用者时
if(event->delta() > 0){
//TODO
}else{//当滚轮向使用者方向旋转时
m_deviceService->key.flag = Press;
onKeyWorked(m_deviceService->key.flag);
}
}

21
mainwidget.h

@ -5,6 +5,9 @@
#include "patientemergencyinfo.h"
#include <QTimer>
#include <QtWidgets>
#include "httpservice.h"
#include "websocketservice.h"
#include "deviceservice.h"
namespace Ui {
class MainWidget;
@ -15,23 +18,35 @@ class MainWidget : public QWidget
Q_OBJECT
public:
explicit MainWidget(QWidget *parent = 0);
explicit MainWidget(HttpService *httpService,
WebsocketService *websocketService,
DeviceService *deviceService,
QWidget *parent = 0);
~MainWidget();
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
private:
HttpService *m_httpService;
WebsocketService *m_websocketService;
DeviceService *m_deviceService;
Ui::MainWidget *ui;
QList<PatientEmergencyInfo *> m_patientEmergencyInfos;
qint32 m_maxPatientNum,m_switchPatientInterval;
qint32 m_patientIndex;
QTimer m_countDownTimer;
QTimer m_switchPatientTimer;
QTimer m_ledTurnTimer;
int m_wsConnectedStatus;
QFont font1, font2, font3;
QTimer m_lableScrollTimer;
int m_width, m_curX;
int m_width, m_height, m_curX, m_y;
bool isFenzhen;
PatientEmergencyInfo *keyDownPInfo;
public slots:
void updateUi();
@ -43,6 +58,8 @@ public slots:
void lableScrollDisplay();
void onKeyClicked();
void onKeyDown();
void onKeyWorked(KeyFlag flag);
signals:
void statusChanged(QString firstAidId,QString status);

12
mainwidget.ui

@ -23,7 +23,7 @@
</rect>
</property>
<property name="text">
<string>传控科技优先做CT</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -39,7 +39,7 @@
</rect>
</property>
<property name="text">
<string>countdownLabel</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -48,9 +48,9 @@
<widget class="QLabel" name="statusLabel">
<property name="geometry">
<rect>
<x>950</x>
<x>1050</x>
<y>390</y>
<width>151</width>
<width>51</width>
<height>21</height>
</rect>
</property>
@ -60,10 +60,10 @@
</font>
</property>
<property name="text">
<string>statusLabel</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="LEDLabel">

27
setting.ini

@ -1,27 +0,0 @@
[MAIN]
;最大患者数量
maxPatientNum = 5
;切换病人时间(s)
switchPatientInterval = 5
[USER]
;登录用户名
username = shoufeichu
;登录密码
password = 123456
[HTTP]
;登录请求URL
loginUrl = http://test.tall.wiki/gateway/tall3/v3.0/users/signin
;发送身份证信息URL
sendUserInfoUrl = https://test.tall.wiki/gateway/qcp/v3.0/button/idCardDiscern
;一键启动URL
oneKeyStartUrl = https://test.tall.wiki/gateway/qcp/v3.0/button/buttonStart
;服务状态改变URL(rgb)
serviceStatusChangedUrl = https://test.tall.wiki/gateway/qcp/v3.0/button/updateStatus
[WEBSOCKET]
;Websocket URL
wsUrl = wss://test.tall.wiki/websocket/message/v4.0/ws
;Websocket心跳间隔(s)
wsHeartInterval = 10
Loading…
Cancel
Save