Import-Export Device

Hi All,

I have one doubt related to following syntax:
DbDevImportInfo Database::import_device(string &);
I have tried the code given in tango_manual_81. The code is as follows:


        string s = string("gmrt/c0/tcs");

	DbDevImportInfo my_device_import;
	my_device_import = db->import_device(s);
	
	cout << "Device " << my_device_import.name << endl;
	cout << "Exported " << my_device_import.exported << endl;
	cout << "IOR " << my_device_import.ior << endl;
	cout << "Version " << my_device_import.version << endl;
	cout << endl;
But the above code is throwing this exception:


Tango exception
Severity = ERROR 
Error reason = API_CorbaException
Desc : BAD_INV_ORDER CORBA system exception: BAD_INV_ORDER_ORBHasShutdown
Origin : Connection::command_inout()

Tango exception
Severity = ERROR 
Error reason = API_CommunicationFailed
Desc : Failed to execute command_inout on device sys/database/2, command DbImportDevice
Origin : Connection::command_inout()

Received a CORBA_Exception
Exiting

So please help me to resolve this doubt.

Thanks and Regards,
Tcs-Gmrt


Regards,
TCS_GMRT
Hello "Tcs-gmrt"

Could you send us how the "db" variable is initialized. According to the error message, it seems that it is not a Tango
Database instance (rather a pointer to).
In the documentation you are referring, "db" is a pointer to one instance of the Tango::Database class

Regards

Emmanuel
Hi
This is how we initialized 'db' variable.

Database *db=new Database();

I have one more doubt, can i get "host" information after importing the device. If "yes" then how to get it.

Thanks and Regards,
Tcs-Gmrt
Regards,
TCS_GMRT
Hi,

With code like the following, it's working fine.

#include <tango.h>

using namespace std;

int main(int argc,char *argv[])
{
	if (argc != 2)
	{
		cerr << "Usage: " << argv[0] << " <device name>" << endl;
		exit(-1);
	}

	try
	{
		Tango::Database *db = new Tango::Database();
		string dev_name(argv[1]);

		Tango::DbDevImportInfo my_device_import;
		my_device_import = db->import_device(dev_name);
	
		cout << "Device " << my_device_import.name << endl;
		cout << "Exported " << my_device_import.exported << endl;
		cout << "IOR " << my_device_import.ior << endl;
		cout << "Version " << my_device_import.version << endl;
		cout << endl;		
	}
	catch (Tango::DevFailed &e)
	{
		Tango::Except::print_exception(e);
	}
}

Could you compare this code and yours?

Cheers

Emmanuel
Hi,

Thank You. I compared both codes. Now my code is working.
I have one more question,can I get "host" information after importing the device. If "yes" then how to get it.

Thanks and Regards
Tcs-Gmrt


Regards,
TCS_GMRT
You can get the device host information after importing the device as documented in this section of the manual:

http://www.esrf.eu/computing/cs/tango/tango_doc/kernel_doc/ds_prog/node7.html#SECTION00712100000000000000

Always check the manual first!

Andy
 
Register or login to create to post a reply.