#ifndef _DEVICE_H_ #define _DEVICE_H_ #include #include namespace mvsol { class DeviceInfo { friend class DeviceManagerUdp; public: DeviceInfo(); ~DeviceInfo(); enum { MACADDRESSSIZE = 18, IPADDRESSSIZE = 16, DEVICENAMESIZE = 21, }; enum { INDEX_PROTOCOLVERSION = 1, INDEX_COMMAND = 2, INDEX_ADDRESS = 3, INDEX_MAC = 5, INDEX_IP = 13, INDEX_ID = 17, INDEX_DEVICENAME = 25, INDEX_VERSION = 45, INDEX_SERIALNUMBER = 49, INDEX_STATUS = 69, INDEX_CHECKSUM = 70, }; int32_t Parse(uint8_t* indata, int32_t indatasize); DeviceInfo& operator=(const DeviceInfo& device); // ¼Ó¼º public: std::string GetDeviceName() { return devicename_; } std::string GetMacAddressString(); uint64_t GetMacAddress() { return macaddress_; } std::string GetLocalIpAddressString() { return localipaddress_; } void SetLocalIpAddress(const std::string& localip) { localipaddress_ = localip; } uint32_t GetIpAddress() { return ipaddress_; } std::string GetIpAddressString(); float GetVersionFloat() const { return static_cast(deviceversion_) / 100.0f; } uint32_t GetVersion() const { return deviceversion_; } std::string GetId() const { return id_; } uint32_t GetSerialNumber() const { return serialnumber_; } protected: uint64_t macaddress_; uint32_t ipaddress_; std::string id_; std::string devicename_; uint32_t deviceversion_; uint32_t serialnumber_; std::string localipaddress_; }; } // namespace mvsol #endif // _DEVICE_H_