|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Bearer availability and mobility simulator classes |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file MobilitySimulation.cpp |
|
20 */ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32property.h> |
|
24 #include <in_sock.h> |
|
25 #include <es_sock.h> |
|
26 |
|
27 #include "MobilitySimulation.h" |
|
28 |
|
29 |
|
30 #ifdef __1060_TESTCODE__ |
|
31 |
|
32 |
|
33 TInt CBearerAvailability::GetAvailability(TAvailabilityState& aAvailability) |
|
34 { |
|
35 return RProperty::Get(KBMobilityTestPropCat, iBearerIndex, (TInt&)aAvailability); |
|
36 } |
|
37 |
|
38 TUint CBearerAvailability::SetAvailability(TAvailabilityState aAvailability) |
|
39 { |
|
40 // Set the property associated with the bearer who's availability we are changing |
|
41 TUint err = RProperty::Set(KBMobilityTestPropCat, iBearerIndex, aAvailability); |
|
42 |
|
43 // Should have occurred |
|
44 return err; |
|
45 } |
|
46 |
|
47 |
|
48 TInt CBearerAvailability::MakeAvailable() |
|
49 { |
|
50 return SetAvailability(EAvailable); |
|
51 } |
|
52 |
|
53 TInt CBearerAvailability::MakeUnavailable() |
|
54 { |
|
55 return SetAvailability(EUnavailable); |
|
56 } |
|
57 |
|
58 TInt CBearerAvailability::Disconnect() |
|
59 { |
|
60 return SetAvailability(EDisconnected); |
|
61 } |
|
62 |
|
63 CBearerAvailability::CBearerAvailability(TUint aBearer) |
|
64 { |
|
65 if ((aBearer >= EMinBearerIndex) && (aBearer <= EMaxBearerIndex)) |
|
66 { |
|
67 iBearerIndex = aBearer; |
|
68 |
|
69 TInt err = RProperty::Define(KBMobilityTestPropCat, iBearerIndex, RProperty::EInt); |
|
70 |
|
71 if (err == KErrNone) |
|
72 iPropertyDefined = true; |
|
73 } |
|
74 } |
|
75 |
|
76 // Class for watching for changes to availability |
|
77 |
|
78 TInt CBearerStateWatcher::WaitForBearerStateChange() |
|
79 { |
|
80 } |
|
81 |
|
82 #endif |
|
83 |
|
84 |