|
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/cpnpservicepublisherbase.h> |
|
17 #include "rpnpservicepublisher.h" |
|
18 |
|
19 |
|
20 EXPORT_C RPnPServicePublisher::RPnPServicePublisher( ): |
|
21 iPnPServicePublisherImpl ( NULL ) |
|
22 { |
|
23 } |
|
24 |
|
25 EXPORT_C TInt RPnPServicePublisher::Open ( TUint aTierID ) |
|
26 { |
|
27 if (!iPnPServicePublisherImpl ) |
|
28 { |
|
29 TInt err = KErrNone; |
|
30 TRAP(err,iPnPServicePublisherImpl = CPnPServicePublisherBase::NewL( aTierID )); |
|
31 if ( err != KErrNone ) |
|
32 return err; |
|
33 |
|
34 err = iPnPServicePublisherImpl->Construct( aTierID ); |
|
35 if ( err != KErrNone ) |
|
36 { |
|
37 Close(); |
|
38 } |
|
39 return err; |
|
40 } |
|
41 else |
|
42 return KErrAlreadyExists; |
|
43 |
|
44 } |
|
45 |
|
46 EXPORT_C void RPnPServicePublisher::Close ( ) |
|
47 { |
|
48 delete iPnPServicePublisherImpl; |
|
49 iPnPServicePublisherImpl = NULL; |
|
50 } |
|
51 |
|
52 EXPORT_C void RPnPServicePublisher::Publish ( const RPnPParameterBundle& aServiceInfo ) |
|
53 { |
|
54 __ASSERT_ALWAYS( iPnPServicePublisherImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
55 iPnPServicePublisherImpl->Publish ( aServiceInfo ); |
|
56 } |
|
57 |
|
58 EXPORT_C void RPnPServicePublisher::SendNotify ( const RPnPParameterBundle& aServiceInfo ) |
|
59 { |
|
60 __ASSERT_ALWAYS( iPnPServicePublisherImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
61 iPnPServicePublisherImpl->SendNotify ( aServiceInfo ); |
|
62 } |
|
63 |
|
64 EXPORT_C TInt RPnPServicePublisher::InitiateControl( RControlChannel& aControlChannel ) |
|
65 { |
|
66 __ASSERT_ALWAYS( iPnPServicePublisherImpl, User::Panic( KPnPHandleNotOpen, KErrPnPNotOpen) ); |
|
67 CControlChannelBase* channelBase = NULL; |
|
68 TRAPD (err , channelBase = iPnPServicePublisherImpl->InitiateControlL()); |
|
69 if ( err == KErrNone) |
|
70 { |
|
71 aControlChannel.Attach(*channelBase); |
|
72 } |
|
73 return err; |
|
74 } |
|
75 |