mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-01-11 19:44:44 +00:00
Merge pull request #66 from PepperDash/bugfix/stream-debugging-fixes
Fixes some exceptions when setting stream debugging mode
This commit is contained in:
@@ -79,10 +79,7 @@ namespace PepperDash.Core
|
||||
|
||||
_DebugTimeoutInMs = minutes * 60000;
|
||||
|
||||
if (DebugExpiryPeriod != null)
|
||||
{
|
||||
DisableDebugging();
|
||||
}
|
||||
StopDebugTimer();
|
||||
|
||||
DebugExpiryPeriod = new CTimer((o) => DisableDebugging(), _DebugTimeoutInMs);
|
||||
|
||||
@@ -101,14 +98,24 @@ namespace PepperDash.Core
|
||||
/// </summary>
|
||||
private void DisableDebugging()
|
||||
{
|
||||
DebugExpiryPeriod.Stop();
|
||||
DebugExpiryPeriod.Dispose();
|
||||
DebugExpiryPeriod = null;
|
||||
StopDebugTimer();
|
||||
|
||||
Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off);
|
||||
}
|
||||
|
||||
private void StopDebugTimer()
|
||||
{
|
||||
RxStreamDebuggingIsEnabled = false;
|
||||
TxStreamDebuggingIsEnabled = false;
|
||||
|
||||
Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off);
|
||||
if (DebugExpiryPeriod == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DebugExpiryPeriod.Stop();
|
||||
DebugExpiryPeriod.Dispose();
|
||||
DebugExpiryPeriod = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,4 +130,4 @@ namespace PepperDash.Core
|
||||
Tx = 2,
|
||||
Both = Rx | Tx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,11 +68,9 @@ namespace PepperDash.Core.DebugThings
|
||||
/// <returns></returns>
|
||||
public void SetDebugSettingsForKey(string deviceKey, object settings)
|
||||
{
|
||||
var existingSettings = DeviceDebugSettings[deviceKey];
|
||||
|
||||
if (existingSettings != null)
|
||||
if(DeviceDebugSettings.ContainsKey(deviceKey))
|
||||
{
|
||||
existingSettings = settings;
|
||||
DeviceDebugSettings[deviceKey] = settings;
|
||||
}
|
||||
else
|
||||
DeviceDebugSettings.Add(deviceKey, settings);
|
||||
|
||||
Reference in New Issue
Block a user