2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 vdr = VDR::getInstance();
26 logger = Log::getInstance();
28 setDimensions(400, 200);
29 if (Video::getInstance()->getFormat() == Video::PAL)
31 setScreenPos(170, 200);
35 setScreenPos(160, 150);
45 vdr->cancelFindingServer();
54 int VConnect::handleCommand(int command)
64 void VConnect::threadMethod()
70 ViewMan* viewman = ViewMan::getInstance();
74 setMainText("\n Locating server");
78 vdr->findServers(serverIPs);
81 if (serverIPs.size() == 1)
88 VServerSelect* vs = new VServerSelect(&serverIPs);
93 threadWaitForSignal();
96 logger->log("Command", Log::NOTICE, "Connecting to server at %s", serverIPs[selectedServer]);
97 vdr->setServerIP(serverIPs[selectedServer]);
99 // Clear the serverIPs vector
100 for(UINT k = 0; k < serverIPs.size(); k++)
102 delete[] serverIPs[k];
106 setMainText("\n Connecting to VDR");
110 success = vdr->connect();
113 logger->log("Command", Log::DEBUG, "Connected ok, doing login");
114 success = vdr->doLogin();
118 setMainText("\n Connected");
120 ts.tv_nsec = 500000000;
125 setMainText("\n Login failed");
132 setMainText("\n Connection failed");
139 nanosleep(&ts, NULL);
143 Message* m = new Message();
145 m->message = Message::VDR_CONNECTED;
146 Command::getInstance()->postMessage(m);
149 void VConnect::processMessage(Message* m)
151 if (m->message == Message::SERVER_SELECTED)
153 selectedServer = m->parameter;