pans
2016-12-15 87e3ee273b2f84081ac45926be9d8e5be3166eaa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include "crtspparams.h"
#include <QMessageBox>
#include "publicfuc.h"
#include "DemoPublic.h"
 
CRtspParams::CRtspParams(QWidget *parent)
    : QDialog(parent)
{
    ui.setupUi(this);
 
    m_lUserID = -1;
 
     connect(ui.btnSave,  SIGNAL(clicked()), this, SLOT(clickSave()));
     connect(ui.btnRefresh,  SIGNAL(clicked()), this, SLOT(clickRefresh()));
}
 
CRtspParams::~CRtspParams()
{
 
}
 
int CRtspParams::setUserID(long lUserID)
{
    m_lUserID = lUserID;
    return HPR_OK;
}
 
//get rtsp info
 int CRtspParams::getRtspInfo()
 {
     NET_DVR_RTSPCFG  struRtspParams;
     int iRet;
 
     iRet = NET_DVR_GetRtspConfig(m_lUserID, 0, &struRtspParams, sizeof(NET_DVR_RTSPCFG));
     if(iRet == 0)
     {
         KIT_DisplayErrorInfo("Get Rtsp information", KIT_ERRPR_DIS_TYPE);
         return HPR_ERROR;
     }
 
     return HPR_OK;
 }
 
 //set rtsp info
 int CRtspParams::setRtspInfo()
 {
     NET_DVR_RTSPCFG  struRtspParams;
     int iRet;
     int iPort;
 
     iRet = NET_DVR_GetRtspConfig(m_lUserID, 0, &struRtspParams, sizeof(NET_DVR_RTSPCFG));
     if(iRet == 0)
     {
         iRet = NET_DVR_GetLastError();
         QMessageBox::information(this, tr("Get Rtsp fail!"), tr("Get Rtsp fail. \"%1\"").arg(iRet));
         return HPR_ERROR;
     }
 
     KIT_editToInt(ui.editPort, &iPort);
     struRtspParams.wPort = iPort;
     iRet = NET_DVR_SetRtspConfig(m_lUserID, 0, &struRtspParams, sizeof(NET_DVR_RTSPCFG));
     if(iRet == 0)
    {
        iRet = NET_DVR_GetLastError();
        QMessageBox::information(this, tr("SetRtsp fail!"), tr("Set Rtsp fail. \"%1\"").arg(iRet));
        return HPR_ERROR;
    }
 
      return HPR_OK;
 }
 
 void CRtspParams::showEvent ( QShowEvent * event )
 {
     //disable warning
     if(event == NULL)
     {
     }
     if(m_lUserID < 0)
     {
         //QMessageBox::information(this, tr("Please login firstly!"), tr("Please login firstly!."));
         return;
     }
     else
     {
         getRtspInfo();
     }
 }
 
void  CRtspParams::clickSave()
{
    if(m_lUserID < 0)
    {
        return;
    }
    setRtspInfo();
 
}
 
void CRtspParams::on_btnExit_clicked()
{
    close();
}
 
void  CRtspParams::clickRefresh()
{
    if(m_lUserID < 0)
    {
        return;
    }
    getRtspInfo();
 
}