You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/06/12 03:38:38 UTC
[10/10] git commit: Removed Windows7 which is now in it's own branch.
This closes #29
Removed Windows7 which is now in it's own branch. This closes #29
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/dfb81f0a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/dfb81f0a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/dfb81f0a
Branch: refs/heads/master
Commit: dfb81f0af720dd7f1223e59640d901141a290120
Parents: fcb1f66
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Jun 11 18:38:49 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Jun 11 18:38:49 2014 -0700
----------------------------------------------------------------------
README.md | 53 +-
windows7/Cordova.sln | 20 -
windows7/Cordova/Cordova.vcxproj | 161 -
windows7/Cordova/Cordova.vcxproj.filters | 110 -
windows7/Cordova/accel.c | 251 -
windows7/Cordova/accel.h | 22 -
windows7/Cordova/capture.c | 2334 -
windows7/Cordova/capture.h | 44 -
windows7/Cordova/common.c | 120 -
windows7/Cordova/common.h | 45 -
windows7/Cordova/compass.c | 277 -
windows7/Cordova/compass.h | 23 -
windows7/Cordova/device.c | 147 -
windows7/Cordova/device.h | 27 -
windows7/Cordova/file.c | 1280 -
windows7/Cordova/file.h | 43 -
windows7/Cordova/filetransfer.c | 486 -
windows7/Cordova/filetransfer.h | 22 -
windows7/Cordova/jpeg.cpp | 105 -
windows7/Cordova/jpeg.h | 26 -
windows7/Cordova/json.c | 545 -
windows7/Cordova/json.h | 68 -
windows7/Cordova/lib/js/exec.js | 63 -
windows7/Cordova/lib/js/platform.js | 58 -
windows7/Cordova/lib/js/plugin/win7/SQLError.js | 13 -
windows7/Cordova/lib/js/plugin/win7/device.js | 34 -
.../Cordova/lib/js/plugin/win7/jsHandler.js | 19 -
windows7/Cordova/lib/js/plugin/win7/storage.js | 300 -
windows7/Cordova/lib/sqlite/sqlite3.c | 138243 ----------------
windows7/Cordova/lib/sqlite/sqlite3.h | 7055 -
windows7/Cordova/mp4patch.c | 175 -
windows7/Cordova/mp4patch.h | 22 -
windows7/Cordova/network.c | 108 -
windows7/Cordova/network.h | 22 -
windows7/Cordova/notification.c | 324 -
windows7/Cordova/notification.h | 22 -
windows7/Cordova/platform.c | 49 -
windows7/Cordova/platform.h | 24 -
windows7/Cordova/resource.h | 37 -
windows7/Cordova/resource.rc | 40 -
windows7/Cordova/shell.c | 1471 -
windows7/Cordova/shell.h | 61 -
windows7/Cordova/storage.c | 384 -
windows7/Cordova/storage.h | 22 -
windows7/Cordova/toolbar.bmp | Bin 1558 -> 0 bytes
windows7/Cordova/www/accel_game.css | 23 -
windows7/Cordova/www/accel_game.html | 27 -
windows7/Cordova/www/accel_game.js | 165 -
windows7/Cordova/www/capture.html | 34 -
windows7/Cordova/www/cordova.win7.js | 5322 -
windows7/Cordova/www/device.html | 15 -
windows7/Cordova/www/events.html | 16 -
windows7/Cordova/www/file.html | 28 -
windows7/Cordova/www/index.html | 17 -
windows7/Cordova/www/network.html | 15 -
windows7/Cordova/www/notification.html | 39 -
windows7/Cordova/www/storage.html | 31 -
windows7/README | 44 -
58 files changed, 51 insertions(+), 160480 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/dfb81f0a/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e9de5b2..f1be939 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,54 @@
-# Apache Cordova for Windows
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+
+
+Apache Cordova for Windows 8
===
-This repo may eventually hold, Windows8, Windows7, Win32, win.net, or other windows desktop related implementations of the Apache Cordova API.
+This repo includes code to build Apache Cordova applications that target Windows 8 SDK.
+
+An Apache Cordova based applications is, at the core, an application written with web technology: HTML, CSS and JavaScript.
+
+[Apache Cordova][] is a project at The Apache Software Foundation (ASF).
+
+Requires
+---
+
+- [Windows 8 SDK][]
+-- Windows 8 development requires Windows 8 Professional, and Visual Studio 2012 ( express works )
+
+BUGS?
+-----
+
+- File them at the [Apache Cordova Issue Tracker][]
+
+
+Further Reading
+---
+
+- [Apache Cordova Documentation][]
+- [Apache Cordova Wiki][]
+
+[Apache Cordova]: http://cordova.io "Apache Cordova"
+[Apache Cordova Issue Tracker]: https://issues.apache.org/jira/browse/CB "Apache Cordova Issue Tracker"
+[Apache Cordova Documentation]: http://cordova.io/docs "Apache Cordova Documentation"
+[Apache Cordova Wiki]: http://wiki.apache.org/cordova "Apache Cordova Wiki"
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/dfb81f0a/windows7/Cordova.sln
----------------------------------------------------------------------
diff --git a/windows7/Cordova.sln b/windows7/Cordova.sln
deleted file mode 100644
index 5e07fda..0000000
--- a/windows7/Cordova.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cordova", "Cordova\Cordova.vcxproj", "{3FE6EDB1-A141-4CC2-BA28-FD7761F2E9A9}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3FE6EDB1-A141-4CC2-BA28-FD7761F2E9A9}.Debug|Win32.ActiveCfg = Debug|Win32
- {3FE6EDB1-A141-4CC2-BA28-FD7761F2E9A9}.Debug|Win32.Build.0 = Debug|Win32
- {3FE6EDB1-A141-4CC2-BA28-FD7761F2E9A9}.Release|Win32.ActiveCfg = Release|Win32
- {3FE6EDB1-A141-4CC2-BA28-FD7761F2E9A9}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/dfb81f0a/windows7/Cordova/Cordova.vcxproj
----------------------------------------------------------------------
diff --git a/windows7/Cordova/Cordova.vcxproj b/windows7/Cordova/Cordova.vcxproj
deleted file mode 100644
index 944fa99..0000000
--- a/windows7/Cordova/Cordova.vcxproj
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{3FE6EDB1-A141-4CC2-BA28-FD7761F2E9A9}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>PGA</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- <IncludePath>$(ProgramFiles)\Microsoft SDKs\Internet Explorer\v9\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include\um;$(WindowsSdkDir)include\shared;$(FrameworkSDKDir)\include</IncludePath>
- <LibraryPath>$(WindowsSdkDir)lib\win8\um\x86;$(ProgramFiles)\Microsoft SDKs\Internet Explorer\v9\lib;$(DXSDK_DIR)lib\x86;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- <IncludePath>$(ProgramFiles)\Microsoft SDKs\Internet Explorer\v9\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include\um;$(WindowsSdkDir)include\shared;$(FrameworkSDKDir)\include</IncludePath>
- <LibraryPath>$(WindowsSdkDir)lib\win8\um\x86;$(ProgramFiles)\Microsoft SDKs\Internet Explorer\v9\lib;$(DXSDK_DIR)lib\x86;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- <ProjectReference />
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MinSpace</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- <ProjectReference />
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="accel.c" />
- <ClCompile Include="capture.c" />
- <ClCompile Include="common.c" />
- <ClCompile Include="compass.c" />
- <ClCompile Include="device.c" />
- <ClCompile Include="file.c" />
- <ClCompile Include="filetransfer.c" />
- <ClCompile Include="jpeg.cpp" />
- <ClCompile Include="json.c" />
- <ClCompile Include="lib\sqlite\sqlite3.c" />
- <ClCompile Include="mp4patch.c" />
- <ClCompile Include="network.c" />
- <ClCompile Include="notification.c" />
- <ClCompile Include="platform.c" />
- <ClCompile Include="shell.c" />
- <ClCompile Include="storage.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="accel.h" />
- <ClInclude Include="capture.h" />
- <ClInclude Include="common.h" />
- <ClInclude Include="compass.h" />
- <ClInclude Include="device.h" />
- <ClInclude Include="file.h" />
- <ClInclude Include="filetransfer.h" />
- <ClInclude Include="jpeg.h" />
- <ClInclude Include="json.h" />
- <ClInclude Include="mp4patch.h" />
- <ClInclude Include="network.h" />
- <ClInclude Include="notification.h" />
- <ClInclude Include="platform.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="shell.h" />
- <ClInclude Include="storage.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="lib\js\exec.js" />
- <None Include="lib\js\platform.js" />
- <None Include="lib\js\plugin\win7\device.js" />
- <None Include="lib\js\plugin\win7\jsHandler.js" />
- <None Include="lib\js\plugin\win7\SQLError.js" />
- <None Include="lib\js\plugin\win7\storage.js" />
- <None Include="toolbar.bmp" />
- <None Include="www\accel_game.css" />
- <None Include="www\accel_game.html">
- <SubType>Designer</SubType>
- </None>
- <None Include="www\accel_game.js" />
- <None Include="www\capture.html" />
- <None Include="www\compass.html" />
- <None Include="www\cordova.win7.js" />
- <None Include="www\device.html" />
- <None Include="www\events.html">
- <SubType>Designer</SubType>
- </None>
- <None Include="www\file.html" />
- <None Include="www\index.html" />
- <None Include="www\network.html" />
- <None Include="www\notification.html">
- <SubType>Designer</SubType>
- </None>
- <None Include="www\storage.html" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="resource.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/dfb81f0a/windows7/Cordova/Cordova.vcxproj.filters
----------------------------------------------------------------------
diff --git a/windows7/Cordova/Cordova.vcxproj.filters b/windows7/Cordova/Cordova.vcxproj.filters
deleted file mode 100644
index 6a13dd9..0000000
--- a/windows7/Cordova/Cordova.vcxproj.filters
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <ClCompile Include="accel.c" />
- <ClCompile Include="capture.c" />
- <ClCompile Include="device.c" />
- <ClCompile Include="jpeg.cpp" />
- <ClCompile Include="network.c" />
- <ClCompile Include="shell.c" />
- <ClCompile Include="notification.c" />
- <ClCompile Include="storage.c" />
- <ClCompile Include="json.c" />
- <ClCompile Include="lib\sqlite\sqlite3.c" />
- <ClCompile Include="platform.c" />
- <ClCompile Include="file.c" />
- <ClCompile Include="common.c" />
- <ClCompile Include="filetransfer.c" />
- <ClCompile Include="mp4patch.c" />
- <ClCompile Include="compass.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="accel.h" />
- <ClInclude Include="capture.h" />
- <ClInclude Include="common.h" />
- <ClInclude Include="device.h" />
- <ClInclude Include="jpeg.h" />
- <ClInclude Include="network.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="shell.h" />
- <ClInclude Include="notification.h" />
- <ClInclude Include="storage.h" />
- <ClInclude Include="json.h" />
- <ClInclude Include="platform.h" />
- <ClInclude Include="file.h" />
- <ClInclude Include="filetransfer.h" />
- <ClInclude Include="mp4patch.h" />
- <ClInclude Include="compass.h" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="resource.rc" />
- </ItemGroup>
- <ItemGroup>
- <None Include="toolbar.bmp" />
- <None Include="lib\js\plugin\win7\device.js">
- <Filter>javascript</Filter>
- </None>
- <None Include="lib\js\exec.js">
- <Filter>javascript</Filter>
- </None>
- <None Include="www\cordova.win7.js">
- <Filter>javascript</Filter>
- </None>
- <None Include="lib\js\platform.js">
- <Filter>javascript</Filter>
- </None>
- <None Include="www\index.html">
- <Filter>html</Filter>
- </None>
- <None Include="www\device.html">
- <Filter>html</Filter>
- </None>
- <None Include="www\network.html">
- <Filter>html</Filter>
- </None>
- <None Include="www\capture.html">
- <Filter>html</Filter>
- </None>
- <None Include="www\events.html">
- <Filter>html</Filter>
- </None>
- <None Include="lib\js\plugin\win7\jsHandler.js">
- <Filter>javascript</Filter>
- </None>
- <None Include="lib\js\plugin\win7\storage.js">
- <Filter>javascript</Filter>
- </None>
- <None Include="www\storage.html">
- <Filter>html</Filter>
- </None>
- <None Include="lib\js\plugin\win7\SQLError.js">
- <Filter>javascript</Filter>
- </None>
- <None Include="www\file.html">
- <Filter>html</Filter>
- </None>
- <None Include="www\compass.html">
- <Filter>html</Filter>
- </None>
- <None Include="www\accel_game.css">
- <Filter>html</Filter>
- </None>
- <None Include="www\accel_game.html">
- <Filter>html</Filter>
- </None>
- <None Include="www\accel_game.js">
- <Filter>html</Filter>
- </None>
- <None Include="www\notification.html">
- <Filter>html</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <Filter Include="javascript">
- <UniqueIdentifier>{03872dca-8198-4d19-a847-612e33652f00}</UniqueIdentifier>
- </Filter>
- <Filter Include="html">
- <UniqueIdentifier>{56894366-d156-48a1-a4ac-68ebf29c4442}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/dfb81f0a/windows7/Cordova/accel.c
----------------------------------------------------------------------
diff --git a/windows7/Cordova/accel.c b/windows7/Cordova/accel.c
deleted file mode 100644
index bbfc2ec..0000000
--- a/windows7/Cordova/accel.c
+++ /dev/null
@@ -1,251 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include <windows.h>
-#include <sensors.h>
-#include <sensorsapi.h>
-#include <propvarutil.h>
-#include <portabledevicetypes.h>
-#include <wchar.h>
-#include "common.h"
-
-#pragma comment(lib, "sensorsapi.lib")
-#pragma comment(lib, "portabledeviceguids.lib")
-
-#include "shell.h"
-extern HWND hWnd; // Main window, used as a way to request routine calls from the main thread
-
-ISensorManager* sensor_manager_if;
-ISensorCollection* sensor_collection_if;
-ISensor* accelerometer_if;
-
-int acceleration_sensor_count;
-
-double last_x, last_y, last_z;
-double prev_x, prev_y, prev_z;
-
-HANDLE accel_thread; // Data acquisition thread handle
-BOOL stop_flag; // Flag raised to indicate that the acquisition thread should exit
-
-BSTR new_sample_callback;
-
-void propagate_accel_sample (void)
-{
- if (new_sample_callback)
- {
- wchar_t buf[100];
- swprintf(buf, sizeof(buf)/sizeof(buf[0]), L"{x:%f,y:%f,z:%f}", last_x, last_y, last_z);
-
- cordova_success_callback(new_sample_callback, TRUE, buf);
- }
-}
-
-unsigned int __stdcall accel_thread_proc(void* param)
-{
- ISensorDataReport* data_report_if;
- PROPVARIANT v;
-// SYSTEMTIME timestamp;
- static int counter;
- HRESULT hr;
- ULONG ulCount = 0;
-
- set_thread_name(-1, "Accelerometer Sampling");
-
- CoInitialize(0);
-
- // Retrieve sensor manager object
- hr = CoCreateInstance(&CLSID_SensorManager, NULL, CLSCTX_INPROC_SERVER, &IID_ISensorManager, (void**) &sensor_manager_if);
-
- if (hr == HRESULT_FROM_WIN32(ERROR_ACCESS_DISABLED_BY_POLICY))
- {
- // The user hasn't granted access to sensors
- return -1;
- }
-
- if (!SUCCEEDED(hr))
- // Sensor API not available...
- return -2;
-
- // Get the list of available accelerometers
- hr = sensor_manager_if->lpVtbl->GetSensorsByCategory(sensor_manager_if, &SENSOR_CATEGORY_MOTION, &sensor_collection_if);
-
- sensor_manager_if->lpVtbl->RequestPermissions(sensor_manager_if, GetForegroundWindow(), sensor_collection_if, TRUE);
-
- if (SUCCEEDED(hr))
- {
- // Check sensor count
- hr = sensor_collection_if->lpVtbl->GetCount(sensor_collection_if, &acceleration_sensor_count);
-
- if (SUCCEEDED(hr))
- {
- if (acceleration_sensor_count == 0)
- {
- // No accelerometer
- }
- }
- }
-
- if (SUCCEEDED(hr))
- {
- // Get the first available accelerometer
- hr = sensor_collection_if->lpVtbl->GetAt(sensor_collection_if, 0, &accelerometer_if);
- }
-
-
- if (SUCCEEDED(hr))
- {
- IPortableDeviceValues* params_in = NULL;
- IPortableDeviceValues* params_out = NULL;
-
- // Need a properties object...
- hr = CoCreateInstance(&CLSID_PortableDeviceValues, NULL, CLSCTX_INPROC_SERVER, &IID_IPortableDeviceValues, (void**) ¶ms_in);
-
- if (SUCCEEDED(hr))
- {
- // Request 20 ms update interval
- hr = params_in->lpVtbl->SetUnsignedIntegerValue(params_in, &SENSOR_PROPERTY_CURRENT_REPORT_INTERVAL, 20);
- }
-
- if (SUCCEEDED(hr))
- {
- // Set property
- hr = accelerometer_if->lpVtbl->SetProperties(accelerometer_if, params_in, ¶ms_out);
- }
-
- if (params_in)
- params_in->lpVtbl->Release(params_in);
-
- if (params_out)
- params_out->lpVtbl->Release(params_out);
- }
-
- while (!stop_flag)
- {
- prev_x = last_x;
- prev_y = last_y;
- prev_z = last_z;
-
- if (!accelerometer_if || !SUCCEEDED(accelerometer_if->lpVtbl->GetData(accelerometer_if, &data_report_if)))
- {
- last_x = .002 * (rand()%1000) -1;
- last_y = .002 * (rand()%1000) -1;
- last_z = .002 * (rand()%1000) -1;
- }
- else
- {
- PropVariantInit(&v);
- data_report_if->lpVtbl->GetSensorValue(data_report_if, &SENSOR_DATA_TYPE_ACCELERATION_X_G, &v);
- if (v.vt == VT_R4)
- last_x = v.fltVal;
- if (v.vt == VT_R8)
- last_x = v.dblVal;
- PropVariantClear(&v);
-
- PropVariantInit(&v);
- data_report_if->lpVtbl->GetSensorValue(data_report_if, &SENSOR_DATA_TYPE_ACCELERATION_Y_G, &v);
- if (v.vt == VT_R4)
- last_y = v.fltVal;
- if (v.vt == VT_R8)
- last_y = v.dblVal;
- PropVariantClear(&v);
-
- PropVariantInit(&v);
- data_report_if->lpVtbl->GetSensorValue(data_report_if, &SENSOR_DATA_TYPE_ACCELERATION_Z_G, &v);
- if (v.vt == VT_R4)
- last_z = v.fltVal;
- if (v.vt == VT_R8)
- last_z = v.dblVal;
- PropVariantClear(&v);
-
- //data_report_if->lpVtbl->GetTimestamp(data_report_if, ×tamp);
- //*ts = 0;
-
- data_report_if->lpVtbl->Release(data_report_if);
- }
-
- if (last_x != prev_x || last_y != prev_y || last_z != prev_z)
- SendMessage(hWnd, WM_USER_ACCEL, 0, 0); // Request the main thread to invoke a JS call for us ; will call propagate_accel_sample in response
-
- Sleep(10);
- }
-
- return 0;
-}
-
-int start_accel_acquisition (void)
-{
- if (accel_thread)
- return -1;
-
- // Return 0 x/y/z and 0 timestamp until samples start coming in
- last_x = 0;
- last_y = 0;
- last_z = 0;
-
- stop_flag = FALSE;
-
- // Reading sensor values seem to block the calling thread ; do this in a dedicated thread
- accel_thread = CreateThread(0, 0, accel_thread_proc, 0, 0, 0);
- return 0;
-}
-
-int stop_accel_acquisition (void)
-{
- if (accel_thread == 0)
- return -1;
-
- stop_flag = TRUE;
-
- // Wait until the acquisition thread exits
- WaitForSingleObject(accel_thread, INFINITE);
-
- accel_thread = 0;
-
- if (new_sample_callback)
- {
- SysFreeString(new_sample_callback);
- new_sample_callback = 0;
- }
-
- return 0;
-}
-
-
-HRESULT accel_exec(BSTR callback_id, BSTR action, BSTR args, VARIANT *result)
-{
- if (!wcscmp(action, L"start"))
- {
- new_sample_callback = SysAllocString(callback_id);
- last_x = last_y = last_z = 0;
- propagate_accel_sample();
- start_accel_acquisition();
- return S_OK;
- }
-
- if (!wcscmp(action, L"stop"))
- {
- stop_accel_acquisition();
- cordova_success_callback(callback_id, FALSE, NULL_MESSAGE);
- return S_OK;
- }
-
- return DISP_E_MEMBERNOTFOUND;
-}
-
-DEFINE_CORDOVA_MODULE(Accelerometer, L"Accelerometer", accel_exec, NULL, NULL)
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/dfb81f0a/windows7/Cordova/accel.h
----------------------------------------------------------------------
diff --git a/windows7/Cordova/accel.h b/windows7/Cordova/accel.h
deleted file mode 100644
index 807cf49..0000000
--- a/windows7/Cordova/accel.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-void propagate_accel_sample(void);
-
-DECLARE_CORDOVA_MODULE(Accelerometer)