LAPTOP-SNT8I5JK\Boounion
2025-10-13 047c7cbd047e11fba8d7872e69a11a13e463aec4
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
#pragma once
#include <string>
 
namespace DAQEvt {
 
    // ÓÃö¾Ù¶¨Ò壬Íⲿ»Øµ÷ÈÔÒÔ int ´«µÝ
    enum class ConnCode : int {
        // Collector£¨·þÎñ¶Ë£©
        ServerListening = 100,  // createServer ³É¹¦
        ServerStopped = 101,  // disconnect/close
        ClientAccepted = 110,  // Ð¿ͻ§¶Ë½ÓÈë
        ClientDisconnected = 111,  // ¿Í»§¶ËÖ÷¶¯¶Ï¿ª
        VersionOk = 120,  // ¿Í»§¶Ë°æ±¾Ð£Ñéͨ¹ý
        VersionTimeoutKick = 121,  // 5 ÃëδÎÕÊÖ±»Ìß
 
        // Display£¨¿Í»§¶Ë£©
        DisplayConnected = 200,  // connectServer ³É¹¦£¨Òѽ¨Á¬£©
        DisplayDisconnected = 201,  // disconnect/close
 
        // Í¨ÓÃ/´íÎó
        SocketError = 900
    };
 
    // ¿ÉÑ¡£º°Ñ code ×ª³ÉĬÈÏ×Ö·û´®£¨±¸Óã©
    inline const char* ToString(ConnCode c) {
        switch (c) {
        case ConnCode::ServerListening:     return "Server listening";
        case ConnCode::ServerStopped:       return "Server stopped";
        case ConnCode::ClientAccepted:      return "Client accepted";
        case ConnCode::ClientDisconnected:  return "Client disconnected";
        case ConnCode::VersionOk:           return "Version OK";
        case ConnCode::VersionTimeoutKick:  return "Version timeout kick";
        case ConnCode::DisplayConnected:    return "Display connected";
        case ConnCode::DisplayDisconnected: return "Display disconnected";
        case ConnCode::SocketError:         return "Socket error";
        default:                            return "Unknown";
        }
    }
 
} // namespace DAQEvt