|
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 "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: Telephony Multimedia Service |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <ecom/ecom.h> |
|
19 #include "tmscallserver.h" |
|
20 #include "tmscallserverstartparam.h" |
|
21 #include "tmsutility.h" |
|
22 |
|
23 using namespace TMS; |
|
24 |
|
25 _LIT(KTMSCallServerName, "TMSCallServer-"); |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // TMSCallServer::StartThread |
|
29 // |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 EXPORT_C TInt TMSCallServer::StartThread(TAny* aParams) |
|
33 { |
|
34 TRACE_PRN_FN_ENT; |
|
35 |
|
36 TInt err = KErrNone; |
|
37 __UHEAP_MARK; |
|
38 TMSCallServerStartParam* start = |
|
39 reinterpret_cast<TMSCallServerStartParam*> (aParams); |
|
40 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
41 if (!cleanup) |
|
42 { |
|
43 err = KErrNoMemory; |
|
44 } |
|
45 else |
|
46 { |
|
47 TRAP(err, StartThreadL(*start)); |
|
48 } |
|
49 delete cleanup; |
|
50 |
|
51 REComSession::FinalClose(); |
|
52 __UHEAP_MARKEND; |
|
53 |
|
54 TRACE_PRN_FN_EXT; |
|
55 return err; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // TMSCallServer::StartThreadL |
|
60 // |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void TMSCallServer::StartThreadL(TMSCallServerStartParam& aStart) |
|
64 { |
|
65 TRACE_PRN_FN_ENT; |
|
66 |
|
67 CActiveScheduler* sched = new (ELeave) CActiveScheduler; |
|
68 CleanupStack::PushL(sched); |
|
69 |
|
70 CActiveScheduler::Install(sched); |
|
71 TMSCallServer* server = TMSCallServer::NewL(aStart.iTMSServer); |
|
72 CleanupStack::PushL(server); |
|
73 |
|
74 //Rename tmscall server name |
|
75 RThread tmscallServerThread; |
|
76 TThreadId threadId; |
|
77 TName name; |
|
78 name.Append(KTMSCallServerName); |
|
79 threadId = tmscallServerThread.Id(); |
|
80 name.AppendNum(threadId.Id(), EHex); |
|
81 //We are ignoring the error code returned from User::RenameThread |
|
82 //as it is not important here, may be for profiling |
|
83 User::RenameThread(name); |
|
84 |
|
85 aStart.iTMSCallServerHandle = server->Server(); |
|
86 // Sync with the client and enter the active scheduler |
|
87 RThread::Rendezvous(KErrNone); |
|
88 sched->Start(); |
|
89 |
|
90 CleanupStack::PopAndDestroy(server); // server |
|
91 CleanupStack::PopAndDestroy(sched); // sched |
|
92 |
|
93 TRACE_PRN_FN_EXT; |
|
94 } |
|
95 |
|
96 // End of file |