-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert: move onto another branch & refactor
- Loading branch information
1 parent
8590205
commit 73bf3bb
Showing
20 changed files
with
82 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 15 additions & 51 deletions
66
GalaxyBudsClient.Platform/Interfaces/IBluetoothService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using GalaxyBudsClient.Platform.Model; | ||
|
||
namespace GalaxyBudsClient.Platform.Interfaces | ||
{ | ||
public class BluetoothDevice(string name, string address, bool isConnected, bool isPaired, BluetoothCoD cod, Guid[]? serviceUuids = null) | ||
{ | ||
public BluetoothDevice(uint cod) : this(string.Empty, string.Empty, false, false, new BluetoothCoD(cod)) | ||
{ | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"{Name} ({Address})"; //$"BluetoothDevice[Name={Name},Address={Address},IsConnected={IsConnected},IsPaired='{IsPaired}',CoD='{Class}']"; | ||
} | ||
namespace GalaxyBudsClient.Platform.Interfaces; | ||
|
||
public virtual string Name { get; } = name; | ||
public virtual string Address { get; } = address; | ||
public virtual bool IsConnected { get; } = isConnected; | ||
public virtual bool IsPaired { get; } = isPaired; | ||
public BluetoothCoD Class { get; } = cod; | ||
public virtual Guid[]? ServiceUuids { get; } = serviceUuids; | ||
|
||
public static IEnumerable<BluetoothDevice> DummyDevices() | ||
{ | ||
/* Dummy devices for testing */ | ||
var cod = new BluetoothCoD(0); | ||
return new BluetoothDevice[] | ||
{ | ||
new("Galaxy Buds (36FD) [Dummy]", "36:AB:38:F5:04:FD", true, true, cod), | ||
new("Galaxy Buds+ (A2D5) [Dummy]", "A2:BF:D4:4A:52:D5", true, true, cod), | ||
new("Galaxy Buds Live (4AC3) [Dummy]", "4A:6B:87:E5:12:C3", true, true, cod), | ||
new("Galaxy Buds Pro (E43F) [Dummy]", "E4:25:FA:6D:B9:3F", true, true, cod), | ||
new("Galaxy Buds2 (D592) [Dummy]", "D5:97:B8:23:AB:92", true, true, cod), | ||
new("Galaxy Buds2 Pro (3292) [Dummy]", "32:97:B8:23:AB:92", true, true, cod), | ||
new("Galaxy Buds FE (A7D4) [Dummy]", "A7:97:B8:23:AB:D4", true, true, cod) | ||
}; | ||
} | ||
} | ||
|
||
public interface IBluetoothService | ||
{ | ||
event EventHandler<BluetoothException>? BluetoothErrorAsync; | ||
event EventHandler? Connecting; | ||
event EventHandler? Connected; | ||
event EventHandler? RfcommConnected; | ||
event EventHandler<string>? Disconnected; | ||
event EventHandler<byte[]>? NewDataAvailable; | ||
public interface IBluetoothService | ||
{ | ||
event EventHandler<BluetoothException>? BluetoothErrorAsync; | ||
event EventHandler? Connecting; | ||
event EventHandler? Connected; | ||
event EventHandler? RfcommConnected; | ||
event EventHandler<string>? Disconnected; | ||
event EventHandler<byte[]>? NewDataAvailable; | ||
|
||
bool IsStreamConnected { get; } | ||
bool IsStreamConnected { get; } | ||
|
||
Task ConnectAsync(string macAddress, string serviceUuid, CancellationToken cancelToken); | ||
Task DisconnectAsync(); | ||
Task SendAsync(byte[] data); | ||
Task ConnectAsync(string macAddress, string serviceUuid, CancellationToken cancelToken); | ||
Task DisconnectAsync(); | ||
Task SendAsync(byte[] data); | ||
|
||
Task<BluetoothDevice[]> GetDevicesAsync(); | ||
} | ||
Task<BluetoothDevice[]> GetDevicesAsync(); | ||
} |
2 changes: 1 addition & 1 deletion
2
GalaxyBudsClient.Platform/BluetoothCoD.cs → ...BudsClient.Platform/Model/BluetoothCoD.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace GalaxyBudsClient.Platform | ||
namespace GalaxyBudsClient.Platform.Model | ||
{ | ||
public class BluetoothCoD | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace GalaxyBudsClient.Platform.Model; | ||
|
||
public class BluetoothDevice(string name, string address, bool isConnected, bool isPaired, BluetoothCoD cod, Guid[]? serviceUuids = null) | ||
{ | ||
protected BluetoothDevice(uint cod) : this(string.Empty, string.Empty, false, false, new BluetoothCoD(cod)) | ||
{ | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"{Name} ({Address})"; //$"BluetoothDevice[Name={Name},Address={Address},IsConnected={IsConnected},IsPaired='{IsPaired}',CoD='{Class}']"; | ||
} | ||
|
||
public virtual string Name { get; } = name; | ||
public virtual string Address { get; } = address; | ||
public virtual bool IsConnected { get; } = isConnected; | ||
public virtual bool IsPaired { get; } = isPaired; | ||
public BluetoothCoD Class { get; } = cod; | ||
public virtual Guid[]? ServiceUuids { get; } = serviceUuids; | ||
|
||
public static IEnumerable<BluetoothDevice> DummyDevices() | ||
{ | ||
/* Dummy devices for testing */ | ||
var cod = new BluetoothCoD(0); | ||
return new BluetoothDevice[] | ||
{ | ||
new("Galaxy Buds (36FD) [Dummy]", "36:AB:38:F5:04:FD", true, true, cod), | ||
new("Galaxy Buds+ (A2D5) [Dummy]", "A2:BF:D4:4A:52:D5", true, true, cod), | ||
new("Galaxy Buds Live (4AC3) [Dummy]", "4A:6B:87:E5:12:C3", true, true, cod), | ||
new("Galaxy Buds Pro (E43F) [Dummy]", "E4:25:FA:6D:B9:3F", true, true, cod), | ||
new("Galaxy Buds2 (D592) [Dummy]", "D5:97:B8:23:AB:92", true, true, cod), | ||
new("Galaxy Buds2 Pro (3292) [Dummy]", "32:97:B8:23:AB:92", true, true, cod), | ||
new("Galaxy Buds FE (A7D4) [Dummy]", "A7:97:B8:23:AB:D4", true, true, cod) | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GalaxyBudsClient/Interface/ViewModels/Dialogs/ManualPairDialogViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters