|
1 /* |
|
2 * Copyright (c) 2008 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: RNotifier handler for dynamic soft notifications. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "AknDynamicNotifier.h" |
|
19 #include <AknNotifierWrapperDefs.h> |
|
20 #include <AknCapServerDefs.h> |
|
21 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
22 #include <uikon.hrh> |
|
23 #else |
|
24 #include <uikon.hrh> |
|
25 #include <uiklaf/private/pluginuid.hrh> |
|
26 #endif |
|
27 |
|
28 //----------------------------------------------------------------------------- |
|
29 // RDynNotifier::Connect |
|
30 //----------------------------------------------------------------------------- |
|
31 // |
|
32 TInt RDynNotifier::Connect() |
|
33 { |
|
34 TInt ret = KErrNone; |
|
35 if ( Handle() == NULL) |
|
36 { |
|
37 _LIT(KServerNameFormat, "%08x_%08x_AppServer"); |
|
38 TFullName serverName; |
|
39 TUid serviceUid = KAknNotifierServiceUid; |
|
40 serverName.Format(KServerNameFormat, KUikonUidPluginInterfaceNotifiers, KAknCapServerUid); |
|
41 ret = CreateSession(serverName,*reinterpret_cast<TVersion*>(&serviceUid)); |
|
42 } |
|
43 return ret; |
|
44 } |
|
45 |
|
46 //----------------------------------------------------------------------------- |
|
47 // CAknDynamicNotifier::~CAknDynamicNotifier |
|
48 //----------------------------------------------------------------------------- |
|
49 // |
|
50 CAknDynamicNotifier::~CAknDynamicNotifier() |
|
51 { |
|
52 if( iStarted ) |
|
53 { |
|
54 iNotify.CancelNotifier( iUid ); |
|
55 } |
|
56 iNotify.Close(); |
|
57 } |
|
58 |
|
59 //----------------------------------------------------------------------------- |
|
60 // CAknDynamicNotifier::CAknDynamicNotifier |
|
61 //----------------------------------------------------------------------------- |
|
62 // |
|
63 CAknDynamicNotifier::CAknDynamicNotifier( TUid aUid ) : |
|
64 iUid( aUid ) |
|
65 { |
|
66 } |
|
67 |
|
68 //----------------------------------------------------------------------------- |
|
69 // CAknDynamicNotifier::StartOrUpdate |
|
70 //----------------------------------------------------------------------------- |
|
71 // |
|
72 TInt CAknDynamicNotifier::StartOrUpdate( |
|
73 const TDesC8& aBuffer, |
|
74 TDes8& aResponse ) |
|
75 { |
|
76 TInt err = iNotify.Connect(); |
|
77 if( !err ) |
|
78 { |
|
79 if( !iStarted ) |
|
80 { |
|
81 err = iNotify.StartNotifier( iUid, aBuffer, aResponse ); |
|
82 if( !err ) |
|
83 { |
|
84 iStarted = ETrue; |
|
85 } |
|
86 } |
|
87 else |
|
88 { |
|
89 err = iNotify.UpdateNotifier( iUid, aBuffer, aResponse ); |
|
90 } |
|
91 } |
|
92 |
|
93 return err; |
|
94 } |
|
95 |
|
96 //----------------------------------------------------------------------------- |
|
97 // CAknDynamicNotifier::StartOrUpdate |
|
98 //----------------------------------------------------------------------------- |
|
99 // |
|
100 TInt CAknDynamicNotifier::StartOrUpdate( |
|
101 TRequestStatus& aStatus, |
|
102 const TDesC8& aBuffer, |
|
103 TDes8& aResponse) |
|
104 { |
|
105 TInt err = iNotify.Connect(); |
|
106 if( !err ) |
|
107 { |
|
108 iStarted = ETrue; |
|
109 iNotify.StartNotifierAndGetResponse( aStatus, iUid, aBuffer, aResponse ); |
|
110 } |
|
111 return err; |
|
112 } |
|
113 |
|
114 |
|
115 // End of File |