diff --git a/.appveyor.yml b/.appveyor.yml index bf7d74102..8f35dc7b5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -60,3 +60,5 @@ test_script: artifacts: - path: release name: release +- path: build\bin\AppPackages + name: app diff --git a/.gitignore b/.gitignore index 36ea568b8..6c2aa02e4 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,8 @@ config.log config.status doc/Doxyfile doc/html +etc/visual-studio/BundleArtifacts +etc/visual-studio/Generated Files include/openthread-config.h include/openthread-config.h.in include/stamp-h1 diff --git a/etc/visual-studio/Assets/LockScreenLogo.scale-200.png b/etc/visual-studio/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 000000000..1e1671875 Binary files /dev/null and b/etc/visual-studio/Assets/LockScreenLogo.scale-200.png differ diff --git a/etc/visual-studio/Assets/SplashScreen.scale-200.png b/etc/visual-studio/Assets/SplashScreen.scale-200.png new file mode 100644 index 000000000..9f918754e Binary files /dev/null and b/etc/visual-studio/Assets/SplashScreen.scale-200.png differ diff --git a/etc/visual-studio/Assets/Square150x150Logo.scale-200.png b/etc/visual-studio/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 000000000..e46fa0436 Binary files /dev/null and b/etc/visual-studio/Assets/Square150x150Logo.scale-200.png differ diff --git a/etc/visual-studio/Assets/Square44x44Logo.scale-200.png b/etc/visual-studio/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 000000000..81f252c34 Binary files /dev/null and b/etc/visual-studio/Assets/Square44x44Logo.scale-200.png differ diff --git a/etc/visual-studio/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/etc/visual-studio/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 000000000..4b07c7d5d Binary files /dev/null and b/etc/visual-studio/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/etc/visual-studio/Assets/StoreLogo.png b/etc/visual-studio/Assets/StoreLogo.png new file mode 100644 index 000000000..61d6a334b Binary files /dev/null and b/etc/visual-studio/Assets/StoreLogo.png differ diff --git a/etc/visual-studio/Assets/Wide310x150Logo.scale-200.png b/etc/visual-studio/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 000000000..41130667c Binary files /dev/null and b/etc/visual-studio/Assets/Wide310x150Logo.scale-200.png differ diff --git a/etc/visual-studio/OpenThread.vcxproj b/etc/visual-studio/OpenThread.vcxproj new file mode 100644 index 000000000..1c4de0dc6 --- /dev/null +++ b/etc/visual-studio/OpenThread.vcxproj @@ -0,0 +1,107 @@ + + + + + {f8c22844-9b93-4978-80df-8af2b37a7abb} + Thread + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + + + + Application + true + v140 + + + Application + false + true + v140 + true + + + + + + + + + ..\..\examples\apps\windows\OpenThread_TemporaryKey.pfx + + + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + ..\..\build\bin\$(Platform)\$(Configuration)\app\ + True + ..\..\build\bin\AppPackages\ + Never + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + %(AdditionalIncludeDirectories); + ..\..\examples\apps\windows; + ..\..\include; + + + + + %(AdditionalDependencies); + ..\..\build\bin\$(Platform)\$(Configuration)\dll\otApi.lib; + + + + + + + ..\..\examples\apps\windows\App.xaml + + + ..\..\examples\apps\windows\MainPage.xaml + + + + + Designer + + + Designer + + + + + Designer + + + + + + + + + + + + + + + ..\..\examples\apps\windows\App.xaml + + + ..\..\examples\apps\windows\MainPage.xaml + + + Create + + + + + + \ No newline at end of file diff --git a/etc/visual-studio/OpenThread.vcxproj.filters b/etc/visual-studio/OpenThread.vcxproj.filters new file mode 100644 index 000000000..ac15ec70e --- /dev/null +++ b/etc/visual-studio/OpenThread.vcxproj.filters @@ -0,0 +1,57 @@ + + + + + f8c22844-9b93-4978-80df-8af2b37a7abb + + + cf539bf1-44af-4a06-be13-5941f6ac2623 + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + + + + \ No newline at end of file diff --git a/etc/visual-studio/openthread.sln b/etc/visual-studio/openthread.sln index 825fdfd2c..d76e83ddc 100644 --- a/etc/visual-studio/openthread.sln +++ b/etc/visual-studio/openthread.sln @@ -48,6 +48,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otLwf", "otLwf.vcxproj", "{ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otApi", "otApi.vcxproj", "{ED0EA262-C222-42C7-98D3-E70C72978ED2}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenThread", "OpenThread.vcxproj", "{F8C22844-9B93-4978-80DF-8AF2B37A7ABB}" + ProjectSection(ProjectDependencies) = postProject + {ED0EA262-C222-42C7-98D3-E70C72978ED2} = {ED0EA262-C222-42C7-98D3-E70C72978ED2} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -240,6 +245,24 @@ Global {ED0EA262-C222-42C7-98D3-E70C72978ED2}.Release|x64.Build.0 = Release|x64 {ED0EA262-C222-42C7-98D3-E70C72978ED2}.Release|x86.ActiveCfg = Release|Win32 {ED0EA262-C222-42C7-98D3-E70C72978ED2}.Release|x86.Build.0 = Release|Win32 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|ARM.ActiveCfg = Debug|ARM + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|ARM.Build.0 = Debug|ARM + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|ARM.Deploy.0 = Debug|ARM + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|x64.ActiveCfg = Debug|x64 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|x64.Build.0 = Debug|x64 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|x64.Deploy.0 = Debug|x64 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|x86.ActiveCfg = Debug|Win32 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|x86.Build.0 = Debug|Win32 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Debug|x86.Deploy.0 = Debug|Win32 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|ARM.ActiveCfg = Release|ARM + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|ARM.Build.0 = Release|ARM + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|ARM.Deploy.0 = Release|ARM + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|x64.ActiveCfg = Release|x64 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|x64.Build.0 = Release|x64 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|x64.Deploy.0 = Release|x64 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|x86.ActiveCfg = Release|Win32 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|x86.Build.0 = Release|Win32 + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB}.Release|x86.Deploy.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -259,5 +282,6 @@ Global {9EEF9DCD-EA8F-4154-BD02-AB2B31CEC324} = {76EA541E-CAB1-4DB5-A39F-E3DB2A78CDDD} {3F1F7F6C-2A33-4635-9880-08FC5BC4E435} = {61E8A4A0-8138-49DB-97B4-3BEC87C8E133} {ED0EA262-C222-42C7-98D3-E70C72978ED2} = {61E8A4A0-8138-49DB-97B4-3BEC87C8E133} + {F8C22844-9B93-4978-80DF-8AF2B37A7ABB} = {76EA541E-CAB1-4DB5-A39F-E3DB2A78CDDD} EndGlobalSection EndGlobal diff --git a/examples/apps/windows/App.xaml b/examples/apps/windows/App.xaml new file mode 100644 index 000000000..45bbb4ff7 --- /dev/null +++ b/examples/apps/windows/App.xaml @@ -0,0 +1,35 @@ + + + + diff --git a/examples/apps/windows/App.xaml.cpp b/examples/apps/windows/App.xaml.cpp new file mode 100644 index 000000000..8fffb144d --- /dev/null +++ b/examples/apps/windows/App.xaml.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace Thread; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// +/// Details about the launch request and process. +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ +#if _DEBUG + // Show graphics profiling information while debugging. + if (IsDebuggerPresent()) + { + // Display the current frame rate counters + DebugSettings->EnableFrameRateCounter = true; + } +#endif + auto rootFrame = dynamic_cast(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + } + + if (e->PrelaunchActivated == false) + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + // Ensure the current window is active + Window::Current->Activate(); + } + } + else + { + if (e->PrelaunchActivated == false) + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Ensure the current window is active + Window::Current->Activate(); + } + } +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +/// The source of the suspend request. +/// Details about the suspend request. +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + //TODO: Save application state and stop any background activity +} + +/// +/// Invoked when Navigation to a certain page fails +/// +/// The Frame which failed navigation +/// Details about the navigation failure +void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) +{ + throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); +} diff --git a/examples/apps/windows/App.xaml.h b/examples/apps/windows/App.xaml.h new file mode 100644 index 000000000..52ef3aab5 --- /dev/null +++ b/examples/apps/windows/App.xaml.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "App.g.h" + +namespace Thread +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + ref class App sealed + { + protected: + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + internal: + App(); + + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); + }; +} diff --git a/examples/apps/windows/MainPage.xaml b/examples/apps/windows/MainPage.xaml new file mode 100644 index 000000000..4bfb3503e --- /dev/null +++ b/examples/apps/windows/MainPage.xaml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +