Symbian tips and tricks
From MoDe
| Table of contents |
How to send your application into the background
If you want to hide your application, but want to keep it running, then you can just send it to the background.
In your AppUi class -
TapaTask task(iEikonEnv->WsSession()); task.SetWgId( CEikonEnv::Static()->RootWin().Identifier()); task.SendToBackground();
reference: forum nokia (http://discussion.forum.nokia.com/forum/showthread.php?s=eec02e0c5a449b16ba153ec4c1829e22&threadid=51946&highlight=%2Atapatask%2A)
Bluetooth
Symbian Workshop : Bluetooth Exercise
- Bluetooth exercise materials from Symbian Training event at CSAIL January 2005. This ZIP file includes instructions, Bluetooth Sockets engine and example GUI program.
The instructions "Project Notes.doc" give a step-by-step procedure for integrating Bluetooth messaging into your application.
The Bluetooth Sockets engine provides a dramatically simplified API for Bluetooth Sockets and Discovery. It's based on the btpointtopoint example that is included in the Series 60 SDK's. Communication is one-way between two Symbian devices. Each device must choose either client (initiate connection) or server (listen for connections) role. It has been tested on 3650, N-GAGE, 6600, 7610 and 6630. http://csail.mit.edu/~madler/workshop_bt_s60.zip
Asynchronous Device Inquiry without using cached results
To do any asynchronous I/O, you'll want to subclass CActive.
// Your class should have these member variables. rename them as you see fit. RHostResolver resolver; RSocketServ socketserver; TProtocolDesc protocol_info; TNameEntry discovered_device;
// do all your bluetooth initialization.
// This should probably be done in an initialization member function...
TProtocolName pname;
pname.Append( _L("BTLinkManager") );
User::LeaveIfError(socketserver.FindProtocol(pname, protocol_info));
User::LeaveIfError(resolver.Open(socketserver, protocol_info.iAddrFamily),
protocol_info.iProtocol));
// start the actual inquiry.
InquirySockAddr addr;
addr.SetIAC(KGIAC);
addr.SetAction(KHostResInquiry | KHostResIgnoreCache);
// and whatever other flags you want (e.g. KHostResName)
resolver.GetByAddress(addr, discovered_device, iStatus);
SetActive();
// handle the results. This must be in the RunL() method of the CActive class.
if(iStatus.Int() == KErrNone) {
// do something with discovered_device
...
// now see if there are more devices to be discovered
resolver.next( discovered_device, iStatus);
SetActive();
}
Back to Nokia Series 60
