2025-09-06 08:50:07 -04:00
|
|
|
#ifndef LIVOX_PROTO1_DEVICE_H
|
|
|
|
|
#define LIVOX_PROTO1_DEVICE_H
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include "livoxProto1Protocol.h"
|
|
|
|
|
|
|
|
|
|
namespace livoxProto1 {
|
|
|
|
|
namespace comms {
|
|
|
|
|
|
|
|
|
|
/** EXPLANATION:
|
|
|
|
|
* This class represents a discovered device. It is used to store the
|
|
|
|
|
* device identifier and IP address of a discovered device.
|
|
|
|
|
*/
|
|
|
|
|
class DiscoveredDevice
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DiscoveredDevice(
|
|
|
|
|
const std::string &deviceIdentifier,
|
|
|
|
|
DeviceType deviceType,
|
|
|
|
|
const std::string &ipAddr);
|
|
|
|
|
|
|
|
|
|
// "Conversion" constructor from BroadcastMessage
|
|
|
|
|
DiscoveredDevice(const BroadcastMessage &msg, const std::string &ipAddr);
|
|
|
|
|
|
|
|
|
|
~DiscoveredDevice() = default;
|
|
|
|
|
|
|
|
|
|
bool operator==(const DiscoveredDevice &other) const
|
|
|
|
|
{ return deviceIdentifier == other.deviceIdentifier; }
|
|
|
|
|
|
|
|
|
|
std::string stringify(void) const;
|
|
|
|
|
std::string getDeviceTypeName(void) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
std::string deviceIdentifier;
|
|
|
|
|
DeviceType deviceType;
|
|
|
|
|
std::string ipAddr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace comms
|
|
|
|
|
|
|
|
|
|
class Device
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Device(const comms::DiscoveredDevice &discoveredDevice);
|
|
|
|
|
~Device() = default;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
comms::DiscoveredDevice discoveredDevice;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace livoxProto1
|
|
|
|
|
|
|
|
|
|
#endif // LIVOX_PROTO1_DEVICE_H
|