-
Notifications
You must be signed in to change notification settings - Fork 536
/
Copy pathGuidWrapper.cs
164 lines (146 loc) · 6.75 KB
/
GuidWrapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//
// GuidWrapper.cs: Support for treating C# Guids as UUids
//
// Author:
// Miguel de Icaza ([email protected]
//
// Copyright 2011-2014 Xamarin Inc
//
using System;
using System.Runtime.InteropServices;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
#nullable enable
namespace CoreBluetooth {
internal static class CFUUID {
// CFUUID.h
[DllImport (Constants.CoreFoundationLibrary)]
public extern static /* CFUUIDRef */ IntPtr CFUUIDCreateFromString ( /* CFAllocatorRef */ IntPtr alloc, /* CFStringRef */ IntPtr uuidStr);
}
public partial class CBCentralManager {
/// <include file="../../docs/api/CoreBluetooth/CBCentralManager.xml" path="/Documentation/Docs[@DocId='M:CoreBluetooth.CBCentralManager.ConnectPeripheral(CoreBluetooth.CBPeripheral,CoreBluetooth.PeripheralConnectionOptions)']/*" />
public void ConnectPeripheral (CBPeripheral peripheral, PeripheralConnectionOptions? options = null)
{
ConnectPeripheral (peripheral, options?.Dictionary);
}
/// <param name="peripheralUuids">To be added.</param>
/// <param name="options">To be added.</param>
/// <summary>Scans for peripherals that are advertising any of the specified <paramref name="peripheralUuids" /> with the specified <paramref name="options" />.</summary>
/// <remarks>To be added.</remarks>
public void ScanForPeripherals (CBUUID []? peripheralUuids, NSDictionary? options)
{
if (peripheralUuids is null)
ScanForPeripherals ((NSArray?) null, options);
else
ScanForPeripherals (NSArray.FromObjects (peripheralUuids), options);
}
/// <param name="peripheralUuids">To be added.</param>
/// <param name="options">To be added.</param>
/// <summary>Scans for peripherals that are advertising any of the specified <paramref name="peripheralUuids" /> with the specified <paramref name="options" />.</summary>
/// <remarks>To be added.</remarks>
public void ScanForPeripherals (CBUUID [] peripheralUuids, PeripheralScanningOptions? options = null)
{
ScanForPeripherals (peripheralUuids, options?.Dictionary);
}
/// <param name="peripheralUuids">To be added.</param>
/// <summary>Scans for peripherals that are advertising any of the specified <paramref name="peripheralUuids" />.</summary>
/// <remarks>To be added.</remarks>
public void ScanForPeripherals (CBUUID [] peripheralUuids)
{
ScanForPeripherals (peripheralUuids, null as NSDictionary);
}
/// <param name="serviceUuid">To be added.</param>
/// <param name="options">To be added.</param>
/// <summary>Scans for peripherals that are advertising the specified <paramref name="serviceUuid" /> with the specified <paramref name="options" />.</summary>
/// <remarks>To be added.</remarks>
public void ScanForPeripherals (CBUUID serviceUuid, NSDictionary? options)
{
ScanForPeripherals (new [] { serviceUuid }, options);
}
/// <param name="serviceUuid">To be added.</param>
/// <summary>Scans for peripherals that are advertising the specified <paramref name="serviceUuid" />.</summary>
/// <remarks>To be added.</remarks>
public void ScanForPeripherals (CBUUID serviceUuid)
{
ScanForPeripherals (new [] { serviceUuid }, null as NSDictionary);
}
}
public partial class CBPeripheral {
/// <summary>Discovers all available services.</summary>
/// <remarks>To be added.</remarks>
public void DiscoverServices ()
{
DiscoverServices ((NSArray?) null);
}
/// <param name="services">To be added.</param>
/// <summary>Discovers the specified <paramref name="services" />.</summary>
/// <remarks>To be added.</remarks>
public void DiscoverServices (CBUUID []? services)
{
if (services is null)
DiscoverServices ((NSArray?) null);
else
DiscoverServices (NSArray.FromObjects (services));
}
/// <param name="includedServiceUUIDs">To be added.</param>
/// <param name="forService">To be added.</param>
/// <summary>Discovers the included services in <paramref name="forService" /> that are of the service types that are identified by the UUIDs in <paramref name="includedServiceUUIDs" />.</summary>
/// <remarks>To be added.</remarks>
public void DiscoverIncludedServices (CBUUID []? includedServiceUUIDs, CBService forService)
{
if (includedServiceUUIDs is null)
DiscoverIncludedServices ((NSArray?) null, forService);
else
DiscoverIncludedServices (NSArray.FromObjects (includedServiceUUIDs), forService);
}
/// <param name="forService">Service that you want to discover all the characteristics for.</param>
/// <summary>Discover all characteristics in a service (slow).</summary>
/// <remarks>
/// <para>
/// When the characteristics are discovered, the event
/// DiscoverCharacteristic is raised (or alternatively, if you
/// set a Delegate, the method DiscoverCharacteristic on the
/// delegate is invoked with the results).
/// </para>
/// <para>
/// Once the characterstics have been discovered, they are
/// available on the <see cref="P:CoreBluetooth.CBService.Characteristics" />
/// property.
/// </para>
/// <para>
/// This method is potentially slow and will return all the
/// characteristics supported by the service. Ideally, you
/// should use the overload that allows you to specifify an
/// array of CBUUIDs as that will be faster.
/// </para>
/// </remarks>
public void DiscoverCharacteristics (CBService forService)
{
DiscoverCharacteristics ((NSArray?) null, forService);
}
/// <param name="charactersticUUIDs">Array of CBUUIDs containing the characteristics that you are probing for.</param>
/// <param name="forService">Service that you want to discover the characteristics for.</param>
/// <summary>Discovers the list of characteristics in the specified service.</summary>
/// <remarks>
/// <para>
/// When the characteristics are discovered, the event
/// DiscoverCharacteristic is raised (or alternatively, if you
/// set a Delegate, the method DiscoverCharacteristic on the
/// delegate is invoked with the results).
/// </para>
/// <para>
/// Once the characterstics have been discovered, they are
/// available on the <see cref="P:CoreBluetooth.CBService.Characteristics" />
/// property.
/// </para>
/// </remarks>
public void DiscoverCharacteristics (CBUUID []? charactersticUUIDs, CBService forService)
{
if (charactersticUUIDs is null)
DiscoverCharacteristics ((NSArray?) null, forService);
else
DiscoverCharacteristics (NSArray.FromObjects (charactersticUUIDs), forService);
}
}
}