Symbian3/SDK/Source/GUID-33210C48-3198-51BC-9970-8B29F711A8E2.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-33210C48-3198-51BC-9970-8B29F711A8E2"><title>Setting service record attributes</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Service records are made up of attributes that collectively describe the service. </p> <section><title>How to set an attribute in a service record</title> <p>Attributes in a service record are set or altered by calling <xref href="GUID-FC133F0F-C9E8-30CB-B2FE-8AC9F7F802AC.dita#GUID-FC133F0F-C9E8-30CB-B2FE-8AC9F7F802AC/GUID-43012089-A8EF-3632-BB01-DEF0B4CA7A97"><apiname>RSdpDatabase::UpdateAttributeL()</apiname></xref>. </p> <p><b>Example </b> </p> <p>The following example adds an attribute with ID 0x0102, the attribute that specifies the service provider name (0x0002 for the <i>ProviderName</i> attribute plus the language base offset, which for the primary language is 0x0100), in the service record identified by <codeph>recordHandle</codeph>: </p> <codeblock id="GUID-75061CD8-14C6-5226-8425-3D617DC86C26" xml:space="preserve">// Assumes sdpSubSession is an open subsession to the database,
// and recordHandle is the service record

_LIT8(KProvName,"Symbian Ltd.");
CSdpAttrValueString* attrVal = CSdpAttrValueString::NewStringL(KProvName);
CleanupStack::PushL(attrVal);
sdpSubSession.UpdateAttributeL(recordHandle, 0x0102, *attrVal);
CleanupStack::PopAndDestroy();</codeblock> <p><b>Note </b> </p> <p> <codeph>UpdateAttributeL()</codeph> places no constraints on the contents of service records, and allows attributes of any value or content. You should ensure that the correct attribute IDs are used. </p> </section> <section><title>Where next?</title> <p>The complete set of Service Discovery Database tutorials are shown below: </p> <ol id="GUID-E9C58B56-4745-5D93-BF72-3231B713D3BD"><li id="GUID-E9C458D4-911C-5A67-9322-9F65AA2CF02C"><p><xref href="GUID-B75BD3DE-9C2E-5429-B55B-891462B92795.dita">Connecting to the service discovery database</xref>  </p> </li> <li id="GUID-AC597924-FE76-57F9-A0AD-A00A7BA32FB2"><p><xref href="GUID-E2A2FA2A-5D9A-56FE-B7E5-69CCBC656BB9.dita">Handling SDP attributes</xref>  </p> </li> <li id="GUID-9CBDA1B1-CAFD-522E-9E4D-2ABDCCDF39DD"><p><xref href="GUID-2373A158-C18A-51B5-BE9A-6B8F7FC63A35.dita">Registering Services</xref>  </p> </li> <li id="GUID-CCC59890-8E3F-5CAD-92A1-486BD5A0E099"><p> <b>Setting service record attributes</b> - This document </p> </li> <li id="GUID-A8796FDF-8F9E-57E3-9CBC-4A26E3512955"><p><xref href="GUID-ED342E6B-A4A3-576B-8934-7E7C049837F0.dita">SDP Service records and attributes</xref>  </p> </li> </ol> <p>Also refer to the <xref href="GUID-E5893C4A-024A-53A7-805F-68989382DC3F.dita">Bluetooth Service Discovery Database overview</xref> and the <xref href="GUID-8451102A-8E68-5C86-9E40-D53183E32261.dita">Bluetooth SDP Overview</xref> for additional background information. </p> </section> </conbody></concept>