Skip to content

Commit

Permalink
Improvements to SDK build. Added tvOS and watchOS targets. Working on…
Browse files Browse the repository at this point in the history
… integrating desktop win32 and Unity compatible mono.
  • Loading branch information
peterfoot committed May 2, 2018
1 parent 074a321 commit 10f1ed2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
42 changes: 38 additions & 4 deletions InTheHand.Devices.Bluetooth/InTheHand.Devices.Bluetooth.csproj
@@ -1,32 +1,42 @@
<Project Sdk="MSBuild.Sdk.Extras/1.2.2">

<PropertyGroup>
<TargetFrameworks>netstandard1.4;uap10.0;monoandroid80;xamarin.ios10;xamarin.mac20</TargetFrameworks>
<TargetFrameworks>netstandard1.4;uap10.0;monoandroid80;xamarin.ios10;xamarin.tvos10;xamarin.watchos10;xamarin.mac20</TargetFrameworks>
<Company>In The Hand Ltd</Company>
<Authors>Peter Foot</Authors>
<Product>32feet.NET</Product>
<Version>4.2018.4.23</Version>
<Version>4.2018.5.2</Version>
<RepositoryUrl>https://github.com/inthehand/32feet</RepositoryUrl>
<PackageProjectUrl>https://github.com/inthehand/32feet</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/inthehand/32feet/blob/master/LICENSE</PackageLicenseUrl>
<Copyright>Copyright © 2004-2018 In The Hand Ltd</Copyright>
<Description>32feet.NET is a shared-source project to make personal area networking technologies such as Bluetooth, Infrared (IrDA) and more, easily accessible from .NET code.</Description>
<FileVersion>4.2018.4.23</FileVersion>
<FileVersion>4.2018.5.2</FileVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyName>InTheHand.Devices.Bluetooth</AssemblyName>
<GenerateDocumentationFile Condition=" '$(Configuration)' == 'Release' ">true</GenerateDocumentationFile>
<PackageIconUrl>https://avatars3.githubusercontent.com/u/11249648</PackageIconUrl>
<PackageTags>bluetooth windows android ios tvos macos uwp win32</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>C:\Users\peter\Source\Repos\32feet\InTheHand.Devices.Bluetooth\NuGet\lib\</OutputPath>
<DocumentationFile>C:\Users\Peter\Source\Repos\32feet\InTheHand.Devices.Bluetooth\NuGet\lib\InTheHand.Devices.Bluetooth.xml</DocumentationFile>
<DocumentationFile>InTheHand.Devices.Bluetooth.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'uap10.0' ">
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net451'">
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net20'">
<DefineConstants>UNITY;WIN32</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'uap10.0' ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="5.4.0" />
Expand All @@ -50,6 +60,14 @@
<Compile Include="Platforms\uap\*.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net20' ">
<Compile Include="Platforms\win32\*.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'wpa81' ">
<Compile Include="Platforms\wp81\*.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'monoandroid80' ">
<Compile Include="Platforms\android\*.cs" />
<Compile Include="Platforms\bytes\*.cs" />
Expand All @@ -64,12 +82,28 @@
<Compile Include="Platforms\ios\*.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'xamarin.tvos10' ">
<Compile Remove="Devices\Bluetooth\Rfcomm\*.*" />
<Compile Remove="Devices\Bluetooth\BluetoothDevice.cs" />
<Compile Include="Platforms\unified\*.cs" />
<Compile Include="Platforms\bytes\*.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'xamarin.watchos10' ">
<Compile Remove="Devices\Bluetooth\Rfcomm\*.*" />
<Compile Remove="Devices\Bluetooth\BluetoothDevice.cs" />
<Compile Include="Platforms\unified\*.cs" />
<Compile Include="Platforms\bytes\*.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'xamarin.mac20' ">
<Compile Remove="Devices\Bluetooth\Rfcomm\*.*" />
<Compile Remove="Devices\Bluetooth\BluetoothDevice.cs" />
<Compile Include="Platforms\unified\*.cs" />
<Compile Include="Platforms\bytes\*.cs" />
<Compile Include="Platforms\mac\*.cs" />
<PackageReference Include="InTheHand.IOBluetooth" Version="0.1.412" />
<PackageReference Include="InTheHand.IOBluetoothUI" Version="0.1.412" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -76,7 +76,7 @@ public override void DisconnectedPeripheral(CBCentralManager central, CBPeripher
{
s_default.ConnectionStateChanged?.Invoke(this, peripheral);
}
#if !__TVOS__
#if !__TVOS__ && !__WATCHOS__
public override void RetrievedConnectedPeripherals(CBCentralManager central, CBPeripheral[] peripherals)
{
}
Expand Down
Expand Up @@ -58,10 +58,12 @@ private static async Task FindAllAsyncImpl(string aqsFilter, List<DeviceInformat
{
await Task.Run<IReadOnlyCollection<DeviceInformation>>(async () =>
{
#if !__WATCHOS__
if (BluetoothAdapter.Default.Manager.State != CBCentralManagerState.PoweredOn)
{
stateHandle.WaitOne();
}
#endif
string[] filterParts = aqsFilter.Split(':');
bool discover = true;
Expand Down
7 changes: 7 additions & 0 deletions InTheHand.Devices.Bluetooth/Platforms/unified/RadioUnified.cs
Expand Up @@ -37,6 +37,12 @@ private string GetName()
return RadioKind.Bluetooth.ToString();
}

#if __WATCHOS__
private RadioState GetState()
{
return RadioState.Unknown;
}
#else
private RadioState GetState()
{
try
Expand Down Expand Up @@ -66,5 +72,6 @@ private static RadioState CBCentalManagerStateToRadioState(CBCentralManagerState
return RadioState.Unknown;
}
}
#endif
}
}

0 comments on commit 10f1ed2

Please sign in to comment.