|
Development | .NET Compact Framework
Intelligent Applications: Accessing System Information
Written by Rick Winscot
[author's bio]
[read 38818 times]
Edited by Derek
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 isnt 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 wont need to worry about speed.
Segmenting applications, using APIs, 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 didnt 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 arent familiar with eVC dont 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 heres 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]
|