|
1 /* |
|
2 * Copyright (c) 2002 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: class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <etel.h> |
|
20 #include <etelmm.h> |
|
21 #include <MmTsy_names.h> |
|
22 #include <centralrepository.h> |
|
23 |
|
24 #include "SysInfoUtils.h" |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // RPhoneInstance::Connect |
|
28 // Connects to the RTelServer and the RMobilePhone classes |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 TInt RPhoneInstance::Connect(RTelServer& aTelServer,RMobilePhone& aMobilePhone) |
|
32 { |
|
33 TInt PHONEINDEX = 0; |
|
34 |
|
35 RTelServer::TPhoneInfo PhoneInfo; |
|
36 TInt errorCode = KErrNone ; |
|
37 if( ( errorCode = aTelServer.Connect() ) != KErrNone ) |
|
38 { |
|
39 return errorCode; |
|
40 } |
|
41 else |
|
42 { |
|
43 if ( ( errorCode = aTelServer.LoadPhoneModule(KMmTsyModuleName) ) |
|
44 != KErrNone || |
|
45 ( errorCode = aTelServer.GetPhoneInfo(PHONEINDEX, PhoneInfo) ) |
|
46 != KErrNone || |
|
47 ( errorCode = aMobilePhone.Open(aTelServer, PhoneInfo.iName) ) |
|
48 != KErrNone ) |
|
49 { |
|
50 // Close mTelServer handle on cleanup stack. |
|
51 aTelServer.Close(); |
|
52 return errorCode; |
|
53 } |
|
54 } |
|
55 return KErrNone; |
|
56 } |
|
57 // --------------------------------------------------------------------------- |
|
58 // RepositoryUtil::SetRepositoryKeyL |
|
59 // Modifies interger value of an Repository key. |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 void RepositoryUtil::SetRepositoryKeyL(const TUid& aUid,const TUint32& aKey, |
|
63 const TInt& aValue) |
|
64 { |
|
65 CRepository* repository = CRepository::NewLC(aUid); |
|
66 User::LeaveIfError(repository->Set(aKey, aValue)); |
|
67 CleanupStack::PopAndDestroy(repository); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // RepositoryUtil::SetRepositoryKeyL |
|
72 // Modifies descritor value of an Repository key. |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void RepositoryUtil::GetRepositoryKeyL(const TUid& aUid,const TUint32& aKey, |
|
76 TInt& aValue) |
|
77 { |
|
78 CRepository* repository = CRepository::NewLC(aUid); |
|
79 User::LeaveIfError(repository->Get(aKey, aValue)); |
|
80 CleanupStack::PopAndDestroy(repository); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // RepositoryUtil::GetRepositoryKeyL |
|
85 // reads integer value of an Repository key. |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void RepositoryUtil::GetRepositoryKeyL(const TUid& aUid,const TUint32& aKey, |
|
89 TDes& aValue) |
|
90 { |
|
91 CRepository* repository = CRepository::NewLC(aUid); |
|
92 User::LeaveIfError(repository->Get(aKey, aValue)); |
|
93 CleanupStack::PopAndDestroy(repository); |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // RepositoryUtil::GetRepositoryKeyL |
|
98 // reads descritor value of an Repository key. |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void RepositoryUtil::SetRepositoryKeyL(const TUid& aUid,const TUint32& aKey, |
|
102 const TDesC& aValue) |
|
103 { |
|
104 CRepository* repository = CRepository::NewLC(aUid); |
|
105 User::LeaveIfError(repository->Set(aKey, aValue)); |
|
106 CleanupStack::PopAndDestroy(repository); |
|
107 } |
|
108 |
|
109 //End of file. |