如何检测symbian QT中3G数据连接的丢失

时间:2013-07-19 12:37:30

标签: qt symbian

是否有可能检测到我的手机丢失了3G数据连接(不是WIFI)并注册了某种无数据事件以便安排并发送到远程服务器。

我找到了MConnectionMonitorObserver的使用(请参考下面的代码),但我真的不知道应该使用哪种情况来激发所需的事件:它是EConnMonStatusUnattached还是EConnMonStatusSuspended或EConnMonPacketDataUnavailable?

void ConnectionObserver::EventL(const CConnMonEventBase& aEvent )
{
    switch(aEvent.EventType())
    {
        case EConnMonConnectionStatusChange:
        {
            CConnMonConnectionStatusChange* realEvent;
            realEvent = (CConnMonConnectionStatusChange*) &aEvent;
            TInt connectionStatus = realEvent->ConnectionStatus();

            if (connectionStatus == EConnMonStatusNotAvailable)
                return;

            switch(connectionStatus)
            {
                case EConnMonStatusActive:
                    //Connect status is active

                    SaveConnectionEvent("Connected");
                    break;

                case EConnMonStatusUnattached:
                    //Connect status is disconnected

                    SaveConnectionEvent("Disconnected");
                    break;

                case EConnMonStatusAttached:
                    //Connect status is connecting

                    SaveConnectionEvent("Connecting");
                    break;

                case EConnMonStatusSuspended:
                    //Connect status is suspended

                    SaveConnectionEvent("Suspended");
                    break;
            }
        }
        break;

        case EConnMonPacketDataAvailable:
        {
            SaveConnectionEvent("PDPAvailable");
        }
         break;

        case EConnMonPacketDataUnavailable:
        {
            SaveConnectionEvent("PDPUnavailable");
        }
         break;


         default:
            break;
    }
} 

0 个答案:

没有答案