diff --git a/OBD.NET/OBD.NET.Common/Devices/ELM327.cs b/OBD.NET/OBD.NET.Common/Devices/ELM327.cs
index 372d5ca..1c96122 100644
--- a/OBD.NET/OBD.NET.Common/Devices/ELM327.cs
+++ b/OBD.NET/OBD.NET.Common/Devices/ELM327.cs
@@ -134,6 +134,18 @@ namespace OBD.NET.Common.Devices
return await RequestDataAsync(pid) as T;
}
+ ///
+ /// Requests the data asynchronous and return the data when available
+ ///
+ ///
+ ///
+ public virtual async Task RequestDataAsync(Type type)
+ {
+ Logger?.WriteLine("Requesting Type " + type.Name + " ...", OBDLogLevel.Debug);
+ byte pid = ResolvePid(type);
+ return await RequestDataAsync(pid) as IOBDData;
+ }
+
///
/// Request data based on a pid
///
@@ -182,9 +194,12 @@ namespace OBD.NET.Common.Devices
protected virtual byte ResolvePid()
where T : class, IOBDData, new()
+ => ResolvePid(typeof(T));
+
+ protected virtual byte ResolvePid(Type type)
{
- if (!PidCache.TryGetValue(typeof(T), out byte pid))
- pid = AddToPidCache();
+ if (!PidCache.TryGetValue(type, out byte pid))
+ pid = AddToPidCache(type);
return pid;
}