2022-05-13 14:07:49 -07:00
|
|
|
|
// <copyright file="MacGattHelpers.cs" company="Scratch Foundation">
|
|
|
|
|
// Copyright (c) Scratch Foundation. All rights reserved.
|
|
|
|
|
// </copyright>
|
|
|
|
|
|
2022-07-07 17:40:49 -07:00
|
|
|
|
namespace ScratchLink.Mac.BLE;
|
2022-05-13 14:07:49 -07:00
|
|
|
|
|
|
|
|
|
using CoreBluetooth;
|
2022-05-25 09:59:31 -07:00
|
|
|
|
using ScratchLink.BLE;
|
2022-05-13 14:07:49 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Implement the MacOS-specific GATT helpers.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class MacGattHelpers : GattHelpers<CBUUID>
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override CBUUID MakeUUID(string name) =>
|
|
|
|
|
CBUUID.FromString(name);
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override CBUUID CanonicalUuid(uint alias) =>
|
|
|
|
|
CBUUID.FromBytes(new[]
|
|
|
|
|
{
|
|
|
|
|
(byte)((alias >> 24) & 0xFF),
|
|
|
|
|
(byte)((alias >> 16) & 0xFF),
|
|
|
|
|
(byte)((alias >> 8) & 0xFF),
|
|
|
|
|
(byte)((alias >> 0) & 0xFF),
|
|
|
|
|
});
|
|
|
|
|
}
|