mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
Added DeviceName() and DeviceType() to client device. The server IP and the
number of the device used on the server are returned respectively.
This commit is contained in:
parent
af48d11b18
commit
5cfa16c402
3
HISTORY
3
HISTORY
@ -1,6 +1,9 @@
|
||||
VDR Plugin 'streamdev' Revision History
|
||||
---------------------------------------
|
||||
|
||||
- Added DeviceName() and DeviceType() to client device. The server IP and the
|
||||
number of the device used on the server are returned respectively.
|
||||
|
||||
2012-05-29: Version 0.6.0
|
||||
|
||||
- Reimplemented some client device methods
|
||||
|
@ -318,17 +318,34 @@ void cStreamdevDevice::UpdatePriority(bool SwitchingChannels) {
|
||||
}
|
||||
}
|
||||
|
||||
cString cStreamdevDevice::DeviceName(void) const {
|
||||
return StreamdevClientSetup.RemoteIp;
|
||||
}
|
||||
|
||||
cString cStreamdevDevice::DeviceType(void) const {
|
||||
static int dev = -1;
|
||||
static cString devType("STRDev");
|
||||
int d = -1;
|
||||
if (ClientSocket.DataSocket(siLive) != NULL)
|
||||
ClientSocket.GetSignal(NULL, NULL, &d);
|
||||
if (d != dev) {
|
||||
dev = d;
|
||||
devType = d < 0 ? "STRDev" : *cString::sprintf("STRD%2d", d);
|
||||
}
|
||||
return devType;
|
||||
}
|
||||
|
||||
int cStreamdevDevice::SignalStrength(void) const {
|
||||
int strength = -1;
|
||||
if (ClientSocket.DataSocket(siLive) != NULL)
|
||||
ClientSocket.GetSignal(&strength, NULL);
|
||||
ClientSocket.GetSignal(&strength, NULL, NULL);
|
||||
return strength;
|
||||
}
|
||||
|
||||
int cStreamdevDevice::SignalQuality(void) const {
|
||||
int quality = -1;
|
||||
if (ClientSocket.DataSocket(siLive) != NULL)
|
||||
ClientSocket.GetSignal(NULL, &quality);
|
||||
ClientSocket.GetSignal(NULL, &quality, NULL);
|
||||
return quality;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
#else
|
||||
virtual bool IsTunedToTransponder(const cChannel *Channel);
|
||||
#endif
|
||||
virtual cString DeviceName(void) const;
|
||||
virtual cString DeviceType(void) const;
|
||||
virtual int SignalStrength(void) const;
|
||||
virtual int SignalQuality(void) const;
|
||||
|
||||
|
@ -29,6 +29,7 @@ cClientSocket::cClientSocket(void)
|
||||
m_LastSignalUpdate = 0;
|
||||
m_LastSignalStrength = -1;
|
||||
m_LastSignalQuality = -1;
|
||||
m_LastDev = -1;
|
||||
Reset();
|
||||
}
|
||||
|
||||
@ -291,7 +292,7 @@ bool cClientSocket::SetPriority(int Priority) {
|
||||
return Command(command, 220);
|
||||
}
|
||||
|
||||
bool cClientSocket::GetSignal(int *SignalStrength, int *SignalQuality) {
|
||||
bool cClientSocket::GetSignal(int *SignalStrength, int *SignalQuality, int *Dev) {
|
||||
if (!CheckConnection()) return -1;
|
||||
|
||||
CMD_LOCK;
|
||||
@ -301,7 +302,8 @@ bool cClientSocket::GetSignal(int *SignalStrength, int *SignalQuality) {
|
||||
std::string buffer;
|
||||
std::string command("SGNL");
|
||||
if (!Send(command) || !Receive(command, &code, &buffer) || code != 220
|
||||
|| sscanf(buffer.c_str(), "%*d %*d %d:%d", &m_LastSignalStrength, &m_LastSignalQuality) != 2) {
|
||||
|| sscanf(buffer.c_str(), "%*d %d %d:%d", &m_LastDev, &m_LastSignalStrength, &m_LastSignalQuality) != 3) {
|
||||
m_LastDev = -1;
|
||||
m_LastSignalStrength = -1;
|
||||
m_LastSignalQuality = -1;
|
||||
}
|
||||
@ -311,6 +313,8 @@ bool cClientSocket::GetSignal(int *SignalStrength, int *SignalQuality) {
|
||||
*SignalStrength = m_LastSignalStrength;
|
||||
if (SignalQuality)
|
||||
*SignalQuality = m_LastSignalQuality;
|
||||
if (Dev)
|
||||
*Dev = m_LastDev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ private:
|
||||
time_t m_LastSignalUpdate;
|
||||
int m_LastSignalStrength;
|
||||
int m_LastSignalQuality;
|
||||
int m_LastDev;
|
||||
protected:
|
||||
/* Send Command, and return true if the command results in Expected.
|
||||
Returns false on failure. */
|
||||
@ -57,7 +58,7 @@ public:
|
||||
bool SetPriority(int Priority);
|
||||
bool SetPid(int Pid, bool On);
|
||||
bool SetFilter(ushort Pid, uchar Tid, uchar Mask, bool On);
|
||||
bool GetSignal(int *SignalStrength, int *SignalQuality);
|
||||
bool GetSignal(int *SignalStrength, int *SignalQuality, int *Dev);
|
||||
bool CloseDvr(void);
|
||||
bool SuspendServer(void);
|
||||
bool Quit(void);
|
||||
|
Loading…
Reference in New Issue
Block a user