qtinternetradio/irqnetworkcontroller/inc/irqnetworkcontroller.h
changeset 14 896e9dbc5f19
parent 11 f683e24efca3
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
    16 */
    16 */
    17 #ifndef IRQNETWORKCONTROLLER_H_
    17 #ifndef IRQNETWORKCONTROLLER_H_
    18 #define IRQNETWORKCONTROLLER_H_
    18 #define IRQNETWORKCONTROLLER_H_
    19 
    19 
    20 #include <QObject>
    20 #include <QObject>
       
    21 #include <QMutex>
    21 
    22 
       
    23 #include "irqnetworkcontrollerexport.h"
    22 #include "irqenums.h"
    24 #include "irqenums.h"
    23 #include "irqevent.h"
    25 #include "irqevent.h"
    24 
    26 
    25 class IRQNetworkControllerBody;
    27 class IRQNetworkControllerPrivate;
    26 
    28 
    27 /**
    29 /**
    28  * This class provides the interface to IR Network Controller component
    30  * This class provides the interface to IR Network Controller component
    29  *
    31  *
    30  * IRQNetworkController follows a singleton pattern
    32  * IRQNetworkController follows a singleton pattern
    31  * hence the destructor is private and to destroy it we need to use an API
    33  * hence the destructor is private and to destroy it we need to use an API
    32  *
    34  *
    33  */
    35  */
    34 
    36 
    35 class IRQNetworkController : public QObject
    37 class IRQNETWORKCONTROLLER_DLL_EXPORT IRQNetworkController : public QObject
    36 {
    38 {
    37     Q_OBJECT
    39     Q_OBJECT
    38 
    40 
    39 public:
    41 public:
    40 
    42 
    41     /**
    43     /**
    42      *  Get the instance of IRQNetworkController
    44      *  Get the instance of IRQNetworkController
    43      *  @return IRQNetworkController*
    45      *  @return IRQNetworkController*
    44      */
    46      */
    45     IMPORT_C static  IRQNetworkController* openInstance();
    47     static  IRQNetworkController* openInstance();
    46 
    48 
    47     /**
    49     /**
    48      *  Close the instance of IRQNetworkController
    50      *  Close the instance of IRQNetworkController
    49      */
    51      */
    50     IMPORT_C void closeInstance();
    52     void closeInstance();
    51 
    53 
    52     /**
    54     /**
    53      *  Return the variable which indicates if connection is active or not
    55      *  Return the variable which indicates if connection is active or not
    54      *  @return bool
    56      *  @return bool
    55      */
    57      */
    56     IMPORT_C bool getNetworkStatus() const;
    58     bool getNetworkStatus() const;
    57 
    59 
    58     /**
    60     /**
    59      *  Return the IAP Id of the chosen IAP
    61      *  Return the IAP Id of the chosen IAP
    60      *  @return int Error code
    62      *  @return int Error code
    61      */
    63      */
    62     IMPORT_C IRQError getIAPId(unsigned long& aIapId) const;
    64     IRQError getIAPId(unsigned long& aIapId) const;
    63     
    65     
    64     /**
    66     /**
    65      *  Configure the Access Point which is used by all the components for network connectivity
    67      *  Configure the Access Point which is used by all the components for network connectivity
    66      */
    68      */
    67     IMPORT_C void  chooseAccessPoint();
    69     void  chooseAccessPoint();
    68 
    70 
    69     /*
    71     /*
    70      * Cancel configuring access point
    72      * Cancel configuring access point
    71      */
    73      */
    72     IMPORT_C void cancelConnecting();
    74     void cancelConnecting();
    73     
    75     
    74     /**
    76     /**
    75      *  This api is used to determine if the phone is in offline mode
    77      *  This api is used to determine if the phone is in offline mode
    76      *  @return True if the phone is in offline mode else False
    78      *  @return True if the phone is in offline mode else False
    77      */
    79      */
    78     IMPORT_C bool isOfflineMode();
    80     bool isOfflineMode();
    79 
    81 
    80     /**
    82     /**
    81      *  This api is used to determine if the phone supports WLan usage
    83      *  This api is used to determine if the phone supports WLan usage
    82      *  @return True if the phone supports else False
    84      *  @return True if the phone supports else False
    83      */
    85      */
    84     IMPORT_C bool isWlanSupported() const;
    86     bool isWlanSupported() const;
    85 
    87 
    86     /**
    88     /**
    87      *  Reset the connection status to Disconnected state
    89      *  Reset the connection status to Disconnected state
    88      */
    90      */
    89     IMPORT_C void resetConnectionStatus();
    91     void resetConnectionStatus();
    90 
    92 
    91     /**
    93     /**
    92      *  Used to determine the type of connection
    94      *  Used to determine the type of connection
    93      *  @return enum describing the type of connection ( GPRS/3G/WiFi )
    95      *  @return enum describing the type of connection ( GPRS/3G/WiFi )
    94      */
    96      */
    95     IMPORT_C IRQConnectionType identifyConnectionType() const;
    97     IRQConnectionType identifyConnectionType() const;
    96 
    98 
    97     /**
    99     /**
    98      *  Notifies all observers whose network request is active to reissue the request
   100      *  Notifies all observers whose network request is active to reissue the request
    99      */
   101      */
   100     IMPORT_C void notifyActiveNetworkObservers(IRQNetworkEvent aEvent);
   102     void notifyActiveNetworkObservers(IRQNetworkEvent aEvent);
   101 
   103 
   102     /**
   104     /**
   103      *  Indicates if the hand over of network connection has happened
   105      *  Indicates if the hand over of network connection has happened
   104      */
   106      */
   105     IMPORT_C bool isHandlingOverConnection();
   107     bool isHandlingOverConnection();
   106 
   108 
   107     /**
   109     /**
   108      *  Indicates if chooseAccessPoint is called
   110      *  Indicates if chooseAccessPoint is called
   109      */
   111      */
   110     IMPORT_C bool isConnectRequestIssued() const;
   112     bool isConnectRequestIssued() const;
   111     
   113     
   112 signals:
   114 signals:
   113 
   115 
   114     /**
   116     /**
   115      *  Notifies all observers whose network request is active to reissue the request
   117      *  Notifies all observers whose network request is active to reissue the request
   129     /**
   131     /**
   130      *  Notifies the error
   132      *  Notifies the error
   131      */
   133      */
   132     void errorOccured(IRQError aError);
   134     void errorOccured(IRQError aError);
   133 
   135 
   134 private:
   136 private:     
   135     /**
   137     
   136      *  Creates IRQNetworkController instance
       
   137      */
       
   138     static IRQNetworkController* createInstanceL();
       
   139         
       
   140     void constructL();
       
   141 
       
   142     /**
   138     /**
   143      *  Default C++ Constructor
   139      *  Default C++ Constructor
   144      */
   140      */
   145     IRQNetworkController();
   141     IRQNetworkController();
   146 
   142 
   148      *  Default C++ Destructor
   144      *  Default C++ Destructor
   149      */
   145      */
   150     ~IRQNetworkController();
   146     ~IRQNetworkController();
   151 
   147 
   152 private:
   148 private:
   153 
   149     
   154     /**
       
   155      *  IRQNetworkControllerBody instance
       
   156      */
       
   157     IRQNetworkControllerBody* iBody;
       
   158 
       
   159     /**
   150     /**
   160      * Number of objects currently referring to the singleton object IRQNetworkController
   151      * Number of objects currently referring to the singleton object IRQNetworkController
   161      */
   152      */
   162     int iSingletonInstances;
   153     int mRefCount;
       
   154     
       
   155     /**
       
   156      * The instance of IRQStatisticsReporter singleton
       
   157      */
       
   158     static IRQNetworkController *mInstance;
       
   159     
       
   160     /**
       
   161      * Mutex for the thread-safe of openInstance()
       
   162      */
       
   163     static QMutex mMutex;
       
   164         
       
   165     /**
       
   166      *  IRQNetworkControllerPrivate instance
       
   167      */
       
   168     IRQNetworkControllerPrivate* const d_ptr;
       
   169     
       
   170     /**
       
   171      *  The successful mark for initialization of private data
       
   172      */
       
   173     bool mInitPrivateSuccess;
       
   174      
       
   175     Q_DISABLE_COPY(IRQNetworkController)
       
   176     
       
   177     friend class IRQNetworkControllerPrivate;
   163 };
   178 };
   164 
   179 
   165 #endif /* IRQNETWORKCONTROLLER_H_ */
   180 #endif /* IRQNETWORKCONTROLLER_H_ */