Skip navigation

Tips and Tricks

2 Posts authored by: John Seimer

Some earlier Android builds did not come preloaded with the EMDK runtime and as such this will need to be installed before making use of any of the EMDK features on the device.

 

The runtime can be installed with a simple PC side script that comes as part of the EMDK installation or it can be pushed down to multiple devices at once through an MDM like AirWatch.

 

Since the EMDK runtime installer is packaged as an application and the installer is removed after a successful install, this can create complications for some MDMs that enforce that apps remain installed.  The following steps allow you to add the installer as a managed application in Airwatch and ensure that the install runs only once:

 

1.Add EMDKOSUpdate as a managed application in Airwatch
2.Create a product to install the application only (don’t send the intent to start it)
3.Add a new Files/Actions item to only run the intent for installation: mode=explicit,action=android.intent.action.MAIN,package=com.symbol.emdkosupdater,class=com.symbol.emdkosupdater.MainActivity
4.Create a separate product to run the intent action and list the EMDKOSUpdate application product as a dependency.
5.Activate both products

 

It is key that the dependency be set so that the intent is not fired before the application is installed.  By following these steps the installer application will be installed, and then the intent will be fired to kick off the install.  The device will reboot into recovery, perform the update, remove the installer, and reboot.  After the reboot Airwatch will detect that the app is no longer there and re install it however since the Action only runs once, the install will not be restarted.

Handheld devices in enterprise environments typically don't use a single network connection for communication.  The devices can be connected through wireless LAN, cellular, Bluetooth, and even wired Ethernet.  To add to that, these can be connected independent of each other or all at the same time.  Windows Embedded HH 6.5 allows multiple interfaces to be up simultaneously and will allow the device to have multiple IP addresses.  The Microsoft Connection Manager (http://msdn.microsoft.com/en-us/library/ms849587.aspx) is responsible for handling connection requests from applications and automatically deciding the "least cost" interface to use.  Typically it will prefer wired Ethernet to wireless LAN and wireless LAN to cellular.  This works well in most cases however there can be situations where the best suited connection for the customer is not the "least cost" connection as decided by Connection Manger.  There are also power considerations when dealing with multiple radios.  Leaving all radios active at all times can have a detrimental effect on battery performance with little to no gain.  In this blog I will explain some best practices when dealing with multiple connections and then provide some details on implementation.

 

Suggested Practices

 

  • Control power to radios that aren't needed or aren't in use.  By powering off the radios that you do not want to use, Connection Manager is forced to use only the connection that remains.  This method had the added benefit of saving battery power by turning off radios when they aren't needed.
  • Consider using power notifications to suggest that terminal is in or out of WiFi coverage.  In some situations, devices are out in cellular coverage during the day and are only in WiFi coverage when they are brought back to a central depot to charge following a shift.  In this case a notification that the device is charging could be a good indicator for the application to power on the WiFi radio.
  • Periodically power on the WiFi radio to check if a known network is available.  If no network is available, shut down the radio and increase the time until the next check to prevent frequent power cycles when out of WiFi coverage long periods of time.
  • Use Microsoft's Connection Manager when multiple connections exist.

 

Wireless LAN - Power Control

  • Use Fusion Public API (FAPI) to enable and disable radio power.
  • Call OpenFusionAPI() with COMMAND_MODE.
    • Note: Command mode can only be open by a single application at any given time.  It is recommended only to open command mode for the time necessary to send the command.  Applications should not hold an open command mode context for an extended period to ensure interoperability with other applications.
  • Call CommandFusionAPI()
    • POWER_CONTROL_WLAN_DISABLE_POWER
    • POWER_CONTROL_WLAN_ENABLE_POWER
  • Alternate Method
    • Call DevicePowerNotify(L"WLP1:", D0, 1);
      • D0 - On
      • D4 - Off

 

Wireless LAN - Getting Status

  • Use Fusion public API (FAPI) to get WLAN status
  • Call OpenFusionAPI() with STAT_MODE
  • Call CommandFusionAPI()
  • The following commands provide useful information from the WLAN radio:
    • ADAPTER_INFO_WLAN
    • RF_SIGNAL_STRENGTH_WLAN_GET
    • RF_SIGNAL_QUALITY_WLAN_GET
    • WLAN_ADAPTER_STATISTICS_GET
    • FUSION_DIAG_LOG_SAVE

 

Cellular - Power Management

  • Use Microsoft TAPI commands to Enable/Disable the WAN radio
  • lineSetEquipmentState with:
    • LINEEQUIPSTATE_FULL – On
    • LINEEQUIPSTATE_MINIMUM – Off
  • See WANSample in the Motorola Solutions EMDK for C for more information

 

Cellular - Getting Status

  • The following TAPI calls provide useful information from the WAN radio:
  • lineGetCurrentSystemType – GSM, CDMA, IDEN, etc
    • lineGetRegisterStatus – Registration status (roam, home)
    • lineGetLineDevStatus – Signal strength
  • See WANSample in the Motorola Solutions EMDK for C for more information

 

Bluetooth - Power Management

  • When using the Stonestreet One BT stack, the recommended way to enable/disable Bluetooth is by using the OEMBthSetMode exposed by SS1PWMGR.dll:

          hInstance = LoadLibrary(L"SS1PWMGR.dll");

          // If the lib was found, try and find the OEMBthGetMode/OEMBthSetMode functions

          if(hInstance)

          {

                     pBthGetMode = (int (*)(DWORD *pdwMode))GetProcAddress( hInstance,    L"OEMGetBthPowerState");

                     pBthSetMode = (int (*)(DWORD dwMode))GetProcAddress( hInstance, L"OEMSetBthPowerState");

                     if(pBthGetMode) // be sure to check the ptr before using it

                     {

                         pBthGetMode (&pdwMode);

                     }

                     if(pBthSetMode)

                     {

                         pBthSetMode (dwNewState);

                     }

          };

 

  • Note:  For WM devices, the Microsoft API BthSetMode() will also work

 

Bluetooth - Getting Status (Stonestreet One stack)

  • Use BTExplorer (provisioning) API to enumerate connections:
    • BTPFindFirstConnection
    • BTPFindNextConnection
    • Use BTP_Connection_Query_t structure to filter types of connections to return (Active, All, etc.)

 

  • Returns BTP_Connection_Info_t structure:

typedef struct

{

          BTP_Connection_ID            ConnectionID;

          BD_ADDR_t                            BD_ADDR;

          unsigned int                         RFCOMMPort;

          int                                       LocalCOMPort;

          unsigned char                       MajorVersion;

          unsigned char                       MinorVersion;

          Word_t                                ConnectionAttributes;

          BTP_Profile_Type               ProfileType;

} BTP_Connection_Info_t;

 

Using Microsoft Connection Manager

  • Connection Manager exposes functionality to explicitly request a certain interface be used for the requested connection:
    • ConnMgrMapConRef() will return a destination network GUID when given the name of a network connection (ex. My Connection).
    • Calling ConnMgrEstablishConnectionSync() with the GUID from ConnMgrMapConRef() will ensure the supplied connection path is used even if it is not the “least cost”
  • If a cellular connection had an entry in the "Connections" settings applet, it can be referred to by its name when calling ConnMgrMapConRef.  Other adapters (like WiFi or ethernet) must be added to Connection Manager by means of XML provisioning.  The following example shows how to add a network connection called "Wifi Connection" that will correspond to the Wifi adapter named "NPME\JEDI10_1".  Note that the adapter name will change based on the specific WiFi adapter in the device.  You can use GetAdaptersInfo() to retrieve all of the adapter names in the system.

 

<wap-provisioningdoc>

          <characteristic type="CM_NetEntries">

                    <characteristic type="Wifi Connection">

                              <parm name="DestId" value="{436EF144-B4FB-4863-A041-                                                            8F905A62C572}"/>

                              <parm name="Adapter" value="NPME\JEDI10_1"/>

                    </characteristic>

          </characteristic>

</wap-provisioningdoc>

 

Additional Information

Additional information on using Connection Manager can be found here: http://msdn.microsoft.com/en-us/library/bb840031.aspx .

Filter Blog

By date:
By tag: