|
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 // TCFCommVirtualSerial.cpp : Defines the entry point for the DLL application. |
|
18 // |
|
19 |
|
20 #include "stdafx.h" |
|
21 #include <sys/stat.h> |
|
22 #include "TCFCommVirtualSerial.h" |
|
23 #include "VirtualSerialComm.h" |
|
24 |
|
25 static const char* pCommType="virtualserial"; |
|
26 static CBaseCom* pCommClass=NULL; |
|
27 #ifdef _DEBUG |
|
28 BOOL gDoLogging = FALSE; |
|
29 #endif |
|
30 |
|
31 BOOL APIENTRY DllMain( HANDLE hModule, |
|
32 DWORD ul_reason_for_call, |
|
33 LPVOID lpReserved |
|
34 ) |
|
35 { |
|
36 switch (ul_reason_for_call) |
|
37 { |
|
38 case DLL_PROCESS_ATTACH: |
|
39 { |
|
40 #ifdef _DEBUG |
|
41 struct _stat buf; |
|
42 char* dirname = "c:\\tcf"; |
|
43 int result = _stat(dirname, &buf); |
|
44 if (result == 0) // exists |
|
45 { |
|
46 gDoLogging = TRUE; |
|
47 } |
|
48 else |
|
49 { |
|
50 gDoLogging = FALSE; |
|
51 } |
|
52 #endif |
|
53 } |
|
54 break; |
|
55 case DLL_THREAD_ATTACH: |
|
56 case DLL_THREAD_DETACH: |
|
57 case DLL_PROCESS_DETACH: |
|
58 break; |
|
59 } |
|
60 return TRUE; |
|
61 } |
|
62 |
|
63 // register this connection type |
|
64 TCFCOMMVIRTUALSERIAL_API const char* RegisterComm() |
|
65 { |
|
66 return pCommType; |
|
67 } |
|
68 |
|
69 // create this connection type |
|
70 TCFCOMMVIRTUALSERIAL_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) |
|
71 { |
|
72 pCommClass = new VirtualSerialComm(connectSettings, connectionId, protocol); |
|
73 |
|
74 return pCommClass; |
|
75 } |