29 #ifndef _TRM_TRM_MONITOR_H
30 #define _TRM_TRM_MONITOR_H
33 #include <QWaitCondition>
38 #include "trm/TunerReservation.h"
39 #include "trm/JsonEncoder.h"
41 #include "trm/MessageProcessor.h"
42 #include "safec_lib.h"
50 TRMMonitor(
const QHostAddress &address, quint16 port, uint32_t clientId);
52 void sendTunerReserve(
const QString &device, qint64 startTime, qint64 duration,
const QString &locator,
const QString &activity,
const QString &token);
53 void sendGetAllTunerIds(
void);
54 void sendGetAllTunerStates(
void);
55 void sendGetAllReservations(
void);
56 void sendReleaseTunerReservation(
const QString &reservationToken);
57 void sendValidateTunerReservation(
const QString &device,
const QString &reservationToken);
58 void sendCancelRecording(
const QString &device,
const QString &reservationToken);
59 void sendCancelRecordingResponse(
const QString &uuid,
const QString &device,
const QString &reservationToken, uint32_t outClientId);
62 void send(
const MsgT &msg, std::vector<uint8_t> &out, uint32_t outClientId = Connection::kInvalidClientId) {
63 if (connection == 0) {
67 out.resize(Header::kHeaderLength, 0);
70 std::cout << (
const char *)(&out[Header::kHeaderLength]) <<
"\r\n";
73 std::vector<uint8_t> headerBytes;
74 if (outClientId == Connection::kInvalidClientId) {
75 outClientId = clientId;
77 Header header(Request, outClientId, out.size() - Header::kHeaderLength);
78 header.serialize(headerBytes);
79 errno_t safec_rc = memcpy_s(&out[0], out.size(), &headerBytes[0], Header::kHeaderLength);
84 this->inClientId = inClientId;
88 bool hasResponse(
void)
const {
return false; }
91 void process(
const MsgT &msg) {
108 const std::list<std::string> & getTunerIds(
void)
const;
111 void tunerIdsUpdated(std::list<std::string>);
112 void tunerStatesUpdated(std::map<std::string, std::string>);
113 void tunerReservationsUpdated(std::map<std::string, std::list<TunerReservation> >);
114 void statusMessageReceived(std::string);
115 void conflictsReceived(ReserveTunerResponse::ConflictCT);
118 QHostAddress hostAddress;
122 QQueue<QString> pendingRequestIds;
123 std::list<std::string> tunerIds;