Tss000467
Development partner platform:
S60 2nd edition, s60 2nd Edition FP1, fp2, and fp3
S60 3rd edition, s60 3rd edition FP1
Detailed description
In the following situations, a dialog box is displayed, prompting you to select an access point, for example:
Code:
-Initiating an HTTP connection-downloading a file with Download Manager API-opening a URL in browser control API
You can reuse the current access point. When you open an HTTP link and use the Download Manager API to start downloading a file, you will see this situation. Repeated use can prevent the access point prompt dialog box from appearing twice.
Solution
Mconnectionmonitorobserver is a monitoring class that can monitor Connection events such as generating or deleting a connection or IAP change events. ClientProgramYou must complete its interface to receive Processing notifications.
The steps are as follows:
1) inherit from mconnectionmonitorobserver and complete the eventl () callback method:
Code:
Class cmyhttpengine: Public mconnectionmonitorobserver {... public: // from mconnectionobserver void eventl (constCconmonevenbase& Aconnevent);... private: rconnectionmonitor iconnmon ;};
2) register before allowing users to use an HTTP connection to get Event Notifications:
Code:
Tint err = iconnmon. connectl (); iconnmon. policyeventl (* This );//... Proceed to open HTTP Connection
3) process the received events and check the ID of the active IAP.
Code:
cmyhttpengine: eventl (const cconmonevenbase & aconnevent) {tint event = aconnevent. eventtype (); tuint connid = aconnevent. connectionid (); tuint iapid; trequeststatus status; Switch (event) {Case econnmoncreateconnection: // new connection created {// cast aconnevent to cconnmoncreateconnection if needed iconnmon. getuintattribute (connid, 0, kiapid, iapid, status); // name of AP can be retrieved with // getstringattribute (connid, 0, kiapname ,...) user: waitforrequest (Status); break;} case econnmoncreatesubconnection: // subconnection to an existing AP {tuint subconnid; // cast aconnevent to cconnmoncreatesubconnection if needed const cconnmoncreatesubconnection subconnevent =
(Cconnmoncreatesubconnection) aconnevent;
// There is an error in this sentence. I don't know how to solve it yet.
// Function call '[cconnmoncreatesubconnection].
// Cconnmoncreatesubconnection ({lval} const cconnmoneventbase) 'does not matchSubconnid = subconnevent. subconnectionid (); iconnmon. getuintattribute (connid, subconnid, kiapid, iapid, status); // name of AP can be retrieved with // getstringattribute (connid, subconnid, kiapname ,...) user: waitforrequest (Status); break;} default: break;} // close the monitor when Event Notifications are no longer required // iconnmon. close ();}
We can monitor whether the access point can be accessed, whether it is deleted, and whether its status is changed.
Cconmonevenbase is incorrect. It should beCconnmonevenbase