|
1 // Copyright (c) 2004-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 <bluetooth/logger.h> |
|
17 #include "CBnepPktDrvFactory.h" |
|
18 #include "CBnepLocalDevice.h" |
|
19 #include "bneputils.h" |
|
20 |
|
21 #ifdef __FLOG_ACTIVE |
|
22 _LIT8(KLogComponent, LOG_COMPONENT_PAN_BNEP); |
|
23 #endif |
|
24 |
|
25 /** |
|
26 Create the packet driver factory. |
|
27 Uses logging, so will also instantiate TLS in logging builds. |
|
28 */ |
|
29 EXPORT_C CPktDrvFactory* NewBnepPktDrvFactoryL() |
|
30 { |
|
31 CPktDrvFactory* f = new (ELeave) CBnepPktDrvFactory; |
|
32 return f; |
|
33 } |
|
34 |
|
35 CBnepPktDrvFactory::CBnepPktDrvFactory() |
|
36 { |
|
37 CONNECT_LOGGER |
|
38 LOG_FUNC |
|
39 } |
|
40 |
|
41 /** |
|
42 Delete any TLS allocated. |
|
43 @internalComponent |
|
44 */ |
|
45 CBnepPktDrvFactory::~CBnepPktDrvFactory() |
|
46 { |
|
47 CLOSE_LOGGER |
|
48 } |
|
49 |
|
50 /** |
|
51 Second stage constructor. |
|
52 @param aLib Reference to the packet driver library. Takes ownership. |
|
53 @param aCon The CObject container to hold this object. |
|
54 @internalComponent |
|
55 */ |
|
56 void CBnepPktDrvFactory::InitL (RLibrary& aLib, CObjectCon& aCon) |
|
57 { |
|
58 LOG_FUNC |
|
59 iLib.SetHandle(aLib.Handle()); |
|
60 aLib.SetHandle(0); // Handle transferred |
|
61 TPtrC name = _L("BNEP"); |
|
62 SetNameL(&name); |
|
63 aCon.AddL(this); |
|
64 } |
|
65 |
|
66 /** |
|
67 Create and return a new packet driver object |
|
68 @param aParent The bottom of the ethernet nif. |
|
69 @internalComponent |
|
70 */ |
|
71 CPktDrvBase* CBnepPktDrvFactory::NewDriverL (CLANLinkCommon* aParent) |
|
72 { |
|
73 LOG_FUNC |
|
74 return CBnepLocalDevice::NewL(*this, aParent); |
|
75 } |
|
76 |
|
77 /** |
|
78 Increment the object access count. |
|
79 @internalComponent |
|
80 */ |
|
81 TInt CBnepPktDrvFactory::Open () |
|
82 { |
|
83 LOG_FUNC |
|
84 Inc(); |
|
85 LOG1(_L8("CBnepPktDrvFactory: Open count=%d"), AccessCount()); |
|
86 return KErrNone; |
|
87 } |
|
88 |
|
89 /** |
|
90 Return version of packet driver |
|
91 @internalComponent |
|
92 */ |
|
93 TVersion CBnepPktDrvFactory::Version () const |
|
94 { |
|
95 LOG_FUNC |
|
96 return (TVersion(KBnepMajorVersionNumber, KBnepMinorVersionNumber, KBnepBuildVersionNumber)); |
|
97 } |
|
98 |