26 // --------------------------------------------------------------------------- |
26 // --------------------------------------------------------------------------- |
27 // CMmcService::NewL |
27 // CMmcService::NewL |
28 // --------------------------------------------------------------------------- |
28 // --------------------------------------------------------------------------- |
29 CMmcService* CMmcService::NewL() |
29 CMmcService* CMmcService::NewL() |
30 { |
30 { |
31 FLOG(_L("CMmcService::NewL >>")); |
31 _DMEVNT_DEBUG(_L("CMmcService::NewL >>")); |
32 |
32 |
33 TInt value (KErrNotFound); |
33 TInt value (KErrNotFound); |
34 |
34 |
35 RProperty::Get(KMMCPSKey.iConditionCategory, KMMCPSKey.iConditionKey, value); |
35 RProperty::Get(KMMCPSKey.iConditionCategory, KMMCPSKey.iConditionKey, value); |
36 CMmcService* self (NULL); |
36 CMmcService* self (NULL); |
37 if(value == 0) |
37 if(value == 0) |
38 { |
38 { |
39 FLOG(_L("MMC is removed, hence setting for insertion...")); |
39 _DMEVNT_DEBUG(_L("MMC is removed, hence setting for insertion...")); |
40 self = new (ELeave) CMmcService(KMMCPSKeyConditionInsert); |
40 self = new (ELeave) CMmcService(KMMCPSKeyConditionInsert); |
41 } |
41 } |
42 else //(value == 1) |
42 else //(value == 1) |
43 { |
43 { |
44 FLOG(_L("MMC is inserted, hence setting for removal...")) |
44 _DMEVNT_DEBUG(_L("MMC is inserted, hence setting for removal...")) |
45 self = new (ELeave) CMmcService(KMMCPSKeyConditionRemove); |
45 self = new (ELeave) CMmcService(KMMCPSKeyConditionRemove); |
46 } |
46 } |
47 |
47 |
48 CleanupStack::PushL(self); |
48 CleanupStack::PushL(self); |
49 |
49 |
50 self->ConstructL(); |
50 self->ConstructL(); |
51 self->iLookingFor = value; |
51 self->iLookingFor = value; |
52 CleanupStack::Pop(self); |
52 CleanupStack::Pop(self); |
53 FLOG(_L("CMmcService::NewL <<")); |
53 _DMEVNT_DEBUG(_L("CMmcService::NewL <<")); |
54 return self; |
54 return self; |
55 } |
55 } |
56 |
56 |
57 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
58 // CMmcService::NewLC |
58 // CMmcService::NewLC |
59 // --------------------------------------------------------------------------- |
59 // --------------------------------------------------------------------------- |
60 CMmcService* CMmcService::NewLC() |
60 CMmcService* CMmcService::NewLC() |
61 { |
61 { |
62 FLOG(_L("CMmcService::NewLC >>")); |
62 _DMEVNT_DEBUG(_L("CMmcService::NewLC >>")); |
63 |
63 |
64 CMmcService* self = CMmcService::NewL(); |
64 CMmcService* self = CMmcService::NewL(); |
65 CleanupStack::PushL(self); |
65 CleanupStack::PushL(self); |
66 |
66 |
67 FLOG(_L("CMmcService::NewLC <<")); |
67 _DMEVNT_DEBUG(_L("CMmcService::NewLC <<")); |
68 return self; |
68 return self; |
69 } |
69 } |
70 |
70 |
71 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
72 // CMmcService::ConstructL |
72 // CMmcService::ConstructL |
73 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
74 void CMmcService::ConstructL() |
74 void CMmcService::ConstructL() |
75 { |
75 { |
76 FLOG(_L("CMmcService::ConstructL >>")); |
76 _DMEVNT_DEBUG(_L("CMmcService::ConstructL >>")); |
77 |
77 |
78 FLOG(_L("CMmcService::ConstructL <<")); |
78 _DMEVNT_DEBUG(_L("CMmcService::ConstructL <<")); |
79 } |
79 } |
80 |
80 |
81 // --------------------------------------------------------------------------- |
81 // --------------------------------------------------------------------------- |
82 // CMmcService::CMmcService |
82 // CMmcService::CMmcService |
83 // --------------------------------------------------------------------------- |
83 // --------------------------------------------------------------------------- |
84 CMmcService::CMmcService(const TPSKeyCondition& aPSKeyCondition):CDmEventServiceBase(aPSKeyCondition, EMmcService) |
84 CMmcService::CMmcService(const TPSKeyCondition& aPSKeyCondition):CDmEventServiceBase(aPSKeyCondition, EMmcService) |
85 { |
85 { |
86 FLOG(_L("CMmcService::CMmcService >>")); |
86 _DMEVNT_DEBUG(_L("CMmcService::CMmcService >>")); |
87 |
87 |
88 FLOG(_L("CMmcService::CMmcService <<")); |
88 _DMEVNT_DEBUG(_L("CMmcService::CMmcService <<")); |
89 } |
89 } |
90 |
90 |
91 // --------------------------------------------------------------------------- |
91 // --------------------------------------------------------------------------- |
92 // CMmcService::~CMmcService |
92 // CMmcService::~CMmcService |
93 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
99 // --------------------------------------------------------------------------- |
99 // --------------------------------------------------------------------------- |
100 // CMmcService::IsKeyValid |
100 // CMmcService::IsKeyValid |
101 // --------------------------------------------------------------------------- |
101 // --------------------------------------------------------------------------- |
102 TBool CMmcService::IsKeyValid() |
102 TBool CMmcService::IsKeyValid() |
103 { |
103 { |
104 FLOG(_L("CMmcService::IsKeyValid >>")); |
104 _DMEVNT_DEBUG(_L("CMmcService::IsKeyValid >>")); |
105 TBool ret (EFalse); |
105 TBool ret (EFalse); |
106 TInt value (KErrNone); |
106 TInt value (KErrNone); |
107 |
107 |
108 //Just read the key to find if it exists |
108 //Just read the key to find if it exists |
109 if (RProperty::Get(KMMCPSKey.iConditionCategory, KMMCPSKey.iConditionKey, value) == KErrNone) |
109 if (RProperty::Get(KMMCPSKey.iConditionCategory, KMMCPSKey.iConditionKey, value) == KErrNone) |
110 ret = ETrue; |
110 ret = ETrue; |
111 |
111 |
112 FLOG(_L("CMmcService::IsKeyValid, return = %d >>"), ret); |
112 _DMEVNT_DEBUG(_L("CMmcService::IsKeyValid, return = %d >>"), ret); |
113 return ret; |
113 return ret; |
114 } |
114 } |
115 |
115 |
116 |
116 |
117 // --------------------------------------------------------------------------- |
117 // --------------------------------------------------------------------------- |
118 // CMmcService::WaitForRequestCompleteL |
118 // CMmcService::WaitForRequestCompleteL |
119 // --------------------------------------------------------------------------- |
119 // --------------------------------------------------------------------------- |
120 void CMmcService::WaitForRequestCompleteL() |
120 void CMmcService::WaitForRequestCompleteL() |
121 { |
121 { |
122 FLOG(_L("CMmcService::WaitForRequestCompleteL >>")); |
122 _DMEVNT_DEBUG(_L("CMmcService::WaitForRequestCompleteL >>")); |
123 TInt value (KErrNone); |
123 TInt value (KErrNone); |
124 |
124 |
125 iOperation = ENoOpn; |
125 iOperation = ENoOpn; |
126 TInt err = RProperty::Get(KMMCPSKey.iConditionCategory, KMMCPSKey.iConditionKey, value); |
126 TInt err = RProperty::Get(KMMCPSKey.iConditionCategory, KMMCPSKey.iConditionKey, value); |
127 FLOG(_L("err = %d"), err); |
127 _DMEVNT_DEBUG(_L("err = %d"), err); |
128 |
128 |
129 switch (value) |
129 switch (value) |
130 { |
130 { |
131 case 0: |
131 case 0: |
132 { |
132 { |
142 { |
142 { |
143 iOperation = EOpnUnknown; |
143 iOperation = EOpnUnknown; |
144 } |
144 } |
145 break; |
145 break; |
146 } |
146 } |
147 FLOG(_L("CMmcService::WaitForRequestCompleteL <<")); |
147 _DMEVNT_DEBUG(_L("CMmcService::WaitForRequestCompleteL <<")); |
148 } |
148 } |
149 |
149 |
150 // --------------------------------------------------------------------------- |
150 // --------------------------------------------------------------------------- |
151 // CMmcService::TaskName |
151 // CMmcService::TaskName |
152 // --------------------------------------------------------------------------- |
152 // --------------------------------------------------------------------------- |
153 const TDesC& CMmcService::TaskName() |
153 const TDesC& CMmcService::TaskName() |
154 { |
154 { |
155 return KMmcTaskName(); |
155 return KMmcTaskName(); |
156 } |
156 } |
157 |
157 |
158 void CMmcService::UpdateMmcStatus() |
158 void CMmcService::UpdateMmcStatusL() |
159 { |
159 { |
160 FLOG(_L("Looking for %d"), iLookingFor); |
160 _DMEVNT_DEBUG(_L("Looking for %d"), iLookingFor); |
161 |
161 |
162 if (iLookingFor != KErrNotFound) |
162 if (iLookingFor != KErrNotFound) |
163 { |
163 { |
164 CRepository * rep = CRepository::NewL(TUid::Uid(KAppUidDmEventNotifier)); |
164 CRepository * rep = CRepository::NewL(TUid::Uid(KAppUidDmEventNotifier)); |
165 rep->Set(KMMCStatus, iLookingFor); |
165 rep->Set(KMMCStatus, iLookingFor); |
166 delete rep; rep = NULL; |
166 delete rep; rep = NULL; |
167 } |
167 } |
168 else |
168 else |
169 { |
169 { |
170 FLOG(_L("Can't set value %d to cenrep"), iLookingFor); |
170 _DMEVNT_DEBUG(_L("Can't set value %d to cenrep"), iLookingFor); |
171 } |
171 } |
172 } |
172 } |