http://www.siemensjobcam.com/windows-mobile-language-extenders/
The development of Windows Mobile applications
Mobile and compact devices increasingly popular in our society. Each of us is faced with them every day. Certainly, each of us have laptops mobile phone, hand or other high-tech devices.
All these Mobile devices have different platforms. There are those platforms known as Windows MobileMe, iPhone, BlackBerry, Symbian OS, Android, Maemo, OpenMoko etc. They all have different history and the advantages and shortcomings.
Introduction
Platforms like Windows Mobile, BlackBerry, iPhone is 'closed' and rather limited either by their own devices (Blackberry, iPhone) or the complexity of development. Other problems above the platforms is limited API. Even the Java platform for mobile devices has some shortcomings, such as a large number of constraints very different API; dependent device code. Symbian and Windows Mobile Platforms are better from this point to the extent that the widest support device and its API to give more options.
Common problem is that there are a lot of platforms. Talking About OpenSource and for multiple platforms and we must say that they are still developing at this time and not yet widespread.
In this article we will give our attention to the Windows Mobile platform.
Microsoft Company released its first platform for embedded devices at the end of the 90th. In 2002, the Windows CE.NET platform appeared. And while Pocket PCs based on Windows CE 3.0 platform was launched and higher. The development of wireless communication technologies able to combine phone and personal computer. Thus, Pocket PC 2002 Phone Edition supporting standards like GSM, GPRS, Bluetooth and Wireless Network Access SA. Similarly another Device concept of time that was developing was much more similar to the above, but was closer to the phone, then the personal computer. This device was named SmartPhone 2002. fundamental difference between Smartphone and Pocket PC Pocket PC is that it has touch screen, while buttons only Smartphone control. They also had different application areas and different standards and technologies supported.
The Windows Mobile platform most part to smartphones, communicators and small personal devices. Windows CE and Windows platforms are commonly integrated in various industrial equipment.
Now we have Windows Mobile 5 and Windows Mobile 6 and Windows Mobile 7 generations will be released soon. Modern devices based on Windows Mobile Pocket PC, the processors have 500-600 MHz and 64-128 MB of RAM that is no small thing for such devices.
1. Development Tools
There are few models for developing applications for Windows Mobile:
- Win32 API
- MFC
- . NET Compact Framework.
Microsoft Co offers developers all the tools needed for developing applications for PDA, Pocket PC and Smartphone.
Here are some tips on choosing different kind of code.
- Use native code to achieve burst performance, working directly with the hardware, and also minimizing the resource requirements of the system.
- Using managed code to the development of graphical user interface-oriented applications that the main requirements are the development and implementation in terms of the market. Managed code is also good for easy work with Web services.
- Using server code to work with different devices through a single code base, and also whether any stable communication channel with a device is present.
Then are the comments of the current development tools for PDAs, Pocket PCs and Smartphones.
eMbedded Visual C + + 4.0
Microsoft eMbedded Visual C + + 4.0 development environment is designed to create applications for Windows CE devices. NET 4.2 operating system and also (with Update Rollup Service Pack 3) for PDA and Smartphones on the platform of Windows Mobile 2003 Second Edition. The development environment eMbedded Visual C + + 4.0 is good for creating native code for mobile and embedded devices running Windows CE. NET 4.2 OS. It allows developers to perform Just-In-Time debugging for diagnosing unhandled exceptions, Attach-with the process of purification processes extended, and the interaction with an emulator.
Visual Studio. NET and SDP functions
SDP (Smart Device Programming) functions integrated development environment Visual Studio. NET 2003 (2005, 2008) can build applications that use the possibilities of Microsoft. NET Compact Framework platform. So a developer can create mobile data systems, distributed processing, performance, both on stage with online and offline learning. Extensive class library. NET Compact Framework allows application development much faster than with traditional development tools.
Visual Studio. NET to create applications for Pocket PC 2002 devices (with the appropriate SDK) Pocket PC 2003, 2005 and Smartphone 2003, 2005, applying the same tools that are used for developing applications for desktop PCs. Library. NET Compact Framework is installed with Visual Studio. NET. This library is specially developed for devices with limited resources. Developers can also use new languages C # and Visual Basic. NET applications for mobile and embedded devices. They are good at working with Web services and ADO.NET technologies.
ASP Control Elements. NET mobile controls and extend the functionality of SDP. NET Compact Framework platform. Dan opportunities for usability. NET Compact Framework and Visual Studio De NET for web application development for mobile, due to the delivery of data to various mobile devices using ASP.NET technology. This approach allows to create mobile web in a single Visual Studio. NET, which is performed automatically data representation for display on different devices: mobile phones, smartphones, PDA, Pocket PC. The integrated development environment makes it possible to create applications Mobile web by dragging the controls in forms.
ASP.NET does not provide a set of components on a client device. In adapting specific format in the browser you use server-side logic. Information is generated in the formats of wireless markup language (WML), HTML and Compact HTML (cHTML).
Microsoft SQL Server
Microsoft SQL Server Compact Edition (SQL Server CE) is a compact DBMS for development Rapid applications ranging possibilities of working with data from the company due to using mobile devices. SQL Server CE is a tool to facilitate the development of mobile applications with support of SQL syntax and use of the application and API model through the interface that is compatible with SQL Server.
SQL Server CE provides the basic set of functions of relational database, including query optimized controller, support for operations and heterogeneous data types – Claims the requirements of the system resources. Remote access to data and replication by the confluence provide reliable delivery of information bases SQL Server, self-employment possibility with the information and later synchronization with the server. SQL Server CE is good for systems with mobile devices and wireless networks.
DBMS SQL Server CE is developed for integration with. NET Compact Framework using Visual Studio. NET. Simplify development of applications to work with databases on mobile devices and construction. New data from SQL Server CE provider to manage code in the environment Common Language Runtime helps develop applications compliant with self-employment opportunities with information on stages without permanent connection.
Microsoft. NET SqlClient provides API to work for both. NET Framework and applications. NET Compact Framework. For SqlClient common Windows systems with Microsoft SQL Server are used, and SqlServerCe Database Microsoft SQL Server Compact Edition for Compact Framework.
SqlClient namespace is in both versions. So we can interact:
- Using. NET Compact Framework SqlClient for accessing SQL Server from the device to the desktop.
- Using. NET Compact Framework SqlServerCe have access to SQL Server Compact Edition directly on a device.
Working with databases on a device is similar to work on the desktop. To access to SQL Server in the SQL desktop system uses TCP / IP is therefore in this case is not possible to have SQL Server Compact Edition installed on a device.
All of these models are implemented on the desktop. So the experience of its application can be done to develop programs for Windows Mobile. Use Win32 API to quickly get compact code, and can also use it for development of drivers and system components. Use of MFC extensions have API functions, design and development of the interface. And using the Compact Framework at our disposal, well-developed interface, the collection Automatic garbage, XML support and other options. There are also further truncated version – Micro Framework, which has fewer features of the SDK.
After configurations SDK for MS Visual Studio reassembly appearing, and new features for mounting on these platforms. Demand also contains Emularor for software development and testing without physical connection between the device and computer.
For devices based on Windows Mobile has ARM processor units can also compile using other compilers: AVR32, ARM (RealView), GNUARM, IAR Systems.
2. Building Windows Mobile applications Windows Mobile devices using MS Visual Studio. NET
Visual Studio development environment, along with Compact Framework enables development of applications great graphic interface, databases, and file encryption tools, USB, Bluetooth, and wireless network connections and telephony. Everyone these is provided by SDK, as well as libraries and archives of the departure of Platform Builder.
2.1 User Interface
Due to the presence good designer VS SDK and can easily develop graphical user interface for mobile applications, like applications for funds. The only difference is in groups of graphical components for desktop and Windows Mobile. There are also differences between the components of the Smartphone and Pocket PC versions caused by the Pocket PC has a touchscreen and no SmartPhone. Therefore the development of the SmartPhone interface is more complex. One should take into account when developing software for both platforms.
Here we should also mention that software built for Pocket PC does not start in the smartphone platform as the situation Conversely, it is possible – so when a function is called special Smartphone.
It is natural that many of the graphical components, as well as most of full-size functions were carried under the Windows Mobile SDK to reduce the size of the SDK on the side of the device. Only the most necessary elements remained. However, productivity and memory volumes are increasing the number of functions included in the SDK becomes greater. So the difference between Compact Framework 1.0 and 2.0 is huge. Version 1.0 was very limited.
In general, the development of graphical user interface? Framework Ompact in? # Is similar to development of common Win32 application in C #.
It is also possible to develop a graphical interface using the arrangement for providing 3D-engine. They are like GAPI (Game API), OpenGL ES (Embedded Systems), OpenVG (Vector Graphics), and other projects. Certainly, it is rather labor-intensive process to the extent that it is very important to write an optimal code because of the relatively low productivity of mobile devices.
2.2 Communications
To date, mobile devices have a wide range of communication options. They have access to high-speed wireless network using 802.11 WiFi connection. They also use IrDA, Bluetooth and USB host / client functionality. While the use of IrDA is gradually getting less protocols and standards Bluetooth, WiFi, EDGE, GSM, and also use USB quit often.
Microsoft Company provides an API like this:
- ActiveSync API provides functionality for dealing with synchronization services, file filters, etc.
- Bluetooth API that provides functionality for wireless mobile devices and peripherals.
- Connection Manager API is used for automation the connection process, management of network connection. Devices are using Connection Manager to establish the connection and also to report the alleged connection (eg internet).
- Object Exchange (OBEX) API provides functionality for dealing effectively with the protocol, binary compact only suitable for devices with limited possibilities.
- Remote API (RAPI) provides functions for call management and Remote Method on the side of the device. These functions are available: Access to the register, files, databases and various configurations of device from desktop system. The most important option is the remote procedure call when you just call the method 'CeRapiInvoke () "on the desktop, to transmit the name of the DLL to the device side and the name of the function in this DLL and then just call this method.
- Pocket Outlook Object Model API provides functions for working with Pocket Outlook objects. Provides interfaces for synchronization and access to objects: Tasks, Calendar, Contacts.
- Telephony API (TAPI) includes:
- Assisted API
- Extended API
- Phone API
- SIM Manager API
- Short Message Service (SMS) API
- Telephony Service Provider (TSP) API
- Wireless Application Protocol (WAP) API.
Mobile devices also have the opportunity to work with Serial (USB). There are few ports COM in many devices. Normally, 3-5 first is reserved for IrDA, Bluetooth, SerialPort, and others. Other ports are available to users. Some devices have USB host functionality, in other words, are USB On-The-Go (OTG) devices that can serve as both USB host and USB client. For this purpose device should have necessary hardware and software (with device driver).
Device Driver is a driver which is an intermediate layer between the driver Reception and the level of applications. Such factors provides' Stream Interface Driver and contain features such as:
- Xxx_init
- XXX_Open
- XXX_Close
- XXX_Write
- XXX_Read
- XXX_IOControl
Here "XXX" is replaced by ' "Prefix (for example,' COM ',' DSK ').
This prefix register in the register when a driver registers in the system. More details of the interface device drivers can be obtained from MSDN.
Also a developer can use APIs such as not to affect the communication:
- Device Configuration API
- File and Application Management API
- Game API
- Screen Home of the IPA
- HTML Control API
- MIDI API
- Shell API
- Speech Recognizer API
- Vibrate API
- Voice Recorder Control API.
2.3 P / Invoke and native interoperability
As for Compact Framework contains the basic functions complete and methods
Marco have a functionality, such as:
- XML Serialization
- Cryptography
- Security
- Reflection
- Services Interoperability, et al.
Certainly calls Platform Invoke are accessible. For this purpose – and under track – we have the functions and attributes of the System.Runtime.InteropServices namespace and attribute DllImport for the description of the functions called from unmanaged code.
However, the functionality of these methods is limited. Class, for Mariscal has PtrToStructure, GetComInterfaceForObject, Copy () and read () functions, but, for example, there is no role as GetDelegateForFunctionPointer () on it. So it is impossible to marshaling the delegate only. The function is only available GetFunctionPointerForDelegate. If we pass a pointer to the function from managed code that should get your FunctionPointer and transmit only after the unmanaged code to call it back from there. Also we can not pass some objects because Compact Framework can not count sizeof () for some objects. Therefore, we often have to transmit data only Blitable types and arrays of these types (Int, byte, char, but not bool), and transmit and receive classes and structures by IntPtr. Certainly be explained by aspiration to increase performance. It is therefore recommended that the primary types of marshaling and "GCHandle class" for the storage of an object in memory of the process and that this memory 'visible' unmanaged code
Certainly, the performance of P / Invoke calls for the application of C # In C + + DLL is almost two times less than that of method calls between C + + DLL. However, the performance of devices grows and becomes possible to use such calls.
2.4 Debugging
MS Visual Studio enables debugging of applications under
Windows Mobile as well as for applications desktop. We Emulator, Device Emulator Manager and other functions such as breakpoints, threads, panel clocks, etc.
However, to make use of debugging native and managed simultaneously is impossible. Therefore, it is possible to start or C + + or managed. Such is also "Associating the process. " There is the possibility of uniting the processes on the side of the device (or emulator sideways.) ActiveSync is required to facilitate communication between a device and the system is installed with the SDK. An emulator can also be connected to the computer via ActiveSync. We obtain almost complete emulation devices Windows Mobile. Here are SmartPhone and Pocket PC (or Pocket PC Phone Edition) emulators. However, only a Windows Mobile device can be connected to the computer at a time time. Thus, debugging on two devices simultaneously, for example, interact in some way, is quite difficult. Certainly, speaking only purification of applications developed by us, but not on applications and system services. For debugging such we complete construction of the system created Platform Builder through (in recent versions of the Platform Builder with Visual Studio). We can also create our own Visual Studio SDK and platform Windows CE.
An emulator can also emulate the network connection with GSM and GPS support. This makes it possible to test and develop wide range of applications without a physical device in their hands.
Speaking of debugging with IDA should be mentioned that the version 5.1 and has the ability to perform debugging through this interactive disassembler using their plug-in that is installed on a device.
With Option SDK appearance as "implement" appears in the Visual Studio. Now there is "Implement theme" in the context menu of the project, in addition to "build", "Clean", "cleansing". After choosing this theme DLL or EXE built by the current configuration is transmitted to the device. Also featured on the new column configuration where Manager not just "making" in any configuration option is available, but also "implement". Deployment. NET projects carries not only the unit but also the generations that are in it (addiction).
3. Implementation and installation
Developing applications for Windows Mobile is assembly and also create the installation package. To do this concept is not so? Abinet (. Cab) Windows Mobile. This is a common file but is also an installation package (a kind of MSI package). They met through the cabin Wizard (cabwiz.exe) from VisualStudio MS (or a command line). This utility creates "depends on the processor." Cab file. CAB WinCEApplicationManager and begins transmitting a device, so that the user can install the application following the instructions on the device display. It is also possible to create the MSI installation project that includes a CAB file through Visual Studio. This package of construction will begin in the user's computer and then transmit? AB installation on a device to continue the installation process.
Uninstall Manager is not special in the side of the device. You must attach the INI configuration file-a CAB file. This INI file contains settings for managing the process as the installation path, shortcut name to create, minimal OS to install the application and written in special syntax. It is also possible to include its own DLL file in the CAB-file for expanding installation options. This DLL contains functions such as "Installer_AfterInstall", "Installer_BeforeInstall" "Installer_AfterUnInstall", "Installer_BeforeUnInstall" code for these functions are executed on the side of the device at certain times of the installation or the removal process.
In developing the CAB installation can attach files of different resources, build units, add information the registry. They are designated as "Project Output. That's why no need to restart anything after CAB-file creation: lists all the projects included and files in a file and mount.
4. Security Model for Windows Mobile 5 and Windows Mobile 6
The Windows Mobile-based devices to receive, send and analyze information potentially important to be protected by secure applications. To protect the starting device of unknown applications is disabled, access to some API's restricted and in parts is prohibited to change the registration. The units can be marked as trusted and untrusted and the system uses this information to avoid the boot unauthorized applications and limit their access to the system. Also access the system via RAPI (Remote API) through ActiveSync can be restricted. Certificates Security Security of rights is used for units of executable (EXE, DLL) and CAB files.
Protection against threats and risks
Followers options help protect the devices:
- Strict password protection.
- PIN code protection.
- Information devices corrupt suppressed to prevent access to it (WM 6).
- Information devices removed corrupt memory cards to avoid access to it (WM 6).
- Storages and Advanced Encryption Standard encryption for SSL (WM 6).
- Proper use certificates.
- Detection via Bluetooth device can be protected (6 WM Smartphone).
- 2 application layer system starting (one grade and two levels of access).
- There is no support for macros, so viruses can do great damage.
The start of applications is based on permissions. Windows devices Mobile use such models:
- Privileged
- Normal
- Locked
Privileged applications have the wider access. You can access any API, write to the protected areas of registration and have full access to the system.
Most applications have the normal model. They do not have access to the API of confidence and have complete control of the system.
The application can not start at all if it is "locked" state. This means that it is not signed with the appropriate user certificate or banned by the appropriate home system alert.
Analogue situation is with cab files. Executable units with the normal state can begin inside DLL, but then will work normally. But inside the executables units can not start the drives have the normal condition.
Written by Eugene Kordin, Apriorit specialist.
Learn more about the development process Apriorit here.
About the Author