×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Question WLan passive usage?

    Hi

    I wonder whether its possible to share/use an already opened WLAN connection/ access point by another app ?
    The scene is like this . my app wants to send data only when user uses a wlan connection . My app does not actively search for one but gets notified when other apps are using and then uses same access point to send my own data

    Br
    Last edited by julie_777; 2012-01-18 at 07:54.

  2. #2
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: WLan passive usage?

    a bit off topic question Is IAPID enough to connect to a wlan?

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: WLan passive usage?

    RConnection::Attach can attach to an already working interface (like WLAN).
    If you know the IAP Id (which means that the access point is already configured in the device), that is enough. RConnection::Start has overloads with TConnPref, where you can specify the IAP Id.
    If you mean that you know the SSID only, it is also possible to configure the access point. Some related Wiki articles: http://www.developer.nokia.com/Commu..._access_points, http://www.developer.nokia.com/Commu...nnect_to_it%3F, http://www.developer.nokia.com/Commu...g_CommsDat_API

  4. #4
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: WLan passive usage?

    And you can use RConnectionMonitor to be notified of WLAN usage. RConnectionMonitor::NotifyEventL will call your implementation of MConnectionMonitorObserver::EventL(const CConnMonEventBase & aConnMonEvent) [pure virtual] ; switch on aEvent.EventType() to match case EConnMonCreateConnection or EConnMonDeleteConnection....
    And in order to obtain:

    1. IAP Id, try or elaborate:
    Code:
    TRequestStatus status;
    TUint iapId;
    iConnMon.GetUintAttribute(aEvent.ConnectionId(),0,KIAPId,iapId,status);
    User::WaitForRequest(status);
    2. bearer type, try or elaborate
    Code:
    TRequestStatus status;
    TInt bearerType;
    iConnMon.GetIntAttribute(aEvent.ConnectionId(),0,KBearer,bearerType,status);
    User::WaitForRequest(status);
    look for EBearerWLAN (other bearer type values defined into rconnmon.h)

    If you use RConnection::Attach, as suggested by wizard, please remember to use RConnection::Close() and not RConnection::Stop(); using Stop(), if you have enough capabs, will stop connection for the other app too...

    regards
    pg

  5. #5
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: WLan passive usage?

    Thanks!!!
    But here I have a doubt regarding the usage of ::Attach (IMPORT_C TInt Attach(const TDesC8 &aConnectionInfo, TConnAttachType aAttachType)
    it needs
    const TDesC8 &aConnectionInfo Identity of the connection to attach to. This is a TPckg<TConnectionInfo>& (possibly obtained from a call to GetConnectionInfo()).

    GetConnectionInfo(TUint aIndex, TDes8 &aConnectionInfo);

    what is this index!! ? Here im trying to a random WLAN access point that came visible. and which might not stay for ever. so I cannot rely on any hardcoded indexes right?

    Or

    If i get the IAP ID is that enough to share the connection ? like make a temp TConnectionInfo with just IAPID and then try to attach ?

  6. #6
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: WLan passive usage?

    Hello,
    RConnectionMonitor has all you need :-)

    Let's say that another application started to use an internet connection (i.e. started to use an access point or IAP); so that your implementation of MConnectionMonitorObserver::EventL(const CConnMonEventBase & aConnMonEvent) has been called, aConnMonEvent.EventType() is equal to EConnMonCreateConnection and with code at #4. you decided that is the right bearer (as per your question EBearerWLAN)

    now you have the two options mentioned by wizard:

    1. use RConnection::Start(TConnPref &aPref);
    TConnPref can be a TCommDbConnPref too, so that you can use TCommDbConnPref::SetIapId();
    and you obtain IapId with code at #4

    2. use RConnection::Attach(const TDesC8 &aConnectionInfo, TConnAttachType aAttachType);
    and in this case you can do something like:

    Code:
    TUint iapId;
    TUint ntwId;
    iConnMonitor.GetUintAttribute(aConnMonEvent.ConnectionId(),0,KIAPId,iapId,status);
    User::WaitForRequest(status);
    iConnMonitor.GetUintAttribute(aConnMonEvent.ConnectionId(),0,KNetworkIdentifier,ntwId,status);
    User::WaitForRequest(status);
    TConnectionInfo connInfo(iapId,ntwId);
    TConnectionInfoBuf connInfoBuf(connInfo);
    iConnection.Attach(connInfoBuf, RConnection::EAttachTypeNormal);
    hope it helps
    regards
    pg

  7. #7
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: WLan passive usage?

    thanks again!! I wonder why I get a painc cbase 44 when i try User::LeaveIfError(iConnectionMonitor.NotifyEventL(*this));!! do i have to make my class an active object to observe Rconnmonitor events?

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: WLan passive usage?

    Do you happen to use multiple threads, or is it a GUI-less code?
    "E32USER-CBase 44 if the thread does not have an installed active scheduler."

  9. #9
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: WLan passive usage?

    I installed an active sch now the panic disappaeared but , who is using active scheduler? is the Rconnmonitor using it internally ?

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: WLan passive usage?

    Yes. In Symbian C++ wherever you see an asynchronous callback (like MConnectionMonitorObserver), there is always an active object somewhere nearby.

  11. #11
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: WLan passive usage?

    I found that the thread that my observer is present has a activescheduler installed so I removed the new activescheduler.
    And it worked well if I use like this
    Treqstatus status;
    iConnMonitor.GetUintAttribute(aConnMonEvent.ConnectionId(),0,KIAPId,iapId,status);
    User::WaitForRequest(status);
    but when i changed it to cactive class then issues strted coming up
    first is cbase 46 !! i have called cactivescheduler add (this).
    (I think the activescheduler created in same thread can be shared, no ned to create a new one in cactive class right?)

  12. #12
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: WLan passive usage?

    Hello,
    if you want to use RConnectionMonitor in an asynchronous way, please see this example (if you haven't find it yet):
    https://www.developer.nokia.com/info..._0_en.zip.html

    regards

  13. #13
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: WLan passive usage?

    well Im using a console app with threads so the scene is different , i wonder whether making a new active-scheduler in same class which has active object.
    But can there be two active schedulers for a single thread? if there are multiple will it cause any problem ?

  14. #14
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: WLan passive usage?

    CActiveScheduler::Install panics if you try that. But there is no need for multiple schedulers in a single thread anyway. A single scheduler can deal with arbitrary amount of active objects, that is why it is called a scheduler.

  15. #15
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: WLan passive usage?

    oops I think I have a missing setactive in one area!

Similar Threads

  1. Passive content SIS through QA - suggestions?
    By proberts in forum [Closed] Publishing to Nokia Store
    Replies: 4
    Last Post: 2009-10-21, 07:06
  2. wlan usage permission by test criteria
    By paipeng in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 1
    Last Post: 2008-11-14, 11:52
  3. Uninstall Passive Content sis??
    By AbuElElla in forum Symbian
    Replies: 2
    Last Post: 2007-08-23, 07:44
  4. how to create passive content
    By tigerbeba in forum Symbian
    Replies: 1
    Last Post: 2005-10-19, 03:56
  5. WLAN usage
    By mpsaarin in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-05-18, 13:32

Posting Permissions

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