×

Discussion Board

Results 1 to 3 of 3

Thread: Battery drain

  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    United Kingdom
    Posts
    78

    Battery drain

    Hi,
    I've got an application that acts as a sever accepting clients via bluetooth. I use the follwing code to get the application to accept clients.

    // 1. Connect to the socket server
    RSocketServ socketServ;
    socketServ.Connect();

    _LIT(KL2Cap, "L2CAP");

    // 2. Open a socket
    RSocket listen;
    listen.Open(socketServ;,KL2Cap);

    // 3. Set up address object
    TBTSockAddr addr;
    addr.SetPort(KListeningPSM); //defined elsewhere
    User::LeaveIfError(listen.Bind(addr));

    // 4. Begin to listen
    User::LeaveIfError(listen.Listen(2));

    // 5. Wait for connection
    RSocket accept;
    TRequestStatus status;
    User::LeaveIfError(accept.Open(socketServ));
    listen.Accept(accept,iStatus);
    SetActive();


    The application works fine. The only problem is that battery fails after about 24 hours, even though no one connects. Does any one have any clues as to why the battery could be dying so quickly? If I close the application, the phone lasts several days.

    Thanks in advance!

  2. #2
    Regular Contributor
    Join Date
    Oct 2003
    Location
    Spain
    Posts
    329

    Activate Bluetooth

    The problem is that bluetooth is active. So even if no one connects it will be listening for incoming connections, and this will empty the battery. It is possible to change the moments (frecuency) that BT is listening for other devices, but I think it is not supported on Symbian OS.

    Cheers.

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    United Kingdom
    Posts
    78

    Bluetooth & battery life

    Thanks for the quick response ajsanchez. I realise that activating the Bluetooth module will cause a drain on the battery. However, if I disable my application and enable Bluetooth, the battery lasts for several days. If activate my application, it lasts one day. I am beginning to think that there must be some difference in the way that my application handles connections, compared to they way that the Symbian OS ROM side applications handle them.
    Last edited by a_barbs; 2003-12-01 at 14:52.

Posting Permissions

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