Symbian OS<br />Communication and Messaging<br />1<br />Andreas Jakl, 2008<br />v2.0a – 19 June 2008<br />
Disclaimer<br />These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS...
Contents<br />Communication overview<br />Sockets<br />HTTP<br />Serialcommunication<br />Infrared/ Bluetooth<br />Messagi...
Overview<br />Countlesspossibilities …<br />Andreas Jakl, 2008<br />4<br />
Communication<br />Andreas Jakl, 2008<br />5<br />Serial communicationframework<br />TCP/IP Stack<br />HTTP transportframe...
Basic Architecture<br />Many requirements:<br />Hardware: IR present?, Bluetooth?<br />Operator: TCP/IP supported?, MMS?<b...
Communications Servers<br />Most are implemented as Servers (Client/Server!)<br />Four communication servers:<br />Sockets...
Sockets<br />Communicationusing<br />Andreas Jakl, 2008<br />8<br />
Sockets<br />Socket<br />Logical communication endpoint between 2+ software processes<br />Communication<br />Peer-to-Peer...
Characteristics<br />Communication Domain<br />Address family / format of the socket<br />e.g. internet socket (KAfInet): ...
Connection<br />Connection-oriented – “reliable”<br />First establishes end-to-end-connection, then sends data<br />Connec...
Symbian OS Sockets<br />C++ Socket Framework <br />Similar to BSD C-based socket API<br />Transport-Independent<br />Allow...
Sockets Framework<br />Sockets Server (esock.exe)<br />Provides end-to-end communication<br />Protocols supplied by plug-i...
Sockets – Structure<br />Andreas Jakl, 2008<br />14<br />myApp.exe<br />Calling client<br />Client interface for theSocket...
Important Components<br />RSocketServ<br />Creates a session with the socket server<br />Communication channel to the sock...
Stepsfor TCP/IP<br />Create a connectiontotheSocket Server<br />(Check protocols)*<br />(Choose Internet Access Point)*<br...
RSocketServ<br />Communicates with the socket server<br />Used for:<br />Establishing subsessions for RSocket & RHostResol...
RHostResolver<br />Generic interface for protocol-specific host-resolution services<br />Example:<br />IP address 81.89.14...
RSocket<br />Endpoint for socket-based communication<br />Each instantiated object represents a single socket<br />Allows:...
Socket Lifecycle<br />Andreas Jakl, 2008<br />20<br />Start<br />Closed<br />Open(RSocketServ&)<br />Open(RSocketServ&, .....
Using Symbian OS Sockets<br />General overview<br />Andreas Jakl, 2008<br />21<br />
Active Connection* – Initialization<br />Connect to the socket server<br />RSocketServ::Connect()<br />Socket server neede...
Configuring & Connecting<br />Assign a local address to a connectionless socket<br />RSocket::Open()<br />RSocket::Bind()<...
Reading<br />Receive data + address of the sending endpoint<br />RSocket::RecvFrom()<br />Connectionless<br />Asynchronous...
Writing<br />Always needs the address of the end point<br />RSocket::SendTo()Parameters: target address, buffer to send, f...
Closing<br />Recommended: Cancel pending requests<br />RSocket::CancelAll()<br />Close synchronously (releases all resourc...
Additional Details<br />More about sockets:<br />Andreas Jakl, 2008<br />27<br />
Socket Type<br />Andreas Jakl, 2008<br />28<br />RSocket::Open(RSockServ&, addrFamily, sockType, protocol)<br />
Send / Receive Data<br />Each task is an asynchronous process<br />Callback (Success?) in RunL()<br />Send:<br />iSocket.W...
Secure Sockets<br />Symbian OS supportsclient-sideofSSLandTLS<br />Implementation:<br />Create connectionasalwaysusingRSoc...
S60 Sockets Example<br />Andreas Jakl, 2008<br />31<br />C:Symbian8.1aS60_2nd_FP3Series60Exsockets<br />
HTTP-API<br />Web-communication<br />Andreas Jakl, 2008<br />32<br />
HTTP<br />HTTP Client API since Symbian OS v7.0<br />S60 implements HTTP 1.1 compatiblestack<br />Framework forhandlingTCP...
HTTP – Overview<br />Andreas Jakl, 2008<br />34<br />SessionCommunicationsettings<br />…<br />TransactionHandling of messa...
HTTP – Session<br />Defines Settings for communication<br />HTTP protocol, encoding and transport (Proxy, …)<br />Contains...
HTTP – Transaction<br />Defines exchange of messages between client / server<br />Advanced functionality:<br />Can be infl...
Procedure<br />Set up Session (RHTTPSession)<br />When using standard protocol: no additional parameters<br />Create Trans...
Messages – Request<br />Header (RHTTPHeaders)<br />Information about transaction, message or client/server itself<br />Usu...
Messages<br />Andreas Jakl, 2008<br />39<br />RHTTPHeaders<br />RHTTPMessageGetHeaderCollection()Body()<br />MHTTPDataSupp...
Procedure (Continued)<br />Send Request (iTransaction.SubmitL())<br />Asynchronous processing implemented in Symbian OS HT...
Procedure – Finish<br />Process response (RHTTPResponse, equivalent to RHTTPRequest-Message)<br />Several call-backs sent:...
Cleanup<br />(if necessary) Cancel transaction<br />iTransaction.Cancel() – cancel active transaction<br />iTransaction.Cl...
Serial Communication<br />Basics of …<br />Andreas Jakl, 2008<br />43<br />
Overview – Serial Comm.<br />Low-Level, Point-to-Point Technology<br />Managed by the Serial Communications Server (C32)<b...
Serial Connections<br />Load serial device drivers<br />Start Comms-Server<br />Connect to Comms-Server<br />Load Comms-Mo...
Infrarot, Bluetooth<br />Wirelesscommunication<br />Andreas Jakl, 2008<br />46<br />
Comparison: IrDA vs. Bluetooth<br />Andreas Jakl, 2008<br />47<br />
Useable through IrDA Sockets API or IrDA Serial API<br />Server<br />Protocols<br />Services<br />Infrared<br />Andreas Ja...
Infrared – Protocols<br />IrCOMM (Serial)<br />IR-Connection = Emulated RS-232 Connection<br />TinyTP (Sockets)<br />Relia...
Bluetooth<br />Bluetooth-Support through Socket Server Plug-in<br />Allows using standard Socket APIs<br />Point-to-Point ...
BT Host (SW)<br />Bluetooth-Stack<br />Andreas Jakl, 2008<br />51<br />Radio Frequency Comm.<br />Emulates RS-232 through ...
Access to Session Discovery Protocol<br />Architecture<br />Andreas Jakl, 2008<br />52<br />Set security requirements (aut...
Bluetooth – Sockets, Security<br />Access through Socket classes (e.g. RSocket)<br />Specialised extensions, e.g.:<br />TB...
Bluetooth – Services<br />BT Session Discovery Protocol (SDP) through 2 APIs:<br />BT Service Discovery Agent:Allows the u...
Bluetooth – Serial, OBEX<br />Serial Communication<br />Plugin of the Serial Server<br />Only for outgoing connections (in...
Messaging<br />SMS, MMS, Email<br />Andreas Jakl, 2008<br />56<br />
Messaging<br />Framework for Multi-Protocol-Messaging<br />Plug-ins for individual protocols (MTM)<br />Message Server<br ...
Root<br />Services<br />Message Server – Architecture<br />Andreas Jakl, 2008<br />58<br />Root<br />…<br />Mail Service<b...
Entries – Architecture<br />Andreas Jakl, 2008<br />59<br />CMsvEntryEntry handler<br />Represents a node in the message s...
MTMs<br />Protocol Plug-Ins for the Message Server<br />Handle lower level communication (TCP/IP, …)<br />Offer two APIs: ...
RSendAs: Generic, simplified creation of messages<br />CSendUi / ...: Provide UI for creating, editing and sending<br />MT...
Working with Messages [1]<br />Several options available<br />Choose depending on required complexity:<br />Direct use of ...
Working with Messages [2]<br />SendAs-API (RSendAs):<br />Simplifies creating messages<br />Limited subset of MTM function...
Sending an SMS with SendAs<br />Andreas Jakl, 2008<br />64<br />#include &lt;smut.h&gt;	// for KUidMsgTypeSMS<br />#includ...
Send SMS (MTM) [1]<br />Establish session to the MessageServer<br />Create Client MTM Registry<br />Use this for creating ...
Send SMS (MTM) [2]<br />Validate (optional) – Check if message conforms to message type<br />Set SMS Service Center number...
MMS<br />Andreas Jakl, 2008<br />67<br />MMS application<br />MMS server (Message type module)<br />Symbian OS Message Ser...
Telephony<br />The interfacetothecellularnetworkfunctionality<br />Andreas Jakl, 2008<br />68<br />
Cellular Network Access<br />Data-centric<br />Apps usually use higher level APIs (ESock, RConnection, RSocket, ...)<br />...
Other uses of the ETel API<br />Monitoring cell ID<br />e.g. for location based games (The Journey)<br />Is the user roami...
Telephony<br />Architecture similar to Socket or Comms-Server<br />Generic API<br />Server-side: Plug-in modules (TSY) tha...
Example – Making a Call<br />Andreas Jakl, 2008<br />72<br />#include &lt;Etel3rdParty.h&gt;<br />classCCallDialer : publi...
Example – Making a Call<br />Andreas Jakl, 2008<br />73<br />voidCCallDialer::DialL( constTDesC& aNumber)<br />	{<br />	Ca...
Telephony – Architecture<br />CTelephony provides a simple interface<br />More direct control (Session RTelServer, Subsess...
Other Services<br />Symbian OS 9 supports several other protocols and services:<br />Web Services / XML<br />SIP (Session ...
Thanks for your attention<br />That’s it!<br />Andreas Jakl, 2008<br />76<br />
Nächste SlideShare
Wird geladen in …5
×

Symbian OS - Communication And Messaging

4.338 Aufrufe
4.172 Aufrufe

Veröffentlicht am

Communication services are an integral aspect for mobile devices. This course gives an high-level overview of the different available options on how a mobile phone can get in contact with other electronic devices.

Contents

* Communication overview
* Sockets
* HTTP
* Serial communication
* Infrared / Bluetooth
* Messaging
* Telephony

Veröffentlicht in: Technologie
2 Kommentare
3 Gefällt mir
Statistik
Notizen
  • Very nice presenation ,but how can i can download that for offline read
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • nice presentation, but cannot download for offline study which would have been great.
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
Keine Downloads
Aufrufe
Aufrufe insgesamt
4.338
Auf SlideShare
0
Aus Einbettungen
0
Anzahl an Einbettungen
49
Aktionen
Geteilt
0
Downloads
0
Kommentare
2
Gefällt mir
3
Einbettungen 0
Keine Einbettungen

Keine Notizen für die Folie

Symbian OS - Communication And Messaging

  1. 1. Symbian OS<br />Communication and Messaging<br />1<br />Andreas Jakl, 2008<br />v2.0a – 19 June 2008<br />
  2. 2. Disclaimer<br />These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria ( http://www.fh-hagenberg.at/ )<br />Respecting the copyright laws, you are allowed to use them:<br />for your own, personal, non-commercial use<br />in the academic environment<br />In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at<br />The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials.<br />Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006. <br />Andreas Jakl, 2008<br />2<br />
  3. 3. Contents<br />Communication overview<br />Sockets<br />HTTP<br />Serialcommunication<br />Infrared/ Bluetooth<br />Messaging<br />Telephony<br />Andreas Jakl, 2008<br />3<br />
  4. 4. Overview<br />Countlesspossibilities …<br />Andreas Jakl, 2008<br />4<br />
  5. 5. Communication<br />Andreas Jakl, 2008<br />5<br />Serial communicationframework<br />TCP/IP Stack<br />HTTP transportframework<br />Sockets framework<br />Telephonyframework<br />(WAP stack)<br />Bluetooth stack<br />Messaging Protocol support (incl. MMS, SMTP, POP3, IMAP)<br />Infrared stack<br />Telnet and FTP engines<br />SMS and EMS stack<br />
  6. 6. Basic Architecture<br />Many requirements:<br />Hardware: IR present?, Bluetooth?<br />Operator: TCP/IP supported?, MMS?<br />…<br /> Four different frameworks(Communications Servers)<br />Plug-in modules implement protocols<br />Example: Socket-Connection with TCPFramework (Comm. Server): protocols through socketsPlug-in module: TCP<br />Andreas Jakl, 2008<br />6<br />
  7. 7. Communications Servers<br />Most are implemented as Servers (Client/Server!)<br />Four communication servers:<br />Sockets: Communication using addressable end points, using protocols like TCP/IP<br />Serial comms: Simple serial communication, using IR or Bluetooth, RS-232 (not supported by S60)<br />Messaging: Send, receive and save messages, using protocols like email or SMS<br />Telephony: Control telephone calls and services<br />Andreas Jakl, 2008<br />7<br />
  8. 8. Sockets<br />Communicationusing<br />Andreas Jakl, 2008<br />8<br />
  9. 9. Sockets<br />Socket<br />Logical communication endpoint between 2+ software processes<br />Communication<br />Peer-to-Peer: Two similar processes communicate<br />Client-Server: Different roles, e.g. web server & browser<br />Can be used for:<br />TCP/IP, Bluetooth, Infrared, USB<br />Andreas Jakl, 2008<br />9<br />
  10. 10. Characteristics<br />Communication Domain<br />Address family / format of the socket<br />e.g. internet socket (KAfInet): address + port number<br />Socket Type<br />Typically:<br />Streaming (connected) – KSockStream<br />Datagram (connectionless) – KSockDatagram<br />Transport Protocol<br />e.g. TCP/IP (KProtocolInetTcp)<br />Andreas Jakl, 2008<br />10<br /> Typical Symbian OS call:<br />iSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp);<br />
  11. 11. Connection<br />Connection-oriented – “reliable”<br />First establishes end-to-end-connection, then sends data<br />Connection is present  can check delivery order, arrival, errors, ...<br />Connectionless – “unreliable”<br />Requires destination address each time data is sent (datagrams)<br />Each received packet is treated independently<br />No guarantees on order, duplication, delivery<br />Andreas Jakl, 2008<br />11<br />
  12. 12. Symbian OS Sockets<br />C++ Socket Framework <br />Similar to BSD C-based socket API<br />Transport-Independent<br />Allows: Internet protocol suite, Bluetooth, USB, IR<br />Lower communication layers handled by communications-server<br />Andreas Jakl, 2008<br />12<br />
  13. 13. Sockets Framework<br />Sockets Server (esock.exe)<br />Provides end-to-end communication<br />Protocols supplied by plug-ins, examples:<br />TCP/IP<br />Bluetooth (L2CAP, RFCOMM)<br />IR (IrDA, IrTinyTP, IrMUX)<br />SMS<br />Protocol modules (PRTs) (un)loaded as required<br />Can contain multiple protocols<br />e.g. TCPIP.PRT contains UDP, TCP, ICMP, IP, DNS<br />Andreas Jakl, 2008<br />13<br />esock.exe<br />tcpip.prt<br />irda.prt<br />
  14. 14. Sockets – Structure<br />Andreas Jakl, 2008<br />14<br />myApp.exe<br />Calling client<br />Client interface for theSocket Server: RSocketServ<br />Socket itself: RSocket<br />Socket-implementation(Client-side)<br />esock.dll<br />Client-Servercommunication (via kernel)<br />Process Boundary<br />esock.exe<br />Socket Server<br />…<br />TCP/IP(tcpip.prt)<br />IrDA(irda.prt)<br />Protocol Modules(Plug-Ins)<br />
  15. 15. Important Components<br />RSocketServ<br />Creates a session with the socket server<br />Communication channel to the socket server<br />RSocket (Subsession of RSocketServ)<br />Every connection to a server needs an RSocket-Subsession<br />RHostResolver (Subsession of RSocketServ)<br />Name resolution services (DNS Lookup)<br />RConnection (Subsession of RSocketServ)<br />Selecting an Internet Access Point<br />Supports Multihoming (several network interfaces active at the same time)<br />If not used by client app: automatic implicit connection<br />TProtocolDesc<br />Query supported socket protocols<br />Andreas Jakl, 2008<br />15<br />RSocketServ<br />RSocket<br />RHostResolver<br />RConnection<br />
  16. 16. Stepsfor TCP/IP<br />Create a connectiontotheSocket Server<br />(Check protocols)*<br />(Choose Internet Access Point)*<br />(Send DNS-Request)*<br />(Close connectionto DNS-Resolver)*<br />OpenTCP Socket<br />Connection request + target IP<br />Data transfer<br />Close socket<br />(Close Connection)*<br />Close Socket Server connection<br />Andreas Jakl, 2008<br />16<br />RSocketServ<br />RSocketServ / TProtocolDesc<br />RConnection<br />RHostResolver<br />Asynchronous<br />RSocket<br />RSocket<br />Asynchronous<br />RSocket<br />Asynchronous<br />RSocket<br />RConnection<br />RSocketServ<br />* optional step<br />
  17. 17. RSocketServ<br />Communicates with the socket server<br />Used for:<br />Establishing subsessions for RSocket & RHostResolver<br />RSocketServ does not send/receive data or establish connections!<br />To use it:<br />Instantiate an object of RSocketServ<br />Establish a session with the socket server: RSocketServ::Connect()<br />Cleanup:<br />RSocketServ::Close() automatically closes all subsessions<br />... but it’s recommended to close sockets first<br />Andreas Jakl, 2008<br />17<br />RSocketServ<br />
  18. 18. RHostResolver<br />Generic interface for protocol-specific host-resolution services<br />Example:<br />IP address 81.89.143.203 hard to remember<br />www.symbian.com is much more pleasant<br />Domain Name System (DNS) translates this<br />Allows:<br />Converting server name to IP address: RHostResolver::GetByName()<br />Getting hostname of the local device<br />IR + BT: Discover other devices in range<br />Generic interface – available methods depend on protocol module!<br />Andreas Jakl, 2008<br />18<br />RHostResolver<br />
  19. 19. RSocket<br />Endpoint for socket-based communication<br />Each instantiated object represents a single socket<br />Allows:<br />Socket opening<br />Active connecting<br />Read / write data from / to a protocol<br />Passive connections (listen/accept-model)<br />Andreas Jakl, 2008<br />19<br />RSocket<br />
  20. 20. Socket Lifecycle<br />Andreas Jakl, 2008<br />20<br />Start<br />Closed<br />Open(RSocketServ&)<br />Open(RSocketServ&, ...)<br />Open<br />Blank<br />CancelConnect()(if reconnectable)<br />Listen()<br />Connect()<br />Listening<br />Connecting<br />CancelConnect()non-reconnectable<br />Accept()<br />Called on listening socket<br />with blank socket parameter<br />Protocol disconnects<br />reconnectable socket<br />Error<br />Connected<br />Shutdown()<br />Protocol disconnects<br />non-reconnectable socket<br />Shutting down<br />Discon-nected<br />RSocket::Close() can be called from any state and will return the socket to the Closed state, cleaning up any resources or outstanding requests.<br />Shutdown(EImmediate)<br />Dead<br />= all operations will return errors. Close() is the only available operation.<br />
  21. 21. Using Symbian OS Sockets<br />General overview<br />Andreas Jakl, 2008<br />21<br />
  22. 22. Active Connection* – Initialization<br />Connect to the socket server<br />RSocketServ::Connect()<br />Socket server needed to create subsessions for RSocket and RHostResolver<br />Andreas Jakl, 2008<br />22<br />Connectionless<br />&<br />Connected<br />* an active connection is initiated by your program.Your program can also wait to receive connections from a peer (“passive connection”)<br />
  23. 23. Configuring & Connecting<br />Assign a local address to a connectionless socket<br />RSocket::Open()<br />RSocket::Bind()<br />Connectionless<br />Configure socket with address of the remote socket  tied together until the end<br />RSocket::Connect() [asynchronous]<br />RSocket::Bind() called automatically (if not done manually)<br />Andreas Jakl, 2008<br />23<br />Connected<br />
  24. 24. Reading<br />Receive data + address of the sending endpoint<br />RSocket::RecvFrom()<br />Connectionless<br />Asynchronous requests.<br />Receive buffers: 8-bit descriptors.Advantage: current & max. length are always known!<br />Complete when data is available:<br />RSocket::RecvOneOrMore()<br />Complete when entire descriptor is filled:<br />RSocket::Recv() – should not be used for TCP<br />Andreas Jakl, 2008<br />24<br />Connected<br />
  25. 25. Writing<br />Always needs the address of the end point<br />RSocket::SendTo()Parameters: target address, buffer to send, flags<br />Connectionless<br />Asynchronous requests.<br />Does not need endpoint because of established connection<br />RSocket::Write() – sends the entire descriptor<br />RSocket::Send() – allows control over amount of data sent & flags<br />Andreas Jakl, 2008<br />25<br />Connected<br />
  26. 26. Closing<br />Recommended: Cancel pending requests<br />RSocket::CancelAll()<br />Close synchronously (releases all resources)<br />RSocket::Close()<br />Connectionless<br />Same as above, but you should disconnect before closing the socket using Close()<br />RSocket::Shutdown() – asynchronous, takes a flag how to close the socket (e.g. EStopInput = Stop socket input and complete when output is stopped)<br />Andreas Jakl, 2008<br />26<br />Connected<br />
  27. 27. Additional Details<br />More about sockets:<br />Andreas Jakl, 2008<br />27<br />
  28. 28. Socket Type<br />Andreas Jakl, 2008<br />28<br />RSocket::Open(RSockServ&, addrFamily, sockType, protocol)<br />
  29. 29. Send / Receive Data<br />Each task is an asynchronous process<br />Callback (Success?) in RunL()<br />Send:<br />iSocket.Write(iWriteBuffer, iStatus);SetActive();<br />Receive:<br />iSocket.RecvOneOrMore(iBuffer, flags, iStatus, iLength);SetActive();<br />Andreas Jakl, 2008<br />29<br />ContaindatasentbyAsynchronous Service Provider after requestcompletition<br />
  30. 30. Secure Sockets<br />Symbian OS supportsclient-sideofSSLandTLS<br />Implementation:<br />Create connectionasalwaysusingRSocket<br />Create CSecureSocketobjectbased on theconnection<br />Transfer datathroughCSecureSocketinstance<br />Andreas Jakl, 2008<br />30<br />
  31. 31. S60 Sockets Example<br />Andreas Jakl, 2008<br />31<br />C:Symbian8.1aS60_2nd_FP3Series60Exsockets<br />
  32. 32. HTTP-API<br />Web-communication<br />Andreas Jakl, 2008<br />32<br />
  33. 33. HTTP<br />HTTP Client API since Symbian OS v7.0<br />S60 implements HTTP 1.1 compatiblestack<br />Framework forhandlingTCP/IP-Communicationwith HTTP servers<br />High-Level API<br />Andreas Jakl, 2008<br />33<br />
  34. 34. HTTP – Overview<br />Andreas Jakl, 2008<br />34<br />SessionCommunicationsettings<br />…<br />TransactionHandling of messages<br />Transaction<br />TransactionsubmitsRequestHeader, Body<br />Server<br />GPRS, UMTS, …<br />Callback(Transaction-Interface)ResponseHeader, Body<br />
  35. 35. HTTP – Session<br />Defines Settings for communication<br />HTTP protocol, encoding and transport (Proxy, …)<br />Contains 1+ Transactions, who share the connection<br />HTTP-terms (GET, User-Agent, …) defined in StringPool<br />HashMap for Strings<br />Application doesn’t have to define strings itself<br /> more efficient, faster comparison, …<br />RStringPoolstrP = iSess.StringPool();RStringF method = strP.StringF(HTTP::EGET, RHTTPSession::GetTable());<br />Andreas Jakl, 2008<br />35<br />
  36. 36. HTTP – Transaction<br />Defines exchange of messages between client / server<br />Advanced functionality:<br />Can be influenced through Filter (MHTTPFilter)<br />Used for caching, automated handling of specific status codes (redirection, authentication, …)<br />Not necessary for standard application<br />Andreas Jakl, 2008<br />36<br />
  37. 37. Procedure<br />Set up Session (RHTTPSession)<br />When using standard protocol: no additional parameters<br />Create Transaction (RHTTPTransaction)<br />Exchange of messages between client and server<br />Most likely: Client request  Server response<br />Open through session<br />Define Request (RHTTPRequest)<br />Set message for the request<br />Contains URI for the request, target for call-back and type of the request (GET, POST)<br />Andreas Jakl, 2008<br />37<br />
  38. 38. Messages – Request<br />Header (RHTTPHeaders)<br />Information about transaction, message or client/server itself<br />Usually defined by the application:<br />UserAgent (e.g. browser name)<br />Accepted content for the response (e.g. „text/*“)<br />Other properties set automatically (Content-Length, Host, …)<br />Body (MHTTPDataSupplier)<br />When using POST: form data<br />Andreas Jakl, 2008<br />38<br />
  39. 39. Messages<br />Andreas Jakl, 2008<br />39<br />RHTTPHeaders<br />RHTTPMessageGetHeaderCollection()Body()<br />MHTTPDataSupplier(Message Body)<br />RHTTPRequestSetMethod()SetURI()<br />RHTTPResponseStatusCode()StatusText()Version()<br />
  40. 40. Procedure (Continued)<br />Send Request (iTransaction.SubmitL())<br />Asynchronous processing implemented in Symbian OS HTTP Stack classes<br />Status callbacks sent to MHFRunL()<br />Most of the time you’ll need to convert from 8bit to 16bit Unicode<br />Andreas Jakl, 2008<br />40<br />
  41. 41. Procedure – Finish<br />Process response (RHTTPResponse, equivalent to RHTTPRequest-Message)<br />Several call-backs sent:<br />EGotResponseHeaders<br />Contains header of server response, e.g.:<br />HTTP/1.1 200 OKContent-Length: 354[…]<br />EGotResponseBodyData (if successful)<br />Called 1..n times, until data is received completely<br />Manually combine fragments to complete response<br />EResponseComplete<br />Called when data is fully received<br />Andreas Jakl, 2008<br />41<br />
  42. 42. Cleanup<br />(if necessary) Cancel transaction<br />iTransaction.Cancel() – cancel active transaction<br />iTransaction.Close() – cancel + free resources of the transaction<br />Close session:<br />iSession.Close() – includes all above options<br />Andreas Jakl, 2008<br />42<br />
  43. 43. Serial Communication<br />Basics of …<br />Andreas Jakl, 2008<br />43<br />
  44. 44. Overview – Serial Comm.<br />Low-Level, Point-to-Point Technology<br />Managed by the Serial Communications Server (C32)<br />Plug-ins for data transfer (called CSY = DLL)<br />Infrared<br />Bluetooth<br />(RS232 – supported by Symbian OS, not by S60)<br />Requires port configuration (Baud-Rate, Parity, …)<br />Andreas Jakl, 2008<br />44<br />
  45. 45. Serial Connections<br />Load serial device drivers<br />Start Comms-Server<br />Connect to Comms-Server<br />Load Comms-Module (CSY – use Ir / Bt?)<br />Open serial port<br />Configure port<br />Read / write data through port<br />Close port<br />Andreas Jakl, 2008<br />45<br />
  46. 46. Infrarot, Bluetooth<br />Wirelesscommunication<br />Andreas Jakl, 2008<br />46<br />
  47. 47. Comparison: IrDA vs. Bluetooth<br />Andreas Jakl, 2008<br />47<br />
  48. 48. Useable through IrDA Sockets API or IrDA Serial API<br />Server<br />Protocols<br />Services<br />Infrared<br />Andreas Jakl, 2008<br />48<br />Application<br />Serial comms server<br />Socket server<br />IrCOMM<br />IrTinyTP<br />IrMUX<br />IrOBEX<br />IrLAN<br />
  49. 49. Infrared – Protocols<br />IrCOMM (Serial)<br />IR-Connection = Emulated RS-232 Connection<br />TinyTP (Sockets)<br />Reliable transport layer, sequential packet delivery<br />IrMUX (Sockets)<br />Equals unreliable datagram connection<br />Andreas Jakl, 2008<br />49<br />
  50. 50. Bluetooth<br />Bluetooth-Support through Socket Server Plug-in<br />Allows using standard Socket APIs<br />Point-to-Point and Multipoint supported<br />S60 3rd Edition+: Bluetooth 1.2<br />Very complex topic …<br />… however, there are many example programs in the SDK!<br />Andreas Jakl, 2008<br />50<br />
  51. 51. BT Host (SW)<br />Bluetooth-Stack<br />Andreas Jakl, 2008<br />51<br />Radio Frequency Comm.<br />Emulates RS-232 through L2CAP protocol.<br />Session Discovery ProtocolAllows searching for other devices and services. Required for setting up communication.<br />RFCOMM protocol<br />SDP<br />L2CAP protocol<br />Logical Link Control And Adaption Protocol<br />Allows detailled control of the connection. Defines type of data transfer.<br />HCI Driver<br />Host Controller InterfaceCommunication with HW<br />Host ControllerTransport Layer<br />BT Host Controller (HW)<br />HCI Firmware<br />Link Manager ProtocolManages behaviour of the wireless connection. Security mechanisms.<br />Link Manager Protocol (LMP)<br />Baseband Link Controller (LC)<br />Bluetooth Radio<br />
  52. 52. Access to Session Discovery Protocol<br />Architecture<br />Andreas Jakl, 2008<br />52<br />Set security requirements (authentication, authorisation, encryption)<br />BT Sockets<br />BT Security Manager<br />Sockets Client<br />BT Service Discovery Agent<br />Client<br />Server<br />Sockets Server<br />BT Service Discovery DB<br />BT Sockets Module<br />Query services from remote device.<br />Get Attributes for specific service.<br />Host Controller Interface<br />
  53. 53. Bluetooth – Sockets, Security<br />Access through Socket classes (e.g. RSocket)<br />Specialised extensions, e.g.:<br />TBTDevAddr: BT device addresses<br />TInquirySocketAddr: For search using RHostResolver<br />BT Security Manager<br />Enables specification of security settings:<br />User authorization, authentication and encryption required for connection?<br />Andreas Jakl, 2008<br />53<br />
  54. 54. Bluetooth – Services<br />BT Session Discovery Protocol (SDP) through 2 APIs:<br />BT Service Discovery Agent:Allows the user to query services and their attributes from remote devices<br />BT Service Discovery Database:Local service can add ist attributes so that it can be found by other devices<br />Andreas Jakl, 2008<br />54<br />
  55. 55. Bluetooth – Serial, OBEX<br />Serial Communication<br />Plugin of the Serial Server<br />Only for outgoing connections (incoming through RFCOMM, using Sockets)<br />For legacy applications and the Serial Port Profile<br />OBEX Protocol (Object Exchange)<br />Exchange objects like vCards or appointments<br />API (CObexClient/CObexServer) for session through Bluetooth or IrDA<br />Andreas Jakl, 2008<br />55<br />
  56. 56. Messaging<br />SMS, MMS, Email<br />Andreas Jakl, 2008<br />56<br />
  57. 57. Messaging<br />Framework for Multi-Protocol-Messaging<br />Plug-ins for individual protocols (MTM)<br />Message Server<br />Manages entries, folders and messages in a hierarchical structure<br />Controls data access<br />Delegates protocol-specific requests to server-side MTMs<br />Access through Session (CMsvSession)<br />Andreas Jakl, 2008<br />57<br />
  58. 58. Root<br />Services<br />Message Server – Architecture<br />Andreas Jakl, 2008<br />58<br />Root<br />…<br />Mail Service<br />SMS Service<br />Local Service<br />Messages andfolders<br />Outbox<br />Sent<br />Drafts<br />Inbox<br />Customfolders ..<br />Sub-folders<br />Messageentry<br />Messageentry<br />Messageentry<br />Attach-ment<br />
  59. 59. Entries – Architecture<br />Andreas Jakl, 2008<br />59<br />CMsvEntryEntry handler<br />Represents a node in the message server hierarchy, provides means to access the current item and to navigate through the tree<br />CMsvStoreEntry Store<br />Stores message body text, headers, …<br />TMsvEntryIndex Entry<br />Generic summary of the message, containing most important info (type, date, size, read/unread, …)<br />TMsvIdEntry ID<br />Unique ID of the entry<br />
  60. 60. MTMs<br />Protocol Plug-Ins for the Message Server<br />Handle lower level communication (TCP/IP, …)<br />Offer two APIs: Server and Client-API<br />Pre-installed for: SMS (EMS), MMS, POP3, IMAP4, SMTP, OBEX, BIO Messaging (vCards, configuration SMS)<br />Additionally available for all MTMs:<br />Simple, generic Client-API<br />User Interface Wrapper classes<br />Extensible: e.g. Flickr MTM example in the “Symbian OS Communications Programming, 2nd Edition”-book (Iain Campbell, John Wiley & Sons, 2007).<br />Andreas Jakl, 2008<br />60<br />
  61. 61. RSendAs: Generic, simplified creation of messages<br />CSendUi / ...: Provide UI for creating, editing and sending<br />MTMs<br />Andreas Jakl, 2008<br />61<br />Application<br />can use either of these APIs,<br />depending on the required functionality<br />Client<br />SMS MTM<br />MMS MTM<br />POP3 MTM<br />IMAP4 MTM<br />SMTP MTM<br />CBaseMTM: Generic interface to operating on message data(Create messages, reply, add/remove address, body, subject, attachments, …)<br />ProcessBoundary<br />Messaging Server<br />Server<br />
  62. 62. Working with Messages [1]<br />Several options available<br />Choose depending on required complexity:<br />Direct use of a specific MTM (e.g. CSmsClientMtm):<br />Allows more control<br />Access to specific, non-generic elements (e.g. number of the SMS Service Center)<br />Generic MTM (CBaseMtm):<br />High-level interface for access to Message Server Entry<br />Defines general access (saving) and individual elements of a message (recipient, subject, text, attachments)<br />Andreas Jakl, 2008<br />62<br />
  63. 63. Working with Messages [2]<br />SendAs-API (RSendAs):<br />Simplifies creating messages<br />Limited subset of MTM functions<br />Wrapper-UI (S60: CSendUi / UIQ: CQikSendAsDialog + CQikSendAsLogic):<br />If message should be created / edited by the user<br />Provides UI controls and command handling for editing messages<br />Andreas Jakl, 2008<br />63<br />
  64. 64. Sending an SMS with SendAs<br />Andreas Jakl, 2008<br />64<br />#include &lt;smut.h&gt; // for KUidMsgTypeSMS<br />#include &lt;sendas2.h&gt;// link against sendas2.lib<br />#include &lt;rsendasmessage.h&gt;<br />_LIT(KSMSRecipient, &quot;+436...&quot;);<br />_LIT(KSMSBodyText, &quot;Welcome to the world of Symbian OS&quot;);<br />// Connect to the SendAs-service<br />RSendAssendAs;<br />User::LeaveIfError(sendAs.Connect());<br />CleanupClosePushL(sendAs);<br />// Create a new message<br />RSendAsMessagesendAsMessage;<br />sendAsMessage.CreateL(sendAs, KUidMsgTypeSMS);<br />CleanupClosePushL(sendAsMessage);<br />// Prepare the message<br />sendAsMessage.AddRecipientL(KSMSRecipient, RSendAsMessage::ESendAsRecipientTo);<br />sendAsMessage.SetBodyTextL(KSMSBodyText);<br />// Send the message<br />// Will display a warning dialog without the required capabilities<br />sendAsMessage.SendMessageAndCloseL();<br />//sendAsMessage.LaunchEditorAndCloseL(); // Display a message editor<br />CleanupStack::PopAndDestroy(2, &sendAs);<br />
  65. 65. Send SMS (MTM) [1]<br />Establish session to the MessageServer<br />Create Client MTM Registry<br />Use this for creating handle to required MTM<br />Create a local index entry with status “in preparation” (TMsvEntry)<br />Construct entry in MessageServer through MTM (CMsvEntry; assigns ID, Store, Folder,…)<br />Add data (text, recipient)<br />Save final message<br />Andreas Jakl, 2008<br />65<br />
  66. 66. Send SMS (MTM) [2]<br />Validate (optional) – Check if message conforms to message type<br />Set SMS Service Center number through MTM settings (specific to SMS, all the other steps are generic!)<br />Switchstatus: “in preparation”  “waiting to be sent”<br />Submit asynch. request to send the message<br />Check return value (RunL(), iStatus)<br />Andreas Jakl, 2008<br />66<br />
  67. 67. MMS<br />Andreas Jakl, 2008<br />67<br />MMS application<br />MMS server (Message type module)<br />Symbian OS Message Server<br />Symbian OS WAP server<br />MMS Client MTM<br />WAP session protocol (WSP)<br />Wireless transaction protocol (WTP)<br />… only those parts are relevant to your application – behind the scenes a lot more stuff is involved!<br />Wireless transaction layer security (WTLS)<br />Wireless datagram protocol (WDP)<br />Symbian OS Socket server<br />Internet protocol (IP)<br />Network interface manager<br />Connection agent<br />Point-to-point protocol (PPP)<br />Symbian OS Telephony server<br />Symbian OS Serial communications server<br />GPRS telephone module<br />Serial protocol module<br />Serial device drivers<br />GSM protocol stack<br />
  68. 68. Telephony<br />The interfacetothecellularnetworkfunctionality<br />Andreas Jakl, 2008<br />68<br />
  69. 69. Cellular Network Access<br />Data-centric<br />Apps usually use higher level APIs (ESock, RConnection, RSocket, ...)<br />Abstracts details of creating connection over cellular network<br />Voice-centric<br />Use telephony subsystem directly<br />Placing outgoing call, answering incoming call, call barring, forwarding, ...<br />VOIP calls not established by ETel (-&gt; SIP / RTP)<br />Andreas Jakl, 2008<br />69<br /><br />
  70. 70. Other uses of the ETel API<br />Monitoring cell ID<br />e.g. for location based games (The Journey)<br />Is the user roaming?<br />Adapt application behavior, e.g. decrease update rate<br />Retrieve IMEI (phone ID) or IMSI (subscriber ID)<br />Lock your application to a specific phone, copy protection<br />Andreas Jakl, 2008<br />70<br />
  71. 71. Telephony<br />Architecture similar to Socket or Comms-Server<br />Generic API<br />Server-side: Plug-in modules (TSY) that allow different hardware without client-side modifications<br />Secure management of multiple (simultaneous) connections through the ETel-Server<br />Andreas Jakl, 2008<br />71<br />
  72. 72. Example – Making a Call<br />Andreas Jakl, 2008<br />72<br />#include &lt;Etel3rdParty.h&gt;<br />classCCallDialer : publicCActive<br /> {<br /> // Omitted construction methods [...]<br />public:<br />// Function for making the initial request<br />voidDialL( constTDesC& aNumber );<br />private:<br />// Handle completion<br />voidRunL();<br />private:<br />CTelephony* iTelephony;<br />CTelephony::TCallIdiCallId;<br /> };<br />#include &quot;CallDialer.h&quot;<br />CCallDialer::CCallDialer() :<br />CActive( EPriorityStandard) // Standard priority<br /> {}<br />voidCCallDialer::ConstructL()<br /> {<br />CActiveScheduler::Add ( this ); // Add to scheduler<br />iTelephony = CTelephony::NewL ();<br /> }<br />CCallDialer::~CCallDialer()<br /> {<br /> Cancel (); // Cancel any request, if outstanding<br />deleteiTelephony;<br /> }<br />voidCCallDialer::DoCancel()<br /> {<br />iTelephony-&gt;CancelAsync ( CTelephony::EDialNewCallCancel);<br /> }<br />
  73. 73. Example – Making a Call<br />Andreas Jakl, 2008<br />73<br />voidCCallDialer::DialL( constTDesC& aNumber)<br /> {<br /> Cancel (); // Cancel any request, just to be sure<br />CTelephony::TTelNumbertelNumber(aNumber);<br /> // Set additional call parameters, e.g. to always send own identity<br />CTelephony::TCallParamsV1 callParams;<br />callParams.iIdRestrict = CTelephony::ESendMyId;<br />CTelephony::TCallParamsV1Pckg callParamsPckg(callParams);<br />// Making a call requires the NetworkServices capability<br />iTelephony-&gt;DialNewCall (iStatus, callParamsPckg, telNumber, iCallId);<br />SetActive ();<br /> }<br />voidCCallDialer::RunL()<br /> {<br />// Handle call dialling completion<br /> // e.g.: iObserver.CallDialedL (iStatus.Int ());<br /> }<br />
  74. 74. Telephony – Architecture<br />CTelephony provides a simple interface<br />More direct control (Session RTelServer, Subsessions for abstractions):<br />RPhone: Represents the device.Inquiry of status and possibilities<br />RLine: Phone can support 1+ lines.Inquiry of status and possibilities<br />RCall: Line can support 0+ Calls.Tasks like dialling a number, waiting for incoming call, hanging up<br />All three subsessions can inform clients about changes<br />Andreas Jakl, 2008<br />74<br />
  75. 75. Other Services<br />Symbian OS 9 supports several other protocols and services:<br />Web Services / XML<br />SIP (Session Initiation Protocol), e.g. IP-Telephony<br />WLAN<br />WCDMA, EDGE<br />...<br />Andreas Jakl, 2008<br />75<br />
  76. 76. Thanks for your attention<br />That’s it!<br />Andreas Jakl, 2008<br />76<br />

×