mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-06 10:09:33 +02:00
hello getClientId
This commit is contained in:
parent
bb7bea1b6c
commit
218b10cf04
2 changed files with 20 additions and 9 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "jsonMessage.h"
|
#include "jsonMessage.h"
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
|
#include "common/strCompat.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,46 +51,56 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getMacAddress()
|
std::string getMacAddress() const
|
||||||
{
|
{
|
||||||
return msg["MAC"];
|
return msg["MAC"];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getHostName()
|
std::string getHostName() const
|
||||||
{
|
{
|
||||||
return msg["HostName"];
|
return msg["HostName"];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getVersion()
|
std::string getVersion() const
|
||||||
{
|
{
|
||||||
return msg["Version"];
|
return msg["Version"];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getClientName()
|
std::string getClientName() const
|
||||||
{
|
{
|
||||||
return msg["ClientName"];
|
return msg["ClientName"];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getOS()
|
std::string getOS() const
|
||||||
{
|
{
|
||||||
return msg["OS"];
|
return msg["OS"];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getArch()
|
std::string getArch() const
|
||||||
{
|
{
|
||||||
return msg["Arch"];
|
return msg["Arch"];
|
||||||
}
|
}
|
||||||
|
|
||||||
int getInstance()
|
int getInstance() const
|
||||||
{
|
{
|
||||||
return get("Instance", 1);
|
return get("Instance", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getProtocolVersion()
|
int getProtocolVersion() const
|
||||||
{
|
{
|
||||||
return get("SnapStreamProtocolVersion", 1);
|
return get("SnapStreamProtocolVersion", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getClientId() const
|
||||||
|
{
|
||||||
|
std::string id = getMacAddress();
|
||||||
|
int instance = getInstance();
|
||||||
|
if (instance != 1)
|
||||||
|
{
|
||||||
|
id = id + "#" + cpt::to_string(instance);
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T get(const std::string& what, const T& def)
|
T get(const std::string& what, const T& def) const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue