MikimotoH on Fri, 14 Sep 2012 10:08:50

I want metro style app Bluetooth Low Energy Health Profiles sample can access Thermometer Health Service installed in Bluetooth Low Energy (LE) Generic Attribute (GATT) Profile Drivers. However, I encountered 80070005 (E_ACCESSDENIED) while Health Profile Metro App trying to access device.

The error is in Thermometer.js. deviceFactory.getDeviceFromIdAsync returns error 80070005 .

            done(function (devices) {
                // If devices were found, proceed with initialization
                if (devices.length > 0) {
                    try {

                        // Use WPD Automation to initialize the device objects
                        var deviceFactory = new ActiveXObject("PortableDeviceAutomation.Factory");

                        var devServiceName = document.getElementById('deviceServiceName' + Constants.thermometerDeviceShortName);
                        devServiceName.innerText = devices[0].name;

                        // For the purpose of this sample we will initialize the first device
                        deviceFactory.getDeviceFromIdAsync(devices[0].id, function (device) {

                            // Initialize the temperature service
                            tempService =[0];

                            // Set up ApplicationActivated to be called asynchronously (fire-and-forget mode)
                            tempService.onApplicationActivatedComplete = function() {};

                            // Set up ApplicationSuspended to be called asynchronously (fire-and-forget mode)
                            tempService.onApplicationSuspendedComplete = function() {};

                            var devs = DeviceData.getDevices();
                            var devId = Constants.thermometerDeviceIndex;
                            devs[devId] = {
                                devId: devId,
                                name: devices[0].name,
                                description: devices[0].id,
                                data: [],
                                handler: function (timestamp, thermometerMeasurementValue) {
                                    try {
                                        var measuredValue = {
                                            timestamp: new Date(timestamp * 1000),
                                            value: thermometerMeasurementValue,
                                            toString: function () {
                                                return this.value + " \u00B0C @ " + this.timestamp;


                                        if (uiVisible) {
                                            UIHelper.updateUI(Constants.thermometerDeviceShortName, Constants.thermometerDeviceIndex, measuredValue);
                                    } catch (exception) {
                                        WinJS.log && WinJS.log(exception.toString(), "sample", "error");

                            tempService.onTemperatureMeasurement = devs[devId].handler;
                            tempInitialized = true;
                            UIHelper.refreshUI(Constants.thermometerDeviceShortName, Constants.thermometerDeviceIndex);

                        }, function (errorCode) {
                            WinJS.log && WinJS.log("Getting the device failed with error: " + errorCode.toString(16), "sample", "error");

                    } catch (exception) {
                        WinJS.log && WinJS.log(exception.toString(), "sample", "error");

I've followed the instructions in Forum post Why access denied (80070005) when I run Metro Simple bluetooth LE Controller using TICC2540 Dev kit in Win8 release preview. I created the Device Metadata Package on my local Win8 64bit Desktop, but I still encounter error 80070005 (E_ACCESSDENIED). 

Are the following values wrong for Bluetooth Low Energy Health Profiles sample ?
I have remove the Bluetooth Low Energy device and reinstall again, and reboot again, but I still has 80070005 error.


Eric Hanson-MSFT on Sat, 15 Sep 2012 01:46:16

Have you enabled test signing and rebooted?

Best Wishes - Eric

MikimotoH on Mon, 17 Sep 2012 02:48:23

I have launched Command Prompt(Admin) console window, run "bcdedit /set testsigning on", and then reboot Win8 Desktop PC. I found "Test Mode" showing in the bottom right corner of desktop.
However I still encounter error 80070005 in
Thermometer.js. deviceFactory.getDeviceFromIdAsync().

Lisa O - MSFT on Thu, 20 Sep 2012 14:18:51

Uncheck the "Access Custom Driver" box in the Device Metadata Authoring Wizard and redeploy the metadata. This box is only intended for custom WDF drivers accessed via IDeviceIoControl.