Windows Mobile 6 includes a number of new state values, especially in the area of cellular communication. Unfortunately, they're not really documented anywhere yet. Hopefully that'll be remedied at some point but until then, here's the list I've been able to put together.
If you're not familiar with programming with the State and Notifications Broker, checkout these papers.
I've grouped the state values into separate tables based on the way the macros are defined. State values that follow the standard naming of using a common prefix for the root, key, value, and bitmask macros appear in the first table. For the remainder of the macros, each table lists the bitmask macros that all share common root, key, and value macros. I know it seems arbitrary but it's the easiest way I've found to display the values in a reasonably organized list.
The following lists the state values for those new values that follow the standard C/C++ State and Notifications Broker naming practice of the root, key, value, and bitmask macros sharing a common prefix.
Main list of New Windows Mobile 6 State and Notifications Broker state values
|
SystemState Property |
C/C++ Macro Prefix |
Description |
|
BluetoothStateA2DPConnected |
SN_BLUETOOTHSTATEA2DPCONNECTED
|
Gets a value indicating whether Bluetooth Advanced Audio Distribution Profile is connected |
|
BluetoothStateDiscoverable |
SN_BLUETOOTHSTATEDISCOVERABLE |
Gets a value indicating whether Bluetooth is discoverable |
|
BluetoothStateHandsFreeAudio |
SN_BLUETOOTHSTATEHANDSFREEAUDIO
|
Gets a value indicating whether the device is under Bluetooth hands-free audio and control |
|
BluetoothStateHandsFreeControl |
SN_BLUETOOTHSTATEHANDSFERECONTROL
|
Gets a value indicating whether device is under Bluetooth hands-free control - The macros for this value are spelled as shown here, the E and the R in the word FREE are transposed in the macros just as shown here |
|
BluetoothStateHardwarePresent |
SN_BLUETOOTHSTATEHARDWAREPRESENT
|
Gets a value indicating whether Bluetooth hardware is present |
|
BluetoothStatePowerOn |
SN_BLUETOOTHSTATEPOWERON
|
Gets a value indicating whether Bluetooth is powered on |
|
CameraEnabled |
SN_CAMERAENABLED |
Gets a value indicating whether a camera is enabled |
|
ClamshellClosed |
SN_CLAMSHELLCLOSED |
Gets a value indicating whether the clamshell is closed |
|
PhoneTalkingCallStartTime |
SN_PHONETALKINGCALLSTARTTIME |
Gets the time of the current active call in FILETIME format |
|
WiFiStateConnected |
SN_WIFISTATECONNECTED |
Gets a value indicating whether Wi-Fi is connected to a network |
|
WiFiStateConnecting |
SN_WIFISTATECONNECTING |
Gets a value indicating whether Wi-Fi is connecting to a network |
|
WiFiStateHardwarePresent |
SN_WIFISTATEHARDWAREPRESENT |
Gets a value indicating whether Wi-Fi hardware is present |
|
WiFiStateNetworksAvailable |
SN_WIFISTATENETWORKSAVAILABLE |
Gets a value indicating whether Wi-Fi networks are available |
|
WiFiStatePowerOn |
SN_WIFISTATEPOWERON |
Gets a value indicating whether Wi-Fi is powered on |
The following shows the new state values related to cellular system availability. All of the state values in this table are contained in the Cellular System Available registry value under the registry key HKLM\System\State\Phone. All of the bitmask macros are used in conjunction with the SN_CELLSYSTEMAVAILABLE_ROOT, SN_CELLSYSTEMAVAILABLE_PATH, and SN_CELLSYSTEMAVAILABLE_VALUE macros.
New Windows Mobile 6 Cell System Availability Macros
|
SystemState Property |
C/C++ Bitmask Macro Name |
Cellular System |
|
CellularSystemAvailable1xrtt |
SN_CELLSYSTEMAVAILABLE_1XRTT_BITMASK |
1XRTT |
|
CellularSystemAvailableEdge |
SN_CELLSYSTEMAVAILABLE_EDGE_BITMASK |
EDGE |
|
CellularSystemAvailableEvdo |
SN_CELLSYSTEMAVAILABLE_1XEVDO_BITMASK |
1XEVDO |
|
CellularSystemAvailableEvdv |
SN_CELLSYSTEMAVAILABLE_EVDV_BITMASK |
EVDV |
|
CellularSystemAvailableGprs |
SN_CELLSYSTEMAVAILABLE_GPRS_BITMASK |
GPRS |
|
CellularSystemAvailableHsdpa |
SN_CELLSYSTEMAVAILABLE_HSDPA_BITMASK |
HSDPA |
|
CellularSystemAvailableUmts |
SN_CELLSYSTEMAVAILABLE_UMTS_BITMASK |
UMTS |
The following shows the new state values related to cellular system connectivity. All of the state values in this table are contained in the Cellular System Connected registry value under the registry key HKLM\System\State\Phone. All of the bitmask macros are used in conjunction with the SN_CELLSYSTEMCONNECTED_ROOT, SN_CELLSYSTEMCONNECTED_PATH, and SN_CELLSYSTEMCONNECTED_VALUE macros.
New Windows Mobile 6 Cell System Connectivity Macros
|
SystemState Property |
C/C++ Bitmask Macro Name |
Cellular System |
|
CellularSystemConnected1xrtt |
SN_CELLSYSTEMCONNECTED_1XRTT_BITMASK |
1XRTT |
|
CellularSystemConnectedCsd |
SN_CELLSYSTEMCONNECTED_CSD_BITMASK |
CSD |
|
CellularSystemConnectedEdge |
SN_CELLSYSTEMCONNECTED_EDGE_BITMASK |
EDGE |
|
CellularSystemConnectedEvdo |
SN_CELLSYSTEMCONNECTED_1XEVDO_BITMASK |
1XEVDO |
|
CellularSystemConnectedEvdv |
SN_CELLSYSTEMCONNECTED_EVDV_BITMASK |
EVDV |
|
CellularSystemConnectedGprs |
SN_CELLSYSTEMCONNECTED_GPRS_BITMASK |
GPRS |
|
CellularSystemConnectedHsdpa |
SN_CELLSYSTEMCONNECTED_HSDPA_BITMASK |
HSDPA |
|
CellularSystemConnectedUmts |
SN_CELLSYSTEMCONNECTED_UMTS_BITMASK |
UMTS |
The following shows the new state values related to device lock states. All of the state values in this table are contained in the Lock registry value under the registry key HKLM\System\State. All of the bitmask macros are used in conjunction with the SN_LOCK_ROOT, SN_LOCK_PATH, and SN_LOCK_VALUE macros. In addition to exposing properties for each of the individual lock-related state values, the SystemState class also exposes the LockStates property, which returns a LockStates enumeration value for the various device lock states.
New Windows Mobile 6 Device Lock States Macros
|
SystemState Property |
C/C++ Bitmask Macro Name |
Description |
|
DeviceLocked |
SN_LOCK_BITMASK_DEVICELOCKED |
Gets a value indicating whether the device is locked |
|
KeyLocked |
SN_LOCK_BITMASK_KEYLOCKED |
Gets a value indicating whether the keys are locked |
|
LockStates |
Use DeviceLocked, KeyLocked, and SimLocked macros |
Returns a managed enumeration identifying the Device, Key, and SIM locked states |
|
SimLocked |
SN_LOCK_BITMASK_SIMLOCKED |
Gets a value indicating whether the SIM is locked |
The following shows the new state values related to Internet Sharing. All of the state values in this table are contained in the InternetSharing registry value under the registry key HKLM\System\State\Connectivity. All of the bitmask macros are used in conjunction with the SN_INTERNETSHAREING_ROOT, SN_INTERNETSHAREING_PATH, and SN_INTERNETSHAREING_VALUE macros.
Managed developers use the RegistryState class to access the registry value for the Internet Sharing state values because the SystemState class does not expose properties for the Internet Sharing state values. The following code example shows the appropriate RegistryState class constructor call.
RegistryState _internetSharingState;
_internetSharingState = new RegistryState(@"HKEY_LOCAL_MACHINE\System\State\Connectivity", "Value");
To access the individual Internet Sharing state values, convert the RegistryState.CurrentValue property from an object to a uint, and then perform a bitwise-and against the bitmask that corresponds to the state value of interest. The bitmask for each state value is listed in the first column of the table. The following code example demonstrates how to test if Internet Sharing is running.
uint internetSharingRegistryValue = (uint) _internetSharingState.CurrentValue;
bool isRunning = (internetSharingRegistryValue & 0x00000001) > 0;
Note Unlike the other bitmask macros, the bitmask macros for Internet Sharing state values do not contain the word BITMASK in the macro name.
New Windows Mobile 6 Internet Sharing State Macros
|
Bitmask Value |
C/C++ Bitmask Macro Name |
Description |
|
0x00000001 |
SN_INTERNETSHARING_PROCESS_RUNNING |
InternetSharing has successfully been loaded and is ready for use |
|
0x00000002 |
SN_INTERNETSHARING_ENABLED |
InternetSharing data session is currently enabled—this means InternetSharing is either connecting or connected |
|
0x00000004 |
SN_INTERNETSHARING_DATA_CONNECTED |
InternetSharing has a valid cellular data connection |
|
0x00000008 |
SN_INTERNETSHARING_HOST_CONNECTED |
InternetSharing has a valid connection with PC |
|
0x00000010 |
SN_INTERNETSHARING_HOST_USB |
Connection with PC is over USB |
|
0x00000020 |
SN_INTERNETSHARING_HOST_BLUETOOTH |
Connection with PC is over Bluetooth |
Posted
Apr 20 2007, 03:04 PM
by
jim-wilson