Skip to content

Commit c5ebd0b

Browse files
authored
Update AccessibilitySubsystemDescriptor to use built-in MRTK base classes (#1109)
* Remove noisy log * Update core files * Update tools files * Update AccessibilitySubsystemDescriptor to use built-in MRTK base classes
1 parent 5b27655 commit c5ebd0b

11 files changed

Lines changed: 43 additions & 158 deletions

File tree

org.mixedrealitytoolkit.accessibility/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
44

5+
## Unreleased
6+
7+
### Changed
8+
9+
* Updated `AccessibilitySubsystemDescriptor` to use built-in MRTK base classes. [PR #1109](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1109)
10+
511
## [1.0.3-development.pre.20] - 2024-04-17
612

713
### Fixed

org.mixedrealitytoolkit.accessibility/Subsystems/AccessibilitySubsystemDescriptor.cs

Lines changed: 7 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -3,155 +3,26 @@
33

44
using MixedReality.Toolkit.Subsystems;
55
using System;
6-
using UnityEngine;
7-
using UnityEngine.SubsystemsImplementation;
86

97
namespace MixedReality.Toolkit.Accessibility
108
{
119
/// <summary>
1210
/// Encapsulates the parameters for creating a new <see cref="AccessibilitySubsystemDescriptor"/>.
1311
/// </summary>
14-
public struct AccessibilitySubsystemCinfo :
15-
IEquatable<AccessibilitySubsystemCinfo>, IMRTKSubsystemDescriptor
16-
{
17-
#region IMRTKDescriptor implementation
18-
19-
///<inheritdoc/>
20-
public string Name { get; set; }
21-
22-
///<inheritdoc/>
23-
public string DisplayName { get; set; }
24-
25-
///<inheritdoc/>
26-
public string Author { get; set; }
27-
28-
///<inheritdoc/>
29-
public Type ConfigType { get; set; }
30-
31-
///<inheritdoc/>
32-
public Type ProviderType { get; set; }
33-
34-
///<inheritdoc/>
35-
public Type SubsystemTypeOverride { get; set; }
36-
37-
#endregion IMRTKDescriptor implementation
38-
39-
/// <summary>
40-
/// Tests for equality.
41-
/// </summary>
42-
/// <param name="other">The other <see cref="AccessibilitySubsystemCinfo"/> to compare against.</param>
43-
/// <returns>
44-
/// <see langword="true"/> if every field in <paramref name="other"/> is equal to this
45-
/// <see cref="AccessibilitySubsystemCinfo"/>, otherwise <see langword="false"/>.
46-
/// </returns>
47-
public bool Equals(AccessibilitySubsystemCinfo other)
48-
{
49-
return
50-
ReferenceEquals(Name, other.Name)
51-
&& ReferenceEquals(ProviderType, other.ProviderType)
52-
&& ReferenceEquals(SubsystemTypeOverride, other.SubsystemTypeOverride);
53-
}
54-
55-
/// <summary>
56-
/// Tests for equality.
57-
/// </summary>
58-
/// <param name="obj">The `object` to compare against.</param>
59-
/// <returns>
60-
/// <see langword="true"/> if <paramref name="obj"/> is of type <see cref="AccessibilitySubsystemCinfo" /> and
61-
/// <see cref="Equals(AccessibilitySubsystemCinfo)"/> also returns <see langword="true"/>,
62-
/// otherwise <see langword="false"/>.
63-
/// </returns>
64-
public override bool Equals(System.Object obj)
65-
{
66-
return (obj is AccessibilitySubsystemCinfo cinfo) && Equals(cinfo);
67-
}
68-
69-
/// <summary>
70-
/// Tests for equality.
71-
/// </summary>
72-
/// <remarks>
73-
/// This is a same as <see cref="Equals(AccessibilitySubsystemCinfo)"/>.
74-
/// </remarks>
75-
/// <param name="lhs">The left-hand side of the comparison.</param>
76-
/// <param name="rhs">The right-hand side of the comparison.</param>
77-
/// <returns>
78-
/// <see langword="true"/> if <paramref name="lhs"/> is equal to <paramref name="rhs"/>,
79-
/// otherwise <see langword="false"/>.
80-
/// </returns>
81-
public static bool operator==(AccessibilitySubsystemCinfo lhs, AccessibilitySubsystemCinfo rhs)
82-
{
83-
return lhs.Equals(rhs);
84-
}
85-
86-
/// <summary>
87-
/// Tests for inequality. Same as `!`<see cref="Equals(AccessibilitySubsystemCinfo)"/>.
88-
/// </summary>
89-
/// <param name="lhs">The left-hand side of the comparison.</param>
90-
/// <param name="rhs">The right-hand side of the comparison.</param>
91-
/// <returns><see langword="true"/> if <paramref name="lhs"/> is not equal to <paramref name="rhs"/>, otherwise <see langword="false"/>.</returns>
92-
public static bool operator !=(AccessibilitySubsystemCinfo lhs, AccessibilitySubsystemCinfo rhs)
93-
{
94-
return !(lhs == rhs);
95-
}
96-
97-
/// <summary>
98-
/// This <see cref="GetHashCode"/> override is meant to disable hash lookups of
99-
/// <see cref="AccessibilitySubsystemCinfo"/> objects.
100-
/// </summary>
101-
/// <remarks>
102-
/// This will throw a <see cref="ApplicationException"/> if called.
103-
/// </remarks>
104-
/// <exception cref="ApplicationException">
105-
/// Thrown if this function is called.
106-
/// </exception>
107-
public override int GetHashCode()
108-
{
109-
throw new ApplicationException("Do not hash subsystem descriptors as keys.");
110-
}
111-
}
12+
public class AccessibilitySubsystemCinfo : MRTKSubsystemCinfo { }
11213

11314
/// <summary>
11415
/// Specifies a functionality description that may be registered for each implementation that provides the
11516
/// <see cref="AccessibilitySubsystem"/> interface.
11617
/// </summary>
11718
public class AccessibilitySubsystemDescriptor :
118-
SubsystemDescriptorWithProvider<AccessibilitySubsystem, AccessibilitySubsystem.Provider>,
119-
IMRTKSubsystemDescriptor
19+
MRTKSubsystemDescriptor<AccessibilitySubsystem, AccessibilitySubsystem.Provider>
12020
{
12121
/// <summary>
12222
/// Initializes a new instance of the <see cref="AccessibilitySubsystemDescriptor"/> class.
12323
/// </summary>
124-
/// <param name='accessibilitySubsystemCinfo'>The parameters required to initialize the descriptor.</param>
125-
AccessibilitySubsystemDescriptor(AccessibilitySubsystemCinfo accessibilitySubsystemCinfo)
126-
{
127-
Name = accessibilitySubsystemCinfo.Name;
128-
DisplayName = accessibilitySubsystemCinfo.DisplayName;
129-
Author = accessibilitySubsystemCinfo.Author;
130-
ProviderType = accessibilitySubsystemCinfo.ProviderType;
131-
SubsystemTypeOverride = accessibilitySubsystemCinfo.SubsystemTypeOverride;
132-
}
133-
134-
#region IMRTKDescriptor implementation
135-
136-
///<inheritdoc/>
137-
public string Name { get => id; set => id = value; }
138-
139-
///<inheritdoc/>
140-
public string DisplayName { get; set; }
141-
142-
///<inheritdoc/>
143-
public string Author { get; set; }
144-
145-
///<inheritdoc/>
146-
public Type ConfigType { get; set; }
147-
148-
///<inheritdoc/>
149-
public Type ProviderType { get => providerType; set => providerType = value; }
150-
151-
///<inheritdoc/>
152-
public Type SubsystemTypeOverride { get => subsystemTypeOverride; set => subsystemTypeOverride = value; }
153-
154-
#endregion IMRTKDescriptor implementation
24+
/// <param name="cinfo">The parameters required to initialize the descriptor.</param>
25+
AccessibilitySubsystemDescriptor(AccessibilitySubsystemCinfo cinfo) : base(cinfo) { }
15526

15627
/// <summary>
15728
/// Creates a <see cref="AccessibilitySubsystemDescriptor"/> based on the given parameters.
@@ -167,14 +38,13 @@ internal static AccessibilitySubsystemDescriptor Create(AccessibilitySubsystemCi
16738
{
16839
// Validates cinfo.
16940
if (!XRSubsystemHelpers.CheckTypes<AccessibilitySubsystem, AccessibilitySubsystem.Provider>(cinfo.Name,
170-
cinfo.SubsystemTypeOverride,
171-
cinfo.ProviderType))
41+
cinfo.SubsystemTypeOverride,
42+
cinfo.ProviderType))
17243
{
17344
throw new ArgumentException("Could not create AccessibilitySubsystemDescriptor.");
17445
}
17546

176-
Debug.Log("Successfully created new descriptor");
17747
return new AccessibilitySubsystemDescriptor(cinfo);
17848
}
17949
}
180-
}
50+
}

org.mixedrealitytoolkit.accessibility/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "org.mixedrealitytoolkit.accessibility",
3-
"version": "1.0.3-development.pre.20",
3+
"version": "1.0.4-development.pre.20",
44
"description": "Features and subsystem to enable accessibility in MR experiences.\n\nThis is in early preview and may undergo significant, breaking changes before release.",
55
"displayName": "MRTK Accessibility Early Preview",
66
"msftFeatureCategory": "MRTK3",

org.mixedrealitytoolkit.core/CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
44

55
## Unreleased
66

7+
### Changed
8+
9+
* Updated code style in `HandsSubsystemDescriptor`, `MRTKSubsystemDescriptor`, `DictationSubsystemDescriptor`, and `XRSubsystemHelpers`. [PR #1109](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1109)
10+
711
### Fixed
812

9-
* Fixed "The type MixedReality.Toolkit.Core MixedReality.Toolkit.Experimental.BubbleChildHoverEvents/TrickleChildHoverEvents/BubbleChildSelectEvents/TrickleChildSelectEvents is being serialized by [SerializeReference], but is missing the [Serializable] attribute." on Unity 6.3. [PR #1107](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1107)
13+
* Fixed "The type MixedReality.Toolkit.Core MixedReality.Toolkit.Experimental.BubbleChildHoverEvents/TrickleChildHoverEvents/BubbleChildSelectEvents/TrickleChildSelectEvents is being serialized by `[SerializeReference]`, but is missing the `[Serializable]` attribute." on Unity 6.3. [PR #1107](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1107)
1014

1115
## Deprecated
1216

@@ -39,7 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
3943

4044
### Fixed
4145

42-
* Fixed missing [CanEditMultipleObject] attributes as per Bug 573 [PR #698](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/698)
46+
* Fixed missing `[CanEditMultipleObject]` attributes as per Bug 573 [PR #698](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/698)
4347

4448
## [3.2.0] - 2024-03-20
4549

org.mixedrealitytoolkit.core/Subsystems/Hands/HandsSubsystemDescriptor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the BSD 3-Clause
33

44
using System;
5-
using UnityEngine.SubsystemsImplementation;
65

76
namespace MixedReality.Toolkit.Subsystems
87
{
@@ -41,7 +40,7 @@ public class HandsSubsystemDescriptor :
4140
/// <summary>
4241
/// Initializes a new instance of the <see cref="HandsSubsystemDescriptor"/> class.
4342
/// </summary>
44-
/// <param name='cinfo'>The parameters required to initialize the descriptor.</param>
43+
/// <param name="cinfo">The parameters required to initialize the descriptor.</param>
4544
HandsSubsystemDescriptor(HandsSubsystemCinfo cinfo) : base(cinfo)
4645
{
4746
IsPhysicalData = cinfo.IsPhysicalData;

org.mixedrealitytoolkit.core/Subsystems/MRTKSubsystemDescriptor.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ public class MRTKSubsystemDescriptor<TSubsystem, TProvider> :
8888
/// <summary>
8989
/// Initializes a new instance of the <see cref="MRTKSubsystemDescriptor{T, U}"/> class.
9090
/// </summary>
91-
/// <param name='MRTKSubsystemCinfo'>The parameters required to initialize the descriptor.</param>
92-
public MRTKSubsystemDescriptor(MRTKSubsystemCinfo MRTKSubsystemCinfo)
91+
/// <param name="subsystemCinfo">The parameters required to initialize the descriptor.</param>
92+
public MRTKSubsystemDescriptor(MRTKSubsystemCinfo subsystemCinfo)
9393
{
94-
Name = MRTKSubsystemCinfo.Name;
95-
DisplayName = MRTKSubsystemCinfo.DisplayName;
96-
Author = MRTKSubsystemCinfo.Author;
97-
ConfigType = MRTKSubsystemCinfo.ConfigType;
98-
ProviderType = MRTKSubsystemCinfo.ProviderType;
99-
SubsystemTypeOverride = MRTKSubsystemCinfo.SubsystemTypeOverride;
94+
Name = subsystemCinfo.Name;
95+
DisplayName = subsystemCinfo.DisplayName;
96+
Author = subsystemCinfo.Author;
97+
ConfigType = subsystemCinfo.ConfigType;
98+
ProviderType = subsystemCinfo.ProviderType;
99+
SubsystemTypeOverride = subsystemCinfo.SubsystemTypeOverride;
100100
}
101101

102102
#region IMRTKDescriptor implementation

org.mixedrealitytoolkit.core/Subsystems/Speech/DictationSubsystemDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class DictationSubsystemDescriptor :
3636
/// <summary>
3737
/// Initializes a new instance of the <see cref="DictationSubsystemDescriptor"/> class.
3838
/// </summary>
39-
/// <param name='cinfo'>The parameters required to initialize the descriptor.</param>
39+
/// <param name="cinfo">The parameters required to initialize the descriptor.</param>
4040
DictationSubsystemDescriptor(DictationSubsystemCinfo cinfo) : base(cinfo)
4141
{
4242
IsCloudBased = cinfo.IsCloudBased;

org.mixedrealitytoolkit.core/Utilities/XRSubsystemHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static IHandsAggregatorSubsystem HandsAggregator
167167
return handsAggregator;
168168
}
169169
}
170-
170+
171171
private static IDictationSubsystem dictationSubsystem = null;
172172

173173
/// <summary>
@@ -297,9 +297,9 @@ public static ConfigT GetConfiguration<ConfigT, SubsystemT>()
297297
/// Validates the descriptor parameters against possible type errors that could arise at runtime.
298298
/// The base subsystem type and base provider type are passed as generic type params for validation.
299299
/// </summary>
300-
/// <param name='name'>The parameters required to initialize the descriptor.</param>
301-
/// <param name='subsystemTypeOverride'>The derived type of the subsystem.</param>
302-
/// <param name='providerType'>The derived type of the provider.</param>
300+
/// <param name="name">The parameters required to initialize the descriptor.</param>
301+
/// <param name="subsystemTypeOverride">The derived type of the subsystem.</param>
302+
/// <param name="providerType">The derived type of the provider.</param>
303303
/// <returns>
304304
/// <see langword="true"/> if all validation checks pass.
305305
/// </returns>

org.mixedrealitytoolkit.tools/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
44

5+
## Unreleased
6+
7+
### Changed
8+
9+
* Updated code style in SubsystemDescriptorTemplate.txt. [PR #1109](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1109)
10+
511
## [3.0.5] - 2025-11-12
612

713
### Fixed

org.mixedrealitytoolkit.tools/SubsystemWizard/Templates/SubsystemDescriptorTemplate.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace %NAMESPACE%
3535
/// <summary>
3636
/// Constructs a <c>%SUBSYSTEMBASECLASSNAME%Descriptor</c> based on the given parameters.
3737
/// </summary>
38-
/// <param name=cinfo>The parameters required to initialize the descriptor.</param>
38+
/// <param name="cinfo">The parameters required to initialize the descriptor.</param>
3939
%SUBSYSTEMBASECLASSNAME%Descriptor(%SUBSYSTEMBASECLASSNAME%Cinfo cinfo) : base(cinfo)
4040
{
4141
// TODO: Initialize subsystem specific properties.
@@ -47,7 +47,7 @@ namespace %NAMESPACE%
4747
/// Creates a <c>%SUBSYSTEMBASECLASSNAME%Descriptor</c> based on the given parameters validating that the
4848
/// <c>id</c> and <c>implentationType</c> properties are specified.
4949
/// </summary>
50-
/// <param name='cinfo'>The parameters required to initialize the descriptor.</param>
50+
/// <param name="cinfo">The parameters required to initialize the descriptor.</param>
5151
/// <returns>
5252
/// The created <c>%SUBSYSTEMBASECLASSNAME%Descriptor</c>.
5353
/// </returns>

0 commit comments

Comments
 (0)