DEVBUZZ Homepage Intelligent Applications: Accessing System Information
 
Web www.devbuzz.com
  HOME PAGE
  All Articles
  Advertise
  Consulting

 Development
  Discuss - Forums
  Still in the box?
  .Compact Framework
  Code Snippets
  SQL Server CE
  Database
  MS Resources
 Stores
  Developer Controls
  Pocket PC Hardware
  Pocket PC Software
  Pocket PC Books
  .NET CF Books
  Book Reviews
  SPB SW Discounts
  RESCO SW Discounts
 DEVBUZZ Info
  About Us
  Help
  Join our email list
  Links & Ratings
  Press & Comments
  Pocket PC version
  Software Reviews
  Hardware Reviews
 Authors
  Authors
  Article Guide
  Competitions
 Resources
  Developers
  Register
  Login

  SPB Discounts!
 Columnists
  Rick Winscot
 Past Blast
  Personal Media Ctr
  Gizmobility
  eVB Legacy
  Old news
  Hosted Software
  Wireless
  Newsletters
  Carl Davis
  Upton Au

 Pocket PC Registry
  Join the registry
  View current list
 Current Poll
Are you converting to .NET Compact Framework?
Yes, it has changed my life!
No, I'm sticking with eVB
.NET CF what's that`?

Current results
3431 votes so far
 Recent Forum Threads [goto forums]

Get Computername
read... (67 hits)


Great aid to development productivity
read... (82 hits)


ThreadingTimer sample code
read... (143 hits)


Multithreading with .NET CF
read... (194 hits)


Moving from eMbedded Visual Basic to Visual Basic .NET
read... (166 hits)


.NET Compact Framework 2.0 Service Pack 2
read... (226 hits)


Transfer Data from SQL Server 2000 to SQL Server Compact Edition
read... (298 hits)


This protocol version is not supported
read... (236 hits)


Converting Lowercase to uppercase wont work
read... (203 hits)


Direct access to MS SQL Server 2000
read... (374 hits)


Creating SDF file in Desktop
read... (513 hits)


Winsock in CF.NET
read... (316 hits)


Using Pocket Outlook to submit HTML page form with MAILTO action
read... (420 hits)


Missing file "System.Data.PocketPC.asmmeta.dll"
read... (268 hits)


HP iPAQ hw6915 Serial Port Issue
read... (309 hits)


Info on the recent forum changes
read... (341 hits)


SqlServer tools from Redgate
read... (383 hits)


Arrow keys and Hardware navigation button
read... (393 hits)


O2 XDA lls pin sync cable to comport
read... (322 hits)


Creating dynamic folders on Pocket PC OS
read... (299 hits)

Custom Windows Mobile software development.
LBS Challenge 2007
LBS Challenge Eight previous NAVTEQ Global LBS Challenge® participants have received venture capital funding and nine past LBS Challenge winners have launched commercial applications on major wireless carriers. Register your non-commercial LBS application in the 2007 NAVTEQ Global LBS Challenge in one of three regions: Americas, Europe-Middle East-Africa (EMEA) or Asia-Pacific(APAC). You could win a share of $2 million in prizes. This could be your year.
Dream. Develop. Win.

Development | .NET Compact Framework

Intelligent Applications: Accessing System Information
Written by Rick Winscot  [author's bio]  [read 38818 times]
Edited by Derek

Download the code   Discuss this article   .NET Compact Framework   

Page 1 

REQUIRES: iPAQ 5000 / 2000 series handheld

Scenario

Your boss asks you to put together a needful database application for field asset management. People will be collecting information in the field, and then synchronizing the data to a central data store. You get to create the application. Easy enough?

The Problem

Many developers approach programming handhelds as if it were a desktop computer plugged into an AC line, on a battery backup, with a Gig of RAM and a 120 MB Raid 0.

The most common problems/complaints you might experience once you roll-out are…

  • “Battery life is terrible!”
  • “There isn’t enough memory!”
  • “The app is to slow!”

Field users suffer from data loss / hardware management issues and as a result - productivity goes down. The answers to these problems are clear…

“Monitor Battery Life”

A good handheld application will periodically monitor battery levels and will warn the user when levels get low. If users are properly warned – data loss due to a dead battery becomes their fault. The truth is, that it is all too common for field personnel to chuck the device in their glove-box, seldom keep it charged, and then complain when they loose data or find out the batteries are dead.

“Leverage Flash Memory”

If battery levels get dangerously low – copy the database to the flash file store or memory card… VOILA!

“Design Handheld Friendly Software”

Keep your requirements in line with your hardware and you won’t need to worry about speed. Segmenting applications, using API’s, and using the right language will mean the difference in performance.

The Solution

Become familiar with and properly manage system information to maximize the potential of your application. Here are a few history tidbits that detail gathering system information over the last few years…

One of the first methods (in eVB on iPAQ series handhelds) was to use the CreateAssetFile.exe application to dump a dat file which contained system information. This didn’t last long, as new OS images excluded CreateAssetFile.exe and included more flexible APIs.

With the introduction of the 3000 series iPAQs, HP (Compaq at the time) decided to include a useful header file which could be used in eVC or wrapped and used in eVB to access system information. The CPQUTIL header gave access to power settings, battery, soft reset and etc. In fact, HP/Compaq indicates that the header file can be used on 3900, 3800, 3700, 3600 and 3100 series devices. Although limited, it does provide the most commonly needed system items.

With the discontinuation of the 3000 series and introduction of the 5000/2000 series HP/Compaq has issued a new and even more feature packed header file. If you aren’t familiar with eVC don’t worry – we got you covered, just keep reading. This header file gives you access to the device serial number, owner, device name, email, company name, main battery level, backup battery level, ac adapter status, WLAN information/settings, Bluetooth information/settings, and the list goes on.

The Application

For those of you who have invested in the 5000/2000 series iPAQ – here’s the Candy and your solution to creating a well behaved application. This VB.NET app shows you how to use the included iPAQAssets.dll to access:

  • GetSerial – for all you GUID junkies
  • GetModel – helpful for multi-model deployment
  • GetCompanyName – from the today screen
  • GetEmail – from the today screen
  • GetOwnerName – from the today screen
  • GetSystemName – yes… your device name
  • GetTelephoneNumber – from the today screen
  • GetMainBatteryLevel – an integer between 0 – 100 (in percent)
  • GetBackupBatteryLevel – an integer between 0 – 100 (in percent)
  • GetAcAdapterPresent – 0 = no adapter / 1 = adapter
  • GetExpansionPack – 0 = no expansion pack / 1 = expansion pack present
  • GetExpansionPackBattery - 0 = no battery on expansion pack / 1 = battery
  • GetExpansionPackBatteryLevel – an integer between 0 – 100 (in percent)
  • GetBacklightOnBatteryLevel – stepping from 0 (off) to 20
  • GetBacklightOnPowerLevel – stepping from 0 (off) to 20
  • SetBacklightOnBatteryLevel – stepping from 0 (off) to 20
  • SetBacklightOnPowerLevel – stepping from 0 (off) to 20
  • GetBlutetoothRadio – 0 = no Bluetooth / 1 = Bluetooth found

The iPAQAssets.dll is essentially a wrapper written in C++ that exposes iPAQUtil.h features to .NET languages via PInvoke. (My primary purpose in this article is to let everyone know about these great features – and their value in your application) I will be following this article with a release of the eVC++ 4.0 source for the dll to help illustrate marshaling techniques, managed / unmanaged code and providing a clear reference for using COM in .NET.

Conclusion

Amazing things can be tied up in little packages! However, it is the responsibility of the developer to ensure stability of the solution and programmatically defend their applications from circumstances that might reduce their effectiveness.

Citius , Altius, Fortius!

Back to .NET Compact Framework | [Article Index]

 

Back to the top of the page.
Chris De Herrera's Windows CE Website Windows CE News & Information Source
Copyright ©2000-2007 by DEVBUZZ.COM, Inc., NJ. USA.MSDEVELOP