datasourcemodules/bluetoothgpspositioningmodule/btgpspsy/inc/Init/BTGPSNokGpsDetector.h
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef BTGPSNOKGPSDETECTOR_H
       
    22 #define BTGPSNOKGPSDETECTOR_H
       
    23 
       
    24 //  INCLUDES
       
    25 
       
    26 #include <e32base.h> 
       
    27 #include "BTGPSMessageListener.h"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION  PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CBTGPSConnectManager;
       
    39 class CBTGPSDeviceManager;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *  This class defines a object that detect if the connect BT device support
       
    45 *  Nokia proprietary sentence by sending PNok message. If the device replies 
       
    46 *  the questing correctly, then the device is considered to be BT GPS device 
       
    47 *  that support Nokia proprietary feature.
       
    48 *
       
    49 */
       
    50 class CBTGPSNokGpsDetector: public CBase, private MBTGPSMessageListener
       
    51     {
       
    52     public: 
       
    53 
       
    54         /**
       
    55         * Two-phase construction.
       
    56 		* @param aConnectManager Reference to connect manager.
       
    57 		* @param aDeviceManager Reference to device manager
       
    58         */
       
    59         static CBTGPSNokGpsDetector * NewL(
       
    60             CBTGPSConnectManager& aConnectManager,
       
    61             CBTGPSDeviceManager& aDeviceManager);
       
    62 
       
    63         /**
       
    64         * Destructor
       
    65         */
       
    66         virtual ~CBTGPSNokGpsDetector();
       
    67         
       
    68         /**
       
    69         * Detect
       
    70         */
       
    71         TInt Detect();
       
    72         
       
    73         /**
       
    74         * Cancel detecting
       
    75         */
       
    76         void Cancel();
       
    77 
       
    78     private:
       
    79         /**
       
    80         * From MBTGPSMessageListener
       
    81         */
       
    82         virtual void HandleMessage(const TBTGPSNmeaParser& aParser);
       
    83 
       
    84     private:
       
    85 
       
    86         /**
       
    87         * Second phase of the construction
       
    88         */
       
    89         void ConstructL();
       
    90 
       
    91         /**
       
    92         * Private constructor
       
    93         */
       
    94         CBTGPSNokGpsDetector(
       
    95             CBTGPSConnectManager& aConnectManager,
       
    96             CBTGPSDeviceManager& aDeviceManager);
       
    97             
       
    98         /**
       
    99         * Timer callback
       
   100         */
       
   101         void TimerTick();
       
   102         
       
   103         /**
       
   104         * Start detecting
       
   105         */
       
   106         void DetectL();
       
   107         
       
   108         /**
       
   109         * Static timer callback
       
   110         */
       
   111         static TInt TimerCallBack(TAny* aAny);
       
   112 
       
   113     private:
       
   114         //Connect Manager
       
   115         CBTGPSConnectManager& iConnectManager;
       
   116 
       
   117         //Device manager
       
   118         CBTGPSDeviceManager& iDeviceManager;
       
   119         
       
   120         //Timer
       
   121         CPeriodic* iTimer;
       
   122         
       
   123         //Number of valide nmea messages received
       
   124         TInt iValidNmeaMsg;
       
   125         
       
   126         //Number of PNOK polling message sent
       
   127         TInt iNumPnokPolling;
       
   128         
       
   129         //Switch to NMEA mode count
       
   130         TInt iSwitchCount;
       
   131 
       
   132     };
       
   133 #endif
       
   134 // End of File
       
   135