Skip to content

Commit 1b3a673

Browse files
authored
chore: Bump csharpier and reformat (#102)
1 parent 470350d commit 1b3a673

8 files changed

Lines changed: 66 additions & 56 deletions

File tree

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"rollForward": false
1111
},
1212
"csharpier": {
13-
"version": "1.1.2",
13+
"version": "1.2.5",
1414
"commands": [
1515
"csharpier"
1616
],

examples/Darp.Ble.Examples/Program.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,10 @@ async Task AdvertiseApi(IBleDevice device)
290290

291291
await device.Broadcaster.StartAdvertisingAsync(
292292
BleEventType.Connectable,
293-
data: AdvertisingData.From(
294-
[
295-
(AdTypes.CompleteListOf16BitServiceOrServiceClassUuids, [0x34, 0x12]),
296-
(AdTypes.ManufacturerSpecificData, [0x04, 0x00, 0x01, 0x02, 0x03, 0x04]),
297-
]
298-
),
293+
data: AdvertisingData.From([
294+
(AdTypes.CompleteListOf16BitServiceOrServiceClassUuids, [0x34, 0x12]),
295+
(AdTypes.ManufacturerSpecificData, [0x04, 0x00, 0x01, 0x02, 0x03, 0x04]),
296+
]),
299297
interval: ScanTiming.Ms100
300298
);
301299
IAdvertisingSet advertisingSet = await device.Broadcaster.CreateAdvertisingSetAsync();

test/Darp.Ble.HciHost.Tests/BleDeviceTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public async Task InitializeBleDevice()
3535
public async Task SetRandomAddress()
3636
{
3737
var newAddress = BleAddress.CreateRandomAddress((UInt48)0x112233445566);
38-
ReplayTransportLayer replayTransportLayer = ReplayTransportLayer.ReplayAfterBleDeviceInitialization(
39-
[HciMessage.CommandCompleteEventToHost("01052000")]
40-
);
38+
ReplayTransportLayer replayTransportLayer = ReplayTransportLayer.ReplayAfterBleDeviceInitialization([
39+
HciMessage.CommandCompleteEventToHost("01052000"),
40+
]);
4141
await using IBleDevice device = await Helpers.GetAndInitializeBleDeviceAsync(
4242
replayTransportLayer,
4343
token: Token
@@ -52,9 +52,10 @@ public async Task SetRandomAddress()
5252
[Fact]
5353
public async Task LaunchMultipleCommandsAtTheSameTime()
5454
{
55-
ReplayTransportLayer replayTransportLayer = ReplayTransportLayer.ReplayAfterInitialization(
56-
[HciMessage.CommandCompleteEventToHost("01392000"), HciMessage.CommandCompleteEventToHost("01352000")]
57-
);
55+
ReplayTransportLayer replayTransportLayer = ReplayTransportLayer.ReplayAfterInitialization([
56+
HciMessage.CommandCompleteEventToHost("01392000"),
57+
HciMessage.CommandCompleteEventToHost("01352000"),
58+
]);
5859
await using var device = new HciDevice(
5960
replayTransportLayer,
6061
0x112233445566,

test/Darp.Ble.HciHost.Tests/CentralTests.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ public async Task ConnectToPeripheral_HappyPath()
1919
const ushort connectionHandle = 0x0001;
2020
var peerAddress = BleAddress.CreateRandomAddress((UInt48)0x112233445566);
2121

22-
ReplayTransportLayer replay = ReplayTransportLayer.ReplayAfterBleDeviceInitialization(
23-
[
24-
HciMessages.HciLeExtendedCreateConnectionCommandStatusEvent(),
25-
HciMessages.HciLeReadPhyEvent(connectionHandle, txPhy: 0x01, rxPhy: 0x01),
26-
HciMessages.AttExchangeMtuResponse(connectionHandle, serverRxMtu: 65),
27-
HciMessages.HciDisconnectionCompleteEvent(connectionHandle),
28-
]
29-
);
22+
ReplayTransportLayer replay = ReplayTransportLayer.ReplayAfterBleDeviceInitialization([
23+
HciMessages.HciLeExtendedCreateConnectionCommandStatusEvent(),
24+
HciMessages.HciLeReadPhyEvent(connectionHandle, txPhy: 0x01, rxPhy: 0x01),
25+
HciMessages.AttExchangeMtuResponse(connectionHandle, serverRxMtu: 65),
26+
HciMessages.HciDisconnectionCompleteEvent(connectionHandle),
27+
]);
3028

3129
await using IBleDevice device = await Helpers.GetAndInitializeBleDeviceAsync(replay, token: Token);
3230

test/Darp.Ble.HciHost.Tests/PeripheralTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public async Task OnHciConnectionCompleteEvent_SuccessfulConnection_ShouldAddPee
2222
const ushort connectionHandle = 0x0001;
2323
var peerAddress = BleAddress.CreateRandomAddress((UInt48)0x112233445566);
2424

25-
ReplayTransportLayer replay = ReplayTransportLayer.ReplayAfterBleDeviceInitialization(
26-
[HciMessages.HciDisconnectionCompleteEvent(connectionHandle)]
27-
);
25+
ReplayTransportLayer replay = ReplayTransportLayer.ReplayAfterBleDeviceInitialization([
26+
HciMessages.HciDisconnectionCompleteEvent(connectionHandle),
27+
]);
2828

2929
await using IBleDevice device = await Helpers.GetAndInitializeBleDeviceAsync(replay, token: Token);
3030

@@ -66,9 +66,9 @@ public async Task ServiceDiscovery_WhenCentralRequestsServices_ShouldRespondWith
6666
const ushort connectionHandle = 0x000F;
6767
var peerAddress = BleAddress.CreateRandomAddress((UInt48)0x112233445566);
6868

69-
ReplayTransportLayer replay = ReplayTransportLayer.ReplayAfterBleDeviceInitialization(
70-
[HciMessages.HciDisconnectionCompleteEvent(connectionHandle)]
71-
);
69+
ReplayTransportLayer replay = ReplayTransportLayer.ReplayAfterBleDeviceInitialization([
70+
HciMessages.HciDisconnectionCompleteEvent(connectionHandle),
71+
]);
7272

7373
await using IBleDevice device = await Helpers.GetAndInitializeBleDeviceAsync(replay, token: Token);
7474
device.Peripheral.AddGattService();

test/Darp.Ble.HciHost.Verify/ReplayTransportLayer.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,12 @@ public sealed class ReplayTransportLayer(
6666
];
6767

6868
public static readonly HciMessage[] InitializeBleDeviceMessages = InitializeHciDeviceMessages
69-
.Concat(
70-
[
71-
// HCI_LE_Set_Random_Address
72-
HciMessage.CommandCompleteEventToHost("01052000"),
73-
// HCI_LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH
74-
HciMessage.CommandCompleteEventToHost("013A20003E00"),
75-
]
76-
)
69+
.Concat([
70+
// HCI_LE_Set_Random_Address
71+
HciMessage.CommandCompleteEventToHost("01052000"),
72+
// HCI_LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH
73+
HciMessage.CommandCompleteEventToHost("013A20003E00"),
74+
])
7775
.ToArray();
7876

7977
/// <summary> Provides all messages sent to the controller. Skips the defined number of messages </summary>

test/Darp.Ble.Tests/Data/BleUuidTests.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,24 @@ public void TryWriteBytes_WithUuid128AndSufficientDestination_ReturnsTrueAndCopi
361361
destination
362362
.ToArray()
363363
.Should()
364-
.BeEquivalentTo(
365-
[0x04, 0x03, 0x02, 0x01, 0x06, 0x05, 0x08, 0x07, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10]
366-
);
364+
.BeEquivalentTo([
365+
0x04,
366+
0x03,
367+
0x02,
368+
0x01,
369+
0x06,
370+
0x05,
371+
0x08,
372+
0x07,
373+
0x09,
374+
0x0A,
375+
0x0B,
376+
0x0C,
377+
0x0D,
378+
0x0E,
379+
0x0F,
380+
0x10,
381+
]);
367382
}
368383

369384
[Fact]

test/Darp.Ble.Tests/Gap/AdvertisingDataExtensionsSetterTests.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ public void WithShortenedLocalName_SectionAlreadyPresent_ReplacesExistingSection
195195
public void WithShortenedLocalName_OriginalAdvertisingData_RemainsUnchanged()
196196
{
197197
// Arrange
198-
AdvertisingData original = AdvertisingData.From(
199-
[(AdTypes.Flags, [(byte)AdvertisingDataFlags.LimitedDiscoverableMode])]
200-
);
198+
AdvertisingData original = AdvertisingData.From([
199+
(AdTypes.Flags, [(byte)AdvertisingDataFlags.LimitedDiscoverableMode]),
200+
]);
201201
const string newShortName = "MyShort";
202202

203203
// Act
@@ -244,9 +244,9 @@ public void WithManufacturerSpecificData_SectionAlreadyPresent_ReplacesExistingS
244244
{
245245
// Arrange
246246
const CompanyIdentifiers companyId = CompanyIdentifiers.NordicSemiconductorAsa;
247-
AdvertisingData original = AdvertisingData.From(
248-
[(AdTypes.ManufacturerSpecificData, [.. BitConverter.GetBytes((ushort)companyId), 0x01, 0x02])]
249-
);
247+
AdvertisingData original = AdvertisingData.From([
248+
(AdTypes.ManufacturerSpecificData, [.. BitConverter.GetBytes((ushort)companyId), 0x01, 0x02]),
249+
]);
250250
ReadOnlyMemory<byte> newData = new byte[] { 0xAA, 0xBB, 0xCC };
251251

252252
// Act
@@ -315,9 +315,9 @@ public void WithCompleteListOfServiceUuids_MultipleUuids_ExistingSections_Replac
315315
{
316316
// Arrange
317317
// Create original data with an existing complete 16-bit section
318-
AdvertisingData original = AdvertisingData.From(
319-
[(AdTypes.CompleteListOf16BitServiceOrServiceClassUuids, [0x0D, 0x18])]
320-
);
318+
AdvertisingData original = AdvertisingData.From([
319+
(AdTypes.CompleteListOf16BitServiceOrServiceClassUuids, [0x0D, 0x18]),
320+
]);
321321
// We will add two 16-bit and one 128-bit
322322
BleUuid[] newUuids = [Uuid16BitHeartRate, Uuid16BitDeviceInfo, Uuid128BitCustom];
323323

@@ -340,9 +340,9 @@ public void WithCompleteListOfServiceUuids_MultipleUuids_ExistingSections_Replac
340340
public void WithCompleteListOfServiceUuids_OriginalData_RemainsUnchanged()
341341
{
342342
// Arrange
343-
AdvertisingData original = AdvertisingData.From(
344-
[(AdTypes.Flags, [(byte)AdvertisingDataFlags.LimitedDiscoverableMode])]
345-
);
343+
AdvertisingData original = AdvertisingData.From([
344+
(AdTypes.Flags, [(byte)AdvertisingDataFlags.LimitedDiscoverableMode]),
345+
]);
346346

347347
// Act
348348
AdvertisingData modified = original.WithCompleteListOfServiceUuids(Uuid32);
@@ -386,9 +386,9 @@ public void WithIncompleteListOfServiceUuids_MultipleUuids_ExistingSections_Repl
386386
{
387387
// Arrange
388388
// Create original data with an existing complete 16-bit section
389-
AdvertisingData original = AdvertisingData.From(
390-
[(AdTypes.IncompleteListOf16BitServiceOrServiceClassUuids, [0x0D, 0x18])]
391-
);
389+
AdvertisingData original = AdvertisingData.From([
390+
(AdTypes.IncompleteListOf16BitServiceOrServiceClassUuids, [0x0D, 0x18]),
391+
]);
392392
// We will add two 16-bit and one 128-bit
393393
BleUuid[] newUuids = [Uuid16BitHeartRate, Uuid16BitDeviceInfo, Uuid128BitCustom];
394394

@@ -411,9 +411,9 @@ public void WithIncompleteListOfServiceUuids_MultipleUuids_ExistingSections_Repl
411411
public void WithIncompleteListOfServiceUuids_OriginalData_RemainsUnchanged()
412412
{
413413
// Arrange
414-
AdvertisingData original = AdvertisingData.From(
415-
[(AdTypes.Flags, [(byte)AdvertisingDataFlags.LimitedDiscoverableMode])]
416-
);
414+
AdvertisingData original = AdvertisingData.From([
415+
(AdTypes.Flags, [(byte)AdvertisingDataFlags.LimitedDiscoverableMode]),
416+
]);
417417

418418
// Act
419419
AdvertisingData modified = original.WithIncompleteListOfServiceUuids(Uuid32);

0 commit comments

Comments
 (0)