|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <bt_sock.h> |
|
20 #include "ObjectExchangeServiceSearcher.h" |
|
21 #include "BTObjectExchange.pan" |
|
22 #include "ObjectExchangeProtocolConstants.h" |
|
23 |
|
24 const TSdpAttributeParser::SSdpAttributeNode gObexProtocolListData[] = |
|
25 { |
|
26 { TSdpAttributeParser::ECheckType, ETypeDES }, |
|
27 { TSdpAttributeParser::ECheckType, ETypeDES }, |
|
28 { TSdpAttributeParser::ECheckValue, ETypeUUID, KL2CAP }, |
|
29 { TSdpAttributeParser::ECheckEnd }, |
|
30 { TSdpAttributeParser::ECheckType, ETypeDES }, |
|
31 { TSdpAttributeParser::ECheckValue, ETypeUUID, KRFCOMM }, |
|
32 { TSdpAttributeParser::EReadValue, ETypeUint, KRfcommChannel }, |
|
33 { TSdpAttributeParser::ECheckEnd }, |
|
34 { TSdpAttributeParser::ECheckType, ETypeDES }, |
|
35 { TSdpAttributeParser::ECheckValue, ETypeUUID, KBtProtocolIdOBEX }, |
|
36 { TSdpAttributeParser::ECheckEnd }, |
|
37 { TSdpAttributeParser::ECheckEnd }, |
|
38 { TSdpAttributeParser::EFinished } |
|
39 }; |
|
40 |
|
41 const TStaticArrayC<TSdpAttributeParser::SSdpAttributeNode> gObexProtocolList = |
|
42 CONSTRUCT_STATIC_ARRAY_C( |
|
43 gObexProtocolListData |
|
44 ); |
|
45 |
|
46 CObjectExchangeServiceSearcher* CObjectExchangeServiceSearcher::NewL() |
|
47 { |
|
48 CObjectExchangeServiceSearcher* self = CObjectExchangeServiceSearcher::NewLC(); |
|
49 CleanupStack::Pop(self); |
|
50 return self; |
|
51 } |
|
52 |
|
53 CObjectExchangeServiceSearcher* CObjectExchangeServiceSearcher::NewLC() |
|
54 { |
|
55 CObjectExchangeServiceSearcher* self = new (ELeave) CObjectExchangeServiceSearcher(); |
|
56 CleanupStack::PushL(self); |
|
57 self->ConstructL(); |
|
58 return self; |
|
59 } |
|
60 |
|
61 CObjectExchangeServiceSearcher::CObjectExchangeServiceSearcher() |
|
62 : iServiceClass(KServiceClass), |
|
63 iPort(-1) |
|
64 { |
|
65 } |
|
66 |
|
67 CObjectExchangeServiceSearcher::~CObjectExchangeServiceSearcher() |
|
68 { |
|
69 } |
|
70 |
|
71 void CObjectExchangeServiceSearcher::ConstructL() |
|
72 { |
|
73 // no implementation required |
|
74 } |
|
75 |
|
76 const TUUID& CObjectExchangeServiceSearcher::ServiceClass() const |
|
77 { |
|
78 return iServiceClass; |
|
79 } |
|
80 |
|
81 const TSdpAttributeParser::TSdpAttributeList& CObjectExchangeServiceSearcher::ProtocolList() const |
|
82 { |
|
83 return gObexProtocolList; |
|
84 } |
|
85 |
|
86 void CObjectExchangeServiceSearcher::FoundElementL(TInt aKey, CSdpAttrValue& aValue) |
|
87 { |
|
88 __ASSERT_ALWAYS(aKey == static_cast<TInt>(KRfcommChannel), Panic(EBTObjectExchangeProtocolRead)); |
|
89 iPort = aValue.Uint(); |
|
90 } |
|
91 |
|
92 TInt CObjectExchangeServiceSearcher::Port() |
|
93 { |
|
94 return iPort; |
|
95 } |