7 #import "..\\isisicp\\isisicp.tlb" named_guids
8 #import "..\\tlb\\Seci.tlb" named_guids
9 #import "..\\tlb\\LabVIEW.tlb" named_guids
15 virtual int main(
const std::vector<std::string>& args);
20 Application::initialize(
self);
32 typedef HRESULT (isisicpLib::Idae::*
comm_func_t)(BSTR* messages);
33 typedef HRESULT (isisicpLib::Idae::*
comm_func_s_i_t)(_bstr_t name,
long value, BSTR* messages);
34 typedef HRESULT (isisicpLib::Idae::*
comm_func_i_t)(
long value, BSTR* messages);
36 static const char*
comm_names[] = {
"BEGIN",
"END",
"PAUSE",
"RESUME",
"ABORT",
"UPDATE",
"STORE",
"QUIT",
"WAIT",
"ENDWAIT", NULL };
38 &isisicpLib::Idae::pauseRun, &isisicpLib::Idae::resumeRun, &isisicpLib::Idae::abortRun,
39 &isisicpLib::Idae::updateCRPT, &isisicpLib::Idae::storeCRPT, &isisicpLib::Idae::quit,
40 &isisicpLib::Idae::startSEWait, &isisicpLib::Idae::endSEWait, NULL };
54 Poco::Logger::root().setLevel(Poco::Message::PRIO_TRACE);
55 logger().setLevel(Poco::Message::PRIO_TRACE);
56 CComPtr<isisicpLib::Idae> icp;
60 CoInitializeEx(NULL, COINIT_MULTITHREADED);
61 hr = icp.CoCreateInstance(isisicpLib::CLSID_dae, 0, CLSCTX_LOCAL_SERVER);
67 for(std::vector<std::string>::const_iterator it = args.begin(); it != args.end(); ++it)
73 std::cerr <<
"INSTCTRL: " <<
comm_names[i] << std::endl;
79 std::cerr << COLE2CT(messages) << std::endl;
87 const std::string& name = *(++it);
88 if ( ++it != args.end() )
90 long value = atol(it->c_str());
91 std::cerr <<
"INSTCTRL: "<<
comm_s_i_names[i] <<
" \"" << name <<
"\" " << value << std::endl;
97 std::cerr << COLE2CT(messages) << std::endl;
101 std::cerr <<
"INSTCTRL: Missing 2nd (integer) argument to command \"" <<
comm_s_i_names[i] <<
"\"" << std::endl;
110 long value = atol((++it)->c_str());
111 std::cerr <<
"INSTCTRL: "<<
comm_i_names[i] <<
" " << value << std::endl;
115 throw _com_error(hr);
117 std::cerr << COLE2CT(messages) << std::endl;
123 catch (
const _com_error& ex)
125 std::cerr << ex.Source() <<
": " << ex.ErrorMessage() <<
": " << ex.Description() << std::endl;
127 catch (
const std::exception& ex)
129 std::cerr << ex.what() << std::endl;
virtual int main(const std::vector< std::string > &args)
void initialize(Poco::Util::Application &self)
static const char * comm_i_names[]
static const char * comm_names[]
BOOST_STATIC_ASSERT(sizeof(DAEEventHeaderInfo)==4)
HRESULT(isisicpLib::Idae::* comm_func_t)(BSTR *messages)
static comm_func_i_t comm_i_funcs[]
static comm_func_s_i_t comm_s_i_funcs[]
HRESULT(isisicpLib::Idae::* comm_func_s_i_t)(_bstr_t name, long value, BSTR *messages)
static const char * comm_s_i_names[]
HRESULT(isisicpLib::Idae::* comm_func_i_t)(long value, BSTR *messages)
static comm_func_t comm_funcs[]
int _tmain(int argc, _TCHAR *argv[])