/**
Test MSdpElementBuilder::BuildUintL()
*/
void CT_DataSdpElementBuilder::DoCmdBuildUintL(MSdpElementBuilder& aElementBuilder, const TDesC& aSection)
{
    iDataWrapper.INFO_PRINTF1(_L("MSdpElementBuilder BuildUintL Call"));

    TPtrC 								theString;
    TPtrC								sdpIntBufName;
    TBool								foundParameter=EFalse;
    if( iDataWrapper.GetStringFromConfig(aSection, KUint(), theString) )
    {
        foundParameter=ETrue;
        HBufC8* theString8 = HBufC8::NewLC(theString.Length());
        theString8->Des().Copy(theString);
        TPtrC8	stringPtr = theString8->Des();
        TRAPD(err, aElementBuilder.BuildUintL(stringPtr));
        if(err != KErrNone)
        {
            iDataWrapper.ERR_PRINTF2(_L("MSdpElementBuilder BuildUintL failed with error %d"), err);
            iDataWrapper.SetError(err);
        }
        CleanupStack::PopAndDestroy(theString8);
    }

    if ( iDataWrapper.GetStringFromConfig(aSection, KSdpIntBufObj(), sdpIntBufName) )
    {
        foundParameter=ETrue;
        TAny* object=iDataWrapper.GetDataObjectL(sdpIntBufName);
        TSdpIntBuf<TUint8>*	sdpIntBuf = static_cast<TSdpIntBuf<TUint8>*>(object);
        TSdpIntBuf<TUint8>	sdpIntObj = *sdpIntBuf;
        const TUint8 *tmp=&sdpIntObj[0];
        TPtrC8 bufferPtr(tmp, sdpIntObj.Length());
        TRAPD(err, aElementBuilder.BuildUintL(bufferPtr));
        if ( err!=KErrNone )
        {
            iDataWrapper.ERR_PRINTF2(_L("MSdpElementBuilder BuildUintL failed with error %d"), err);
            iDataWrapper.SetError(err);
        }
    }

    if (!foundParameter)
    {
        iDataWrapper.ERR_PRINTF2(_L("Missing parameter %S"), &KSdpIntBufObj());
        iDataWrapper.SetBlockResult(EFail);
    }
}
// ----------------------------------------------------------------------------
// QBtServiceAdvertiserPrivate::StartAdvertiser(const QBtService& service)
//
// start service advertiser on given channel.  an entry to service discovery
// database will be entered describing our advertised service.
// ----------------------------------------------------------------------------
void QBtServiceAdvertiserPrivate::StartAdvertiser (const QBtService& service)
{
   //localService = new QBtService(service);

   // open sdp session
   User::LeaveIfError(iSdp.Connect());

   // open sdp database session
   User::LeaveIfError(iSdpDB.Open(iSdp));

   // create a record of the correct service class
   //QBtUuid uuid = service.getClass();

   TUUID uuid = QBtUuidToSymbianUuid (service.getClass() );
   iSdpDB.CreateServiceRecordL (uuid, iRecord);


   // add a protocol to the record
   CSdpAttrValueDES* protocolDescriptorList = CSdpAttrValueDES::NewDESL(NULL);
   CleanupStack::PushL(protocolDescriptorList);

   TBuf8<1> channel;
   channel.Append((TChar)service.getPort());

   // create protocol list for our service
   MSdpElementBuilder* e = protocolDescriptorList->StartListL();

      QBtService::ProtocolList protocolList = service.getProtocols();
      for (int i=0; i < protocolList.size(); i++)
      {
         e = e->BuildDESL();
         e = e->StartListL();

            TUUID u = QBtUuidToSymbianUuid (protocolList[i]);
            e = e->BuildUUIDL (u);

            if (u == TUUID (KRFCOMM) )
               e = e->BuildUintL(channel);

         e = e->EndListL();
       }

   e->EndListL();

   // set protocol list to the record
   iSdpDB.UpdateAttributeL(iRecord, KSdpAttrIdProtocolDescriptorList,
         *protocolDescriptorList);
   CleanupStack::PopAndDestroy(protocolDescriptorList);


   // add a name to the record
   TPtrC16 servName(service.getName().utf16());

   iSdpDB.UpdateAttributeL(iRecord,
         KSdpAttrIdBasePrimaryLanguage +
         KSdpAttrIdOffsetServiceName,
         servName);


   // add a description to the record
   TPtrC16 servDescr(service.getDescription().utf16());

   iSdpDB.UpdateAttributeL(iRecord,
         KSdpAttrIdBasePrimaryLanguage +
         KSdpAttrIdOffsetServiceDescription,
         servDescr);

   // set service available
   UpdateAvailability(ETrue);

   // notify
   QT_TRYCATCH_LEAVING (emit p_ptr->advertisingStarted(service) );


}