mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
bbab3074ed
This commit new configuration option `enable-multiple-instances` and its corresponding option `OPENTHREAD_ENABLE_MULTIPLE_INSTANCES`. When enabled OpenThread supports handling of multiple instances. By default this is disabled. This commit also adds two optimizations for single instance case to simplify the code and also help reduce memory/RAM usage: (1) OpenThread objects/classes typically keep a reference to a higher level object (e.g., many classes keep track of owning `ThreadNetif`) to be able to access other objects/methods within OpenThread class hierarchy. In single instance mode, the reference member variables are removed and instead global functions are used to access the singleton objects from one class to the other. To implement this, a group of `<Object>Locator` classes are defined (e.g., `ThreadNetifLocator`, etc.) which are then used as base class of other OpenThread classes. (2) OpenThread objects which provide a callback/handler (e.g., `Timer`, `Tasklet`, etc.) have `void *mContext` member variable which is used to keep track of the owner of the object. In single instance mode the `mConext` member variables are removed since the owner is expected to be a singleton and can be uniquely determined from the callback function. To implement this, two changes are made: First the handler methods are modified to provide a reference to the object (e.g., `Timer` handler will provide a `Timer &aTimer` as a parameter of its handler callback). Second, a new base class `Context` is introduced which hides the implementation providing an arbitrary context information. A new static method `GetOwner(aContext)` is added to classes which own a callback providing objects. This method help convert a `Context` to the reference of the owner class object.
80 lines
3.4 KiB
XML
80 lines
3.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<Import Project="openthread.configuration.props" />
|
|
<PropertyGroup Label="Globals">
|
|
<ProjectGuid>{91D3ADEA-F1FE-4433-95B6-F8F6A7CF7BAF}</ProjectGuid>
|
|
<Keyword>Win32Proj</Keyword>
|
|
<RootNamespace>ot</RootNamespace>
|
|
<ApplicationType>Windows Store</ApplicationType>
|
|
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
|
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
|
|
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
|
|
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
|
</PropertyGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
|
<ConfigurationType>Application</ConfigurationType>
|
|
<UseDebugLibraries>true</UseDebugLibraries>
|
|
<PlatformToolset>v140</PlatformToolset>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
|
<ConfigurationType>Application</ConfigurationType>
|
|
<UseDebugLibraries>false</UseDebugLibraries>
|
|
<PlatformToolset>v140</PlatformToolset>
|
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
</PropertyGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
<ImportGroup Label="ExtensionSettings" />
|
|
<ImportGroup Label="Shared" />
|
|
<ImportGroup Label="PropertySheets">
|
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
</ImportGroup>
|
|
<PropertyGroup Label="UserMacros" />
|
|
<PropertyGroup>
|
|
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
|
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\exe\</OutDir>
|
|
</PropertyGroup>
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>
|
|
%(PreprocessorDefinitions);
|
|
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
|
OPENTHREAD_FTD=1;
|
|
</PreprocessorDefinitions>
|
|
<AdditionalIncludeDirectories>
|
|
%(AdditionalIncludeDirectories);
|
|
..\..\examples\platforms;
|
|
..\..\include;
|
|
..\..\src\core;
|
|
</AdditionalIncludeDirectories>
|
|
<WarningLevel>Level3</WarningLevel>
|
|
<SDLCheck>true</SDLCheck>
|
|
</ClCompile>
|
|
<Link>
|
|
<SubSystem>Console</SubSystem>
|
|
<AdditionalDependencies>
|
|
mincore.lib;
|
|
</AdditionalDependencies>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
<ItemGroup>
|
|
<ProjectReference Include="libopenthread-cli.vcxproj">
|
|
<Project>{41b32069-632e-4578-855b-a36ebfa80b56}</Project>
|
|
</ProjectReference>
|
|
<ProjectReference Include="libopenthread.vcxproj">
|
|
<Project>{dd5018be-54c6-4fd4-9f8d-08d52fc0cd40}</Project>
|
|
</ProjectReference>
|
|
<ProjectReference Include="mbedtls.vcxproj">
|
|
<Project>{4111c8bb-d354-4348-ad3c-eb6832e84831}</Project>
|
|
</ProjectReference>
|
|
<ProjectReference Include="libopenthread-windows.vcxproj">
|
|
<Project>{30723c38-ba3b-44c9-8d64-c5861a26934f}</Project>
|
|
</ProjectReference>
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<ClCompile Include="..\..\examples\apps\cli\main.c" />
|
|
</ItemGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
<ImportGroup Label="ExtensionTargets">
|
|
</ImportGroup>
|
|
</Project> |