supl/locationomasuplprotocolhandler/supllistener/inc/epos_comasuplsmslistenerbase.h
changeset 0 667063e416a2
child 13 9c303455e256
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2005 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:   Base class for OMA SUPL SMS Listener implementations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_COMASUPLSMSLISTENERBASE_H
       
    21 #define C_COMASUPLSMSLISTENERBASE_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32std.h>
       
    25 #include <es_sock.h>
       
    26 #include <f32file.h>
       
    27 
       
    28 
       
    29 /**  WDP Port on which to listen for incoming messages */
       
    30 const TInt KWDPPort             = 7275;
       
    31 
       
    32 /**
       
    33  *  Base class for OMA SUPL SMS Listener implementations
       
    34  *  @since S60 v3.1
       
    35  */
       
    36 class COMASuplSmsListenerBase : public CActive
       
    37     {
       
    38 
       
    39 public:
       
    40 
       
    41     /**  
       
    42      * States of SMS Listener component 
       
    43      */
       
    44     enum TState
       
    45         {
       
    46         EIdle = 0, 
       
    47         EListening, 
       
    48         EAcknowledging,
       
    49         ESubscriptionActive,
       
    50         ESettingsInitialized,
       
    51         EComplete
       
    52         };
       
    53 
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Destructor
       
    58      *
       
    59      */
       
    60     virtual ~COMASuplSmsListenerBase();
       
    61     
       
    62     /**
       
    63      * Listens for incoming SMS messages
       
    64      *
       
    65      * @since S60 v3.1
       
    66      */
       
    67     void ListenForSMSL();
       
    68     
       
    69 	/**
       
    70 	 * Wrapper function used for tracing
       
    71 	 *
       
    72 	 */
       
    73 	void Trace( const TDesC& aMessage, const TDesC& aFileName, TInt line );
       
    74     
       
    75 protected:
       
    76 
       
    77     /** 
       
    78      * Connection to Socket Server
       
    79      */
       
    80     RSocketServ 	            iSocketServer;
       
    81 
       
    82     /** 
       
    83      * Socket over which SMS is received
       
    84      */
       
    85     RSocket 		            iSocket;
       
    86 
       
    87     /**
       
    88      * Connection to File server required by CSMSMessage API
       
    89      */
       
    90     RFs 			            iFs;
       
    91 
       
    92     /** 
       
    93      * 
       
    94      */
       
    95     TPckgBuf<TUint>             iBuf;
       
    96 
       
    97     /** 
       
    98      * Current state transition
       
    99      */
       
   100     TState 			            iState;
       
   101     
       
   102 protected:
       
   103 
       
   104     /**
       
   105      * Constructor
       
   106      *
       
   107      */
       
   108     COMASuplSmsListenerBase();
       
   109     
       
   110 	/*
       
   111 	 * Forwards message to SUPL gateway
       
   112 	 *
       
   113 	 * @since S60 v3.1
       
   114 	 */
       
   115     void COMASuplSmsListenerBase::SendL( const TPtr8& aMessage );
       
   116 
       
   117     // from base class CActive    
       
   118     /**
       
   119      * Cancels outanding events
       
   120      *
       
   121      */	
       
   122 	void DoCancel();
       
   123 	
       
   124     /**
       
   125      * Event handling function
       
   126      *
       
   127      */	
       
   128 	void RunL();
       
   129 	
       
   130 private:
       
   131 
       
   132     /**
       
   133      * Associates the socket with a specific address family 
       
   134      * based on the implementation and binds the socket
       
   135      *
       
   136      * @since S60 v3.1
       
   137      */
       
   138     virtual void InitializeL()		= 0;
       
   139 
       
   140     /**
       
   141      * Extracts the payload from the received SMS message
       
   142      *
       
   143      * @since S60 v3.1
       
   144      */	
       
   145     virtual void ProcessMessageL()	= 0;
       
   146 
       
   147     };
       
   148 
       
   149 
       
   150 #include "epos_comasuplsmslistenerbase.inl"
       
   151 
       
   152 
       
   153 #endif  // C_COMASUPLSMSLISTENERBASE_H