|
1 // Copyright (c) 2008-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 // |
|
15 |
|
16 #include <pnp/cpnpservicediscoverybase.h> |
|
17 #include "rpnpservicediscovery.h" |
|
18 |
|
19 EXPORT_C RPnPServiceDiscovery::RPnPServiceDiscovery( ): |
|
20 iPnPServiceDiscoveryImpl ( NULL ) |
|
21 { |
|
22 } |
|
23 |
|
24 EXPORT_C TInt RPnPServiceDiscovery::Open ( TUint aTierID ) |
|
25 { |
|
26 if (!iPnPServiceDiscoveryImpl ) |
|
27 { |
|
28 TInt err = KErrNone; |
|
29 TRAP(err,iPnPServiceDiscoveryImpl = CPnPServiceDiscoveryBase::NewL( aTierID )); |
|
30 if ( err != KErrNone ) |
|
31 return err; |
|
32 |
|
33 err = iPnPServiceDiscoveryImpl->Construct( aTierID ); |
|
34 if ( err != KErrNone ) |
|
35 { |
|
36 Close(); |
|
37 } |
|
38 return err; |
|
39 } |
|
40 else |
|
41 return KErrAlreadyExists; |
|
42 |
|
43 } |
|
44 |
|
45 EXPORT_C void RPnPServiceDiscovery::Discover ( const RPnPParameterBundle& aServiceInfo ) |
|
46 { |
|
47 __ASSERT_ALWAYS( iPnPServiceDiscoveryImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
48 iPnPServiceDiscoveryImpl->Discover ( aServiceInfo ); |
|
49 } |
|
50 |
|
51 EXPORT_C void RPnPServiceDiscovery::Describe ( const RPnPParameterBundle& aServiceInfo ) |
|
52 { |
|
53 __ASSERT_ALWAYS( iPnPServiceDiscoveryImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
54 iPnPServiceDiscoveryImpl->Describe ( aServiceInfo ); |
|
55 } |
|
56 |
|
57 EXPORT_C void RPnPServiceDiscovery::Subscribe ( const RPnPParameterBundle& aServiceInfo ) |
|
58 { |
|
59 __ASSERT_ALWAYS( iPnPServiceDiscoveryImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
60 iPnPServiceDiscoveryImpl->Subscribe ( aServiceInfo ); |
|
61 } |
|
62 |
|
63 EXPORT_C void RPnPServiceDiscovery::RegisterNotify ( const RPnPParameterBundle& aServiceInfo ) |
|
64 { |
|
65 __ASSERT_ALWAYS( iPnPServiceDiscoveryImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
66 iPnPServiceDiscoveryImpl->RegisterNotify ( aServiceInfo ); |
|
67 } |
|
68 |
|
69 |
|
70 EXPORT_C void RPnPServiceDiscovery::Cancel ( const RPnPParameterBundle& aServiceInfo ) |
|
71 { |
|
72 __ASSERT_ALWAYS( iPnPServiceDiscoveryImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
73 iPnPServiceDiscoveryImpl->Cancel ( aServiceInfo ); |
|
74 } |
|
75 |
|
76 EXPORT_C TInt RPnPServiceDiscovery::InitiateControl( RControlChannel& aControlChannel, const TDesC8& aUri) |
|
77 { |
|
78 __ASSERT_ALWAYS( iPnPServiceDiscoveryImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
79 CControlChannelBase* channelBase = NULL; |
|
80 TRAPD (err , channelBase = iPnPServiceDiscoveryImpl->InitiateControlL(aUri)); |
|
81 if ( err == KErrNone) |
|
82 { |
|
83 aControlChannel.Attach(*channelBase); |
|
84 } |
|
85 return err; |
|
86 } |
|
87 |
|
88 EXPORT_C void RPnPServiceDiscovery::Close ( ) |
|
89 { |
|
90 delete iPnPServiceDiscoveryImpl; |
|
91 iPnPServiceDiscoveryImpl = NULL; |
|
92 } |
|
93 |
|
94 |