Compare commits
No commits in common. "e0e0310f7f996e48992f924b14311b0c5a345611" and "f577617b4d4910b09ae9b04d66e79d0fb8923361" have entirely different histories.
e0e0310f7f
...
f577617b4d
@ -56,33 +56,23 @@ namespace YaleAccess.Services
|
|||||||
// Flag to indicate if the driver is ready to use
|
// Flag to indicate if the driver is ready to use
|
||||||
bool isReady = false;
|
bool isReady = false;
|
||||||
|
|
||||||
// Message and flag to indicate if there was an error starting the driver
|
|
||||||
string? message = null;
|
|
||||||
|
|
||||||
// Subscribe to the driver ready event
|
// Subscribe to the driver ready event
|
||||||
driver.DriverReady += () =>
|
driver.DriverReady += () =>
|
||||||
{
|
{
|
||||||
isReady = true;
|
isReady = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver.StartUpError += (error) =>
|
driver.StartUpError += (message) =>
|
||||||
{
|
{
|
||||||
message = error;
|
throw new Exception(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wait for the driver to be ready
|
// Wait for the driver to be ready
|
||||||
while (!isReady && message == null)
|
while (!isReady)
|
||||||
{
|
{
|
||||||
// Sleep for a short time to avoid busy waiting
|
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there was an error starting the driver, throw an exception
|
|
||||||
if (message != null)
|
|
||||||
{
|
|
||||||
throw new Exception($"Failed to start the driver. Error message: {message}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the lock node from the driver
|
// Get the lock node from the driver
|
||||||
lockNode = driver.Controller.Nodes.Get(devicesOptions.YaleLockNodeId);
|
lockNode = driver.Controller.Nodes.Get(devicesOptions.YaleLockNodeId);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user