command_inout_asynch method will not re-connnect to device

Hi

I have a question reagarding command_inout_asynch(…) method

In pdf manual:
6.1.5.1 long DeviceProxy::command_inout_asynch(string &name, bool forget)
…Please, note that device re-connection will not take place (in case it is needed) if the fire and forget mode is used. Therefore,an application using only fire and forget requests is not able to automatically re-connnect to device.

Whether this can be understood as: whether forget parameter set true or false, asyn method will not re-connnect device

Thanks
Edited 8 years ago
Hi Jimmy,

If you give the value true for the forget input parameter, it means that you want "fire and forget" and then you have to handle re-connection yourself. If you set this parameter to false (which is the default), re-connection will be handled by the Tango layer

Hoping this help

Emmanuel
Hi Manu

Thanks for your your answer!

But in my test program(for Tango 8.1.2), after restart device, command_inout_asynch(…) method will not re-connect, i am not get what's wrong with my code

int main(int argc,char *argv[])
{
	if(argc != 2)
	{
		cout << "Please input device name " << endl;
		return EXIT_FAILURE;
	}

	try{
		Tango::DeviceProxy dev(argv[1]);

		Tango::DeviceData din;
		string strTrig("1024");
		din << strTrig;

		// admin device, to restart dev
		string adm_name = dev.adm_name();
		Tango::DeviceProxy admin_dev(adm_name);
		Tango::DeviceData di_ad;
		di_ad << argv[1];

		char ch;

		while(true)
		{
			cout << "- " << flush;
			dev.command_inout_asynch("CmdA", din, false);//no re-connect
			// after restart device, no re-connect, why???
			// dev.command_inout("CmdA", din);// auto re-connect ok
			ch = getch();
			if('q'==ch || 'Q'==ch) {cout << endl; break;}

			if('r'==ch || 'R'==ch) // restart device, test if 'dev' will re-connect
			{
				admin_dev.command_inout("DevRestart",di_ad);
				Tango_sleep(1);
			}

		}
		return EXIT_SUCCESS;
	}
	catch (Tango::DevFailed &e) {
		Tango::Except::print_exception(e);
		return EXIT_FAILURE;
	}//try end
}
Edited 8 years ago
Hi Jimmy,

I think your code is not 100 % correct. You are missing a DeviceProxy::command_inout_reply() method call. It is this method which
according to the eventual received exception will generate the re-connection.
Nevertheless, I have tried your code adding it the command_inout_reply() method and… noticed that the re-connection did not
happened! Re-connection works fine in case you re-start the DS process, in case the DS crashed but not after a admin device
DevRestart command. This is due to the exception received during the command_inout_reply method which is different in this case.
I have fixed this in Tango 9 repository and this bug fix will be available in next Tango 9 release

Best regards

Emmanuel
Hi Manu

Thanks for your your help
 
Register or login to create to post a reply.