|
1 // Copyright (c) 2005-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 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #include <bluetooth/logger.h> |
|
22 #include <avctpservices.h> |
|
23 #include "avctpbody.h" |
|
24 #include "avctpserviceutils.h" |
|
25 |
|
26 #ifdef __FLOG_ACTIVE |
|
27 _LIT8(KLogComponent, LOG_COMPONENT_AVCTP_SERVICES); |
|
28 #endif |
|
29 |
|
30 using namespace SymbianAvctp; |
|
31 |
|
32 #define ASSERT_OPEN __ASSERT_ALWAYS(iBody, Panic(EAvctpRAvctpNotOpen)); |
|
33 #define ASSERT_CLOSED __ASSERT_ALWAYS(!iBody, Panic(EAvctpRAvctpAlreadyOpen)); |
|
34 |
|
35 |
|
36 EXPORT_C RAvctp::RAvctp() |
|
37 { |
|
38 LOG_FUNC |
|
39 iBody = NULL; |
|
40 } |
|
41 |
|
42 EXPORT_C TInt RAvctp::Open(MAvctpEventNotify& aNotify, TPid aPid, MAvctpChannel*& aPrimaryChannel) |
|
43 { |
|
44 LOG_FUNC |
|
45 ASSERT_CLOSED |
|
46 |
|
47 TRAPD(err, iBody = CAvctpBody::NewL(aNotify, aPid, aPrimaryChannel)); |
|
48 return err; |
|
49 } |
|
50 |
|
51 EXPORT_C void RAvctp::Close(TCloseType aImmediacy) |
|
52 { |
|
53 LOG_FUNC |
|
54 |
|
55 if (iBody) |
|
56 { |
|
57 iBody->Close(aImmediacy); // This tells iBody to delete itself |
|
58 iBody = NULL; |
|
59 } |
|
60 } |
|
61 |
|
62 EXPORT_C void RAvctp::CloseGracefully() |
|
63 { |
|
64 LOG_FUNC |
|
65 ASSERT_OPEN |
|
66 |
|
67 iBody->CloseGracefully(); // This tells iBody to delete itself |
|
68 } |
|
69 |
|
70 |
|
71 /** |
|
72 * This is separated out from RAvctp::Open so that the client can choose to run RAvctp in two-thread mode |
|
73 * in which the "second channel" Send and receive service provide in AVCTP Services is installed |
|
74 * on another thread if the client so chooses. |
|
75 * |
|
76 * */ |
|
77 EXPORT_C TInt RAvctp::InstallSecondaryChannel(MAvctpEventNotify& aSecondChannelObserverWillyNilly, MAvctpChannel*& aSecondaryChannel) |
|
78 { |
|
79 LOG_FUNC |
|
80 ASSERT_OPEN |
|
81 |
|
82 return iBody->InstallSecondaryChannel(aSecondChannelObserverWillyNilly, aSecondaryChannel); |
|
83 } |
|
84 |
|
85 EXPORT_C void RAvctp::UninstallSecondaryChannel(TCloseType aImmediacy) |
|
86 { |
|
87 LOG_FUNC |
|
88 ASSERT_OPEN |
|
89 |
|
90 iBody->UninstallSecondaryChannel(aImmediacy); |
|
91 } |
|
92 |
|
93 // EOF |