1 /* |
|
2 * Copyright (c) 2007 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: Location Centre Notification Active Object. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 |
|
21 // USER INCLUDES |
|
22 #include "lcnotificationao.h" |
|
23 #include "lcnotification.h" |
|
24 #include "lcclientsession.h" |
|
25 |
|
26 // CONSTANT DEFINTIONS |
|
27 |
|
28 // ----- Member funtions for CLcNotificationAO --------------------------------- |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // CLcNotificationAO::CLcNotificationAO |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CLcNotificationAO::CLcNotificationAO( MLcNotification& aObserver, |
|
35 RLcClientSession& aClientSession ) |
|
36 :CActive( EPriorityStandard ), |
|
37 iObserver( aObserver ), |
|
38 iClientSession( aClientSession ) |
|
39 { |
|
40 // C++ Default constructor. No allocations or functions which can Leave |
|
41 // should be called from here. |
|
42 CActiveScheduler::Add( this ); |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CLcNotificationAO::~CLcNotificationAO |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CLcNotificationAO::~CLcNotificationAO() |
|
50 { |
|
51 // C++ Destructor. Free all resources associated with this class. |
|
52 Cancel(); |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CLcNotificationAO* CLcNotificationAO::NewL |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CLcNotificationAO* CLcNotificationAO::NewL( MLcNotification& aObserver, |
|
60 RLcClientSession& aClientSession ) |
|
61 { |
|
62 CLcNotificationAO* self = new ( ELeave )CLcNotificationAO( aObserver, |
|
63 aClientSession ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // void CLcNotificationAO::IssueRequest |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 void CLcNotificationAO::IssueRequest() |
|
72 { |
|
73 // The request is issued only if there is no outstanding request. If there |
|
74 // any request outstanding then don't do anything. Server the previous |
|
75 // request. |
|
76 if ( !IsActive()) |
|
77 { |
|
78 // Location Centre Server is the ASP. Send a notification request to |
|
79 // the same. |
|
80 iClientSession.SendReceive( ERegisterObserver, iStatus ); |
|
81 SetActive(); |
|
82 } |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // void CLcNotificationAO::CancelRequest |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void CLcNotificationAO::CancelRequest() |
|
90 { |
|
91 Cancel(); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // void CLcNotificationAO::RunL |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CLcNotificationAO::RunL() |
|
99 { |
|
100 // Communicate the Success/Failure of the Notification request to the |
|
101 // Location Centre Client. |
|
102 iObserver.LcStatusChangedL( iStatus.Int()); |
|
103 |
|
104 // Issue the Observer request unless the server has been terminated. |
|
105 if ( iStatus.Int() != KErrServerTerminated ) |
|
106 { |
|
107 IssueRequest(); |
|
108 } |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // void CLcNotificationAO::DeCancel |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 void CLcNotificationAO::DoCancel() |
|
116 { |
|
117 iClientSession.SendReceive( ERemoveObserver ); |
|
118 } |
|
119 |
|
120 // End of File |
|