OpcUaCanOpen
CANopen OPC-UA server
CanOpenConfigXML.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 ** serverconfigxml.cpp
3 **
4 ** Copyright (C) 2008-2009 Unified Automation GmbH. All Rights Reserved.
5 ** Web: http://www.unified-automation.com
6 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
7 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
8 **
9 ** Project: C++ OPC Server SDK sample code
10 **
11 ** Description: Configuration management class for the OPC Server.
12 **
13 ******************************************************************************/
14 #include "CanOpenConfigXML.h"
15 #include "servermanager.h"
16 #include "srvtrace.h"
17 #include "uaunistring.h"
18 
19 #ifdef _WIN32_WCE
20  #include <Winsock2.h>
21 #endif /* _WIN32_WCE */
22 
23 using namespace AddressSpace;
24 /* ----------------------------------------------------------------------------
25  Begin Class CANopenConfigXml
26 -----------------------------------------------------------------------------*/
27 
33 {
34  m_sXmlFileName = sXmlFileName;
35  m_pServer = pServer;
36 }
37 
40 {
41 }
42 
49 {
50  UaStatus ret = OpcUa_True;
51 
52  try {
53  auto_ptr< ::CanOpenOpcServerConfig > vDoc( CanOpenOpcServerConfig_(m_sXmlFileName.toUtf8()));
54 
55  vNodeType = vDoc->NODETYPE();
56  vCanbus = vDoc->CANBUS();
57  vItem = vDoc->ITEM();
58  vReg = vDoc->REGEXPR();
59 
60  cout << "Create Node Manager, Bus number = "<< vCanbus.size() << endl;
61  }
62  catch (const xml_schema::exception& e)
63  {
64  cerr << e.what() << endl;
65  return -1;
66  }
67 
68  return ret;
69 }