|
1 // Copyright (c) 2002-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 // Provides the implementation of the subsession that refers to the local device |
|
15 // |
|
16 // |
|
17 |
|
18 #include "BTManServer.h" |
|
19 #include <bluetooth/logger.h> |
|
20 |
|
21 #ifdef __FLOG_ACTIVE |
|
22 _LIT8(KLogComponent, LOG_COMPONENT_BT_MANAGER_SERVER); |
|
23 #endif |
|
24 |
|
25 // declare statics |
|
26 |
|
27 CBTLocalDeviceSubSession* CBTLocalDeviceSubSession::NewL(CBTManSession& aSession, CBTRegistry& aRegistry) |
|
28 { |
|
29 LOG_STATIC_FUNC |
|
30 CBTLocalDeviceSubSession* self = new(ELeave) CBTLocalDeviceSubSession(aSession, aRegistry); |
|
31 //Since its a CObject derived class so we should use CleanupClosePushL |
|
32 CleanupClosePushL(*self); |
|
33 self->ConstructL(); |
|
34 CleanupStack::Pop(); |
|
35 return self; |
|
36 } |
|
37 |
|
38 CBTLocalDeviceSubSession::~CBTLocalDeviceSubSession() |
|
39 { |
|
40 LOG_FUNC |
|
41 } |
|
42 |
|
43 void CBTLocalDeviceSubSession::ConstructL() |
|
44 { |
|
45 LOG_FUNC |
|
46 } |
|
47 |
|
48 CBTLocalDeviceSubSession::CBTLocalDeviceSubSession(CBTManSession& aSession, CBTRegistry& aRegistry) |
|
49 : CBTManSubSession(aSession,aRegistry) |
|
50 { |
|
51 LOG_FUNC |
|
52 } |
|
53 |
|
54 void CBTLocalDeviceSubSession::GetL(const RMessage2& aMessage) |
|
55 /** |
|
56 Retrieve the settings of the local device and return to client |
|
57 |
|
58 @param aMessage The client message to complete |
|
59 **/ |
|
60 { |
|
61 LOG_FUNC |
|
62 // ask registry for row from the localdevice table |
|
63 TBTLocalDevice* locDevice = iRegistry.GetLocalDeviceLC(); |
|
64 TPckg<TBTLocalDevice> pckg(*locDevice); |
|
65 |
|
66 aMessage.WriteL(0, pckg); // write client descriptor |
|
67 iSession.CompleteMessage(aMessage, KErrNone); |
|
68 |
|
69 CleanupStack::PopAndDestroy(locDevice); |
|
70 } |
|
71 |
|
72 void CBTLocalDeviceSubSession::UpdateL(const TBTLocalDevice& aLocalDevice, const RMessage2& aMessage) |
|
73 /** |
|
74 Update the local device settings in the registry |
|
75 |
|
76 @param aLocalDevice the new settings |
|
77 @param aMessage the client message to complete |
|
78 **/ |
|
79 { |
|
80 LOG_FUNC |
|
81 iRegistry.UpdateLocalDeviceL(aLocalDevice); |
|
82 iSession.CompleteMessage(aMessage, KErrNone); |
|
83 //P&S |
|
84 NotifyChange(KRegistryChangeLocalTable); |
|
85 } |
|
86 |
|
87 void CBTLocalDeviceSubSession::Cleanup(TInt /*aError*/) |
|
88 { |
|
89 LOG_FUNC |
|
90 // do nothing |
|
91 } |