hibernate problem:have to restart mqtt driver

8 years 6 months ago - 8 years 6 months ago #3289 by Zaitsev
windows 8 x 64 platform.
After hibernate mqtt is not working and I have to trig disable/enable button to restart.
Proposal: on c# it is easy to fix:
http://]https://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase.onpowerevent.aspx

PS:
I worked it around by myself using automation:
//===================
int N=0;
public void Setup()
{
	Console.WriteLine("\nSetup()\n");
  	EventHelper.ModuleChangedHandler((o, m, p) =>
    {
      if (m.Domain == Domains.MQTTCLIENT /*&& p.Property == "Status.Connection"*/ )
 		Console.WriteLine("\n<event>\t" + m.Address + " in program id "+ Program.ProgramId.ToString()+ " driver "+ 
                          m.Domain + " address "+ m.Address + " property "+ p.Property + " value " + p.Value);
      	N=0;
        return true;
    });
	Console.WriteLine();
}
public void Run()
{
	Console.WriteLine("\n\t<Run>\tN={0}",N++);
    if(N>=3){
      N=0;
	  Console.WriteLine("\n\t<MQTTCLIENT.SetIsEnabled>");
      DriverHelper.ProcessCommad(Domains.MQTTCLIENT, "1", "SetIsEnabled","");
    }
}
Also this solution reconnects MQTT which is significant for some brokers.
But again - this is just work around.

Please Log in or Create an account to join the conversation.

Time to create page: 0.222 seconds

Forum latest

  • No posts to display.