#include "RecordVideoElement.h"
|
#include <basic/util/app/AppPreference.hpp>
|
|
RecordVideoElement::RecordVideoElement(int index, std::string rtsp)
|
: m_nIndex(std::to_string(index)), m_strRtsp(rtsp),
|
loopRecordClient(appPref.getStringData("loopRecord.proxy"), appPref.getStringData("loopRecord.ip"),
|
appPref.getIntData("loopRecord.port"), "tcp") {
|
|
}
|
|
//#todo index int -> string
|
RecordVideoElement::RecordVideoElement(std::string index, std::string rtsp)
|
: m_nIndex(index), m_strRtsp(rtsp),
|
loopRecordClient(appPref.getStringData("loopRecord.proxy"), appPref.getStringData("loopRecord.ip"),
|
appPref.getIntData("loopRecord.port"), "tcp") {
|
|
}
|
|
RecordVideoElement::~RecordVideoElement() {
|
|
}
|
|
std::string RecordVideoElement::startRecord() {
|
return callStartRecord(m_strRtsp);
|
}
|
|
std::string RecordVideoElement::callStartRecord(std::string jsonValue) {
|
try {
|
auto server = loopRecordClient.getServer();
|
return server->addCamera(m_nIndex, jsonValue);
|
}
|
catch (std::exception &e) {
|
ERR(e.what())
|
return "";
|
}
|
}
|
|
std::string RecordVideoElement::startRecord(std::string json) {
|
return callStartRecord(json);
|
}
|
|
void RecordVideoElement::endRecord() {
|
try {
|
auto server = loopRecordClient.getServer();
|
server->removeCamera(m_nIndex);
|
}
|
catch (std::exception &e) {
|
ERR(e.what())
|
}
|
}
|
|
void RecordVideoElement::feedDog() {
|
try {
|
auto server = loopRecordClient.getServer();
|
server->feedDog(m_nIndex);
|
//INFO("feedDog:" + m_nIndex);
|
}
|
catch (std::exception &e) {
|
ERR(e.what())
|
}
|
}
|