void CTcBtManager::Close() { LOG( _L("CTcBtManager::Close()") ); // Stop advertising our service StopAdvertiser(); // Shut down the service port iConn.Close(); }
void CTcBtManager::StartAdvertiserL( TInt aChannel ) { LOG( _L("CTcBtManager::StartAdvertiserL( %d ) start"), aChannel ); StopAdvertiser(); User::LeaveIfError( iSdpServ.Connect() ); User::LeaveIfError( iSdpDb.Open( iSdpServ ) ); // Create service record iSdpDb.CreateServiceRecordL( KTcSerialClassID, iSdpRecord ); LOG( _L("CTcBtManager::StartAdvertiserL() created service record") ); // Add a Protocol to the record CSdpAttrValueDES* protocolDesList = CSdpAttrValueDES::NewDESL( NULL ); CleanupStack::PushL( protocolDesList ); TBuf8< 1 > channel; channel.Append( (TChar)aChannel ); protocolDesList ->StartListL() // List of protocols required for this method ->BuildDESL() ->StartListL() ->BuildUUIDL( KL2CAP ) ->EndListL() ->BuildDESL() ->StartListL() ->BuildUUIDL( KRFCOMM ) ->BuildUintL( channel ) ->EndListL() ->EndListL(); iSdpDb.UpdateAttributeL( iSdpRecord, KSdpAttrIdProtocolDescriptorList, *protocolDesList ); CleanupStack::PopAndDestroy( protocolDesList ); LOG( _L("CTcBtManager::StartAdvertiserL() adding uid") ); // Add a Unique ID to the record iSdpDb.UpdateAttributeL( iSdpRecord, KSdpAttrIdServiceID, 0x10001234 ); // REPLACE!! LOG( _L("CTcBtManager::StartAdvertiserL() adding name") ); // Add a name to the record iSdpDb.UpdateAttributeL( iSdpRecord, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, KTcServiceName ); LOG( _L("CTcBtManager::StartAdvertiserL() adding description") ); // Add a description to the record iSdpDb.UpdateAttributeL( iSdpRecord, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, KTcServiceDescription ); // "Attach" our service to the root browse group. // This is required by some BT devices for successful remote SDP query TUUID rootTUUID( KTcRootBrowseGroup ); CSdpAttrValueUUID* rootBrowseGroupAttr = CSdpAttrValueUUID::NewUUIDL( rootTUUID ); CleanupStack::PushL( rootBrowseGroupAttr ); iSdpDb.UpdateAttributeL( iSdpRecord, KSdpAttrIdBrowseGroupList, *rootBrowseGroupAttr ); CleanupStack::PopAndDestroy( rootBrowseGroupAttr ); MakeAvailableL( ETrue ); LOG( _L("CTcBtManager::StartAdvertiserL() end") ); }
// ---------------------------------------------------------------------------- // QBtServiceAdvertiserPrivate::~QBtServiceAdvertiserPrivate() // // destructor // ---------------------------------------------------------------------------- QBtServiceAdvertiserPrivate::~QBtServiceAdvertiserPrivate() { TRAPD(err, StopAdvertiser()); //SafeDelete(localService); }