NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices
Showing posts with label Provisioning. Show all posts
Showing posts with label Provisioning. Show all posts

Monday, August 06, 2007

"How To" Series: Configuring Network Adapters with Compact Framework


There was a question in the forums, if there is a way to configure a network adapter automatically - without an user interaction. Using the UI, the user may select "My network card connects to" value for every adapter in the adapters list. It may be changed to point one of the available network destinations like "The Internet" , "Work", etc. So, is there a way to this automatically?

In short the answer is YES! There is a way. We may prepare an OMA Client Provisioning File and pass it to the appropriate configuration provider in Windows Mobile.
An appropriate configuration file would be like this:


<wap-provisioningdoc>
<characteristic type="CM_NetEntries">
<characteristic type="Adapter Name">
<parm name="DestId" value="{A1182988-0D73-439e-87AD-2A5B369F808B}"/>
<parm name="Adapter" value="Qualified Name"/>
</characteristic>
</characteristic>
</wap-provisioningdoc>




This file will bind a network adapter named "Adapter Name"
to the "Work" destination. We have to change the "Adapter Name" value with
the name of the adapter as it is seen in the adapters list. The "Qualified Name" should be changed with the fully qualified name of the adapter - it may be obtained by using the GetAdaptersAddresses routine

If we want to change the destination to "The Internet" , we have to supply different GUID for the DestId parameter. Following network identifiers as configured by default on Windows Mobile:

The Internet: {436EF144-B4FB-4863-A041-8F905A62C572}
Work: {A1182988-0D73-439e-87AD-2A5B369F808B}
WAP Network: {7022E968-5A97-4051-BC1C-C578E2FBA5D9}
Secure WAP Network:{F28D1F74-72BE-4394-A4A7-4E296219390C}
CurrentDTPTNetwork:{A1182988-0D73-439e-87AD-2A5B369F808B}

What we have to do in order to apply this configuration setting?
We have the following options:
1. Preparing the provisioning Xml file , save it as _setup.xml, and place it inside a CAB file. We may "execute" the file on the device, then. Check out this post for details about deploying provisioning files with CABs.
2. We may apply these settings through code(Compact Framework) by using the managed Microsoft.WindowsMobile.Configuration.ConfigurationManager class from Windows Mobile 5 SDK:

string configurationXml = "<wap-provisioningdoc><characteristic type=\"CM_NetEntries\">"+
"<characteristic type=\"Adapter Name\"><parm name=\"DestId\" "+
"value=\"{A1182988-0D73-439e-87AD-2A5B369F808B}\"/><parm name=\"Adapter\" value=\"Qualified Name\" /> "+
"</characteristic></characteristic></wap-provisioningdoc>";
// Load XML
XmlDocument configurationXmlDoc = new XmlDocument();
configurationXmlDoc.LoadXml(configurationXml);
// Send to Configuration Manager
ConfigurationManager.ProcessConfiguration(configurationXmlDoc, false);


Also the unmanaged version DMProcessConfigXML may be used
Check out this post for unmanaged wrapper of DMProcessConfigXML

Links
CM_NetEntries Configuration Service Provider Examples for OMA Client Provisioning
Injecting Provisioning XML into a cab using VS 2005 on the Windows Mobile Blog
DMProcessConfigXML on the Marcus Perryman's WebLog
Windows Mobile Device Management for more configuration options

Friday, July 13, 2007

Windows Mobile Device Management

Developing and deploying a software solution is almost never a single act.
After the solution is deployed, it has to be monitored and continuously updated to meet the ever-changing business environment. So, what we developers do is to utilize existing or implementing a custom strategy for automatic software updating.
However, sometimes the business needs to update not only a particular application, but also changing the application environment (underlying OS for example).
The remote computer management is a common practice(there are a lot of tools) these days. However, the remote management of mobile devices(like PDA-s and smart phones ) is not so common. For example on the Windows platform, we have a Remote Desktop and Terminal Services out of the box. And this is not the case for the Windows Mobile devices (there are third party solutions).
Fortunately, there is a solution for this kind of problems, when dealing with Windows Mobile based devices. The out-of-the-box solution is called Windows Mobile Device Management. Windows Mobile provides infrastructure for remote management based on an industry standards published by Open Mobile Aliance(OMA) . Windows Mobile devices support additional extras as well - not mentioned in the OMA specifications.

The term used in the literature is actually provisioning.

Windows Mobile supports 2 OMA standards for provisioning:

The first one is based on a client-server conversation by using a communication session between the device(client) and a special DM(device management) server. During this conversation the server may query device in order to get data from it and may send provisioning instructions to change particular settings over the device. The communication is based on TCP/IP ,so any TCP/IP capable infrastructure may be used(GPRS,WiFi,...). This post will not talk about this kind of provisioning...

The second one called OMA Client Provisioning is based on deploying(sending) a special xml file on the device ,which contains provisioning instructions. There are various instructions supported by Windows Mobile, which allows for:
- Managing connectivity (GPRS,VPN,WiFi,...) settings of the device
- Managing e-mail accounts in he Pocket Outlook
- Managing Pocket IE favorites
- Managing device registry(adding,modifying and deleting registry keys)
- Managing security settings
... and even more...

The instructions are grouped by functional areas and referred as Configuration Providers. The Configuration Provider actually is the software component, which processes particular type of instructions.
Check out the available configuration providers.

The provisioning files may be delivered to the device throughout the following channels:
  • ROM image
    provisioning files may be deployed in the device's ROM and applied on cold boot.

  • RAPI and ActiveSync
    the rapiconfig.exe is placed in the tools directory of the SDK


  • Deployment as .CAB or .CPF file
    Provisioning files may be packaged in a CAB files and deployed on the device like any other CAB file( ActiveSync,LAN, SD/MMC card, etc)


  • OTA (Over-the-air) Provisioning
    this includes various techniques like DM Server, WAP Push, SMS, E-mail, HTTP(web site download)


  • Custom file delivery and the Windows Mobile Configuration Manager API
    The developers may use the managed WindowsMobile.Configuration.ConfigurationProvider (Part from the Windows Mobile 5 SDK) to "execute" provisioning files. Your application may receive provisioning files through various comm channels( SMS, E-mails, Web Services ,... what ever) and pass them to the configuration provider for execution.
Links
Open Mobile Aliance
OMA DM Provisioning for Windows Mobile
OMA Client Provisioning for Windows Mobile
Configuration providers supported by Windows Mobile
Managing Windows Mobile 5.0