1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
146 //create a message store |
144 //create a message store |
147 const java::runtime::ApplicationInfo& appInf = |
145 const java::runtime::ApplicationInfo& appInf = |
148 java::runtime::ApplicationInfo::getInstance(); |
146 java::runtime::ApplicationInfo::getInstance(); |
149 const std::wstring& root = appInf.getRootPath(); |
147 const std::wstring& root = appInf.getRootPath(); |
150 LOG1(EWMA, EInfo,"SMS Store path %S",root.c_str()); |
148 LOG1(EWMA, EInfo,"SMS Store path %S",root.c_str()); |
151 error = createMessageStore(root + SMS_STORE_PATH); |
149 // At this point mIsAppLaunched will be true if it not |
|
150 // push connection. |
|
151 error = createMessageStore(root + SMS_STORE_PATH , mIsAppLaunched); |
152 mState = EReceivingMessageForNotify; |
152 mState = EReceivingMessageForNotify; |
153 if (KErrNone == error) |
153 if (KErrNone == error) |
154 { |
154 { |
155 error = pthread_create(&mThreadId, NULL, |
155 error = pthread_create(&mThreadId, NULL, |
156 SmsServerConnection::listenThread, this); |
156 SmsServerConnection::listenThread, this); |
163 std::string errTxt("ERROR!!! SMS server conn : Open Failed"); |
163 std::string errTxt("ERROR!!! SMS server conn : Open Failed"); |
164 throw PushException(COMMON_SRV_CONN_PLUGIN_ERROR,errTxt,__FILE__, |
164 throw PushException(COMMON_SRV_CONN_PLUGIN_ERROR,errTxt,__FILE__, |
165 __FUNCTION__,__LINE__); |
165 __FUNCTION__,__LINE__); |
166 } |
166 } |
167 mOpenMonitor->wait(); |
167 mOpenMonitor->wait(); |
168 if (mMessagesOnStore > 0) |
|
169 { |
|
170 mListener->msgArrived(); |
|
171 } |
|
172 mIsListening = true; |
168 mIsListening = true; |
173 } |
169 } |
174 } |
170 } |
175 |
171 |
176 void* SmsServerConnection::listenThread(void* aParams) |
172 void* SmsServerConnection::listenThread(void* aParams) |
453 ELOG(EWMA,"SMS : Exception while creating/writing file"); |
449 ELOG(EWMA,"SMS : Exception while creating/writing file"); |
454 delete[] messagePath; |
450 delete[] messagePath; |
455 writeStream.close(); |
451 writeStream.close(); |
456 User::Leave(KErrGeneral); |
452 User::Leave(KErrGeneral); |
457 } |
453 } |
458 catch (ExceptionBase ex) |
454 catch (ExceptionBase &ex) |
459 { |
455 { |
460 User::Leave(KErrGeneral); |
456 User::Leave(KErrGeneral); |
461 } |
457 } |
462 // Record we have another SMS |
458 // Record we have another SMS |
463 if (mFirstMessageInStore == -1) |
459 if (mFirstMessageInStore == -1) |