Skip to content

Commit c637bde

Browse files
committed
implement #88
1 parent f33d58c commit c637bde

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ satpi
1313
bootID
1414
plantuml.jar
1515
cppcheck.log
16-
test.ts
16+
test.ts
17+
.DS_Store

src/Properties.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Properties::Properties(
3131
const std::string &currentPathOpt,
3232
const std::string &appdataPathOpt,
3333
const std::string &webPathOpt,
34+
const std::string &ipAddress,
3435
const unsigned int httpPortOpt,
3536
const unsigned int rtspPortOpt) :
3637
XMLSupport(),
@@ -45,6 +46,7 @@ Properties::Properties(
4546
_rtspPort = rtspPortOpt == 0 ? 554 : rtspPortOpt;
4647
_httpPortOpt = httpPortOpt;
4748
_rtspPortOpt = rtspPortOpt;
49+
_ipAddress = ipAddress;
4850

4951
_webPath = webPathOpt.empty() ? (currentPathOpt + "/" + "web") : webPathOpt;
5052
_appdataPath = appdataPathOpt.empty() ? currentPathOpt : appdataPathOpt;
@@ -95,6 +97,7 @@ void Properties::doAddToXML(std::string &xml) const {
9597
base::MutexLock lock(_mutex);
9698
ADD_XML_NUMBER_INPUT(xml, "httpport", _httpPort, 0, 65535);
9799
ADD_XML_NUMBER_INPUT(xml, "rtspport", _rtspPort, 0, 65535);
100+
ADD_XML_TEXT_INPUT(xml, "ipaddress", _ipAddress);
98101
ADD_XML_TEXT_INPUT(xml, "xsatipm3u", _xSatipM3U);
99102
ADD_XML_TEXT_INPUT(xml, "xmldesc", _xmlDeviceDescriptionFile);
100103
ADD_XML_TEXT_INPUT(xml, "webPath", _webPath);
@@ -161,6 +164,11 @@ unsigned int Properties::getRtspPort() const {
161164
return _rtspPort;
162165
}
163166

167+
std::string Properties::getIpAddress() const {
168+
base::MutexLock lock(_mutex);
169+
return _ipAddress;
170+
}
171+
164172
std::time_t Properties::getApplicationStartTime() const {
165173
base::MutexLock lock(_mutex);
166174
return _appStartTime;

src/Properties.h

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Properties :
3939
const std::string &currentPathOpt,
4040
const std::string &appdataPathOpt,
4141
const std::string &webPathOpt,
42+
const std::string &ipAddress,
4243
unsigned int httpPortOpt,
4344
unsigned int rtspPortOpt);
4445

@@ -90,6 +91,9 @@ class Properties :
9091
/// Get RtspPort
9192
unsigned int getRtspPort() const;
9293

94+
/// Get IP Adress
95+
std::string getIpAddress() const;
96+
9397
/// Get application start time
9498
std::time_t getApplicationStartTime() const;
9599

@@ -113,6 +117,7 @@ class Properties :
113117
std::string _xmlDeviceDescriptionFile;
114118
std::string _webPath;
115119
std::string _appdataPath;
120+
std::string _ipAddress;
116121
unsigned int _httpPort;
117122
unsigned int _rtspPort;
118123
std::string _webPathOpt;

src/Satpi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SatPI :
7777
XMLSaveSupport((appdataPath.empty() ? currentPath : appdataPath) + "/" + "SatPI.xml"),
7878
_interface(ifaceName),
7979
_streamManager(),
80-
_properties(_interface.getUUID(), currentPath, appdataPath, webPath, httpPort, rtspPort),
80+
_properties(_interface.getUUID(), currentPath, appdataPath, webPath, _interface.getIPAddress(), httpPort, rtspPort),
8181
_httpServer(*this, _streamManager, _interface.getIPAddress(), _properties),
8282
_rtspServer(_streamManager, _interface.getIPAddress()),
8383
_ssdpServer(_interface.getIPAddress(), _properties) {

web/index.html

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
function xmlloaded(xml) {
2222
appdata = xml.getElementsByTagName("appdata");
2323
ssdpdata = xml.getElementsByTagName("ssdp");
24+
configdata = xml.getElementsByTagName("configdata");
25+
2426
var uptime = appdata[0].getElementsByTagName("uptime")[0].childNodes[0].nodeValue;
2527
var sec = uptime % 60;
2628
var min = Math.round((uptime/60) - 0.5);
@@ -35,6 +37,8 @@
3537
InfoPage.rows[2].cells[1].innerHTML = appdata[0].getElementsByTagName("uuid")[0].childNodes[0].nodeValue;
3638
InfoPage.rows[3].cells[1].innerHTML = ssdpdata[0].getElementsByTagName("bootID")[0].childNodes[0].nodeValue;
3739
InfoPage.rows[4].cells[1].innerHTML = ssdpdata[0].getElementsByTagName("deviceID")[0].childNodes[0].nodeValue;
40+
InfoPage.rows[5].cells[1].innerHTML = configdata[0].getElementsByTagName("ipaddress")[0].getElementsByTagName("value")[0].childNodes[0].nodeValue;
41+
InfoPage.rows[6].cells[1].innerHTML = configdata[0].getElementsByTagName("rtspport")[0].getElementsByTagName("value")[0].childNodes[0].nodeValue;
3842
}
3943

4044
function stopSatPI() {
@@ -82,6 +86,8 @@ <h4 class="modal-title">Stop SatPI Server?</h4>
8286
<tr><td class=\"col-xs-1\">UUID</td><td class="col-xs-2">...</td> </tr>
8387
<tr><td class=\"col-xs-1\">Boot ID</td><td class="col-xs-2">...</td> </tr>
8488
<tr><td class=\"col-xs-1\">Device ID</td><td class="col-xs-2">...</td> </tr>
89+
<tr><td class=\"col-xs-1\">IP Address</td><td class="col-xs-2">...</td> </tr>
90+
<tr><td class=\"col-xs-1\">RTSP Port</td><td class="col-xs-2">...</td> </tr>
8591
</table>
8692
<button class="btn btn-danger" type="button" onclick="stopSatPI()"><i class="fas fa-power-off"></i> Stop</button>
8793
<script>

0 commit comments

Comments
 (0)