3using System.Collections.Generic;
11 public class DeviceCapability
13 private protected DeviceCapability()
48 var sb =
new StringBuilder();
49 sb.AppendLine($
" Function: {Helpers.SplitCamelCase(Function.ToString())}");
50 sb.AppendLine($
"Compliance: {Compliance}");
51 sb.AppendLine($
" Number Of: {NumberOf}");
55 internal byte[] BuildData()
60 internal static DeviceCapability ParseData(
byte[] data)
66 if (!_capFactories.TryGetValue(func, out var creator))
68 creator = () =>
new DeviceCapability();
73 cap.Compliance = data[1];
74 cap.NumberOf = data[2];
78 private static Dictionary<CapabilityFunction, Func<DeviceCapability>> _capFactories =
new ()
82 {
CapabilityFunction.LargestCombinedMessageSize, () =>
new LargestCombMsgSizeDeviceCap() }
94 var sb =
new StringBuilder();
95 sb.AppendLine($
" Function: {Helpers.SplitCamelCase(Function.ToString())}");
96 sb.AppendLine($
" Size: {Message.ConvertBytesToUnsignedShort(new[] { Compliance, NumberOf })}");
104 public class RcvBuffSizeDeviceCap : MsgSizeDeviceCap;
109 public class LargestCombMsgSizeDeviceCap : MsgSizeDeviceCap;
129 var sb =
new StringBuilder();
130 sb.AppendLine($
" Function: {Helpers.SplitCamelCase(Function.ToString())}");
131 sb.AppendLine($
"Supports AES-128: {SupportsAes128}");
132 sb.AppendLine($
"Uses Default Key: {UsesDefaultKey}");
133 return sb.ToString();
Receive Buffer Size PD capability.
override string ToString()
bool SupportsAes128
Flag indicating whether or not PD support AES-128.
bool UsesDefaultKey
Flag indicating whether or not PD is using a default encryption key.
DeviceCapability(CapabilityFunction function, byte compliance, byte numberOf)
Initializes a new instance of DeviceCapability class.
CapabilityFunction Function
Gets the function code.
override string ToString()
byte NumberOf
Gets number of objects of this type.
byte Compliance
Gets level of compliance with defined function.
Common base for the device capabilities that identify byte sizes.
override string ToString()
CapabilityFunction
Definitions of the capability function codes.
@ Unknown
Capability is not defined.