adaptationlayer/tsy/simatktsy_dll/inc/satmosmsctrl.h
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2007-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 the License "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 #ifndef SATMOSMSCTRL_H
       
    21 #define SATMOSMSCTRL_H
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>    // base class cbase
       
    26 #include <etelsat.h>    // etel sat api
       
    27 
       
    28 
       
    29 // Message Type received in SMS_RESOURCE_REQ message
       
    30 const TUint8 KSmsCommandType = 2;
       
    31 const TUint8 KSmsSubmitType = 1;
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CSatMessHandler;
       
    35 class CTsySatMessaging;
       
    36 class TIsiReceiveC;
       
    37 
       
    38 
       
    39 // CLASS DECLARATION
       
    40 /**
       
    41 *  CSatMoSmsCtrl
       
    42 *  Sat MO SMS control handling
       
    43 *  @lib SIMATKTSY.LIB
       
    44 *  @since Series 60 Series60_2.6
       
    45 */
       
    46 class CSatMoSmsCtrl : public CBase
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49 
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         * @since NCP 5.0
       
    53         * @param aSatMessHandler pointer to satmessagehandler class
       
    54         * @param aSatMessaging pointer to satmessaging class
       
    55         */
       
    56         static CSatMoSmsCtrl* NewL( CSatMessHandler* aSatMessHandler,
       
    57             CTsySatMessaging* aSatMessaging );
       
    58 
       
    59         /**
       
    60         * Destructor.
       
    61         * @since NCP 5.0
       
    62         */
       
    63         virtual ~CSatMoSmsCtrl();
       
    64 
       
    65 
       
    66     private:    // Constructors
       
    67 
       
    68         /**
       
    69         * C++ default constructor.
       
    70         * @since NCP 5.0
       
    71         * @param aSatMessHandler pointer to satmessagehandler class
       
    72         * @param aSatMessaging pointer to satmessaging class
       
    73         */
       
    74         CSatMoSmsCtrl( CSatMessHandler* aSatMessHandler,
       
    75             CTsySatMessaging* aSatMessaging );
       
    76 
       
    77         /**
       
    78         * By default Symbian 2nd phase constructor is private.
       
    79         * @since NCP 5.0
       
    80         */
       
    81         void ConstructL();
       
    82 
       
    83 
       
    84     public: // New methods
       
    85 
       
    86         /**
       
    87         * Handles an incoming command from phonet
       
    88         * Called by Phonet receiver when it receives ISI msg.
       
    89         * @since NCP 5.0
       
    90         * @param aIsiMessage proactive command from phonet
       
    91         * @return TInt
       
    92         */
       
    93         TInt MessageReceived( const TIsiReceiveC& aIsiMessage );
       
    94 
       
    95         /*
       
    96         * Returns iIsMoSmsCtrlActivated
       
    97         * This is used by CTsySatMessaging::MoSmsControlReceived
       
    98         * @since Series 60 Series60_2.6
       
    99         */
       
   100         TBool IsActivated();
       
   101 
       
   102         /*
       
   103         * Set iIsMoSmsCtrlActivated to ETrue
       
   104         * Allows this object to process incoming Mo-Sm requests
       
   105         * @since Series 60 Series60_2.6
       
   106         */
       
   107         void Activate();
       
   108 
       
   109         /*
       
   110         * Set iIsMoSmsCtrlActivated to EFalse
       
   111         * Prevents this object to process incoming Mo-Sm requests
       
   112         * @since Series 60 Series60_2.6
       
   113         */
       
   114         void Deactivate();
       
   115 
       
   116 
       
   117     private: // New methods
       
   118 
       
   119         /*
       
   120         * Indication received from SMS server with the SMS parameters
       
   121         * of the SMS to be sent by the Mobile Equipment.
       
   122         * The response will tell whether the SMS can be sent
       
   123         * to network or not.
       
   124         * @since NCP 5.0
       
   125         * @param aIsiMessage coming from ISA SMS Server
       
   126         * @return none
       
   127         */
       
   128         void SmsResourceIndReceived( const TIsiReceiveC& aIsiMessage );
       
   129 
       
   130         /*
       
   131         * Send an envelope to SIM server in order to check wheter the SMS
       
   132         * can be sent or not. The response will be used to send a response
       
   133         * to SMS server
       
   134         * @since Series 60 Series60_2.6
       
   135         * @param aTraId transaction id
       
   136         * @param aAddressData1 RP address
       
   137         * @param aAddressData2 TP address
       
   138         * @return none
       
   139         */
       
   140         void SendMoSmsCtrlEnvelope( TUint8 aTraId, TDes8& aAddressData1,
       
   141             TDes8& aAddressData2 );
       
   142 
       
   143         /*
       
   144         * Handles UICC_CAT_RESP, which comes from SIM as a reply
       
   145         * to MO SMS control envelope.
       
   146         * @param aIsiMessage Received ISI message
       
   147         * @return success code of ISI message sending attempt
       
   148         */
       
   149         TInt UiccCatRespEnvelopeReceived( const TIsiReceiveC& aIsiMessage );
       
   150 
       
   151         /*
       
   152         * Extracts data from AtkSwDataNtf message data part
       
   153         * @since Series 60 Series60_2.6
       
   154         * @param aAtkData input
       
   155         * @param aAddr1 output, contains the RP address provided by the SIM
       
   156         * @param aAddr2 ouput, contains the TP address provided by the SIM
       
   157         * @param aAlphaId output, contains the alpha id provided by the SIM
       
   158         * @param aEmptyAlphaId output, ETrue if alpha id is present and empty
       
   159         * @return none
       
   160         */
       
   161         void ParseAtkSwDataNtf( TPtrC8& aAtkData, TDes8& aAddr1, TDes8& aAddr2,
       
   162             RSat::TAlphaId& aAlphaId, TBool& aEmptyAlphaId );
       
   163 
       
   164         /*
       
   165         * This method cleans the address data, so that all the byte found
       
   166         * after a 0xXF or a 0xFX are ignored and removed.
       
   167         * @param  aAddr Address data to be cleaned
       
   168         * @return None
       
   169         */
       
   170         void CleanAddressData( TDes8& aAddr );
       
   171 
       
   172         /*
       
   173         * This method checks the consistency of the data sent by the SIM to
       
   174         * the ME, when the call is allowed and modified.
       
   175         * @param aRPAddr SMSC RP address
       
   176         * @param aTPAddr  TP Destinatiion address
       
   177         * @return ETtrue if data are consistent, else EFalse
       
   178         */
       
   179         TBool VerifySimRespData( TDes8& aRPAddr, TDes8& aTPAddr );
       
   180 
       
   181         /*
       
   182         * This method prepare subblocks for SMS_RESOURCE_REQ IsiMessage
       
   183         * @param number number of subblocks
       
   184         * @param status SMS is Denied or allowed
       
   185         * @param data Actual data to me send in IsiMessage
       
   186         * @param address1 Changed Service centre address received from SIM
       
   187         * @pram address2 Changed destination address received from SIM
       
   188         */
       
   189         void FormSmsResourceReqSb( const TUint8 status,TDes8& data, const TDes8& address1, const TDes8& address2 );
       
   190 
       
   191 
       
   192     private: // Data
       
   193 
       
   194         // This object receives and sends messages to the external world
       
   195         // using the message handler and messaging classes.
       
   196         CSatMessHandler*    iSatMessHandler;
       
   197         CTsySatMessaging*   iSatMessaging;
       
   198 
       
   199         // Boolean to check whether a Sim response is expected by MO-SMS Control
       
   200         TBool               iWaitingForEnvelopeResp;
       
   201 
       
   202         // Boolean to check whether MO-SMS Control is activated.
       
   203         // This is used by CTsySatMessaging::MoSmsControlReceived,
       
   204         // in order to know if this object is in use or not
       
   205         TBool               iIsMoSmsCtrlActivated;
       
   206 
       
   207         // Save transaction id of the envelope, in order to check whether
       
   208         // the incoming SwDataNtf is for MO-SMS Control. This has to be
       
   209         // ANDed with iWaitingForEnvelopeResp.
       
   210         // If this test condition is not strong enough, then it is recommended
       
   211         // to use an array like in Call Control, see SatCC.cpp/h.
       
   212         TUint8              iMoSmsCtrlEnvelopeTransactionId;
       
   213 
       
   214         // Save the transaction id of the incoming Mo-Sm request, which is
       
   215         // re-used in the resp.
       
   216         // It is questionable whether or not another boolean should be used
       
   217         // to remind if there is already an ongoing request not completed while
       
   218         // a new request is received. There is a risk that this transaction id
       
   219         // gets overwritten. But most likely ISA SMS server doesn't send
       
   220         // the next request before the completion of the previous one.
       
   221         TUint8              iMoSmsCtrlReqTransactionId;
       
   222 
       
   223         // Save the sender object id of the MO-SM req, which is
       
   224         // re-used in the resp.
       
   225         // The type TUint8 is based on the assumption on having at maximum
       
   226         // 256 ISA servers. There is a chance that future products possess
       
   227         // more than 256 servers, and therefore this type TUint8 would be
       
   228         // too small.
       
   229         TUint8              iSenderObject;
       
   230 
       
   231         // Save the Sequence id of MO SMS Indication, which is reused in
       
   232         // the resp messgae.
       
   233         // the type is TUint8 is based on the value range defined in ISI SMS Server
       
   234         // Message document
       
   235         TUint8 iSequenceId;
       
   236 
       
   237         // Save the Resource id of MO SMS Indication, which is reused in
       
   238         // the resp messgae.
       
   239         // the type is TUint16 is based on the value range defined in ISI SMS Server
       
   240         // Message document
       
   241         TUint16 iResourceId;
       
   242 
       
   243         // Save the Destination address TPDU Type of MO SMS Indication, which is reused in
       
   244         // the resp messgae.
       
   245         // the type is TUint8 is based on the information from 3gpp document
       
   246         TUint8 iMessageType;
       
   247 
       
   248         // Save the SMSC address subblock of MO SMS Indication, which is reused in
       
   249         // the resp messgae if message is allowed without any change or disallowed.
       
   250         // The size of buffer is based on the value range defined in
       
   251         // ISI SMS Server message document
       
   252         TBuf8<256> iAddressSubblock;
       
   253 
       
   254         // Save the Destination address subblock of MO SMS Indication, which is reused in
       
   255         // the resp messgae if message is allowed without any change or disallowed.
       
   256         // The size of buffer is based on the value range defined in
       
   257         // ISI SMS Server message document
       
   258         TBuf8<256> iUserDataSubblock;
       
   259     };
       
   260 
       
   261 #endif // SATMOSMSCTRL_H
       
   262 
       
   263 
       
   264 // End of file