MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / LCDClient

Method LCDClient

src/server/lcdapi/api/LCDClient.cpp:56–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54};
55
56LCDClient::LCDClient(const string &server, int port) : LCDElement("", ""),
57 _sendMutex(),
58 _gotAnswer(),
59 _mainThread(),
60 _serverConnection(),
61 _answer(),
62 _currentScreen(),
63 _connectionString(),
64 _serverVersion(),
65 _protocolVersion(),
66 _width(0),
67 _height(0),
68 _charWidth(0),
69 _charHeight(0),
70 _callbacks(),
71 _handlers(),
72 _sync(true)
73{
74 ::pthread_mutex_init(&_sendMutex, 0);
75 ::pthread_cond_init(&_gotAnswer, 0);
76
77 _serverConnection.connect(server, port);
78 _serverConnection << "hello";
79 _serverConnection >> _connectionString;
80
81 string token;
82 istringstream response(_connectionString);
83
84 while (response >> token)
85 {
86 if (0 == token.compare("LCDproc"))
87 {
88 response >> _serverVersion;
89 }
90 else if (0 == token.compare("protocol"))
91 {
92 response >> _protocolVersion;
93 }
94 else if (0 == token.compare("wid"))
95 {
96 response >> _width;
97 }
98 else if (0 == token.compare("hgt"))
99 {
100 response >> _height;
101 }
102 else if (0 == token.compare("cellwid"))
103 {
104 response >> _charWidth;
105 }
106 else if (0 == token.compare("cellhgt"))
107 {
108 response >> _charHeight;
109 }
110 }
111
112 ::pthread_create(&_mainThread, 0, &mainRepliesLoop, this);
113}

Callers

nothing calls this directly

Calls 1

connectMethod · 0.80

Tested by

no test coverage detected