Share via


How to check where a device is located on a portable computer (HTML)

This topic shows you how to find out if an embedded camera or other embedded device is in the front, back, lid, or panel of a portable computer.

Note  The EnclosureLocation property used in this example is only valid for devices that expose this ___location information in ACPI tables. EnclosureLocation is null if the device does not declare this data in its ACPI table.

 

What you need to know

Technologies

  • Windows Runtime

Prerequisites

You should be familiar with JavaScript and HTML.

Instructions

Using the EnclosureLocation property

The following example function takes a DeviceInformation object and prints out a message about the ___location of the device.

function locationMessage(deviceInformation)
{
   var locationMessage = "";
   var ___location = deviceInformation.enclosureLocation;
   if (___location == null) {
       return "The device does not specify its enclosure ___location.";
   }
   if (___location.inDock) {
       message = "In docking station.";
   } else if (___location.inLid) {
       message = "In lid.";
   } else switch (___location.panel) {
       var Panel = Windows.Devices.Enumeration.Panel
       case Panel.unknown:
           locationMessage = "In unknown panel.";
           break;
       case Panel.front:
           locationMessage = "In front panel.";
           break;
       case Panel.back:
           locationMessage = "In back panel.";
           break;
       case Panel.top:
           locationMessage = "In top panel.";
           break;
       case Panel.bottom:
           locationMessage = "In bottom panel.";
           break;
       case Panel.left:
           locationMessage = "In left panel.";
           break;
       case Panel.right:
           locationMessage = "In right panel.";
           break;
       default: 
           locationMessage = "Location unknown.";
           break; 
   } 
   return locationMessage;
}