tgmrt
(TCS_GMRT)
August 18, 2015, 7:57am
1
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
etaurel
(Manu)
August 18, 2015, 11:17am
2
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
tgmrt
(TCS_GMRT)
August 18, 2015, 1:38pm
3
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
etaurel
(Manu)
August 18, 2015, 2:05pm
4
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
tgmrt
(TCS_GMRT)
August 19, 2015, 12:45pm
5
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
agotz
(Andy)
August 19, 2015, 4:16pm
6
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