datasourcemodules/bluetoothgpspositioningmodule/btgpspsy/src/Connecting/BTGPSSdpHandler.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <e32std.h>
       
    20 #include "BTGPSSdpHandler.h"
       
    21 #include "BTGPSConnectManagerExt.h"
       
    22 #include "BTGPSDeviceManager.h"
       
    23 #include "BTGPSHandlerFactory.h"
       
    24 #include "BTGPSLogging.h"
       
    25 #include "BTGPSLogging.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CBTGPSSdpHandler::NewL
       
    32 // -----------------------------------------------------------------------------
       
    33 CBTGPSSdpHandler* CBTGPSSdpHandler::NewL(MBTGPSConnectManagerExt& aManagerExt)
       
    34     {
       
    35     CBTGPSSdpHandler* self = new (ELeave) CBTGPSSdpHandler(
       
    36         aManagerExt);
       
    37     CleanupStack::PushL(self);
       
    38     self->ConstructL();
       
    39     CleanupStack::Pop();
       
    40     return self;
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CBTGPSSdpHandler::~CBTGPSSdpHandler
       
    45 // -----------------------------------------------------------------------------
       
    46 CBTGPSSdpHandler::~CBTGPSSdpHandler()
       
    47     {
       
    48     delete iBtGPSDiscovery;
       
    49     }
       
    50 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CBTGPSSdpHandler::ConstructL
       
    54 // -----------------------------------------------------------------------------
       
    55 void CBTGPSSdpHandler::ConstructL()
       
    56     {
       
    57     TRACESTRING("CBTGPSSdpHandler::ConstructL start...")
       
    58 
       
    59     CBTDevice* btDevice = &(iManagerExt.DeviceManager().BtDevice());
       
    60 
       
    61     iChannelNumberErr = KErrNotFound;
       
    62     iBtGPSDiscovery = CBTGPSDiscovery::NewL( this );
       
    63     iBtGPSDiscovery->RemoteProtocolChannelQueryL(btDevice->BDAddr(), KSerialPortUUID );
       
    64         
       
    65     TRACESTRING("CBTGPSSdpHandler::ConstructL end")
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CBTGPSSdpHandler::CBTGPSSdpHandler
       
    70 // C++ default constructor can NOT contain any code, that
       
    71 // might leave.
       
    72 // -----------------------------------------------------------------------------
       
    73 CBTGPSSdpHandler::CBTGPSSdpHandler(MBTGPSConnectManagerExt& aManagerExt)
       
    74     : iManagerExt(aManagerExt)
       
    75     {
       
    76     }
       
    77 
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CBTGPSSdpHandler::RunL
       
    81 // -----------------------------------------------------------------------------
       
    82 //void CBTGPSSdpHandler::ServiceSearchComplete(const RSdpRecHandleArray& /*aResult*/, TUint /*aTotalRecordsCount*/, TInt /*aErr */)
       
    83 //    {
       
    84     //do nothing
       
    85 //    }
       
    86                                                          
       
    87 // -----------------------------------------------------------------------------
       
    88 // CBTGPSSdpHandler::AttributeSearchComplete
       
    89 // -----------------------------------------------------------------------------
       
    90 //void CBTGPSSdpHandler::AttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, const RSdpResultArray& /*aAttr*/, TInt /*aErr*/ )
       
    91 //	{
       
    92     //do nothing
       
    93  //   }
       
    94             
       
    95 // -----------------------------------------------------------------------------
       
    96 // CBTGPSSdpHandler::ServiceAttributeSearchComplete
       
    97 // -----------------------------------------------------------------------------
       
    98 void CBTGPSSdpHandler::ServiceAttributeSearchComplete(TInt aErr )
       
    99     {
       
   100     TRACESTRING2("CBTGPSSdpHandler::ServiceAttributeSearchComplete start...%d", 
       
   101         aErr )
       
   102     if( aErr == KErrNone || aErr == KErrEof)
       
   103         {
       
   104         TInt channel = KErrNotFound;
       
   105         TInt err = iBtGPSDiscovery->ParseRfcommChannel(channel );
       
   106         if( err == KErrNone )
       
   107             {
       
   108             TRACESTRING2("channel number:%d", channel)
       
   109             iManagerExt.DeviceManager().SetPort(channel);
       
   110             iChannelNumberErr = KErrNone;
       
   111             }
       
   112         }
       
   113     // If the bluetooth device needs to be reinitialised it aErr will be EPageTimedOut (-6004)
       
   114     if ((aErr < KErrNone ))
       
   115         {
       
   116         iManagerExt.HandlerComplete( 
       
   117             ESdpHandler,
       
   118             iChannelNumberErr );
       
   119         }
       
   120     TRACESTRING("CBTGPSSdpHandler::ServiceAttributeSearchComplete end")
       
   121     }
       
   122             
       
   123 // -----------------------------------------------------------------------------
       
   124 // CBTGPSSdpHandler::DeviceSearchComplete
       
   125 // -----------------------------------------------------------------------------
       
   126 //void CBTGPSSdpHandler::DeviceSearchComplete( CBTDevice* /*aDevice*/, TInt /*aErr*/ )
       
   127 //    {
       
   128     //do nothing
       
   129  //   }
       
   130 
       
   131 //  End of File
       
   132 
       
   133 
       
   134