Skip to content

Commit

Permalink
Merge pull request #615 from WildernessLabs/formatting_cleanup
Browse files Browse the repository at this point in the history
Autoformatting cleanup
  • Loading branch information
ctacke authored Feb 20, 2025
2 parents bca2684 + 63138ef commit b05f46d
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Source/Meadow.Core/Cloud/MeadowCloudUpdateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private async Task DownloadProc(UpdateMessage message)
Resolver.Log.Trace($"Starting download... File size: {message.FileSize.ToString("N0")} bytes.");
}

using (var stream = await response.Content.ReadAsStreamAsync())
using (var stream = await response.Content.ReadAsStreamAsync())
{
using (var fileStream = Store.GetUpdateFileStream(message.ID))
{
Expand Down
5 changes: 1 addition & 4 deletions Source/Meadow.Core/Gateways/Bluetooth/Characteristic.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.ObjectModel;

namespace Meadow.Gateways.Bluetooth
namespace Meadow.Gateways.Bluetooth
{
/*
public class Characteristic : ICharacteristic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
namespace Meadow.Gateways.Bluetooth
namespace Meadow.Gateways.Bluetooth
{
/// <summary>
/// Specifies how a value should be written.
Expand Down
3 changes: 1 addition & 2 deletions Source/Meadow.Core/Gateways/Bluetooth/Descriptor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
namespace Meadow.Gateways.Bluetooth
namespace Meadow.Gateways.Bluetooth
{
/*
/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions Source/Meadow.Core/Gateways/Bluetooth/Service.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.ObjectModel;

namespace Meadow.Gateways.Bluetooth
namespace Meadow.Gateways.Bluetooth
{
/*
public class Service : IService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,37 +288,37 @@ private void EventHandlerServiceThread(object o)
EventData eventData = Encoders.ExtractEventData(rxBuffer, 0);
byte[]? payload = null;
string functionName = string.Empty;
switch ((Esp32Interfaces) eventData.Interface)
switch ((Esp32Interfaces)eventData.Interface)
{
case Esp32Interfaces.WiFi:
functionName = ((WiFiFunction) eventData.Function).ToString();
functionName = ((WiFiFunction)eventData.Function).ToString();
break;
case Esp32Interfaces.BlueTooth:
functionName = ((BluetoothFunction) eventData.Function).ToString();
functionName = ((BluetoothFunction)eventData.Function).ToString();
break;
case Esp32Interfaces.Cell:
functionName = ((CellFunction) eventData.Function).ToString();
functionName = ((CellFunction)eventData.Function).ToString();
break;
case Esp32Interfaces.System:
functionName = ((SystemFunction) eventData.Function).ToString();
functionName = ((SystemFunction)eventData.Function).ToString();
break;
case Esp32Interfaces.WiredEthernet:
functionName = ((EthernetFunction) eventData.Function).ToString();
functionName = ((EthernetFunction)eventData.Function).ToString();
break;
case Esp32Interfaces.Transport:
functionName = ((TransportFunction) eventData.Function).ToString();
functionName = ((TransportFunction)eventData.Function).ToString();
break;
default:
functionName = "Unknown";
break;
}
if (eventData.MessageId == 0)
{
Resolver.Log.Trace($"Simple event, interface {((Esp32Interfaces) eventData.Interface).ToString()}, event code: {functionName}, status code {((StatusCodes) eventData.StatusCode).ToString()} (0x{eventData.StatusCode:x08})", MessageGroup.Esp);
Resolver.Log.Trace($"Simple event, interface {((Esp32Interfaces)eventData.Interface).ToString()}, event code: {functionName}, status code {((StatusCodes)eventData.StatusCode).ToString()} (0x{eventData.StatusCode:x08})", MessageGroup.Esp);
}
else
{
Resolver.Log.Trace($"Complex event, interface {((Esp32Interfaces) eventData.Interface).ToString()}, event code: {functionName}, status code {((StatusCodes) eventData.StatusCode).ToString()} (0x{eventData.StatusCode:x08})", MessageGroup.Esp);
Resolver.Log.Trace($"Complex event, interface {((Esp32Interfaces)eventData.Interface).ToString()}, event code: {functionName}, status code {((StatusCodes)eventData.StatusCode).ToString()} (0x{eventData.StatusCode:x08})", MessageGroup.Esp);
GetEventData(eventData, out payload);
}
Resolver.Log.Trace("Event data collected, raising event.", MessageGroup.Esp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ public struct DisconnectEventData
/// <summary>
/// Bssid element.
/// </summary>
public Byte []Bssid;
/// <summary>
public Byte[] Bssid;
/// <summary>
/// Rssi element.
/// </summary>
public Byte Rssi;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Meadow.Hardware;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using System.Text;

namespace Meadow.Devices
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Meadow.Hardware;
using Meadow.Hardware;

namespace Meadow.Devices
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Meadow.Hardware;
using Meadow.Hardware;

namespace Meadow.Devices
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
namespace Meadow.Core;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
namespace Meadow.Core;

internal static partial class Interop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static byte[] MeadowCloudDecryptAES(byte[] encrypted_data, byte[] key, by
IntPtr ivBufferPtr = IntPtr.Zero;

if (encrypted_data.Length % 16 != 0)
throw new ArgumentException(nameof(encrypted_data));
throw new ArgumentException(nameof(encrypted_data));

if (key.Length != aes_key_size)
throw new ArgumentException(nameof(key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Meadow.Core
{
// we create some structs for P/Invoke that give 0649's. It's non-applicable for these, so ignore
// we create some structs for P/Invoke that give 0649's. It's non-applicable for these, so ignore
#pragma warning disable 0649
internal static partial class Interop
{
Expand Down
7 changes: 2 additions & 5 deletions Source/implementations/f7/Meadow.F7/Interop/Interop.stm32.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Runtime.InteropServices;

namespace Meadow.Core
namespace Meadow.Core
{
internal static partial class Interop
{
Expand Down Expand Up @@ -96,7 +93,7 @@ public static partial class STM32
public const int ADC_SR_AWD = (1 << 0); // analog watchdog

public const int ADC_CCR_NON_RESERVED_MASK = 0x00c3ef1f;

public const int ADC_CCR_TSVREFE_SHIFT = 23;
public const int ADC_CCR_VBATE_SHIFT = 22;
public const int ADC_CCR_ADCPRE_SHIFT = 16;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Runtime.InteropServices;

namespace Meadow.Core
namespace Meadow.Core
{
internal static partial class Interop
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void SetDirection(int gpio, GpioDirection direction)
var path = $"{GpioFolder}/gpio{gpio}/direction";

var handle = Interop.open(path, Interop.DriverFlags.O_WRONLY);
if(handle < 0)
if (handle < 0)
{
throw new NativeException($"Unable to get handle for GPIO {gpio} (error code {Marshal.GetLastWin32Error()})");
}
Expand Down Expand Up @@ -195,7 +195,7 @@ private void SetEdge(int gpio, InterruptMode mode)
try
{
byte[] content;
switch(mode)
switch (mode)
{
case InterruptMode.EdgeBoth:
content = Encoding.ASCII.GetBytes("both\0");
Expand Down Expand Up @@ -279,7 +279,7 @@ private void InterruptProc(int gpio, int handle, CancellationToken cancelToken,
{
throw new NativeException($"Failed to poll for interrupt: {Marshal.GetLastWin32Error()}");
}
else if(result == 0)
else if (result == 0)
{
// timeout, NOP
}
Expand Down

0 comments on commit b05f46d

Please sign in to comment.