×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    115

    Connection Monitor Server API: Using the RConnectionMonitor

    Hi there,

    have you tried this example from the new Technical Library ?
    getting events from MConnectionMonitorObserver
    It seems that the guys haven't even check
    the code for syntax errors...

    the fuction EventL(const CConnMonEventBase &aEvent)
    is never called!

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Well maybe its never called because of a bug in your code?

  3. #3
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    115

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Hi Paul,

    nice answer! but I have only copied the example
    ..so if there is a bug .., then, it is definitely not mine

    have you tried it yet?
    Cheers, Lucca
    Last edited by lucca99; 2007-04-19 at 03:26.

  4. #4
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    What I was suggesting was you post your code

  5. #5
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    115

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Sorry Paul,
    I didn't get your message in the previous post:|

    here we go...
    Code:
    class MyClass : public CActive, private MConnectionMonitorObserver
        {
        private:
        void EventL( const CConnMonEventBase& aEvent );
        private:
    	RConnectionMonitor iMonitor;
        …
        }
    void MyClass::StartSearch()
    {
      User::LeaveIfError( iMonitor.ConnectL() );
      iMonitor.NotifyEventL(*this);
    }
     MyClass::~MyClass()
    {
    // close RConnectionMonitor object when it is not needed any more 
    iMonitor.Close();
    }
    void MyClass::DoCancel()
    {
    iMonitor.CancelNotifications();
    }
    void MyClass::EventL( const CConnMonEventBase& aEvent )
        {
        switch( aEvent.EventType() )
            {
            case EConnMonCreateConnection:
                {
                CConnMonCreateConnection* eventCreate; 
                eventCreate = (CConnMonCreateConnection*)& aEvent
                TUint connectionId = eventCreate->ConnectionId();
                break;
                }
            case EConnMonDeleteConnection:
                {
                CConnMonDeleteConnection* eventDelete; 
                eventDelete = (CConnMonDeleteConnection*)& aEvent
                TUint connectionId  = eventDelete->ConnectionId();
                TUint totalDlVolume = eventDelete->DownlinkData();
                TUint totalUlVolume = eventDelete->UplinkData();
                TBool authDelete    = eventDelete->AuthoritativeDelete();
                break;
                }
            case EConnMonDownlinkDataThreshold:
                {
                CConnMonEventDownlinkDataThreshold *eventDlData;
                eventDlData = (CConnMonEventDownlinkDataThreshold*)& aEvent
                TUint connectionId = eventDlData->ConnectionId();
                TUint dlVolume     = eventDlData->DownlinkData();
                break;
                }
            case EConnMonNetworkRegistrationChange:
                {
                CConnMonNetworkRegistrationChange* eventNwReg;
                eventNwReg = (CConnMonNetworkRegistrationChange*)& aEvent
                // Get id of the network. See. TConnMonBearerId
                TUint bearerId    = eventNwReg->ConnectionId();
                Tint  nwRegStatus = eventNwReg->RegistrationStatus();
                break;
                }
            case EConnMonSNAPsAvailabilityChange:
                {
                CConnMonSNAPsAvailabilityChange* eventSNAPsAvailChange;
                eventSNAPsAvailChange = (CConnMonSNAPsAvailabilityChange*)& aEvent
                // amount of ids, really available on server side
                TUint totalSNAPs(eventSNAPsAvailChange->SNAPsAvailable());
                if(totalSNAPs != eventSNAPsAvailChange->SNAPsAvailability().iCount)
                    {
                    // not all SNAPs Ids have been received
                    // act accordingly to a client’s needs
                    // for example, request SNAP’s ids by using GetPckgAttribute, 
                    // and specifying bigger buffer (exact size of needed buffer 
                    // can be calculated by using totalSNAPs value)
                    }
                // here could be “else” – but this is just an example
                for(TUint i(0);i< eventSNAPsAvailChange->SNAPsAvailability().iCount;++i)
                    {
                    TUint SNAPId(eventSNAPsAvailChange->SNAPsAvailability().iSNAP[i]);
                    // process SNAP’s id		
                    } 
                break;
                }
            default:
            // for future events, unrecognized events must not crash application
            break;
            }
        }
    I've only copied and extended the code in my Application. When I call
    the function StartSearch() nothing changes..

    Thanks for any help!
    Cheers, Lucca

  6. #6
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    115

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Hey Paul,
    I 've managed to receive events but the problem
    now is that I cannot get the appropriate update.

    I basically need to get a package with all available networks
    every time the signal-strength changes by 30% or 40% (for any IAP)
    Do you have an idea how to achieve this ?

    is this enough?
    case EConnMonSignalStrengthChange:
    case EConnMonIapAvailabilityChange:
    case EConnMonNetworkRegistrationChange:
    case EConnMonSNAPsAvailabilityChange:


    and how to get the wlan information out from the event ?

    Many thanks for any help,
    Lucca

  7. #7
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Connection Monitor Server API: Using the RConnectionMonitor


  8. #8
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    115

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Hello Paul,

    I have read this article already 3 times
    and to be honest I got really upset every time

    I would very much appreciate if someone could tell
    how can I use this example:
    Code:
    // defines buffer of size of max. 512 TChars; 
    // client application sets the needed buffer size.
    ConnMonWLANNetworksArrayPckg arr(512);
    
    // make modifiable descriptor
    TPtr ptr(arr.Buf()->Des()); 
    monitor.GetPckgAttribute( EBearerIdAll,  // some parameter	
                              0,             // SubConnection Id
                              KWLANNetworks, // specify the request
                              ptr,			     // buffer for writing data
                              status );
    // after completion, arr is filled with data
    User::WaitForRequest( status );
    TUint pointer(0);
    // amount of array items totally to be transferred
    TUint total(arr.Buf()[pointer++]);
    // amount of actually received items
    TUint count(arr.Buf()[pointer]);
    
    if(total != count)
        {
        // not all data is received
        // act accordingly to a client's needs
        // for example, re-request the same data with bigger buffer size 
        // can be calculated exactly, by using “total” value
        }
    	
    // unpack data to an array
    RConnMonWLANNetworksArray wlanNetworks;
    
    // here buffer will be converted to an array
    arr.UnpackToL(wlanNetworks);
    
    for(TUint i(0); i < wlanNetworks.Count(); ++i)
        {
        TConnMonWLANNetwork net(wlanNetworks[i]);
        // use net here
        }
    
    
    Using GetPckgAttribute for requesting KSNAPsAvailability
    in my Active Object file (*.cpp and *.h)

    Guys please don't get me wrong, bug senteces like this one
    The following events are enabled only when the client has set the threshold that applies to the event:
    EConnMonDownlinkDataThreshold
    EConnMonUplinkDataThreshold
    EConnMonConnectionActivityChange
    EConnMonSignalStrengthChange
    EConnMonBearerAvailabilityChange
    do not help much !!!

    so I am probably suppose to guess that there is something like
    KSignalStrengthThreshold and not just
    KSignalStrength ...


    The signalstrength comming from TPckgBuf<TConnMonNetworkNames> iPkgNetworks is also rubbish!
    It couldnt' be the case that I am sitting on top of my wlan-router
    and I get only 37% ?!? (my laptop is showing 100) and a router from
    my neighbour shows 87% ...

    anyhow.., thank you for your reply.
    Cheers, Lucca

  9. #9
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Are you only looking for wifi or for all bearers (gprs, gsm cdma?)?

  10. #10
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    You should be able to set it using

    SetUintAttribute with the KSignalStrengthThreshold value (defined in rconnmon.h)

    I hav'nt used this API as I am still fininishing off an example using http filters which is even less documented.

    I agree a sample would go a long way to helping some of these issues.


    What don't you specifically understand in the example that you extracted in the previous post?

  11. #11
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    115

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Hi Paul,

    I am actually imterested in getting info about WiFi.
    any time the availability + signal strength of an IAP changes
    I 'd like to receive the following info:

    -wlan-router name
    -SignalStrength (dBm ? how can I change it to a normal %)
    -SecurityMode

    and also AP-MAC address, but this is unfortunately not possible, because
    there is no public API for the ARP-Protocol

    So I have problem initialising
    ConnMonWLANNetworksArrayPckg

    If I create ConnMonWLANNetworksArrayPckg *iArr; in MyClass.h
    and then iArr = new (ELeave) ConnMonWLANNetworksArrayPckg (512);
    in MyClass.cpp the program says (function not suported) when I try to
    run it....
    I have ReadDeviceData LOCALSERVICES USERENVIRONMENT READUSERDATA WRITEUSERDATA NETWORKSERVICES Capability .., and the project is signed ?!

    There are prbably few lines that I don't know how to write down

    Many thanks for any help,
    Lucca

  12. #12
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Try this,

    The WLAN Api in there is probably much easier to use

    http://www.newlc.com/40-New-APIs-for...=profile%20api

  13. #13
    Registered User
    Join Date
    Apr 2007
    Posts
    10

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Quote Originally Posted by Paul.Todd
    Hi,


    I have already read the document posted by Paul, but I still have a problem with catching events.

    My Code:

    Code:
    class MyClass : public CActive, private MConnectionMonitorObserver
        {
        private:
        void EventL( const CConnMonEventBase& aEvent );
        private:
    	RConnectionMonitor iMonitor;
    	TInt iSignal;
        …
        }
    
    
    void  MyClass::Executor()
    {
    	iMonitor.ConnectL();
                 CleanupClosePushL(iMonitor);
    	StartSearch();
    
    	RecordL(iSignal); //<- always iSignal=0 ??
    
    	iMonitor.CancelNotifications();
    	iMonitor.Close();
                 CleanupStack::PopAndDestroy();
    	
    }
    
    void MyClass::StartSearch()
    {
      iMonitor.SetUintAttribute(EBearerIdGSM,0,KSignalStrengthThreshold, 1);
      iMonitor.NotifyEventL(*this);
    }
     
    void MyClass::EventL( const CConnMonEventBase& aEvent )
        {
        switch( aEvent.EventType() )
            {
            case EConnMonSignalStrengthChange:
                {
                	CConnMonSignalStrengthChange *dl_event = (CConnMonSignalStrengthChange *) &aEvent;
          			iSignal = dl_event->SignalStrength();
                break;
                }
            
                }
            default:
            // for future events, unrecognized events must not crash application
            StartSearch();
             break;
            }
        }
    With the above code after executing StartSearch() I always get iSignal=0 Why?? It looks like EventL is never executed.

    Thanks for any help
    Darek

  14. #14
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    115

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Hi Darek,

    you dont have to define the variable iSignal in your *.h file!
    it is already inherited from CActive !

    try to print out some data in void MyClass::EventL( const CConnMonEventBase& aEvent ) .... default: to see whether you'll get any
    events...


    Cheers,
    Lucca
    P.S. it should work...!

  15. #15
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: Connection Monitor Server API: Using the RConnectionMonitor

    Quote Originally Posted by lucca99
    you dont have to define the variable iSignal in your *.h file!
    it is already inherited from CActive !
    Note that you are talking about TRequestStatus iStatus - storing request status, which is obviously not TInt iSignal - which stores the Receive Signal Strength Indicator in this context.

    DariuSzcz: and some bad news: http://www.forum.nokia.com/document/...s_not_work.htm

Similar Threads

  1. File Connection API question
    By manupeco in forum Mobile Java General
    Replies: 2
    Last Post: 2007-01-27, 19:12
  2. Problem MMC+USB Connection
    By Fede81 in forum General Development Questions
    Replies: 3
    Last Post: 2006-07-19, 15:21
  3. Replies: 1
    Last Post: 2003-07-11, 15:10
  4. PC Sync with 6310i and Socket BT Connection Kit
    By sami_laiho in forum Bluetooth Technology
    Replies: 0
    Last Post: 2002-09-17, 05:25
  5. TCP/IP connection with JavaPhone API
    By nkn_motoko in forum Mobile Java General
    Replies: 1
    Last Post: 2001-11-06, 20:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×