About access points, cmwap, proxy settings, WiFi

Source: Internet
Author: User
[J2s-symbian network programming] include commdb. h
Add commdb. lib to the library list of the MPs File

1. enumerate all access points, including GRPS, Bluetooth, and WiFi
ReferenceCodeAs follows:
...
Ccommsdatabase * dB;
Ccommsdbtableview * view;
Tbuf <kcommsdbsvrmaxcolumnnamelength> iapname;
Tuint32 iapid;
Tint result;
// Open Database
DB = ccommsdatabase: newl (edatabasetypeiap );
Cleanupstack: pushl (db );
View = DB-> opentablelc (tptrc (IAP); // IAP is the table name
Result = view-> gotofirstrecord ();
Tint ncount = 0;
While (result = kerrnone) & (ncount <30 ))
{
View-> readtextl (tptrc (commdb_name), iapname );
View-> readuintl (tptrc (commdb_id), iapid );
Additem (iapname );
Ncount;
Result = view-> gotonextrecord ();
}
Cleanupstack: popanddestroy (2 );
...

2. enable the user to query the connection information after selecting the access point, including distinguishing GRPS, Wi-Fi, and proxy information.
Reference code:
...
M_bisgrps = etrue;
Proxy. Zero ();
Port = 0;

Tint result = kerrnone;
Tbool Bok = efalse;
// 1.is GRPS?

Ccommsdatabase * DB = ccommsdatabase: newl (edatabasetypeiap );
Tuint32 id = 0;
Tbuf <kcommsdbsvrmaxcolumnnamelength> iapname;
Tuint32 iapservice;
Tbuf <kcommsdbsvrmaxcolumnnamelength> servicetype;
Ccommsdbtableview * view = DB-> opentablelc (tptrc (IAP); // IAP is the table name
Result = view-> gotofirstrecord ();
While (result = kerrnone)
{
View-> readuintl (tptrc (commdb_id), ID );
View-> readtextl (tptrc (commdb_name), iapname );
View-> readuintl (tptrc (iap_service), iapservice );
View-> readtextl (tptrc (iap_service_type), servicetype );
If (IAP = ID)
{

If (0 = servicetype. Compare (tptrc (outgoing_gprs )))
{
M_bisgrps = etrue;
}
Else
{
M_bisgrps = efalse;
}
Bok = etrue;
Break;
}
Result = view-> gotonextrecord ();
}
Cleanupstack: popanddestroy ();
If (! Bok)
{
Return kerrnotfound;
}
// 2.get proxy
Ccommsdatabase * commsdb = ccommsdatabase: newl (edatabasetypeiap );
Ccommsdbtableview * commsview = commsdb-> openviewonproxyrecordlc (iapservice, servicetype );
Result = commsview-> gotofirstrecord ();
If (kerrnone! = Result)
{
Cleanupstack: popanddestroy ();
Return kerrnotfound;
}
Tbool proxyenabled (efalse );
Commsview-> readbooll (tptrc (proxy_use_proxy_server), proxyenabled );
If (! Proxyenabled)
{
Cleanupstack: popanddestroy ();
Return kerrnotfound;
}
Proxy. Copy (* commsview-> readlongtextlc (tptrc (proxy_server_name )));
Commsview-> readuintl (tptrc (proxy_port_number), Port );
Cleanupstack: popanddestroy (2 );
...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.