|
1 /******************************************************************************* |
|
2 * Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 |
|
13 #include <hal.h> |
|
14 #include "swtinput.h" |
|
15 #include "swtmobiledevice.h" |
|
16 |
|
17 |
|
18 // ======== MEMBER FUNCTIONS ======== |
|
19 |
|
20 |
|
21 // --------------------------------------------------------------------------- |
|
22 // CSwtInput::NewL |
|
23 // --------------------------------------------------------------------------- |
|
24 // |
|
25 CSwtInput* CSwtInput::NewL(TSwtPeer aPeer, TInt aId) |
|
26 { |
|
27 CSwtInput* self = new(ELeave) CSwtInput(aPeer, aId); |
|
28 return self; |
|
29 } |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // CSwtInput::CSwtInput |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CSwtInput::CSwtInput(TSwtPeer aPeer, TInt aId) |
|
36 : iPeer(aPeer) |
|
37 { |
|
38 iType = KErrNotFound; |
|
39 iLocation = KErrNotFound; |
|
40 RArray<CSwtMobileDevice::TSwtHwInput> inputs; |
|
41 CSwtMobileDevice::GetHwInputs(inputs); |
|
42 if (aId < inputs.Count()) |
|
43 { |
|
44 iType = inputs[aId].iType; |
|
45 iLocation = inputs[aId].iLocation; |
|
46 } |
|
47 inputs.Close(); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CSwtInput::~CSwtInput |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CSwtInput::~CSwtInput() |
|
55 { |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CSwtInput::Dispose |
|
60 // From MSwtInput |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 TSwtPeer CSwtInput::Dispose() |
|
64 { |
|
65 TSwtPeer peer(iPeer); |
|
66 delete this; |
|
67 return peer; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CSwtInput::GetLocation |
|
72 // From MSwtInput |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 TInt CSwtInput::GetLocation() |
|
76 { |
|
77 return iLocation; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CSwtInput::GetType |
|
82 // From MSwtInput |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 TInt CSwtInput::GetType() |
|
86 { |
|
87 return iType; |
|
88 } |