Merge branch '138-toggle-free-look-with-hotkey' into main/gingo-test
[ryzomcore.git] / ryzom / client / src / login_progress_post_thread.h
blobfeeaffcbcb42eda53dae61d796e9738629f9ee4d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef CL_LOGIN_PROGRESS_POST_THREAD_H
18 #define CL_LOGIN_PROGRESS_POST_THREAD_H
20 #include "nel/misc/thread.h"
21 #include "nel/misc/singleton.h"
22 #include "game_share/http_client.h"
25 namespace NLMISC
27 class CConfigFile;
30 // A step in the login process, to be posted
31 class CLoginStep
33 public:
34 uint Step;
35 std::string PostString;
36 std::string* AsyncRet;
37 bool* AsyncSent;
38 public:
39 // if async is not null the return of the sendMsg will be in *async then *AsyncSent will be passed to true;
40 // You add to check via pulling if data have been send (maximum time 1 second)
41 CLoginStep(uint step = 0, const std::string &postString = "", std::string* asyncRet = 0, bool* asyncSent=0)
42 : Step(step), PostString(postString), AsyncRet(asyncRet), AsyncSent(asyncSent) {}
46 /** Notify the http logon server from the various step that have been reached in the client.
47 * Php scripts on server side use these information to collect statistics such as :
48 * - how many player manage to do a successful video driver initialization ?
49 * - how many player did pass the login screen ?
50 * - what is the mean loading time from character selection until in game ?
51 * - etc.
52 * The sending is done in a separate thread to avoid freeze of the client (especially at launch
53 * -> if the server is unavailable, the user will at least be able to reach the login screen
54 * without having to wait 10 seconds or so)
56 class CLoginProgressPostThread : public NLMISC::CSingleton<CLoginProgressPostThread>
58 public:
59 CLoginProgressPostThread();
60 ~CLoginProgressPostThread();
61 void init(const std::string &startupHost,
62 const std::string &startupPage);
63 // Init from a config file (Using the InstallStatsUrl variable)
64 void init(NLMISC::CConfigFile &configFile);
66 void release();
67 // Mark a new step in the login. Only newer step are posted to the server
68 void step(const CLoginStep &ls);
69 // Send the msg (wait until the message is send) return the answer string
70 std::string forceStep(const CLoginStep &ls);
71 private:
72 NLMISC::IThread *_Thread;
73 NLMISC::IRunnable *_Task;
77 // some values for the login step
78 enum
80 LoginStep_Stop = -1,
81 LoginStep_Unknown = 0,
82 InstallStep_StartDownload = 100,
83 InstallStep_UpdateDownload = 200,
84 InstallStep_StopDownload = 300,
85 InstallStep_StartInstall = 400,
86 InstallStep_UpdateInstall = 500,
87 InstallStep_StopInstall = 600,
88 LoginStep_VideoModeSetup = 1000,
89 LoginStep_VideoModeSetupHighColor = 2000,
90 LoginStep_LoginScreen = 3000,
91 LoginStep_PostLogin = 4000,
92 // following are not really part of the login, but are useful information as well (TODO : find a better name for the class ...)
93 LoginStep_CharacterSelection = 5000,
94 LoginStep_InGameEntry = 6000,
95 LoginStep_GameExit = 7000
101 #endif