WatchDog?

Added by bmt22033 3 months ago

Can anyone tell me what the WatchDog does? The only references I've seen to it in the demo app are:

// Set watch dog interval to 5 seconds. Default to 60 seconds
//config.WatchDogInterval = 5000;

mobileGateway.WatchDogFailed += OnWatchDogFailed;

private void OnWatchDogFailed(object sender, WatchDogEventArgs e) {
// Called when gateway is disconnected
Console.WriteLine(e.GatewayId);
if (e.Error != null) {
Console.WriteLine(e.ToString());
}
}

I see the comment that says "Called when gateway is disconnected" but if that's the only purpose, then why have have the OnGatewayDisconnect handler? Thanks for any info!


Replies (5)

RE: WatchDog? - Added by admin 3 months ago

Hi,

The purpose of the watch dog is to periodically ping the modem (sending AT command) to make sure it is still alive, if the modem is idle.

Thanks
Regards
admin

RE: WatchDog? - Added by bmt22033 3 months ago

Thanks admin. I seem to have a problem with the watch dog. I'm using a MultiTech MultiModem Cell USB GSM modem. In the demo app, I see the following line of code:

// Set watch dog interval to 5 seconds. Default to 60 seconds
// config.WatchDogInterval = 5000;

With the demo app running and sitting idle, I can unplug the USB cable from the computer and it takes anywhere from 60 - 100 seconds before the watch dog failed event handler runs. I tried uncommenting the line above (config.WatchDogInterval = 5000;) assuming that this would cause the watch dog to check connectivity to the modem every 5 seconds. Unfortunately, that doesn't seem to have made any difference. I've cleaned/recompiled multiple times but when I unplug the modem, it still takes a minute or more before the watch dog event handler runs. Any ideas? Thanks.

RE: WatchDog? - Added by admin 3 months ago

Hi,

The watch dog basically sends an "AT" command to the modem and wait for a response. The command time out is now set to 30 seconds to wait for the response to come out.

// You can also specify the total number of milliseconds for AT command time out
// Multiply these 2 parameters you can the number of milliseconds for command time out.
// E.g. below is the default of 30 seconds
//config.CommandWaitInterval = 300;
//config.CommandWaitRetryCount = 100;

Sometimes modem performance could be slow, you could try to adjust these 2 parameters to see if it helps. E.g. CommandWaitInterval = 300, CommandWaitRetryCount = 10.

Thanks
Regards
admin

RE: WatchDog? - Added by bmt22033 3 months ago

Ok, so just to make sure I understand correctly, the WatchDogInterval determines how often the AT command is sent (default value is 60 seconds). How long the library waits for a response is determined by CommandWaitInterval * CommandWaitRetryCount (default value is 30 seconds). So if that's correct, then it wouldn't make any sense to set the WatchDogInterval < (CommandWaitInterval * CommandWaitRetryCount), right? Thanks again.

RE: WatchDog? - Added by admin 3 months ago

Yes. You are right.

(1-5/5)