|
1 /** |
|
2 This file is part of CWRT package ** |
|
3 |
|
4 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** |
|
5 |
|
6 This program is free software: you can redistribute it and/or modify |
|
7 it under the terms of the GNU (Lesser) General Public License as |
|
8 published by the Free Software Foundation, version 2.1 of the License. |
|
9 This program is distributed in the hope that it will be useful, but |
|
10 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 (Lesser) General Public License for more details. You should have |
|
13 received a copy of the GNU (Lesser) General Public License along |
|
14 with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 */ |
|
16 |
|
17 |
|
18 #include "serviceipcfactory.h" |
|
19 #include "serviceipc_p.h" |
|
20 #ifndef __SYMBIAN32__ |
|
21 #include "serviceipclocalsocket_p.h" |
|
22 #endif // Q_OS_WIN32 |
|
23 #include "serviceipcsharedmem_p.h" |
|
24 |
|
25 #ifdef __SYMBIAN32__ |
|
26 #include "serviceipcsymbian_p.h" |
|
27 #endif // __SYMBIAN32__ |
|
28 namespace WRT |
|
29 { |
|
30 /*! |
|
31 \class ServiceFwIPCFactory |
|
32 |
|
33 Factory class for constructing the IPC backend |
|
34 */ |
|
35 |
|
36 /*! |
|
37 Constructor |
|
38 */ |
|
39 ServiceFwIPCFactory::ServiceFwIPCFactory() |
|
40 { |
|
41 } |
|
42 |
|
43 /*! |
|
44 Destructor |
|
45 */ |
|
46 ServiceFwIPCFactory::~ServiceFwIPCFactory() |
|
47 { |
|
48 } |
|
49 |
|
50 /*! |
|
51 Check to see if the particular IPC type is supported |
|
52 @param aIPCType type of the IPC |
|
53 @return true if the IPC type is supported, false otherwise |
|
54 */ |
|
55 bool ServiceFwIPCFactory::isIPCTypeSupported(TServiceIPCBackends aIPCType) |
|
56 { |
|
57 bool supported(false); |
|
58 |
|
59 #ifdef Q_OS_WIN32 |
|
60 if( aIPCType == ELocalSocket ) |
|
61 { |
|
62 supported = true; |
|
63 } |
|
64 #elif __SYMBIAN32__ |
|
65 if (aIPCType == ESymbianServer) { |
|
66 supported = true; |
|
67 } |
|
68 #else |
|
69 //avoid compile warning |
|
70 aIPCType = EDefaultIPC; |
|
71 supported = false; |
|
72 #endif |
|
73 |
|
74 return supported; |
|
75 } |
|
76 |
|
77 /*! |
|
78 Create an instance of the Service IPC backend |
|
79 @param aBackend Type of backend to create |
|
80 @return ServiceFwIPCPrivate instance |
|
81 */ |
|
82 ServiceFwIPCPrivate* ServiceFwIPCFactory::createBackend(TServiceIPCBackends aBackend) |
|
83 { |
|
84 ServiceFwIPCPrivate* backend(NULL); |
|
85 |
|
86 #ifndef __SYMBIAN32__ |
|
87 // Local socket is default |
|
88 if( aBackend == ELocalSocket || aBackend == EDefaultIPC ) |
|
89 { |
|
90 backend = new ServiceLocalSocketIPC(); |
|
91 } |
|
92 #else |
|
93 // Symbian server is default |
|
94 if (aBackend == ESymbianServer || aBackend == EDefaultIPC) { |
|
95 TRAP_IGNORE( backend = CServiceSymbianIPC::NewL() ); |
|
96 } |
|
97 #endif |
|
98 return backend; |
|
99 } |
|
100 } |
|
101 // END OF FILE |