equal
deleted
inserted
replaced
|
1 // smswatch.h |
|
2 // |
|
3 // Copyright (c) 2008 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #ifndef __SMS_WATCH__ |
|
14 #define __SMS_WATCH__ |
|
15 |
|
16 #include <smsuaddr.h> |
|
17 class CSmsMessage; |
|
18 #include "smsevent.h" |
|
19 |
|
20 // |
|
21 // CSmsWatcher |
|
22 // listen for incoming sms's from smsstack (via esock) |
|
23 // interpret & execute the command contained therein |
|
24 // |
|
25 NONSHARABLE_CLASS(CSmsWatcher) : public CActive |
|
26 { |
|
27 public: |
|
28 static CSmsWatcher* NewL(CCmdSms& aParent); |
|
29 ~CSmsWatcher(); |
|
30 void WaitForMessage(); |
|
31 const TDesC& Message(); |
|
32 private: |
|
33 CSmsWatcher(CCmdSms& aParent); |
|
34 void ConstructL(); |
|
35 void ReadSmsAndRespondToStackL(); |
|
36 void PrepBuffersL(); |
|
37 void ProcessCommandL(); |
|
38 void ParseBufferL(const TDesC& aInstruction, const TDesC& aSenderAddress); |
|
39 |
|
40 // from CActive |
|
41 virtual void RunL(); |
|
42 virtual void DoCancel(); |
|
43 virtual TInt RunError(TInt aError); |
|
44 private: |
|
45 CCmdSms& iParent; |
|
46 RSocketServ iSocketServer; |
|
47 RSocket iSocket; |
|
48 TSmsAddr iSmsAddr; |
|
49 TPckgBuf<TUint> iIoctlResult; |
|
50 CSmsMessage* iMessage; |
|
51 RBuf iCommand; |
|
52 |
|
53 enum TSmsListenState |
|
54 { |
|
55 ESmsListenIdle, |
|
56 ESmsListenWaitForSms, |
|
57 ESmsListenReadSms, |
|
58 ESmsListenProcessSms, |
|
59 ESmsListenTestMode |
|
60 }; |
|
61 TSmsListenState iState; |
|
62 TBuf<0x100> iErrorMessage; |
|
63 }; |
|
64 |
|
65 |
|
66 #endif // __SMS_WATCH__ |