author | fturovic <frank.turovich@nokia.com> |
Thu, 05 Aug 2010 09:52:02 -0500 | |
changeset 1766 | 040623849d55 |
parent 1481 | c7f22cc57d44 |
permissions | -rw-r--r-- |
60 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
// ClientManager.h: interface for the CClientManager class. |
|
18 |
// |
|
19 |
////////////////////////////////////////////////////////////////////// |
|
20 |
||
21 |
#if !defined(AFX_CLIENTMANAGER_H__D8CD8281_5D57_43E9_922D_9532DC8669C4__INCLUDED_) |
|
22 |
#define AFX_CLIENTMANAGER_H__D8CD8281_5D57_43E9_922D_9532DC8669C4__INCLUDED_ |
|
23 |
||
24 |
#if _MSC_VER > 1000 |
|
25 |
#pragma once |
|
26 |
#endif // _MSC_VER > 1000 |
|
27 |
#include <vector> |
|
28 |
#include <list> |
|
29 |
#include "ServerClient.h" |
|
30 |
#include "InputStream.h" |
|
31 |
#include "ErrorMonitorData.h" |
|
32 |
#include "TCErrorConstants.h" |
|
33 |
#include "TCDebugLog.h" |
|
34 |
||
35 |
typedef std::vector<CInputStream*> InputStreamList; |
|
36 |
typedef std::vector<CErrorMonitor*> ErrorMonitorList; |
|
37 |
//typedef std::vector<CInputStream> InputStreamList; |
|
38 |
||
39 |
#define ERRORMONITORLIST_MUTEX_BASENAME "TCFErrorMonitorList" |
|
40 |
#define ERRORMONITORLIST_MUTEX_TIMEOUT (60000L) |
|
41 |
#define INPUTSTREAMLIST_MUTEX_BASENAME "TCFInputStreamList" |
|
42 |
#define INPUTSTREAMLIST_MUTEX_TIMEOUT (60000L) |
|
43 |
||
44 |
#ifdef WIN32 |
|
45 |
#define SERVER_PROCESS_NAME "TCFServer.exe" |
|
46 |
#define SERVER_LOCKFILE_NAME "TCFServer.lock" |
|
47 |
#define PATH_DELIMITER '\\' |
|
48 |
#else |
|
49 |
#error not WIN32 |
|
50 |
#endif |
|
51 |
||
52 |
#define MAX_DLLPATHNAME (2048) |
|
53 |
||
54 |
class CClientManager |
|
55 |
{ |
|
56 |
public: |
|
57 |
CClientManager(); |
|
58 |
CClientManager(HINSTANCE hinstDLL); |
|
59 |
virtual ~CClientManager(); |
|
60 |
||
61 |
// starting/stopping server |
|
1481
c7f22cc57d44
Commit some changes from Ed, also for USB, return different error for h/w comm error as opposed to where there is no error reported by windows, but the bytes did not get sent to the device (not responding)
Chad Peckham <chad.peckham@nokia.com>
parents:
914
diff
changeset
|
62 |
#ifdef _PSAPI_PRESENT |
c7f22cc57d44
Commit some changes from Ed, also for USB, return different error for h/w comm error as opposed to where there is no error reported by windows, but the bytes did not get sent to the device (not responding)
Chad Peckham <chad.peckham@nokia.com>
parents:
914
diff
changeset
|
63 |
void FindOrCreateRunningServer(); |
c7f22cc57d44
Commit some changes from Ed, also for USB, return different error for h/w comm error as opposed to where there is no error reported by windows, but the bytes did not get sent to the device (not responding)
Chad Peckham <chad.peckham@nokia.com>
parents:
914
diff
changeset
|
64 |
#endif |
60 | 65 |
BOOL StartServer(pServerProcessData pData); |
66 |
BOOL StopServer(pServerProcessData pData); |
|
67 |
long StartServer(); |
|
68 |
long StopServer(); |
|
69 |
BOOL IsServerRunning(); // { return m_ServerRunning; } |
|
70 |
BOOL m_ServerRunning; |
|
71 |
void TerminateServerThroughLockFile(pServerProcessData pData); |
|
72 |
void CreateLockFile(DWORD processId); |
|
73 |
void AppendToLockFile(DWORD processId); |
|
74 |
void DeleteLockFile(); |
|
75 |
void DeleteFromLockFile(DWORD processId); |
|
914
46f36a149510
Fix TCFServer life-cycle issues bug 10621
Chad Peckham <chad.peckham@nokia.com>
parents:
60
diff
changeset
|
76 |
BOOL IsTCFServerActive(DWORD processId); |
60 | 77 |
|
78 |
// input stream |
|
79 |
CInputStream* FindInputStream(long inClientId); |
|
80 |
long InputStreamListSize(); |
|
81 |
void RemoveInputStream(CInputStream* inputStream); |
|
82 |
void AddInputStream(CInputStream* stream); |
|
83 |
BOOL WaitForStreamListAccess() { return m_StreamListMutex.Wait(); } |
|
84 |
BOOL ReleaseStreamListAccess() { return m_StreamListMutex.Release(); } |
|
85 |
Mutex m_StreamListMutex; |
|
86 |
||
87 |
// error monitors |
|
88 |
CErrorMonitor* FindErrorMonitor(long inClientId); |
|
89 |
long ErrorMonitorListSize(); |
|
90 |
void RemoveErrorMonitor(CErrorMonitor* errorMonitor); |
|
91 |
void AddErrorMonitor(CErrorMonitor* monitor); |
|
92 |
BOOL WaitForErrorMonitorListAccess() { return m_ErrorMonitorListMutex.Wait(); } |
|
93 |
BOOL ReleaseErrorMonitorListAccess() { return m_ErrorMonitorListMutex.Release(); } |
|
94 |
Mutex m_ErrorMonitorListMutex; |
|
95 |
||
96 |
CServerCommand* m_Server; |
|
97 |
TCDebugLog* m_DebugLog; |
|
98 |
InputStreamList* m_StreamList; |
|
99 |
ErrorMonitorList* m_ErrorMonitorList; |
|
100 |
char* m_DllLocation; |
|
101 |
HANDLE m_hServer; // our handle to the server process (per process) |
|
102 |
HANDLE m_hServerThread; // handle to server main thread (creator process only) |
|
103 |
char m_Version[MAX_VERSION_STRING]; // our version string |
|
104 |
||
105 |
char* m_ServerLockFile; // TCFServer lock file name at the DLL location |
|
106 |
char* m_ServerExeFile; // TCFServer exe |
|
107 |
||
108 |
}; |
|
109 |
||
110 |
#endif // !defined(AFX_CLIENTMANAGER_H__D8CD8281_5D57_43E9_922D_9532DC8669C4__INCLUDED_) |