Device Function

Fix

dev_Fix()

Fix a device reported broken by dev_Check()

Syntax
#include "device.h"

LResult  dev_Fix
    (
         LDevice    device
    );
devicedevice to fix
Description

dev_Fix() should be called immediately after a device has been reported broken by dev_Check(). dev_Fix() will attempt to reconnect the layer reported disconnected by dev_Check().

Return Values

If successful, dev_Fix() returns a non-negative value. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

dev_Check()

Example
if ((result = dev_Check(device)) < 0)
{
    LOG("Device check failed", lgo_ProtocolMessage(result));
}
else if (result != 0)
{
    LOG("Device failure");
    if (dev_Fix(device) < 0)
    {
        LOG("Cannot restore service");
    }
    else
    {
        LOG("Service restored");
    }
}
else
{
    LOG("Device OK");
}