WAP Stack
Article Metadata
Contents |
Introduction
The WAP Stack uses the client/server framework. A single server provides WAP services which applications access through a client API.WAP server by itself refers to a remote server providing WAP content.The lowest level of the WAP protocol stack, the bearers, are implemented as plug-ins. SMS and IP are the standard bearers. There is no direct API to bearers.
Description
The API has five key concepts: Symbian WAP server, sub-session base class, WSP, and WDP.
Symbian WAP Server
The Symbian WAP server manages client access to WAP services.The client interface to the Symbian WAP server is provided by RWAPServ.
Sub-Session Base Class
The sub-session base class defines operations available on connections in all of WSP, WTP, and WDP. The sub-session base class is provided by RWAPConn.
WSP
WSP (Wireless Session Protocol) is the upper-level application layer of the WAP communications stack. Connection-orientated WSP is provided by RWSPCOConn. Supporting classes are CCapCodec, for capability negotiation, and RWSPCOTrans, which encapsulates an individual transaction. Connectionless WSP is provided by RWSPCLConn
WDP
WDP (Wireless Datagram Protocol) provides a general datagram transport service above the various data capable bearer services. WDP is provided by RWDPConn.
Sample Code
/* in class definition */
RWAPServ server;
RWSPCOConn connection;
RWSPCOTrans transaction;
RWSPCOTrans event_tx;
RWSPCOConn::TEvent event;
/* in Connect() function */
User::LeaveIfError(server.Connect());
_LIT8(headers, "");
iCap = CCapCodec::NewL();
iCap->SetServerSDUSize(MAXSIZE+3000);
iCap->SetClientSDUSize(MAXSIZE+3000);
TBuf8<100> host;
GetGwAddress(host);
TInt port=9201;
User::LeaveIfError(connection.Open(server, host, port, 0, EIP, EFalse));
User::LeaveIfError(connection.Connect(headers, iCap));
connection.GetEvent(event, event_tx, iStatus);
SetActive();
void CWap::GetGwAddress(TDes8& addr)
{
bool found=false;
CCommsDatabase* db;
db=CCommsDatabase::NewL(EDatabaseTypeIAP);
CleanupStack::PushL(db);
CCommsDbTableView *view=db->OpenTableLC(TPtrC(WAP_IP_BEARER));
while (view->GotoNextRecord()==KErrNone) {
TUint32 currid;
view->ReadUintL(TPtrC(WAP_IAP), currid);
if (currid==iIapId) {
found=true;
TBuf<100> tmp;
view->ReadTextL(TPtrC(WAP_GATEWAY_ADDRESS), tmp);
CC()->ConvertFromUnicode(addr, tmp);
break;
}
}
CleanupStack::PopAndDestroy(2); //db, view
if (!found || !addr.Compare(_L8("0.0.0.0")) || addr.Length()==0) {
User::Leave(-1004);
}
}
Download the WAP Stack example from here
Other Related Links
The Wireless Application Protocol


(no comments yet)