Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (779887), страница 19
Текст из файла (страница 19)
The window server also ensures that events suchas key presses, pointer events, and redraw events are routed to the correctapplication for handling.The window server does not enforce any particular UI policy since itscommands are low level – the GUI look is handled by the upper GUIlayers.Above the window server is the UI control framework, which issometimes referred to as CONE (control environment). This is a library ofC++ abstract classes, which communicate directly with the window servervia the client/server IPC channel. The UI control framework provideshigher-level functionality than the window server and is more suitablefor application use. The library contains no concrete controls – upperHIGH-PERFORMANCE GRAPHICS85GUI layers use these base classes to derive their own specific controls.The derived classes need not worry about the details of the client/servercommunication with the window server, since the base classes of the UIcontrol framework handle this.UIKON is the core Symbian OS application framework library.
Whilethe UI control framework contains mainly abstract classes, UIKONprovides a set of concrete controls (e.g., edit boxes, buttons, andtext fields) and event handler classes. These classes are derived fromUI control framework base classes. UIKON also implements classesderived from the application architecture library, which will handle thebasic application framework itself and non-display-related applicationbehavior, such as managing application documents and handling thecommand line.LAF (Look and Feel) is a library that allows the appearance (e.g., sizeand color) of UIKON controls to be changed by a vendor without actuallymodifying any UIKON code. The purpose of LAF is to allow minor lookand feel modifications to occur without needing to derive new controls.While having UIKON plus LAF allows customization to a certainextent, a vendor GUI layer also exists for maximum UI flexibility.
Thisvendor layer consists of C++ classes, which derive from UIKON classesas well as directly from the UI control framework. It can also customizeapplication architecture-oriented behavior.The vendor can also supply their own custom controls to supplementthe existing UIKON controls. For example, UIQ and S60 provide aversion of a date and time editor control, which does not exist as aUIKON control.Applications use classes in the vendor GUI layer as well as from UIKONdirectly to implement the user interface. As mentioned in Chapter 1, avendor’s software platform will have its own SDK with guidelines; applications should follow these guidelines when determining what classes tocall.
In addition to using vendor and UIKON classes, applications cancreate their own custom controls by deriving directly from the UI ControlFramework. Also, there is nothing to prevent user programs from directlycalling the window server when more screen control is desired.3.9 High-Performance GraphicsWhile the GUI framework presented in the last section is fast enough forstandard GUI applications, some applications use graphics more heavilyand require quicker screen response.
One type of application that fallsinto this category is any game with frequent screen updates (such as anaction game). Symbian OS provides several mechanisms for providinghigh-performance graphics, including animation plug-ins and APIs fordirect screen access.86SYMBIAN OS ARCHITECTUREAnimation plug-ins are polymorphic DLLs developed by the application programmer, and plugged directly into the window server. Oncethe animation is started, the animation plug-in executes in the contextof the window server – drawing frames to the desired screen areas atthe specified animation rate.
This avoids having messages sent from theapplication to the window server for drawing each animation frame. Theclient-side animation API provides applications with the capability toinstall animation plug-ins as well as send commands to them.In addition to animation plug-ins, Symbian OS provides APIs fordrawing on the screen directly.
In this manner, low-level drawing primitives (such as drawing a rectangle) can be performed by bypassingthe window server and, again, avoiding client/server IPC messages(although some initial ones are required to coordinate with the windowserver).3.10The Communication ArchitectureCommunication is key to smartphones, and Symbian OS containsan extensive and flexible communication architecture to support it.This section looks at the Symbian OS communications architecture.Chapter 11 will discuss communications in more detail, as you learnto develop communication applications. This section (and Chapter 11)assumes some basic knowledge of network communications.
For moreinformation, see Symbian OS Communications Programming, SecondEdition.Figure 3.8 shows the main components of the Symbian OS communication structure.The communication architecture is a good example of how software isconstructed in Symbian OS. The architecture consists of application-levelDLLs, multiple servers, and subsystem DLLs, which link to the serversand server plug-in modules (which are polymorphic DLLs) to supportdifferent protocols and devices. The overall goal is to provide maximumpower and flexibility for communications support, while at the same timeproviding a common interface, not only to the application but throughoutthe various lower system levels.The following list describes the components of the Symbian communication architecture.•Applications and DLLsApplications use networking API classes in DLLs to access communications features.
As with other application-level DLLs, the communication DLLs hide the details of the underlying architecture. SymbianOS provides a socket-based API that operates in a similar way to theBSD socket API. I will discuss sockets in much more detail (and usethem in programs) in Chapter 11.THE COMMUNICATION ARCHITECTURE87ApplicationsCommunication-specific(e.g., Bluetooth) DLLsSocket Library DLL (esock.dll)Communication DatabaseclientserverThreadboundarySocket Server (esock.exe)NifmanTCP/IP Protocol(tcpip6.prt)Bluetooth Protocol(bt.prt)Other.prtModulesNetwork Interface PPPConnection AgentSerial Communications ServerETEL ServerCSYCSYTSYDataTransferTSYConnectionControlDevice Drivers/HardwareFigure 3.8•Communication ArchitectureCommunication-Specific FunctionalityIn addition to the socket API, there are also APIs specific to certaintypes of communication, such as Bluetooth communication.
A Bluetooth program would call functions from the Bluetooth DLL for device88SYMBIAN OS ARCHITECTUREdiscovery, for example, then use the socket API for the bulk of thedata communications.•Socket ServerThe socket server is a process that implements and manages communication sockets. Applications act as clients to this server throughthe application-level communication DLLs. As with the GUI DLLs,these functions hide the actual client/server communications from thesocket server.•Protocol ModulesThe socket server uses protocol modules for handling the networkdata protocols. These are polymorphic DLLs (PRT files) that implement different communication protocols, while providing a consistentinterface to the socket server. Examples of protocol modules areTCP/IP, Bluetooth, and IR.
New protocol modules can be created andused.Protocol modules are independent of the data-link layer – bringingup the connection and exchanging data with the device is donethrough an abstracted interface. This interface is accomplished withtwo other plug-in modules that attach to the socket server: a networkinterface (which is usually the PPP module) and a connection agent.•Network Interface Manager (Nifman)The socket server with protocol modules uses Nifman to establish theconnection and set up the data path to the data-link level. In order tostart a particular physical connection, Nifman will load a connectionagent.• Connection AgentA connection agent is a polymorphic DLL that is responsible forstarting and stopping the communication connection.
Not only isit responsible for establishing the connection itself (e.g., dialing anumber for GSM or starting GPRS), but it provides information to setup the data communication path between the physical device and thenetwork protocol module. The connection agent will normally useETEL (described further down) to start the connection.•Communication DatabaseA connection agent will consult the communication database todetermine how to establish the network connection.
This databasecontains all the settings applicable to communication connections.Depending on database settings, the connection agent can chooseto start a preferred connection or it may prompt the user to select aconnection. Once the connection is chosen, the agent will extract allTHE COMMUNICATION ARCHITECTURE89the applicable connection parameters from the database to start theconnection.A connection to a network on a Symbian OS smartphone is knownas an Internet Access Point (IAP). An example is a GSM CSD connection using a specific ISP phone number and login information – allstored in the communication database entries for that IAP.•ETEL ServerETEL is a low-level server used to establish a connection with acommunication device. It provides an abstracted telephony API to itsclients, with functions for tasks such as establishing the connection,terminating the connection, and retrieving line status and devicecapabilities.