1.1 --- a/epoc32/include/btsdp.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/btsdp.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,1394 @@
1.4 -btsdp.h
1.5 +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +#ifndef BTSDP_H
1.28 +#define BTSDP_H
1.29 +
1.30 +#include <e32base.h>
1.31 +#include <bttypes.h>
1.32 +
1.33 +
1.34 +/** The UID of the SDP Server.
1.35 +
1.36 +@see TBTServiceSecurity */
1.37 +static const TUid KUidServiceSDP = {0x100095FA};
1.38 +
1.39 +/** Attribute ID. */
1.40 +typedef TUint16 TSdpAttributeID;
1.41 +
1.42 +// Universal Attributes
1.43 +/** Service Record Handle. */
1.44 +static const TSdpAttributeID KSdpAttrIdServiceRecordHandle = 0x0000;
1.45 +/** Service ClassID List. */
1.46 +static const TSdpAttributeID KSdpAttrIdServiceClassIDList = 0x0001;
1.47 +/** Service Record State. */
1.48 +static const TSdpAttributeID KSdpAttrIdServiceRecordState = 0x0002;
1.49 +/** ServiceID. */
1.50 +static const TSdpAttributeID KSdpAttrIdServiceID = 0x0003;
1.51 +/** Protocol Descriptor List. */
1.52 +static const TSdpAttributeID KSdpAttrIdProtocolDescriptorList = 0x0004;
1.53 +/** Browse Group List. */
1.54 +static const TSdpAttributeID KSdpAttrIdBrowseGroupList = 0x0005;
1.55 +/** Language Base Attribute ID List. */
1.56 +static const TSdpAttributeID KSdpAttrIdLanguageBaseAttributeIDList = 0x0006;
1.57 +/** Service Info Time To Live. */
1.58 +static const TSdpAttributeID KSdpAttrIdServiceInfoTimeToLive = 0x0007;
1.59 +/** Service Availability. */
1.60 +static const TSdpAttributeID KSdpAttrIdServiceAvailability = 0x0008;
1.61 +/** Bluetooth Profile Descriptor List. */
1.62 +static const TSdpAttributeID KSdpAttrIdBluetoothProfileDescriptorList = 0x0009;
1.63 +/** Documentation URL. */
1.64 +static const TSdpAttributeID KSdpAttrIdDocumentationURL = 0x000A;
1.65 +/** Client Executable URL. */
1.66 +static const TSdpAttributeID KSdpAttrIdClientExecutableURL = 0x000B;
1.67 +/** Icon URL. */
1.68 +static const TSdpAttributeID KSdpAttrIdIconURL = 0x000C;
1.69 +
1.70 +
1.71 +/** PAN Profile Security enforcement */
1.72 +static const TSdpAttributeID KSdpAttrIdSecurityDescription = 0x030a;
1.73 +
1.74 +/** PAN Profile, NAP access type */
1.75 +static const TSdpAttributeID KSdpAttrIdNetAccessType = 0x030b;
1.76 +
1.77 +/** PAN Profile, NAP maximum throughput of uplink network (octets/second) */
1.78 +static const TSdpAttributeID KSdpAttrIdMaxNetAccessRate = 0x030c;
1.79 +
1.80 +/** PAN Profile, NAP IPv4 Subnet */
1.81 +static const TSdpAttributeID KSdpAttrIdIPv4Subnet = 0x030d;
1.82 +
1.83 +/** PAN Profile, NAP IPv6 Subnet */
1.84 +static const TSdpAttributeID KSdpAttrIdIPv6Subnet = 0x030e;
1.85 +
1.86 +/** SupportedCapabilities */
1.87 +static const TSdpAttributeID KSdpAttrIdSupportedCapabilities = 0x0310;
1.88 +/** SupportedFeatures */
1.89 +static const TSdpAttributeID KSdpAttrIdSupportedFeatures = 0x0311;
1.90 +/** SupportedFunctions */
1.91 +static const TSdpAttributeID KSdpAttrIdSupportedFunctions = 0x0312;
1.92 +
1.93 +
1.94 +// Language specific attributes
1.95 +
1.96 +/** Primary Language. */
1.97 +static const TSdpAttributeID KSdpAttrIdBasePrimaryLanguage = 0x0100;
1.98 +static const TSdpAttributeID KSdpAttrIdCharacterEncodingUTF8 = 0x006a;
1.99 +
1.100 +/** Service Name.
1.101 +
1.102 +This is an offset that should be added to the attribute ID base (contained
1.103 +in the LanguageBaseAttributeIDList attribute). */
1.104 +static const TInt KSdpAttrIdOffsetServiceName = 0x0000; // + Language offset
1.105 +
1.106 +
1.107 +/** Service Description.
1.108 +
1.109 +This is an offset that should be added to the attribute ID base (contained
1.110 +in the LanguageBaseAttributeIDList attribute). */
1.111 +static const TInt KSdpAttrIdOffsetServiceDescription = 0x0001; // + Language offset
1.112 +
1.113 +
1.114 +/** Provider Name.
1.115 +
1.116 +This is an offset that should be added to the attribute ID base (contained
1.117 +in the LanguageBaseAttributeIDList attribute). */
1.118 +static const TInt KSdpAttrIdOffsetProviderName = 0x0002; // + Language offset
1.119 +
1.120 +
1.121 +// SDP server specific attributes
1.122 +/** Version Number List. */
1.123 +static const TSdpAttributeID KSdpAttrIdSdpServerVersionNumberList = 0x0200;
1.124 +/** Service Database State. */
1.125 +static const TSdpAttributeID KSdpAttrIdSdpServerServiceDatabaseState = 0x0201;
1.126 +/** GroupID. */
1.127 +static const TSdpAttributeID KSdpAttrIdSdpServerGroupID = 0x0200;
1.128 +
1.129 +
1.130 +// Protocol UUIDs (add to these as necessary)
1.131 +static const TInt KL2CAPUUID = 0x0100;
1.132 +static const TInt KBnepUUID = 0x000f;
1.133 +static const TInt KAvctpUUID = 0x0017;
1.134 +static const TInt KAvdtpUUID = 0x0019;
1.135 +static const TInt KObexProtocolUUID = 0x0008;
1.136 +static const TInt KRFCommUUID = 0x0003;
1.137 +
1.138 +// Service class UUIDs (add to these as necessary)
1.139 +/** L2CAP UUID used for continuation tests*/
1.140 +static const TUint32 KSdpContTestUUID = 0x100;
1.141 +/** Serial Port UUID */
1.142 +static const TInt KSerialPortUUID = 0x1101;
1.143 +/** Dial Networking UUID */
1.144 +static const TInt KDialUpNetworkingUUID = 0x1103;
1.145 +/** General Networking UUID */
1.146 +static const TInt KGenericNetworkingUUID = 0x1201;
1.147 +/** Fax UUID */
1.148 +static const TInt KFaxUUID = 0x1111;
1.149 +/** Generic Telaphony UUID */
1.150 +static const TInt KGenericTelephonyUUID = 0x1204;
1.151 +/** Obex UUID */
1.152 +static const TInt KObexUUID = 0x1105;
1.153 +/** Attribute number for the Protocol Descriptor List */
1.154 +static const TInt KProtocolDescriptorListUUID = 0x0004;
1.155 +/** Public Browse Group UUID */
1.156 +static const TInt KPublicBrowseGroupUUID = 0x1002;
1.157 +/** Browse Group Descriptor Service Class UUID */
1.158 +static const TInt KBrowseGroupDescriptorServiceClassUUID = 0x1001;
1.159 +/** Service Discovery Server Service Class UUID */
1.160 +static const TInt KServiceDiscoveryServerServiceClassUUID = 0x1000;
1.161 +/** PAN Service Class UUID */
1.162 +static const TInt KPanUUUID = 0x1115;
1.163 +/** PAN NAP Service Class UUID */
1.164 +static const TInt KPanNapUUID = 0x1116;
1.165 +/** PAN GN Service Class UUID */
1.166 +static const TInt KPanGnUUID = 0x1117;
1.167 +/** Audio Source (service class) UUID */
1.168 +static const TInt KAudioSourceUUID = 0x110a;
1.169 +/** Audio Sink (service class) UUID */
1.170 +static const TInt KAudioSinkUUID = 0x110b;
1.171 +/** Remote control target (service class) UUID */
1.172 +static const TInt KAVRemoteControlTargetUUID = 0x110c;
1.173 +/** Advanced audio distribution (A2DP) (profile descriptor) UUID */
1.174 +static const TInt KAdvancedAudioDistributionUUID = 0x110d;
1.175 +/** Remote control (service class) UUID */
1.176 +static const TInt KAVRemoteControlUUID = 0x110E;
1.177 +/** PBAP PSE Service Class UUID */
1.178 +static const TInt KPbapPseUUID = 0x112F;
1.179 +
1.180 +
1.181 +// Language codes, as per "ISO 639:1988 (E/F)"
1.182 +/** Afar */
1.183 +static const TInt16 KLanguageAfar = 0x6161; // aa
1.184 +/** Abkhazian */
1.185 +static const TInt16 KLanguageAbkhazian = 0x6162; // ab
1.186 +/** Afrikaans */
1.187 +static const TInt16 KLanguageAfrikaans = 0x6166; // af
1.188 +/** Amharic */
1.189 +static const TInt16 KLanguageAmharic = 0x616D; // am
1.190 +/** Arabic */
1.191 +static const TInt16 KLanguageArabic = 0x6172; // ar
1.192 +/** Assamese */
1.193 +static const TInt16 KLanguageAssamese = 0x6173; // as
1.194 +/** Aymara */
1.195 +static const TInt16 KLanguageAymara = 0x6179; // ay
1.196 +/** Azerbaijani */
1.197 +static const TInt16 KLanguageAzerbaijani = 0x617A; // az
1.198 +/** Bashkir */
1.199 +static const TInt16 KLanguageBashkir = 0x6261; // ba
1.200 +/** Byelorussian */
1.201 +static const TInt16 KLanguageByelorussian = 0x6265; // be
1.202 +/** Bulgarian */
1.203 +static const TInt16 KLanguageBulgarian = 0x6267; // bg
1.204 +/** Bihari */
1.205 +static const TInt16 KLanguageBihari = 0x6268; // bh
1.206 +/** Bislama */
1.207 +static const TInt16 KLanguageBislama = 0x6269; // bi
1.208 +/** Bengali */
1.209 +static const TInt16 KLanguageBengali = 0x626E; // bn - also Bangala
1.210 +/** Tibetan */
1.211 +static const TInt16 KLanguageTibetan = 0x626F; // bo
1.212 +/** Breton */
1.213 +static const TInt16 KLanguageBreton = 0x6272; // br
1.214 +/** Catalan */
1.215 +static const TInt16 KLanguageCatalan = 0x6361; // ca
1.216 +/** Corsican */
1.217 +static const TInt16 KLanguageCorsican = 0x636F; // co
1.218 +/** Czech */
1.219 +static const TInt16 KLanguageCzech = 0x6373; // cs
1.220 +/** Welsh */
1.221 +static const TInt16 KLanguageWelsh = 0x6379; // cy
1.222 +/** Danish */
1.223 +static const TInt16 KLanguageDanish = 0x6461; // da
1.224 +/** German */
1.225 +static const TInt16 KLanguageGerman = 0x6465; // de
1.226 +/** Bhutani */
1.227 +static const TInt16 KLanguageBhutani = 0x647A; // dz
1.228 +/** Greek */
1.229 +static const TInt16 KLanguageGreek = 0x656C; // el
1.230 +/** English */
1.231 +static const TInt16 KLanguageEnglish = 0x656E; // en
1.232 +/** Esperanto */
1.233 +static const TInt16 KLanguageEsperanto = 0x656F; // eo
1.234 +/** Spanish */
1.235 +static const TInt16 KLanguageSpanish = 0x6573; // es
1.236 +/** Estonian */
1.237 +static const TInt16 KLanguageEstonian = 0x6574; // et
1.238 +/** Basque */
1.239 +static const TInt16 KLanguageBasque = 0x6575; // eu
1.240 +/** Persian */
1.241 +static const TInt16 KLanguagePersian = 0x6661; // fa
1.242 +/** Finnish */
1.243 +static const TInt16 KLanguageFinnish = 0x6669; // fi
1.244 +/** Fiji */
1.245 +static const TInt16 KLanguageFiji = 0x666A; // fj
1.246 +/** Faroese */
1.247 +static const TInt16 KLanguageFaroese = 0x666F; // fo
1.248 +/** French */
1.249 +static const TInt16 KLanguageFrench = 0x6672; // fr
1.250 +/** Frisian */
1.251 +static const TInt16 KLanguageFrisian = 0x6679; // fy
1.252 +/** Irish */
1.253 +static const TInt16 KLanguageIrish = 0x6761; // ga
1.254 +/** Scots Gaelic */
1.255 +static const TInt16 KLanguageScotsGaelic = 0x6764; // gd
1.256 +/** Galician */
1.257 +static const TInt16 KLanguageGalician = 0x676C; // gl
1.258 +/** Guarani */
1.259 +static const TInt16 KLanguageGuarani = 0x676E; // gn
1.260 +/** Gujarati */
1.261 +static const TInt16 KLanguageGujarati = 0x6775; // gu
1.262 +/** Hausa */
1.263 +static const TInt16 KLanguageHausa = 0x6861; // ha
1.264 +/** Hebrew */
1.265 +static const TInt16 KLanguageHebrew = 0x6865; // he - formerly iw
1.266 +/** Hindi */
1.267 +static const TInt16 KLanguageHindi = 0x6869; // hi
1.268 +/** Croatian */
1.269 +static const TInt16 KLanguageCroatian = 0x6872; // hr
1.270 +/** Hungarian */
1.271 +static const TInt16 KLanguageHungarian = 0x6875; // hu
1.272 +/** Armenian */
1.273 +static const TInt16 KLanguageArmenian = 0x6879; // hy
1.274 +/** Interlingua */
1.275 +static const TInt16 KLanguageInterlingua = 0x6961; // ia
1.276 +/** Indonesian */
1.277 +static const TInt16 KLanguageIndonesian = 0x6964; // id - formerly in
1.278 +/** Interlingue */
1.279 +static const TInt16 KLanguageInterlingue = 0x6965; // ie
1.280 +/** Inupiak */
1.281 +static const TInt16 KLanguageInupiak = 0x696B; // ik
1.282 +/** Icelandic */
1.283 +static const TInt16 KLanguageIcelandic = 0x6973; // is
1.284 +/** Italian */
1.285 +static const TInt16 KLanguageItalian = 0x6974; // it
1.286 +/** Inuktitut */
1.287 +static const TInt16 KLanguageInuktitut = 0x6975; // iu
1.288 +/** Japanese */
1.289 +static const TInt16 KLanguageJapanese = 0x6A61; // ja
1.290 +/** Javanese */
1.291 +static const TInt16 KLanguageJavanese = 0x6A77; // jw
1.292 +/** Georgian */
1.293 +static const TInt16 KLanguageGeorgian = 0x6B61; // ka
1.294 +/** Kazakh */
1.295 +static const TInt16 KLanguageKazakh = 0x6B6B; // kk
1.296 +/** Greenlandic */
1.297 +static const TInt16 KLanguageGreenlandic = 0x6B6C; // kl
1.298 +/** Cambodian */
1.299 +static const TInt16 KLanguageCambodian = 0x6B6D; // km
1.300 +/** Kannada */
1.301 +static const TInt16 KLanguageKannada = 0x6B6E; // kn
1.302 +/** Korean */
1.303 +static const TInt16 KLanguageKorean = 0x6B6F; // ko
1.304 +/** Kashmiri */
1.305 +static const TInt16 KLanguageKashmiri = 0x6B73; // ks
1.306 +/** Kurdish */
1.307 +static const TInt16 KLanguageKurdish = 0x6B75; // ku
1.308 +/** Kirghiz */
1.309 +static const TInt16 KLanguageKirghiz = 0x6B79; // ky
1.310 +/** Latin */
1.311 +static const TInt16 KLanguageLatin = 0x6C61; // la
1.312 +/** Lingala */
1.313 +static const TInt16 KLanguageLingala = 0x6C6E; // ln
1.314 +/** Laothian */
1.315 +static const TInt16 KLanguageLaothian = 0x6C6F; // lo
1.316 +/** Lithuanian */
1.317 +static const TInt16 KLanguageLithuanian = 0x6C74; // lt
1.318 +/** Latvian */
1.319 +static const TInt16 KLanguageLatvian = 0x6C76; // lv - also Lettish
1.320 +/** Malagasy */
1.321 +static const TInt16 KLanguageMalagasy = 0x6D67; // mg
1.322 +/** Maori */
1.323 +static const TInt16 KLanguageMaori = 0x6D69; // mi
1.324 +/** Macedonian */
1.325 +static const TInt16 KLanguageMacedonian = 0x6D6B; // mk
1.326 +/** Malayalam */
1.327 +static const TInt16 KLanguageMalayalam = 0x6D6C; // ml
1.328 +/** Mongolian */
1.329 +static const TInt16 KLanguageMongolian = 0x6D6E; // mn
1.330 +/** Moldavian */
1.331 +static const TInt16 KLanguageMoldavian = 0x6D6F; // mo
1.332 +/** Marathi */
1.333 +static const TInt16 KLanguageMarathi = 0x6D72; // mr
1.334 +/** Malay */
1.335 +static const TInt16 KLanguageMalay = 0x6D73; // ms
1.336 +/** Maltese */
1.337 +static const TInt16 KLanguageMaltese = 0x6D74; // mt
1.338 +/** Burmese */
1.339 +static const TInt16 KLanguageBurmese = 0x6D79; // my
1.340 +/** Nauru */
1.341 +static const TInt16 KLanguageNauru = 0x6E61; // na
1.342 +/** Nepali */
1.343 +static const TInt16 KLanguageNepali = 0x6E65; // ne
1.344 +/** Dutch */
1.345 +static const TInt16 KLanguageDutch = 0x6E6C; // nl
1.346 +/** Norwegian */
1.347 +static const TInt16 KLanguageNorwegian = 0x6E6F; // no
1.348 +/** Occitan */
1.349 +static const TInt16 KLanguageOccitan = 0x6F63; // oc
1.350 +/** Oromo */
1.351 +static const TInt16 KLanguageOromo = 0x6F6D; // om - (Afan)
1.352 +/** Oriya */
1.353 +static const TInt16 KLanguageOriya = 0x6F72; // or
1.354 +/** Punjabi */
1.355 +static const TInt16 KLanguagePunjabi = 0x7061; // pa
1.356 +/** Polish */
1.357 +static const TInt16 KLanguagePolish = 0x706C; // pl
1.358 +/** Pashto */
1.359 +static const TInt16 KLanguagePashto = 0x7073; // ps
1.360 +/** Portuguese */
1.361 +static const TInt16 KLanguagePortuguese = 0x7074; // pt
1.362 +/** Quechua */
1.363 +static const TInt16 KLanguageQuechua = 0x7175; // qu
1.364 +/** Rhaeto Romance */
1.365 +static const TInt16 KLanguageRhaetoRomance = 0x726D; // rm
1.366 +/** Kirundi */
1.367 +static const TInt16 KLanguageKirundi = 0x726E; // rn
1.368 +/** Romanian */
1.369 +static const TInt16 KLanguageRomanian = 0x726F; // ro
1.370 +/** Russian */
1.371 +static const TInt16 KLanguageRussian = 0x7275; // ru
1.372 +/** Kinyarwanda */
1.373 +static const TInt16 KLanguageKinyarwanda = 0x7277; // rw
1.374 +/** Sanskrit */
1.375 +static const TInt16 KLanguageSanskrit = 0x7361; // sa
1.376 +/** Sindhi */
1.377 +static const TInt16 KLanguageSindhi = 0x7364; // sd
1.378 +/** Sangho */
1.379 +static const TInt16 KLanguageSangho = 0x7367; // sg
1.380 +/** SerboCroatian */
1.381 +static const TInt16 KLanguageSerboCroatian = 0x7368; // sh
1.382 +/** Sinhalese */
1.383 +static const TInt16 KLanguageSinhalese = 0x7369; // si
1.384 +/** Slovak */
1.385 +static const TInt16 KLanguageSlovak = 0x736B; // sk
1.386 +/** Slovenian */
1.387 +static const TInt16 KLanguageSlovenian = 0x736C; // sl
1.388 +/** Samoan */
1.389 +static const TInt16 KLanguageSamoan = 0x736D; // sm
1.390 +/** Shona */
1.391 +static const TInt16 KLanguageShona = 0x736E; // sn
1.392 +/** Somali */
1.393 +static const TInt16 KLanguageSomali = 0x736F; // so
1.394 +/** Albanian */
1.395 +static const TInt16 KLanguageAlbanian = 0x7371; // sq
1.396 +/** Serbian */
1.397 +static const TInt16 KLanguageSerbian = 0x7372; // sr
1.398 +/** Siswati */
1.399 +static const TInt16 KLanguageSiswati = 0x7373; // ss
1.400 +/** Sesotho */
1.401 +static const TInt16 KLanguageSesotho = 0x7374; // st
1.402 +/** Sundanese */
1.403 +static const TInt16 KLanguageSundanese = 0x7375; // su
1.404 +/** Swedish */
1.405 +static const TInt16 KLanguageSwedish = 0x7376; // sv
1.406 +/** Swahili */
1.407 +static const TInt16 KLanguageSwahili = 0x7377; // sw
1.408 +/** Tamil */
1.409 +static const TInt16 KLanguageTamil = 0x7461; // ta
1.410 +/** Telugu */
1.411 +static const TInt16 KLanguageTelugu = 0x7465; // te
1.412 +/** Tajik */
1.413 +static const TInt16 KLanguageTajik = 0x7467; // tg
1.414 +/** Thai */
1.415 +static const TInt16 KLanguageThai = 0x7468; // th
1.416 +/** Tigrinya */
1.417 +static const TInt16 KLanguageTigrinya = 0x7469; // ti
1.418 +/** Turkmen */
1.419 +static const TInt16 KLanguageTurkmen = 0x746B; // tk
1.420 +/** Tagalog */
1.421 +static const TInt16 KLanguageTagalog = 0x746C; // tl
1.422 +/** Setswana */
1.423 +static const TInt16 KLanguageSetswana = 0x746E; // tn
1.424 +/** Tonga */
1.425 +static const TInt16 KLanguageTonga = 0x746F; // to
1.426 +/** Turkish */
1.427 +static const TInt16 KLanguageTurkish = 0x7472; // tr
1.428 +/** Tsonga */
1.429 +static const TInt16 KLanguageTsonga = 0x7473; // ts
1.430 +/** Tatar */
1.431 +static const TInt16 KLanguageTatar = 0x7474; // tt
1.432 +/** Twi */
1.433 +static const TInt16 KLanguageTwi = 0x7477; // tw
1.434 +/** Uighur */
1.435 +static const TInt16 KLanguageUighur = 0x7567; // ug
1.436 +/** Ukrainian */
1.437 +static const TInt16 KLanguageUkrainian = 0x756B; // uk
1.438 +/** Urdu */
1.439 +static const TInt16 KLanguageUrdu = 0x7572; // ur
1.440 +/** Uzbek */
1.441 +static const TInt16 KLanguageUzbek = 0x757A; // uz
1.442 +/** Vietnamese */
1.443 +static const TInt16 KLanguageVietnamese = 0x7669; // vi
1.444 +/** Volapuk */
1.445 +static const TInt16 KLanguageVolapuk = 0x766F; // vo
1.446 +/** Wolof */
1.447 +static const TInt16 KLanguageWolof = 0x776F; // wo
1.448 +/** Xhosa */
1.449 +static const TInt16 KLanguageXhosa = 0x7868; // xh
1.450 +/** Yiddish */
1.451 +static const TInt16 KLanguageYiddish = 0x7969; // yi - formerly ji
1.452 +/** Yoruba */
1.453 +static const TInt16 KLanguageYoruba = 0x796F; // yo
1.454 +/** Zhuang */
1.455 +static const TInt16 KLanguageZhuang = 0x7A61; // za
1.456 +/** Chinese */
1.457 +static const TInt16 KLanguageChinese = 0x7A68; // zh
1.458 +/** Zulu */
1.459 +static const TInt16 KLanguageZulu = 0x7A75; // zu
1.460 +
1.461 +//***********************************************************************/
1.462 +//
1.463 +// SDP database server API
1.464 +//
1.465 +//***********************************************************************/
1.466 +
1.467 +/** Typedef for a TSdpAttributeID package buf */
1.468 +typedef TPckgBuf<TSdpAttributeID> TSdpAttributeIDPckgBuf;
1.469 +/** Handle to a service record. */
1.470 +typedef TUint32 TSdpServRecordHandle;
1.471 +/** Typedef for a TSdpServRecordHandle package buf */
1.472 +typedef TPckgBuf<TSdpServRecordHandle> TSdpServRecordHandlePckgBuf;
1.473 +
1.474 +NONSHARABLE_CLASS(RSdp) : public RSessionBase
1.475 +/** Provides a session to the Service Discovery Database.
1.476 +
1.477 +Used to create subsessions to database functionality. A clients must create
1.478 +and connect a session, before using a RSdpDatabase subsession to access the
1.479 +database.
1.480 +
1.481 +@see RSdpDatabase */
1.482 + {
1.483 +public:
1.484 + IMPORT_C RSdp();
1.485 + IMPORT_C TInt Connect();
1.486 + IMPORT_C TVersion Version() const;
1.487 + IMPORT_C void ResourceCountMarkStart();
1.488 + IMPORT_C void ResourceCountMarkEnd();
1.489 + IMPORT_C TInt ResourceCount();
1.490 + IMPORT_C TInt __DbgMarkHeap();
1.491 + IMPORT_C TInt __DbgCheckHeap(TInt aCount);
1.492 + IMPORT_C TInt __DbgMarkEnd(TInt aCount);
1.493 + IMPORT_C TInt __DbgFailNext(TInt aCount);
1.494 +
1.495 +private:
1.496 + // This data padding has been added to help prevent future binary compatibility breaks
1.497 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.498 + TUint32 iPadding1;
1.499 + TUint32 iPadding2;
1.500 + };
1.501 +
1.502 +NONSHARABLE_CLASS(RSdpSubSession) : public RSubSessionBase
1.503 +/** Base class used in the derivation of RSdpDatabase.
1.504 +
1.505 +The class contains basic subssession functionality. It has no user accessible
1.506 +functions. */
1.507 + {
1.508 +public:
1.509 + /** Opens subsession on an RSdp session
1.510 + @param aSession The session on which the subsession is being opened.
1.511 + */
1.512 + IMPORT_C virtual TInt Open(RSdp& aSession)=0;
1.513 + /** Closes subsession */
1.514 + IMPORT_C virtual void Close()=0;
1.515 +
1.516 +private:
1.517 + // This data padding has been added to help prevent future binary compatibility breaks
1.518 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.519 + TUint32 iPadding1;
1.520 + TUint32 iPadding2;
1.521 + };
1.522 +
1.523 +
1.524 +
1.525 +class CSdpAttrValueDES;
1.526 +class CSdpAttrValue;
1.527 +
1.528 +NONSHARABLE_CLASS(RSdpDatabase) : public RSdpSubSession
1.529 +/** Subsession to the SDP through which service records and their attributes can
1.530 +be added, deleted, and updated. */
1.531 + {
1.532 +public:
1.533 + IMPORT_C RSdpDatabase();
1.534 + IMPORT_C TInt Open(RSdp& aSession);
1.535 + IMPORT_C void Close();
1.536 + IMPORT_C void CreateServiceRecordL(const TUUID& aUUID, TSdpServRecordHandle& aHandle);
1.537 + IMPORT_C void CreateServiceRecordL(CSdpAttrValueDES& aUUIDList, TSdpServRecordHandle& aHandle);
1.538 + IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue& aAttrValue);
1.539 + IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, TUint aUintValue);
1.540 + IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, const TDesC16& aDesCValue);
1.541 + IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, const TDesC8& aDesCValue);
1.542 + IMPORT_C void DeleteAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID);
1.543 + IMPORT_C void DeleteAttribute(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID);
1.544 + IMPORT_C void DeleteRecordL(TSdpServRecordHandle aHandle);
1.545 + IMPORT_C void DeleteRecord(TSdpServRecordHandle aHandle);
1.546 +private:
1.547 + HBufC8* iBuffer; //used for synchronous requests (could have been local)
1.548 +
1.549 + // This data padding has been added to help prevent future binary compatibility breaks
1.550 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.551 + TUint32 iPadding1;
1.552 + TUint32 iPadding2;
1.553 + };
1.554 +
1.555 +
1.556 +class MSdpElementBuilder
1.557 +/** Constructs an attribute value, or a set of attributes, from multiple data elements.
1.558 +
1.559 +The builder interface is used for building single attribute values, and sets of attribute
1.560 +value, attribute ID pairs, as for example in a service record.
1.561 +
1.562 +In particular, the builder interface can be implemented to receive the results from
1.563 +CSdpAgent attribute queries.
1.564 +
1.565 +Each member function itself returns an MSdpElementBuilder interface that can
1.566 +then be used to add further elements.
1.567 +
1.568 +For more on the format of attribute values, see [BS1 Service Discovery Protocol
1.569 +3].
1.570 +
1.571 +Note that the interface defines each function to leave with the error KErrGeneral.
1.572 +
1.573 +@see CSdpAgent::AttributeRequestL() */
1.574 + {
1.575 +public:
1.576 + IMPORT_C virtual MSdpElementBuilder* BuildUnknownL(TUint8 aType, TUint8 aSizeDesc, const TDesC8& aData);
1.577 + IMPORT_C virtual MSdpElementBuilder* BuildNilL();
1.578 + IMPORT_C virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint);
1.579 + IMPORT_C virtual MSdpElementBuilder* BuildIntL(const TDesC8& aInt);
1.580 + IMPORT_C virtual MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
1.581 + IMPORT_C virtual MSdpElementBuilder* BuildBooleanL(TBool aBool);
1.582 + IMPORT_C virtual MSdpElementBuilder* BuildStringL(const TDesC8& aString);
1.583 + IMPORT_C virtual MSdpElementBuilder* BuildDESL(); // Must not return NULL
1.584 + IMPORT_C virtual MSdpElementBuilder* BuildDEAL(); // ditto
1.585 + IMPORT_C virtual MSdpElementBuilder* StartListL(); // ditto
1.586 + IMPORT_C virtual MSdpElementBuilder* EndListL();
1.587 + IMPORT_C virtual MSdpElementBuilder* BuildURLL(const TDesC8& aURL);
1.588 +
1.589 + /**
1.590 + Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
1.591 + @param aInterface UID of the interface to return
1.592 + @param aObject the container for another interface as specified by aInterface
1.593 + */
1.594 + IMPORT_C void MSEB_ExtensionInterfaceL(TUid aInterface, void*& aObject);
1.595 + };
1.596 +
1.597 +/** Types of attribute data elements. */
1.598 +enum TSdpElementType
1.599 + {
1.600 + /** Null type. */
1.601 + ETypeNil = 0,
1.602 + /** Unsigned integer. */
1.603 + ETypeUint = 1,
1.604 + /** Signed integer. */
1.605 + ETypeInt = 2,
1.606 + /** UUID. */
1.607 + ETypeUUID = 3,
1.608 + /** Text string. */
1.609 + ETypeString = 4,
1.610 + /** Boolean. */
1.611 + ETypeBoolean = 5,
1.612 + /** Data element sequence. */
1.613 + ETypeDES = 6,
1.614 + /** Data element alternative. */
1.615 + ETypeDEA = 7,
1.616 + /** URL. */
1.617 + ETypeURL = 8,
1.618 + /** Outside SDP reserved range. */
1.619 + ETypeEncoded = 32, // Outside SDP reserved range
1.620 + };
1.621 +
1.622 +class MSdpAttributeValueVisitor;
1.623 +
1.624 +NONSHARABLE_CLASS(CSdpAttrValue) : public CBase
1.625 +/** Base class for classes that encapsulate SDP attributes values.
1.626 +
1.627 +Sub-classes of this wrap specific types of SDP service record attributes.
1.628 +For example, CSdpBoolean derives from CSdpAttrValue to encapsulate boolean
1.629 +attributes. The base class defines getters for all types: for example, it
1.630 +declares a function Bool() that returns the attribute value as a TBool. Note
1.631 +though that the function would panic unless called on actual CSdpBoolean.
1.632 +
1.633 +A common base class allows attributes of all types to be used polymorphically.
1.634 +You can use CSdpAttrValue's Type() function to find the actual type being
1.635 +used, and upcast the pointer appropriately. */
1.636 + {
1.637 +public:
1.638 + CSdpAttrValue();
1.639 + virtual ~CSdpAttrValue();
1.640 +
1.641 +
1.642 + /** Gets the attribute type.
1.643 +
1.644 + @return Attribute type */
1.645 + virtual TSdpElementType Type() const=0;
1.646 +
1.647 +
1.648 + /** Gets the size of the attribute.
1.649 +
1.650 + @return Size of the attribute in bytes */
1.651 + virtual TUint DataSize() const=0;
1.652 +
1.653 +
1.654 + // getter interface
1.655 + virtual TUint Uint() const;
1.656 + virtual TInt Int() const;
1.657 + virtual TBool DoesIntFit() const;
1.658 + virtual TInt Bool() const;
1.659 + virtual const TUUID &UUID() const;
1.660 + virtual const TPtrC8 Des() const;
1.661 +
1.662 + virtual void AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor);
1.663 +
1.664 + IMPORT_C void Uint64(TUint64& aValue) const;
1.665 + IMPORT_C void Uint128(TUint64& aLo, TUint64& aHi) const;
1.666 +
1.667 +protected:
1.668 + TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);
1.669 + };
1.670 +
1.671 +/** Base class for classes that specify lists of attribute data elements.
1.672 +
1.673 +It implements the MSdpElementBuilder interface to build data elements into
1.674 +an attribute value.
1.675 +
1.676 +@see CSdpAttrValueDEA
1.677 +@see CSdpAttrValueDES */
1.678 +NONSHARABLE_CLASS(CSdpAttrValueList) : public CSdpAttrValue, public MSdpElementBuilder
1.679 + {
1.680 +public:
1.681 + IMPORT_C virtual ~CSdpAttrValueList();
1.682 + IMPORT_C virtual void AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor);
1.683 + IMPORT_C virtual TUint DataSize() const;
1.684 + IMPORT_C void AppendValueL(CSdpAttrValue* aValue);
1.685 +
1.686 + // MSdpElementBuilder interface
1.687 + /** Adds an element of any type.
1.688 +
1.689 + @param aType Type descriptor
1.690 + @param aSizeDesc Size descriptor
1.691 + @param aData Data field
1.692 + @return Attribute value with added element */
1.693 + IMPORT_C virtual MSdpElementBuilder* BuildUnknownL(TUint8 aType, TUint8 aSizeDesc, const TDesC8& aData);
1.694 + IMPORT_C virtual MSdpElementBuilder* BuildNilL();
1.695 + IMPORT_C virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint);
1.696 + IMPORT_C virtual MSdpElementBuilder* BuildIntL(const TDesC8& aInt);
1.697 + IMPORT_C virtual MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
1.698 + IMPORT_C virtual MSdpElementBuilder* BuildBooleanL(TBool aBool);
1.699 + IMPORT_C virtual MSdpElementBuilder* BuildStringL(const TDesC8& aString);
1.700 + IMPORT_C virtual MSdpElementBuilder* BuildDESL();
1.701 + IMPORT_C virtual MSdpElementBuilder* BuildDEAL();
1.702 + IMPORT_C virtual MSdpElementBuilder* StartListL();
1.703 + IMPORT_C virtual MSdpElementBuilder* EndListL();
1.704 + IMPORT_C virtual MSdpElementBuilder* BuildURLL(const TDesC8& aString);
1.705 + IMPORT_C virtual MSdpElementBuilder* BuildEncodedL(const TDesC8& aString);
1.706 +
1.707 +protected:
1.708 + CSdpAttrValueList(MSdpElementBuilder *aBuilder);
1.709 + void ConstructL();
1.710 +
1.711 +protected:
1.712 + /** Array of attribute values contained in this CSdpAttrValueList class*/
1.713 + CArrayPtr<CSdpAttrValue> *iList;
1.714 +
1.715 +private:
1.716 + MSdpElementBuilder *iParent;
1.717 + };
1.718 +
1.719 +
1.720 +NONSHARABLE_CLASS(CSdpAttrValueNil) : public CSdpAttrValue
1.721 +/** A null type data attribute. */
1.722 + {
1.723 +public:
1.724 + IMPORT_C static CSdpAttrValueNil *NewNilL();
1.725 + virtual ~CSdpAttrValueNil();
1.726 + virtual TSdpElementType Type() const;
1.727 + virtual TUint DataSize() const;
1.728 +
1.729 +private:
1.730 + CSdpAttrValueNil();
1.731 + };
1.732 +
1.733 +/** Max size for an SDP Uint attribute value in bytes */
1.734 +static const TInt KSdpMaxUintSize = 16;
1.735 +
1.736 +NONSHARABLE_CLASS(CSdpAttrValueUint) : public CSdpAttrValue
1.737 +/** A unsigned integer value of an attribute.
1.738 +
1.739 +The value can be up to 128 bits in size. You need to choose to use either Uint() for up to 32 bit size,
1.740 +Uint64() for up to 64 bit size or Uint128() for up to 128 bit size. The size can be found using DataSize().
1.741 +If the incorrect function is used the code will panic.
1.742 +*/
1.743 + {
1.744 +public:
1.745 + IMPORT_C static CSdpAttrValueUint* NewUintL(const TDesC8 &aUint);
1.746 + virtual ~CSdpAttrValueUint();
1.747 +
1.748 + IMPORT_C void SetUintValue(const TDesC8& aValue);
1.749 + virtual TSdpElementType Type() const;
1.750 + virtual TUint DataSize() const;
1.751 + TUint Uint() const;
1.752 + virtual TBool DoesIntFit() const;
1.753 + virtual const TPtrC8 Des() const;
1.754 +
1.755 +private:
1.756 + TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);
1.757 + CSdpAttrValueUint(const TDesC8 & aUint);
1.758 +
1.759 +private:
1.760 + TBuf8<KSdpMaxUintSize> iUint;
1.761 + };
1.762 +
1.763 +/**
1.764 +Max size for an SDP Int attribute value in bytes
1.765 +The new value is KSdpMaxIntSize
1.766 +@deprecated
1.767 +*/
1.768 +static const TInt KMaxIntSize = 16;
1.769 +
1.770 +/**
1.771 +Max size for an SDP Int attribute value in bytes
1.772 +*/
1.773 +static const TInt KSdpMaxIntSize = 16;
1.774 +
1.775 +NONSHARABLE_CLASS(CSdpAttrValueInt) : public CSdpAttrValue
1.776 +/** A signed integer value of an attribute.
1.777 +
1.778 +The value can be up to 128 bits in size. */
1.779 + {
1.780 +public:
1.781 + IMPORT_C static CSdpAttrValueInt* NewIntL(const TDesC8 &aInt);
1.782 + virtual ~CSdpAttrValueInt();
1.783 + virtual TSdpElementType Type() const;
1.784 + virtual TUint DataSize() const;
1.785 + virtual TInt Int() const;
1.786 + virtual TBool DoesIntFit() const;
1.787 + virtual const TPtrC8 Des() const;
1.788 +
1.789 +private:
1.790 + CSdpAttrValueInt(const TDesC8 & aInt);
1.791 +
1.792 +private:
1.793 + TBuf8<KSdpMaxIntSize> iInt;
1.794 + };
1.795 +
1.796 +
1.797 +NONSHARABLE_CLASS(CSdpAttrValueUUID) : public CSdpAttrValue
1.798 +/** A UUID value of an attribute.
1.799 +
1.800 +The value can be up to 128 bits in size. */
1.801 + {
1.802 +public:
1.803 + IMPORT_C static CSdpAttrValueUUID* NewUUIDL(const TUUID& aUUID);
1.804 + virtual ~CSdpAttrValueUUID();
1.805 + virtual TSdpElementType Type() const;
1.806 + virtual TUint DataSize() const;
1.807 + // getters
1.808 + virtual const TUUID &UUID() const;
1.809 + virtual const TPtrC8 Des() const;
1.810 +
1.811 +private:
1.812 + CSdpAttrValueUUID(const TUUID& aUUID);
1.813 +
1.814 +private:
1.815 + TUUID iUUID;
1.816 + };
1.817 +
1.818 +NONSHARABLE_CLASS(CSdpAttrValueString) : public CSdpAttrValue
1.819 +/** A Text String value of an attribute.
1.820 +
1.821 +The encoding of the string is up to the user. The interpretation of the encoding
1.822 +is enabled using facilities in SDP. */
1.823 + {
1.824 +public:
1.825 + IMPORT_C static CSdpAttrValueString* NewStringL(const TDesC8& aString);
1.826 + virtual ~CSdpAttrValueString();
1.827 + virtual TSdpElementType Type() const;
1.828 + virtual TUint DataSize() const;
1.829 + virtual const TPtrC8 Des() const;
1.830 +
1.831 +private:
1.832 + CSdpAttrValueString();
1.833 + void ConstructL(const TDesC8& aString);
1.834 +
1.835 +private:
1.836 + HBufC8 *iBuffer;
1.837 + };
1.838 +
1.839 +NONSHARABLE_CLASS(CSdpAttrValueBoolean) : public CSdpAttrValue
1.840 +/** A Boolean value of an attribute. */
1.841 + {
1.842 +public:
1.843 + IMPORT_C static CSdpAttrValueBoolean *NewBoolL(TBool aBool);
1.844 + virtual ~CSdpAttrValueBoolean();
1.845 + virtual TSdpElementType Type() const;
1.846 + virtual TUint DataSize() const;
1.847 + virtual TBool Bool() const;
1.848 +
1.849 +private:
1.850 + CSdpAttrValueBoolean(TBool aBool);
1.851 +
1.852 +private:
1.853 + TBool iBool;
1.854 + };
1.855 +
1.856 +NONSHARABLE_CLASS(CSdpAttrValueDES) : public CSdpAttrValueList
1.857 +/** A Data element sequence (DES) value of an attribute.
1.858 +
1.859 +A DES can contain other values within it, including other sequences. This
1.860 +enables arbitrary tree structures to be created.
1.861 +
1.862 +Most of the functionality is supplied by the base class CSdpAttrValueList. */
1.863 + {
1.864 +public:
1.865 + IMPORT_C static CSdpAttrValueDES* NewDESL(MSdpElementBuilder* aBuilder);
1.866 + virtual TSdpElementType Type() const;
1.867 +
1.868 +private:
1.869 + CSdpAttrValueDES(MSdpElementBuilder *aBuilder);
1.870 + };
1.871 +
1.872 +NONSHARABLE_CLASS(CSdpAttrValueDEA) : public CSdpAttrValueList
1.873 +/** A Data element alternative (DEA) value of an attribute: this is an attribute
1.874 +whose value is a sequence of data elements from which one data element is
1.875 +to be selected
1.876 +
1.877 +Most of the functionality is supplied by the base class CSdpAttrValueList. */
1.878 + {
1.879 +public:
1.880 + IMPORT_C static CSdpAttrValueDEA* NewDEAL(MSdpElementBuilder* aBuilder);
1.881 + virtual TSdpElementType Type() const;
1.882 +
1.883 +private:
1.884 + CSdpAttrValueDEA(MSdpElementBuilder *aBuilder);
1.885 + };
1.886 +
1.887 +NONSHARABLE_CLASS(CSdpAttrValueURL) : public CSdpAttrValue
1.888 +/** A URL value of an attribute. */
1.889 + {
1.890 +public:
1.891 + IMPORT_C static CSdpAttrValueURL* NewURLL(const TDesC8& aString);
1.892 + virtual ~CSdpAttrValueURL();
1.893 + virtual TSdpElementType Type() const;
1.894 + virtual const TPtrC8 Des() const;
1.895 + virtual TUint DataSize() const;
1.896 +
1.897 +private:
1.898 + CSdpAttrValueURL();
1.899 + void ConstructL(const TDesC8& aString);
1.900 +
1.901 +private:
1.902 + HBufC8 *iBuffer;
1.903 + };
1.904 +
1.905 +class MSdpAttributeValueVisitor
1.906 +/** Abstract interface that can be implemented to receive an enumeration of the
1.907 +values in an attribute list.
1.908 +
1.909 +The class member functions are called by an CSdpAttrValue (or one of its sub-classes)
1.910 +object when CSdpAttrValue::AcceptVisitorL() is called.
1.911 +
1.912 +Note that:
1.913 +
1.914 +When AcceptVisitorL() is called on attributes that are not lists (not DEA
1.915 +or DES), only VisitAttributeValueL() is called, passing the attribute value
1.916 +object itself (i.e. *this), and the value attribute type.
1.917 +
1.918 +When AcceptVisitorL() is called on attributes that are lists (DEA or DES),
1.919 +VisitAttributeValueL() is called for each member of the list
1.920 +
1.921 +This implements the standard Visitor pattern.
1.922 +
1.923 +@see CSdpAttrValue::AcceptVisitorL() */
1.924 + {
1.925 +public:
1.926 + /** Called to pass an attribute value.
1.927 +
1.928 + @param aValue Attribute value
1.929 + @param aType Value type */
1.930 + virtual void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType)=0;
1.931 +
1.932 +
1.933 + /** Called to indicate the start of a list of attribute values.
1.934 +
1.935 + This call is followed by a call to VisitAttributeValueL() for each attribute
1.936 + value in the list, and concluded by a call to EndList().
1.937 +
1.938 + @param aList Attribute value list */
1.939 + virtual void StartListL(CSdpAttrValueList &aList)=0;
1.940 +
1.941 +
1.942 + /** Called to indicate the end of a list of attribute values. */
1.943 + virtual void EndListL()=0;
1.944 +
1.945 + /**
1.946 + Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
1.947 + @param aInterface UID of the interface to return
1.948 + @param aObject the container for another interface as specified by aInterface
1.949 + */
1.950 + IMPORT_C virtual void MSAVV_ExtensionInterfaceL(TUid aInterface, void*& aObject);
1.951 + };
1.952 +
1.953 +class SdpUtil
1.954 +/**Integer Putter/Getter Utility Class
1.955 +
1.956 +Utility class for putting integer values into/getting integer values out of descriptors */
1.957 + {
1.958 +public:
1.959 + IMPORT_C static TUint GetUint(const TDesC8& aData);
1.960 + IMPORT_C static void PutUint(TUint8* aPtr, TInt64 aInt, TInt aNumberOfBytes);
1.961 + IMPORT_C static void PutUint64(TUint8* aPtr, const TUint64& aNumber);
1.962 + IMPORT_C static void GetUint64(const TDesC8& aData, TUint64& aNumber);
1.963 + IMPORT_C static void PutUint128(TUint8* aPtr, const TUint64& aLo, const TUint64& aHi);
1.964 + IMPORT_C static void GetUint128(const TDesC8& aData, TUint64& aLo, TUint64& aHi);
1.965 + };
1.966 +
1.967 +/**Integer to Descriptor Convertor
1.968 +
1.969 +Utility class to convert EPOC integers into TDesC8's, in the correct
1.970 +format for passing to the BuildIntL and BuildUintL members in SDP.
1.971 +This is effectively a Big-endian variant of TPckgBuf.
1.972 +*/
1.973 +
1.974 +
1.975 +template<class T>
1.976 +class TSdpIntBuf : public TBufC8<sizeof(T)>
1.977 + {
1.978 +public:
1.979 + inline TSdpIntBuf(const T& aRef);
1.980 + };
1.981 +
1.982 +/**Speciality of Integer to Descriptor Convertor for TUint64s*/
1.983 +TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint64> :public TBufC8<sizeof(TUint64)>
1.984 + {
1.985 +public:
1.986 + IMPORT_C TSdpIntBuf(const TUint64& aRef);
1.987 + };
1.988 +
1.989 +/**Speciality of Integer to Descriptor Convertor for TUint32s*/
1.990 +TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint32> : public TSdpIntBuf<TUint>
1.991 + {
1.992 +public:
1.993 + IMPORT_C TSdpIntBuf(const TUint32& aRef);
1.994 + };
1.995 +
1.996 +/**Speciality of Integer to Descriptor Convertor for TUint16s*/
1.997 +TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint16> : public TSdpIntBuf<TUint>
1.998 + {
1.999 +public:
1.1000 + IMPORT_C TSdpIntBuf(const TUint16& aRef);
1.1001 + };
1.1002 +
1.1003 +/**Speciality of Integer to Descriptor Convertor for TUint8s*/
1.1004 +TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint8> : public TSdpIntBuf<TUint>
1.1005 + {
1.1006 +public:
1.1007 + IMPORT_C TSdpIntBuf(const TUint8& aRef);
1.1008 + };
1.1009 +
1.1010 +
1.1011 +
1.1012 +// This function has to be inline and not exported since otherwise
1.1013 +// the replacement of T for the class provided doesn't work.
1.1014 +template <class T>
1.1015 +inline TSdpIntBuf<T>::TSdpIntBuf(const T &aRef)
1.1016 + {
1.1017 + TBufC8<sizeof(T)>::DoSetLength(sizeof(T));
1.1018 + SdpUtil::PutUint(TBufC8<sizeof(T)>::iBuf, TInt64(aRef), sizeof(T));
1.1019 + }
1.1020 +
1.1021 +//*************************************************************
1.1022 +//
1.1023 +// SDP Agent client API
1.1024 +//
1.1025 +//*************************************************************
1.1026 +
1.1027 +class MSdpAgentNotifier
1.1028 +/** Handles responses to Bluetooth Service Discovery Protocol queries.
1.1029 +
1.1030 +Clients that make queries through CSdpAgent must implement this interface
1.1031 +to handle the responses.
1.1032 +
1.1033 +@see CSdpAgent::AttributeRequestL() */
1.1034 + {
1.1035 +public:
1.1036 + /** Called when an service record request (CSdpAgent::NextRecordRequestComplete())
1.1037 + operation completes.
1.1038 +
1.1039 + @param aError KErrNone if successful;
1.1040 + KErrEof if there are no more SDP records left to be read; or an SDP error.
1.1041 + @param aHandle Service record for which the query was made
1.1042 + @param aTotalRecordsCount Total number of matching records
1.1043 + @see CSdpAgent::NextRecordRequestL() */
1.1044 + virtual void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount)=0;
1.1045 +
1.1046 + /** Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to
1.1047 + pass up a result.
1.1048 +
1.1049 + @param aHandle Service record for which the query was made
1.1050 + @param aAttrID ID of the attribute obtained
1.1051 + @param aAttrValue Attribute value obtained
1.1052 + @see CSdpAgent::AttributeRequestL() */
1.1053 + virtual void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue)=0;
1.1054 +
1.1055 + /** Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to
1.1056 + signal the completion of a attribute request.
1.1057 +
1.1058 + @param aHandle Service record for which the query was made
1.1059 + @param aError an error
1.1060 + @see CSdpAgent::AttributeRequestL() */
1.1061 + virtual void AttributeRequestComplete(TSdpServRecordHandle, TInt aError)=0;
1.1062 +
1.1063 + /**
1.1064 + Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
1.1065 + @param aInterface UID of the interface to return
1.1066 + @param aObject the container for another interface as specified by aInterface
1.1067 + */
1.1068 + IMPORT_C virtual void MSAN_ExtensionInterfaceL(TUid aInterface, void*& aObject);
1.1069 + };
1.1070 +
1.1071 +class CSdpAgentEng;
1.1072 +class CSdpSearchPattern;
1.1073 +class CSdpAttrIdMatchList;
1.1074 +
1.1075 +NONSHARABLE_CLASS(CSdpAgent) : public CBase
1.1076 +/** Makes Bluetooth service discovery protocol (SDP) requests to a remote device.
1.1077 +
1.1078 +To make SDP requests,
1.1079 +
1.1080 +Construct a CSdpAgent object with the Bluetooth address of the remote device
1.1081 +to query.
1.1082 +
1.1083 +Set the classes of service that you want to query for. The classes have predefined
1.1084 +UUIDs, which you specify with SetRecordFilterL().
1.1085 +
1.1086 +Get results through NextRecordRequestL(). Information on services is stored
1.1087 +as records, which can be queried in turn for attribute values for the service
1.1088 +through AttributeRequestL().
1.1089 +
1.1090 +A user of this class must implement MSdpAgentNotifier to receive the responses
1.1091 +to queries.
1.1092 +
1.1093 +Note that queries are asynchronous, although this is hidden in the API. The
1.1094 +implication is that the interface functions that receive responses are only
1.1095 +called when the thread's active scheduler can schedule handling of the completion
1.1096 +of the query.
1.1097 +
1.1098 +@see MSdpAgentNotifier */
1.1099 + {
1.1100 +public:
1.1101 + IMPORT_C static CSdpAgent* NewL(MSdpAgentNotifier& aNotifier, const TBTDevAddr& aDevAddr);
1.1102 + IMPORT_C static CSdpAgent* NewLC(MSdpAgentNotifier& aNotifier, const TBTDevAddr& aDevAddr);
1.1103 + IMPORT_C ~CSdpAgent();
1.1104 + IMPORT_C void SetRecordFilterL(const CSdpSearchPattern& aUUIDFilter);
1.1105 + IMPORT_C void SetAttributePredictorListL(const CSdpAttrIdMatchList& aMatchList);
1.1106 + IMPORT_C void NextRecordRequestL();
1.1107 +
1.1108 + IMPORT_C void AttributeRequestL(TSdpServRecordHandle aHandle,
1.1109 + TSdpAttributeID aAttrID);
1.1110 + IMPORT_C void AttributeRequestL(TSdpServRecordHandle aHandle,
1.1111 + const CSdpAttrIdMatchList& aMatchList);
1.1112 + IMPORT_C void AttributeRequestL(MSdpElementBuilder* aBuilder,
1.1113 + TSdpServRecordHandle aHandle,
1.1114 + TSdpAttributeID aAttrID);
1.1115 + IMPORT_C void AttributeRequestL(MSdpElementBuilder* aBuilder,
1.1116 + TSdpServRecordHandle aHandle,
1.1117 + const CSdpAttrIdMatchList& aMatchList);
1.1118 + IMPORT_C void Cancel();
1.1119 +
1.1120 +private:
1.1121 + CSdpAgent();
1.1122 + void ConstructL(MSdpAgentNotifier& aNotifier, TBTDevAddr aDevAddr);
1.1123 +
1.1124 +
1.1125 +private:
1.1126 + CSdpAgentEng* iAgentEngine;
1.1127 + };
1.1128 +
1.1129 +NONSHARABLE_CLASS(CSdpSearchPattern) : public CBase, public MSdpElementBuilder
1.1130 +/** A list of Bluetooth service classes, represented as Universal Unique Identifiers
1.1131 +(UUIDs), to be matched in SDP Service Search Requests.
1.1132 +
1.1133 +@see CSdpAgent::SetRecordFilterL()
1.1134 +@see TUUID */
1.1135 + {
1.1136 +public:
1.1137 + IMPORT_C static CSdpSearchPattern* NewL();
1.1138 + IMPORT_C void ConstructL();
1.1139 + IMPORT_C ~CSdpSearchPattern();
1.1140 + IMPORT_C TInt AddL(const TUUID& aUUID);
1.1141 + IMPORT_C TInt Remove(const TUUID& aUUID);
1.1142 + IMPORT_C TInt Find(const TUUID& aUUID, TInt &aPos) const;
1.1143 + IMPORT_C TInt Count() const;
1.1144 + IMPORT_C const TUUID At(TInt anIndex) const;
1.1145 + IMPORT_C void Reset();
1.1146 + /** Tests if the list is empty.
1.1147 +
1.1148 + @return True if the list is empty */
1.1149 + IMPORT_C TBool IsEmpty();
1.1150 +
1.1151 +private:
1.1152 + CSdpSearchPattern();
1.1153 +
1.1154 +private:
1.1155 + // Implementation of Mbuilder interface
1.1156 + MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
1.1157 + MSdpElementBuilder* BuildDESL();
1.1158 + MSdpElementBuilder* StartListL();
1.1159 + MSdpElementBuilder* EndListL();
1.1160 +
1.1161 +private:
1.1162 + CArrayFixFlat<TUUID>* iUUIDArray;
1.1163 + };
1.1164 +
1.1165 +struct TAttrRange
1.1166 +/** A range of attribute ID values.
1.1167 +
1.1168 +This class is used in an attribute list, CSdpAttrIdMatchList, so that all
1.1169 +attributes with IDs in the specified range are considered.
1.1170 +
1.1171 +@see CSdpAttrIdMatchList */
1.1172 + {
1.1173 +public:
1.1174 + /** Default constructor. */
1.1175 + IMPORT_C TAttrRange();
1.1176 +
1.1177 +
1.1178 + /** Constructor with single ID.
1.1179 +
1.1180 + @param aAttrId The start and the end of the range are both set to aAttrId */
1.1181 + IMPORT_C TAttrRange(TSdpAttributeID aAttrId);
1.1182 +
1.1183 +
1.1184 + /** Constructor with start and end IDs.
1.1185 +
1.1186 + @param aStart ID for the start of the range
1.1187 + @param aEnd ID for the end of the range */
1.1188 + IMPORT_C TAttrRange(TSdpAttributeID aStart, TSdpAttributeID aEnd);
1.1189 +
1.1190 +
1.1191 + /** Tests if the specified ID is either within the range.
1.1192 +
1.1193 + @param aAttrId ID to test
1.1194 + @return True if in range, else false */
1.1195 + IMPORT_C TBool IsInRange(TSdpAttributeID aAttrId) const;
1.1196 +
1.1197 +
1.1198 + /** Tests if the specified ID is either within the range, is one less than the
1.1199 + lower bound, or one more than the upper bound.
1.1200 +
1.1201 + @param aAttrId ID to test
1.1202 + @return True if contiguous, else false */
1.1203 + IMPORT_C TBool IsContiguousWith(TSdpAttributeID aAttrId) const;
1.1204 +
1.1205 +
1.1206 + /** Tests if the specified range is contiguous with the range.
1.1207 +
1.1208 + @param aRange Range to test
1.1209 + @return True if contiguous, else false */
1.1210 + IMPORT_C TBool IsContiguousWith(TAttrRange aRange) const;
1.1211 +
1.1212 +public:
1.1213 + /** ID of the start of the range */
1.1214 + TSdpAttributeID iStart;
1.1215 + /** ID of the end of the range */
1.1216 + TSdpAttributeID iEnd;
1.1217 +
1.1218 +private:
1.1219 + // This data padding has been added to help prevent future binary compatibility breaks
1.1220 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.1221 + TUint32 iPadding1;
1.1222 + TUint32 iPadding2;
1.1223 + };
1.1224 +
1.1225 +
1.1226 +/** Greatest range possible for attribute IDs.
1.1227 +
1.1228 +Useful for including all attributes in a CSdpAttrIdMatchList
1.1229 +@see CSdpAttrIdMatchList*/
1.1230 +#define KAttrRangeAll TAttrRange(0, KMaxTUint16)
1.1231 +
1.1232 +
1.1233 +class CSdpServRecord;
1.1234 +class TElementEncoder;
1.1235 +class MAttributeMatchHandler;
1.1236 +
1.1237 +NONSHARABLE_CLASS(CSdpAttrIdMatchList) : public CBase, public MSdpElementBuilder
1.1238 +/** SDP Attribute ID Match list.
1.1239 +
1.1240 +Holds a list of Attribute IDs to be retrieved from a remote device in an Service
1.1241 +Attribute Request. Set in terms of ranges of attributes, each one specified
1.1242 +through a TAttrRange. */
1.1243 + {
1.1244 +public:
1.1245 + IMPORT_C static CSdpAttrIdMatchList* NewL();
1.1246 + IMPORT_C static CSdpAttrIdMatchList* NewL(const CSdpAttrIdMatchList& aAttrMatchList);
1.1247 + IMPORT_C ~CSdpAttrIdMatchList();
1.1248 + IMPORT_C void AddL(TAttrRange aRange);
1.1249 + IMPORT_C void RemoveL(TAttrRange aRange);
1.1250 + TInt Find(TSdpAttributeID aAttrId, TInt &aPos) const;
1.1251 +
1.1252 + // Do not use this - it gives an off-by-one error for aPos
1.1253 + // unless the attribute is the first one in a contiguous range.
1.1254 + // Use InMatchListRange() instead
1.1255 + IMPORT_C TBool InMatchList(TSdpAttributeID aAttrId, TInt &aPos) const;
1.1256 +
1.1257 +
1.1258 +
1.1259 + /** Tests if the specified attribute ID is in the list.
1.1260 +
1.1261 + @param aAttrId Attribute ID to test
1.1262 + @return ETrue if the attribute is in the list, else EFalse */
1.1263 + IMPORT_C TBool InMatchList(TSdpAttributeID aAttrId) const;
1.1264 +
1.1265 +
1.1266 + /** Gets the number of separate ranges of attribute IDs in the list.
1.1267 +
1.1268 + @return Number of ranges of attribute IDs in the list */
1.1269 + IMPORT_C TInt Count() const;
1.1270 +
1.1271 + void FindAttributesL(CSdpServRecord &aRec, MAttributeMatchHandler &aHandler) const;
1.1272 +
1.1273 + /**
1.1274 + @internalTechnology
1.1275 + @released
1.1276 + */
1.1277 + IMPORT_C TUint EncodeL(TElementEncoder aEncoder) const;
1.1278 +
1.1279 +
1.1280 + /** Tests if the specified attribute ID is in the list.
1.1281 +
1.1282 + @param aAttrId Attribute ID to test
1.1283 + @param aRange Position of the range of IDs in the list which contains aAttrId, or 0 if not found
1.1284 + @return ETrue if the attribute is in the list, else EFalse */
1.1285 + IMPORT_C TBool InMatchListRange(TSdpAttributeID aAttrId, TInt &aRange) const;
1.1286 +
1.1287 +
1.1288 +private:
1.1289 + // Implementation of MSdpElementBuilder interface
1.1290 + MSdpElementBuilder* BuildUintL(const TDesC8& aUint);
1.1291 + MSdpElementBuilder* BuildDESL();
1.1292 + MSdpElementBuilder* StartListL();
1.1293 + MSdpElementBuilder* EndListL();
1.1294 + TInt FindInOrContiguousWith(TSdpAttributeID aAttrId, TInt &aPos) const;
1.1295 +
1.1296 +private:
1.1297 + CSdpAttrIdMatchList();
1.1298 + CArrayFix<TAttrRange>* iList;
1.1299 +
1.1300 + __DECLARE_TEST;
1.1301 + };
1.1302 +
1.1303 +
1.1304 +// interface via NetDB
1.1305 +// includes parser and builder to use it
1.1306 +
1.1307 +
1.1308 +/** Cannot bind to specifed sockets protocol, as already bound. */
1.1309 +const static TInt KErrSdpAlreadyBound = -6400;
1.1310 +/** Remote device gave unknown error. */
1.1311 +const static TInt KErrSdpPeerError = -6401;
1.1312 +/** Local device is not connected. */
1.1313 +const static TInt KErrSdpClientNotConnected = -6402;
1.1314 +/** Invalid/unsupported SDP version. */
1.1315 +const static TInt KErrSdpUnsupportedVersion = -6403;
1.1316 +/** Invalid Service Record Handle. */
1.1317 +const static TInt KErrSdpBadRecordHandle = -6404;
1.1318 +/** Invalid Continuation State. */
1.1319 +const static TInt KErrSdpBadContinuationState = -6405;
1.1320 +/** SDP server rejected the request. */
1.1321 +const static TInt KErrSdpServerRejectedRequest = -6406;
1.1322 +/** Request buffer was ill-formed. */
1.1323 +const static TInt KErrSdpBadRequestBufferLength = -6407;
1.1324 +/** Result buffer was ill-formed. */
1.1325 +const static TInt KErrSdpBadResultBufferLength = -6408;
1.1326 +/** UUID entry was ill-formed. */
1.1327 +const static TInt KErrSdpBadUUIDLength = -6409;
1.1328 +/** Response was ill-formed. */
1.1329 +const static TInt KErrSdpBadResultData = -6410;
1.1330 +/** SDP database is full. */
1.1331 +const static TInt KErrSdpDatabaseFull = -6411;
1.1332 +
1.1333 +
1.1334 +template <class T> class CSdpStackFix;
1.1335 +
1.1336 +NONSHARABLE_CLASS(CElementParser) : public CBase
1.1337 +/** Parser for SDP attribute values.
1.1338 +
1.1339 +The class parses an input buffer containing an attribute value into its constituent
1.1340 +data elements. It calls an MSdpElementBuilder object each time a data element
1.1341 +is decoded.
1.1342 +
1.1343 +This parser can parse incrementally, and be fed new data as it arrives.
1.1344 +
1.1345 +@see MSdpElementBuilder */
1.1346 + {
1.1347 +public:
1.1348 +NONSHARABLE_CLASS(CLinearBuf) : public CBase
1.1349 +/*Buffer used for a buffered parse.*/
1.1350 + {
1.1351 +public:
1.1352 + static CLinearBuf* NewLC(TInt aExpandSize);
1.1353 + ~CLinearBuf();
1.1354 + void AppendL(const TDesC8& aData);
1.1355 + const TPtrC8 Ptr() const;
1.1356 + void Consume(TInt aLength);
1.1357 + TInt Size() const;
1.1358 +
1.1359 +private:
1.1360 + CLinearBuf();
1.1361 + void ConstructL(TInt aExpandSize);
1.1362 +
1.1363 + CBufFlat* iBuf;
1.1364 + TInt iStartOffset;
1.1365 + };
1.1366 +
1.1367 +public:
1.1368 + IMPORT_C static CElementParser* NewL(MSdpElementBuilder* aBuilder);
1.1369 + IMPORT_C ~CElementParser();
1.1370 + IMPORT_C TInt ParseElementsL(const TDesC8& aData);
1.1371 + IMPORT_C TBool BufferedParseL(const TDesC8& aData);
1.1372 + IMPORT_C void Reset();
1.1373 + IMPORT_C void Reset(MSdpElementBuilder* aBuilder);
1.1374 + IMPORT_C void SetBuilder(MSdpElementBuilder* aBuilder);
1.1375 + IMPORT_C MSdpElementBuilder* Builder();
1.1376 +
1.1377 +private:
1.1378 + void ConstructL();
1.1379 + CElementParser(MSdpElementBuilder* aBuilder);
1.1380 + static TBool IsComposite(TUint8 aType);
1.1381 + void CloseListsL();
1.1382 +
1.1383 + MSdpElementBuilder* iBuilder;
1.1384 + CSdpStackFix<TInt>* iListStack;
1.1385 + CLinearBuf* iRemainderBuf;
1.1386 + };
1.1387 +
1.1388 +_LIT(KSdpClientPanic,"SDPServer");
1.1389 +enum TSdpClientPanic
1.1390 + {
1.1391 + ESdpBadRequest = 0,
1.1392 + ESdpBadDescriptor = 1,
1.1393 + ESdpBadSubSessionHandle = 6,
1.1394 + ESdpBadSubSessionRemove = 7,
1.1395 + ESdpNonExistantRecordHandle = 12,
1.1396 + };
1.1397 +
1.1398 +#endif