|
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: Declaration of Movement Detection API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_LBTMOVEMENTDETECTOR_H |
|
20 #define C_LBTMOVEMENTDETECTOR_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "lbtmovementdetector.hrh" |
|
24 |
|
25 const TUid KMovementDetectorPlugInInterfaceUid = {KMovementDetectionPlugInInterfaceId}; |
|
26 |
|
27 |
|
28 /** |
|
29 * Observer interface for getting notifications from movement detector @ref CMovementDetector. |
|
30 * |
|
31 * Classes interested in getting notifications when a terminal is moving |
|
32 * must implement this interface. |
|
33 * |
|
34 * @lib movementdetector.lib |
|
35 * @since S60 v4.0 |
|
36 */ |
|
37 class MLbtMovementObserver |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Enumeration for different observer events that are notified through |
|
43 * @ref MMovementObserver. |
|
44 */ |
|
45 enum TMovementObserverEvent |
|
46 { |
|
47 EEventMovement = 1, /** Movement detector senses movement */ |
|
48 EEventDetectorOffline, /** Movement detector has gone offline */ |
|
49 EEventDetectorFailed, /** Movement detector has failed */ |
|
50 EEventDetectorOnline, /** Movement detector has gone online */ |
|
51 EEventAccuracyChanged /** Change in accuracy that movement detector promises */ |
|
52 }; |
|
53 |
|
54 /** |
|
55 * An observer callback to handle notification event. This is called when movement |
|
56 * detector senses movement. |
|
57 * |
|
58 * @since S60 TACO |
|
59 * @param aEvent Eventcode for an event that took place. Refer to @p TMovementObserverEvent |
|
60 */ |
|
61 void virtual HandleDetectorNotification(const TMovementObserverEvent aEvent) = 0; |
|
62 |
|
63 }; |
|
64 |
|
65 |
|
66 /** |
|
67 * ECom interface definition for movement detectors. |
|
68 * |
|
69 * All movement detector implementations must derive from and implement this interface. |
|
70 * The interface defines basic operations that all movement detectors must support. Movement |
|
71 * detector report back movement observers thourgh an interface @ref MMovementObserver. |
|
72 * |
|
73 * Supported use cases: |
|
74 * - Load movement detector. |
|
75 * - Unload movement detector. |
|
76 * - Request notification about movement detector events. |
|
77 * - Remove notification request. |
|
78 * |
|
79 * @lib movementdetector.lib |
|
80 * @since S60 TACO |
|
81 */ |
|
82 class CLbtMovementDetector : public CBase |
|
83 { |
|
84 |
|
85 public: |
|
86 |
|
87 /** |
|
88 * Loads a movement detector and initalises it. Detector does not start running until |
|
89 * a call to @p RequestNotificationL(). |
|
90 * |
|
91 * @since S60 TACO |
|
92 */ |
|
93 IMPORT_C static CLbtMovementDetector* NewL(); |
|
94 |
|
95 /** |
|
96 * Unloads this movement detector. |
|
97 * |
|
98 * @since S60 TACO |
|
99 */ |
|
100 IMPORT_C virtual ~CLbtMovementDetector(); |
|
101 |
|
102 /** |
|
103 * Request notification for movement. This registers an object as an observer to |
|
104 * movement notifications as well as . |
|
105 * |
|
106 * @since S60 TACO |
|
107 * @param aObserver An observer to be registered. Object must implement @ref MMovementObserver |
|
108 * |
|
109 * @param aSleepDuration Time duration during which movement detection should listen for movement |
|
110 */ |
|
111 IMPORT_C virtual void RequestNotificationL( MLbtMovementObserver* aObserver, |
|
112 TInt aSleepDuration) = 0; |
|
113 |
|
114 /** |
|
115 * Request removal of movement notification request. |
|
116 * |
|
117 * @since S60 TACO |
|
118 */ |
|
119 IMPORT_C virtual void StopNotification() = 0; |
|
120 |
|
121 |
|
122 |
|
123 private: // data |
|
124 |
|
125 |
|
126 /** |
|
127 * Instance identifier key |
|
128 */ |
|
129 TUid iDtor_ID_Key; |
|
130 }; |
|
131 |
|
132 |
|
133 #endif // C_MOVEMENTDETECTOR_H |