SDC C-Project CF Review 프로그램
LYW
2022-05-31 f1a543772246f59b8b52a8857270b38ee38f3588
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef _DEVICE_H_
#define _DEVICE_H_
 
#include <string>
#include <stdint.h>
 
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<float>(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_