Skip to content

Commit 58d1b9d

Browse files
committed
Improved handling of *_DESCRIPTION parameters
For CURVE, OUTPUT_RESPONSE_TIME, MODULATION_FREQUENCY, and LOCK_STATE, the corresponding *_DESCRIPTION parameters are now automatically assumed to be supported if the main parameter is present but the DESCRIPTION parameter is missing. This increases consistency among supported parameters and complements the existing logic for METADATA_JSON. Log outputs indicate when such assumptions are made.
1 parent da24851 commit 58d1b9d

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

RDMSharp/Extensions/SupportedParametersExtension/SupportedParametersExtension.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,36 @@ protected override async Task registerAddSupportedParametersHandler(IRDMDeviceMo
118118
}
119119
}
120120

121+
#region Assuming support for DESCRIPTION Parameters based on presence of related Parameters
122+
//Test it if the device supports CURVE Parameter, if not it will be labled as not supported later on
123+
if (parameters.Contains(ERDM_Parameter.CURVE) && !parameters.Contains(ERDM_Parameter.CURVE_DESCRIPTION))
124+
{
125+
supportedParameters.Add(ERDM_Parameter.CURVE_DESCRIPTION);
126+
Logger?.LogInformation($"Remote Device Model ID 0x{deviceInfo.DeviceModelId:X4} - Assuming support for CURVE_DESCRIPTION Parameter.");
127+
}
128+
129+
//Test it if the device supports OUTPUT_RESPONSE_TIME Parameter, if not it will be labled as not supported later on
130+
if (parameters.Contains(ERDM_Parameter.OUTPUT_RESPONSE_TIME) && !parameters.Contains(ERDM_Parameter.OUTPUT_RESPONSE_TIME_DESCRIPTION))
131+
{
132+
supportedParameters.Add(ERDM_Parameter.OUTPUT_RESPONSE_TIME_DESCRIPTION);
133+
Logger?.LogInformation($"Remote Device Model ID 0x{deviceInfo.DeviceModelId:X4} - Assuming support for OUTPUT_RESPONSE_TIME_DESCRIPTION Parameter.");
134+
}
135+
136+
//Test it if the device supports MODULATION_FREQUENCY Parameter, if not it will be labled as not supported later on
137+
if (parameters.Contains(ERDM_Parameter.MODULATION_FREQUENCY) && !parameters.Contains(ERDM_Parameter.MODULATION_FREQUENCY_DESCRIPTION))
138+
{
139+
supportedParameters.Add(ERDM_Parameter.MODULATION_FREQUENCY_DESCRIPTION);
140+
Logger?.LogInformation($"Remote Device Model ID 0x{deviceInfo.DeviceModelId:X4} - Assuming support for MODULATION_FREQUENCY_DESCRIPTION Parameter.");
141+
}
142+
143+
//Test it if the device supports LOCK_STATE Parameter, if not it will be labled as not supported later on
144+
if (parameters.Contains(ERDM_Parameter.LOCK_STATE) && !parameters.Contains(ERDM_Parameter.LOCK_STATE_DESCRIPTION))
145+
{
146+
supportedParameters.Add(ERDM_Parameter.LOCK_STATE_DESCRIPTION);
147+
Logger?.LogInformation($"Remote Device Model ID 0x{deviceInfo.DeviceModelId:X4} - Assuming support for LOCK_STATE_DESCRIPTION Parameter.");
148+
}
149+
#endregion
150+
121151

122152
//Test it if the device supports Identify Device Parameter, if not it will be labled as not supported later on
123153
if (!parameters.Contains(ERDM_Parameter.IDENTIFY_DEVICE))

0 commit comments

Comments
 (0)