Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The call to Dns.GetHostEntry() may fail on MacOS #1927

Merged
merged 5 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/devices/Arduino/Arduino.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arduino", "Arduino.csproj",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Device.Gpio", "..\..\System.Device.Gpio\System.Device.Gpio.csproj", "{0B90F9D4-7353-4172-A317-714471A06781}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arduino.sample", "samples\Arduino.sample.csproj", "{2670F7BF-A7C8-49EB-9A99-1719A90D0C67}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arduino.sample", "samples\ApiChecker\Arduino.sample.csproj", "{2670F7BF-A7C8-49EB-9A99-1719A90D0C67}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bmxx80", "..\Bmxx80\Bmxx80.csproj", "{EEEB0FB8-E1ED-4970-BDF6-DA3D5E2ED074}"
EndProject
Expand All @@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CpuTemperature", "..\CpuTem
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{9E5A25ED-9839-4C1A-9B27-993437D1CB31}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arduino.Monitor", "samples\Arduino.Monitor.csproj", "{23B4B60C-9594-42BB-9D25-C54983B0F809}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arduino.Monitor", "samples\Monitor\Arduino.Monitor.csproj", "{23B4B60C-9594-42BB-9D25-C54983B0F809}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CA26B999-4C0E-4E82-A46E-A68AC1B85C10}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
<Compile Include="TestCases.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Bmxx80\Bmxx80.csproj" />
<ProjectReference Include="..\..\Board\Board.csproj" />
<ProjectReference Include="..\..\Common\Common.csproj" />
<ProjectReference Include="..\..\Mcp3xxx\Mcp3xxx.csproj" />
<ProjectReference Include="..\Arduino.csproj" />
<ProjectReference Include="..\..\..\Bmxx80\Bmxx80.csproj" />
<ProjectReference Include="..\..\..\Board\Board.csproj" />
<ProjectReference Include="..\..\..\Mcp3xxx\Mcp3xxx.csproj" />
<ProjectReference Include="..\..\Arduino.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
<Compile Include="Arduino.Monitor.cs" />
</ItemGroup>
<ItemGroup>
<!--Cases used when running in VS, with the solution config either Windows-Debug or Linux-Debug (or -Release) -->
<ProjectReference Include="..\..\Bmxx80\Bmxx80.csproj" />
<ProjectReference Include="..\..\Button\Button.csproj" />
<ProjectReference Include="..\..\Board\Board.csproj" />
<ProjectReference Include="..\..\CharacterLcd\CharacterLcd.csproj" />
<ProjectReference Include="..\..\HardwareMonitor\HardwareMonitor.csproj" />
<ProjectReference Include="..\..\Mcp3xxx\Mcp3xxx.csproj" />
<ProjectReference Include="..\Arduino.csproj" />
<ProjectReference Include="..\..\..\Bmxx80\Bmxx80.csproj" />
<ProjectReference Include="..\..\..\Button\Button.csproj" />
<ProjectReference Include="..\..\..\Board\Board.csproj" />
<ProjectReference Include="..\..\..\CharacterLcd\CharacterLcd.csproj" />
<ProjectReference Include="..\..\..\HardwareMonitor\HardwareMonitor.csproj" />
<ProjectReference Include="..\..\..\Mcp3xxx\Mcp3xxx.csproj" />
<ProjectReference Include="..\..\Arduino.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/devices/Arduino/tests/Arduino.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../Arduino.csproj" />
<ProjectReference Include="..\Arduino.csproj" />
<ProjectReference Include="..\..\..\..\tools\ArduinoCsCompiler\Frontend\Frontend.csproj" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
Expand Down
4 changes: 2 additions & 2 deletions src/devices/Bh1745/Bh1745.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{EA121A48-7916-4D9D-94C8-8E59BCDE3A96}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bh1745.Sample", "samples\Bh1745.Sample.csproj", "{24A728CA-F4EF-4DB0-B13F-65FFD772352B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bh1745.Sample", "samples\BH1745\Bh1745.Sample.csproj", "{24A728CA-F4EF-4DB0-B13F-65FFD772352B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bh1745CustomConfiguration.Sample", "samples\Bh1745CustomConfiguration.Sample.csproj", "{F6ED35EA-2FDE-4056-8165-0FAB6CE5DD5E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bh1745CustomConfiguration.Sample", "samples\CustomConfiguration\Bh1745CustomConfiguration.Sample.csproj", "{F6ED35EA-2FDE-4056-8165-0FAB6CE5DD5E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bh1745", "Bh1745.csproj", "{C572C86D-5BB2-4610-84EA-768257758933}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Bh1745.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Bh1745.csproj" />
<ProjectReference Include="../../Bh1745.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<None Remove="rpi-bmp280_i2c.fzz" />
<None Remove="rpi-bmp280_i2c.png" />
<Compile Include="Bh1745.CustomConfiguration.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bme280.sample.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bmxx80.csproj" />
<ProjectReference Include="../../Bh1745.csproj" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/devices/Bmxx80/Bmxx80.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{3810A23A-DF9E-4956-961F-10272B731209}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bme280.sample", "samples\Bme280.sample.csproj", "{5F20AA65-F5E2-4CD9-8847-1508DA362092}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bme280.sample", "samples\Bme280\Bme280.sample.csproj", "{5F20AA65-F5E2-4CD9-8847-1508DA362092}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bme680.sample", "samples\Bme680.sample.csproj", "{0583C743-4EE5-4150-8886-AABC1EB6A339}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bme680.sample", "samples\Bme680\Bme680.sample.csproj", "{0583C743-4EE5-4150-8886-AABC1EB6A339}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bmp280.sample", "samples\Bmp280.sample.csproj", "{99456915-2483-4C22-8F63-8817A097F2E2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bmp280.sample", "samples\Bmp280\Bmp280.sample.csproj", "{99456915-2483-4C22-8F63-8817A097F2E2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bmxx80", "Bmxx80.csproj", "{D0AA8380-159F-445B-A081-D750B9062ADA}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.CustomConfiguration.cs" />
<Compile Include="Bme280.sample.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Bh1745.csproj" />
<ProjectReference Include="../../Bmxx80.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Device.I2c;
using System.Threading;
using Iot.Device.Bmxx80;
using Iot.Device.Common;
using UnitsNet;
Console.WriteLine("Hello BME680!");
// The I2C bus ID on the Raspberry Pi 3.
const int busId = 1;
// set this to the current sea level pressure in the area for correct altitude readings
Pressure defaultSeaLevelPressure = WeatherHelper.MeanSeaLevel;
I2cConnectionSettings i2cSettings = new(busId, Bme680.DefaultI2cAddress);
I2cDevice i2cDevice = I2cDevice.Create(i2cSettings);
using Bme680 bme680 = new Bme680(i2cDevice, Temperature.FromDegreesCelsius(20.0));
while (true)
{
// reset will change settings back to default
bme680.Reset();
// 10 consecutive measurement with default settings
for (var i = 0; i < 10; i++)
{
// Perform a synchronous measurement
var readResult = bme680.Read();
// Print out the measured data
Console.WriteLine($"Gas resistance: {readResult.GasResistance?.Ohms:0.##}Ohm");
Console.WriteLine($"Temperature: {readResult.Temperature?.DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Pressure: {readResult.Pressure?.Hectopascals:0.##}hPa");
Console.WriteLine($"Relative humidity: {readResult.Humidity?.Percent:0.#}%");
if (readResult.Temperature.HasValue && readResult.Pressure.HasValue)
{
var altValue = WeatherHelper.CalculateAltitude(readResult.Pressure.Value, defaultSeaLevelPressure, readResult.Temperature.Value);
Console.WriteLine($"Altitude: {altValue.Meters:0.##}m");
}
if (readResult.Temperature.HasValue && readResult.Humidity.HasValue)
{
// WeatherHelper supports more calculations, such as saturated vapor pressure, actual vapor pressure and absolute humidity.
Console.WriteLine($"Heat index: {WeatherHelper.CalculateHeatIndex(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Dew point: {WeatherHelper.CalculateDewPoint(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
}
// when measuring the gas resistance on each cycle it is important to wait a certain interval
// because a heating plate is activated which will heat up the sensor without sleep, this can
// falsify all readings coming from the sensor
Thread.Sleep(1000);
}
// change the settings
bme680.TemperatureSampling = Sampling.HighResolution;
bme680.HumiditySampling = Sampling.UltraHighResolution;
bme680.PressureSampling = Sampling.Skipped;
bme680.ConfigureHeatingProfile(Bme680HeaterProfile.Profile2, Temperature.FromDegreesCelsius(280), Duration.FromMilliseconds(80), Temperature.FromDegreesCelsius(24));
bme680.HeaterProfile = Bme680HeaterProfile.Profile2;
// 10 consecutive measurements with custom settings
for (int i = 0; i < 10; i++)
{
// Perform an asynchronous measurement
var readResult = await bme680.ReadAsync();
// Print out the measured data
Console.WriteLine($"Gas resistance: {readResult.GasResistance?.Ohms:0.##}Ohm");
Console.WriteLine($"Temperature: {readResult.Temperature?.DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Pressure: {readResult.Pressure?.Hectopascals:0.##}hPa");
Console.WriteLine($"Relative humidity: {readResult.Humidity?.Percent:0.#}%");
if (readResult.Temperature.HasValue && readResult.Pressure.HasValue)
{
var altValue = WeatherHelper.CalculateAltitude(readResult.Pressure.Value, defaultSeaLevelPressure, readResult.Temperature.Value);
Console.WriteLine($"Altitude: {altValue.Meters:0.##}m");
}
if (readResult.Temperature.HasValue && readResult.Humidity.HasValue)
{
// WeatherHelper supports more calculations, such as saturated vapor pressure, actual vapor pressure and absolute humidity.
Console.WriteLine($"Heat index: {WeatherHelper.CalculateHeatIndex(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Dew point: {WeatherHelper.CalculateDewPoint(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
}
Thread.Sleep(1000);
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Device.I2c;
using System.Threading;
using Iot.Device.Bmxx80;
using Iot.Device.Common;
using UnitsNet;

Console.WriteLine("Hello BME680!");

// The I2C bus ID on the Raspberry Pi 3.
const int busId = 1;
// set this to the current sea level pressure in the area for correct altitude readings
Pressure defaultSeaLevelPressure = WeatherHelper.MeanSeaLevel;

I2cConnectionSettings i2cSettings = new(busId, Bme680.DefaultI2cAddress);
I2cDevice i2cDevice = I2cDevice.Create(i2cSettings);

using Bme680 bme680 = new Bme680(i2cDevice, Temperature.FromDegreesCelsius(20.0));

while (true)
{
// reset will change settings back to default
bme680.Reset();

// 10 consecutive measurement with default settings
for (var i = 0; i < 10; i++)
{
// Perform a synchronous measurement
var readResult = bme680.Read();

// Print out the measured data
Console.WriteLine($"Gas resistance: {readResult.GasResistance?.Ohms:0.##}Ohm");
Console.WriteLine($"Temperature: {readResult.Temperature?.DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Pressure: {readResult.Pressure?.Hectopascals:0.##}hPa");
Console.WriteLine($"Relative humidity: {readResult.Humidity?.Percent:0.#}%");

if (readResult.Temperature.HasValue && readResult.Pressure.HasValue)
{
var altValue = WeatherHelper.CalculateAltitude(readResult.Pressure.Value, defaultSeaLevelPressure, readResult.Temperature.Value);
Console.WriteLine($"Altitude: {altValue.Meters:0.##}m");
}

if (readResult.Temperature.HasValue && readResult.Humidity.HasValue)
{
// WeatherHelper supports more calculations, such as saturated vapor pressure, actual vapor pressure and absolute humidity.
Console.WriteLine($"Heat index: {WeatherHelper.CalculateHeatIndex(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Dew point: {WeatherHelper.CalculateDewPoint(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
}

// when measuring the gas resistance on each cycle it is important to wait a certain interval
// because a heating plate is activated which will heat up the sensor without sleep, this can
// falsify all readings coming from the sensor
Thread.Sleep(1000);
}

// change the settings
bme680.TemperatureSampling = Sampling.HighResolution;
bme680.HumiditySampling = Sampling.UltraHighResolution;
bme680.PressureSampling = Sampling.Skipped;

bme680.ConfigureHeatingProfile(Bme680HeaterProfile.Profile2, Temperature.FromDegreesCelsius(280), Duration.FromMilliseconds(80), Temperature.FromDegreesCelsius(24));
bme680.HeaterProfile = Bme680HeaterProfile.Profile2;

// 10 consecutive measurements with custom settings
for (int i = 0; i < 10; i++)
{
// Perform an asynchronous measurement
var readResult = await bme680.ReadAsync();

// Print out the measured data
Console.WriteLine($"Gas resistance: {readResult.GasResistance?.Ohms:0.##}Ohm");
Console.WriteLine($"Temperature: {readResult.Temperature?.DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Pressure: {readResult.Pressure?.Hectopascals:0.##}hPa");
Console.WriteLine($"Relative humidity: {readResult.Humidity?.Percent:0.#}%");

if (readResult.Temperature.HasValue && readResult.Pressure.HasValue)
{
var altValue = WeatherHelper.CalculateAltitude(readResult.Pressure.Value, defaultSeaLevelPressure, readResult.Temperature.Value);
Console.WriteLine($"Altitude: {altValue.Meters:0.##}m");
}

if (readResult.Temperature.HasValue && readResult.Humidity.HasValue)
{
// WeatherHelper supports more calculations, such as saturated vapor pressure, actual vapor pressure and absolute humidity.
Console.WriteLine($"Heat index: {WeatherHelper.CalculateHeatIndex(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
Console.WriteLine($"Dew point: {WeatherHelper.CalculateDewPoint(readResult.Temperature.Value, readResult.Humidity.Value).DegreesCelsius:0.#}\u00B0C");
}

Thread.Sleep(1000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
<TargetFramework>$(DefaultSampleTfms)</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<None Remove="rpi-bmp280_i2c.fzz" />
<None Remove="rpi-bmp280_i2c.png" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bme680.sample.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bmxx80.csproj" />
<ProjectReference Include="../../Bmxx80.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
<TargetFramework>$(DefaultSampleTfms)</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<None Remove="rpi-bmp280_i2c.fzz" />
<None Remove="rpi-bmp280_i2c.png" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bmp280.sample.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bmxx80.csproj" />
<ProjectReference Include="../../Bmxx80.csproj" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/devices/LiquidLevel/LiquidLevel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{499A
samples\README.md = samples\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Llc200d3sh.Sample", "samples\Llc200d3sh.Sample.csproj", "{6A38157B-7F9E-4003-A346-D898C86AE8FA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Llc200d3sh.Sample", "samples\Llc200d3sh\Llc200d3sh.Sample.csproj", "{6A38157B-7F9E-4003-A346-D898C86AE8FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiquidLevelSwitch.Sample", "samples\LiquidLevelSwitch.Sample.csproj", "{2675D556-74B1-40DA-B1F8-4CE2733463CF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiquidLevelSwitch.Sample", "samples\LiquidLevelSwitch\LiquidLevelSwitch.Sample.csproj", "{2675D556-74B1-40DA-B1F8-4CE2733463CF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
<TargetFramework>$(DefaultSampleTfms)</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<None Remove="rpi-llc200d3sh.fzz" />
<None Remove="rpi-llc200d3sh_bb.png" />
</ItemGroup>
<ItemGroup>
<Compile Include="LiquidLevelSwitch.sample.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LiquidLevel.csproj" />
<ProjectReference Include="../../LiquidLevel.csproj" />
</ItemGroup>
</Project>