First working implementation of Beremiz plugin for etherlab
authorlaurent
Sun, 18 Dec 2011 19:42:13 +0100
changeset 2022 c2295d311402
child 2023 f9f884cf3033
child 2024 08d67a0af2c1
First working implementation of Beremiz plugin for etherlab
.hgignore
etherlab/ConfigEditor.py
etherlab/EtherCATBase.xsd
etherlab/EtherCATConfig.xsd
etherlab/EtherCATInfo.xsd
etherlab/README
etherlab/__init__.py
etherlab/etherlab.py
etherlab/plc_etherlab.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,7 @@
+
+syntax: regexp
+^\.project$
+syntax: regexp
+^\.pydevproject$
+syntax: regexp
+\.pyc$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/ConfigEditor.py	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,568 @@
+import wx
+
+from controls import CustomGrid, CustomTable, EditorPanel
+
+[ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE] = range(3)
+
+def AppendMenu(parent, help, id, kind, text):
+    if wx.VERSION >= (2, 6, 0):
+        parent.Append(help=help, id=id, kind=kind, text=text)
+    else:
+        parent.Append(helpString=help, id=id, kind=kind, item=text)
+
+[ID_SLAVETYPECHOICEDIALOG, ID_SLAVETYPECHOICEDIALOGSTATICTEXT1,
+ ID_SLAVETYPECHOICEDIALOGSLAVETYPESLIBRARY
+] = [wx.NewId() for _init_ctrls in range(3)]
+
+class SlaveTypeChoiceDialog(wx.Dialog):
+    
+    if wx.VERSION < (2, 6, 0):
+        def Bind(self, event, function, id = None):
+            if id is not None:
+                event(self, id, function)
+            else:
+                event(self, function)
+    
+    def _init_coll_flexGridSizer1_Items(self, parent):
+        parent.AddWindow(self.staticText1, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+        parent.AddWindow(self.SlaveTypesLibrary, 0, border=20, flag=wx.GROW|wx.LEFT|wx.RIGHT)
+        parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+    
+    def _init_coll_flexGridSizer1_Growables(self, parent):
+        parent.AddGrowableCol(0)
+        parent.AddGrowableRow(1)
+    
+    def _init_sizers(self):
+        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
+        
+        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+        self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
+        
+        self.SetSizer(self.flexGridSizer1)
+
+    def _init_ctrls(self, prnt):
+        wx.Dialog.__init__(self, id=ID_SLAVETYPECHOICEDIALOG,
+              name='SlaveTypeChoiceDialog', parent=prnt,
+              size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
+              title=_('Browse slave types library'))
+        self.SetClientSize(wx.Size(600, 400))
+
+        self.staticText1 = wx.StaticText(id=ID_SLAVETYPECHOICEDIALOGSTATICTEXT1,
+              label=_('Choose a slave type:'), name='staticText1', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.SlaveTypesLibrary = wx.TreeCtrl(id=ID_SLAVETYPECHOICEDIALOGSLAVETYPESLIBRARY,
+              name='TypeTree', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 0), style=wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.SUNKEN_BORDER|wx.TR_HIDE_ROOT|wx.TR_LINES_AT_ROOT)
+        
+        self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+        if wx.VERSION >= (2, 5, 0):
+            self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+        else:
+            self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
+        
+        self._init_sizers()
+
+    def __init__(self, parent, controler, default=None):
+        self._init_ctrls(parent)
+        
+        slaves_types = controler.GetSlaveTypesLibrary()
+        
+        root = self.SlaveTypesLibrary.AddRoot("")
+        self.GenerateSlaveTypesLibraryTreeBranch(root, slaves_types, default)
+
+    def GenerateSlaveTypesLibraryTreeBranch(self, root, children, default):
+        for infos in children:
+            item = self.SlaveTypesLibrary.AppendItem(root, infos["name"])
+            if infos["type"] == ETHERCAT_DEVICE:
+                self.SlaveTypesLibrary.SetPyData(item, infos["infos"])
+                if infos["infos"] == default:
+                    self.SlaveTypesLibrary.SelectItem(item)
+                    self.SlaveTypesLibrary.EnsureVisible(item)
+            else:
+                self.GenerateSlaveTypesLibraryTreeBranch(item, infos["children"], default)
+
+    def GetType(self):
+        selected = self.SlaveTypesLibrary.GetSelection()
+        return self.SlaveTypesLibrary.GetPyData(selected)
+
+    def OnOK(self, event):
+        selected = self.SlaveTypesLibrary.GetSelection()
+        if not selected.IsOk() or self.SlaveTypesLibrary.GetPyData(selected) is None:
+            message = wx.MessageDialog(self, _("No valid slave type selected!"), _("Error"), wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        else:
+            self.EndModal(wx.ID_OK)
+
+
+def GetPDOsTableColnames():
+    _ = lambda x : x
+    return ["#", _("Index"), _("Name"), _("Type")]
+
+def GetVariablesTableColnames():
+    _ = lambda x : x
+    return ["#", _("Index"), _("SubIndex"), _("Name"), _("Type"), _("PDO")]
+
+class PDOsTable(CustomTable):
+    
+    def GetValue(self, row, col):
+        if row < self.GetNumberRows():
+            if col == 0:
+                return row + 1
+            colname = self.GetColLabelValue(col, False)
+            value = self.data[row].get(colname, "")
+            if colname == "Type":
+                value = _(value)
+            return value
+
+class VariablesTable(CustomTable):
+    
+    def GetValue(self, row, col):
+        if row < self.GetNumberRows():
+            if col == 0:
+                return row + 1
+            return self.data[row].get(self.GetColLabelValue(col, False), "")
+
+[ID_SLAVEPANEL, ID_SLAVEPANELTYPELABEL,
+ ID_SLAVEPANELTYPE, ID_SLAVEPANELTYPEBROWSE, 
+ ID_SLAVEPANELALIASLABEL, ID_SLAVEPANELALIAS, 
+ ID_SLAVEPANELPOSLABEL, ID_SLAVEPANELPOS, 
+ ID_SLAVEPANELSLAVEINFOSSTATICBOX, ID_SLAVEPANELVENDORLABEL, 
+ ID_SLAVEPANELVENDOR, ID_SLAVEPANELPRODUCTCODELABEL, 
+ ID_SLAVEPANELPRODUCTCODE, ID_SLAVEPANELREVISIONNUMBERLABEL, 
+ ID_SLAVEPANELREVISIONNUMBER, ID_SLAVEPANELPHYSICSLABEL, 
+ ID_SLAVEPANELPHYSICS, ID_SLAVEPANELPDOSLABEL, 
+ ID_SLAVEPANELPDOSGRID, ID_SLAVEPANELVARIABLESLABEL, 
+ ID_SLAVEPANELVARIABLESGRID, 
+] = [wx.NewId() for _init_ctrls in range(21)]
+
+class SlavePanel(wx.Panel):
+    
+    if wx.VERSION < (2, 6, 0):
+        def Bind(self, event, function, id = None):
+            if id is not None:
+                event(self, id, function)
+            else:
+                event(self, function)
+    
+    def _init_coll_MainSizer_Items(self, parent):
+        parent.AddSizer(self.PositionSizer, 0, border=5, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+        parent.AddSizer(self.SlaveInfosBoxSizer, 0, border=5, flag=wx.GROW|wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT)
+    
+    def _init_coll_MainSizer_Growables(self, parent):
+        parent.AddGrowableCol(0)
+        parent.AddGrowableRow(1)
+    
+    def _init_coll_PositionSizer_Items(self, parent):
+        parent.AddWindow(self.TypeLabel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL)
+        parent.AddSizer(self.TypeSizer, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.AliasLabel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL)
+        parent.AddWindow(self.Alias, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.PosLabel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL)
+        parent.AddWindow(self.Pos, 0, border=0, flag=wx.GROW)
+    
+    def _init_coll_PositionSizer_Growables(self, parent):
+        parent.AddGrowableCol(1)
+        parent.AddGrowableCol(3)
+        parent.AddGrowableCol(5)
+        parent.AddGrowableRow(0)
+    
+    def _init_coll_TypeSizer_Items(self, parent):
+        parent.AddWindow(self.Type, 1, border=0, flag=0)
+        parent.AddWindow(self.TypeBrowse, 0, border=0, flag=0)
+    
+    def _init_coll_SlaveInfosBoxSizer_Items(self, parent):
+        parent.AddSizer(self.SlaveInfosSizer, 1, border=5, flag=wx.GROW|wx.ALL)
+    
+    def _init_coll_SlaveInfosSizer_Items(self, parent):
+        parent.AddSizer(self.SlaveInfosDetailsSizer, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.PDOsLabel, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.PDOsGrid, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.VariablesLabel, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.VariablesGrid, 0, border=0, flag=wx.GROW)
+        
+    def _init_coll_SlaveInfosSizer_Growables(self, parent):
+        parent.AddGrowableCol(0)
+        parent.AddGrowableRow(2)
+        parent.AddGrowableRow(4)
+    
+    def _init_coll_SlaveInfosDetailsSizer_Items(self, parent):
+        parent.AddWindow(self.VendorLabel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.GROW)
+        parent.AddWindow(self.Vendor, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.ProductCodeLabel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.GROW)
+        parent.AddWindow(self.ProductCode, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.RevisionNumberLabel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.GROW)
+        parent.AddWindow(self.RevisionNumber, 0, border=0, flag=wx.GROW)
+        parent.AddWindow(self.PhysicsLabel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.GROW)
+        parent.AddWindow(self.Physics, 0, border=0, flag=wx.GROW)
+        
+    def _init_coll_SlaveInfosDetailsSizer_Growables(self, parent):
+        parent.AddGrowableCol(1)
+        parent.AddGrowableCol(3)
+    
+    def _init_sizers(self):
+        self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
+        self.PositionSizer = wx.FlexGridSizer(cols=6, hgap=5, rows=1, vgap=0)
+        self.TypeSizer = wx.BoxSizer(wx.HORIZONTAL)
+        self.SlaveInfosBoxSizer = wx.StaticBoxSizer(self.SlaveInfosStaticBox, wx.VERTICAL)
+        self.SlaveInfosSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=5, vgap=5)
+        self.SlaveInfosDetailsSizer = wx.FlexGridSizer(cols=4, hgap=5, rows=2, vgap=5)
+        
+        self._init_coll_MainSizer_Growables(self.MainSizer)
+        self._init_coll_MainSizer_Items(self.MainSizer)
+        self._init_coll_PositionSizer_Growables(self.PositionSizer)
+        self._init_coll_PositionSizer_Items(self.PositionSizer)
+        self._init_coll_TypeSizer_Items(self.TypeSizer)
+        self._init_coll_SlaveInfosBoxSizer_Items(self.SlaveInfosBoxSizer)
+        self._init_coll_SlaveInfosSizer_Growables(self.SlaveInfosSizer)
+        self._init_coll_SlaveInfosSizer_Items(self.SlaveInfosSizer)
+        self._init_coll_SlaveInfosDetailsSizer_Growables(self.SlaveInfosDetailsSizer)
+        self._init_coll_SlaveInfosDetailsSizer_Items(self.SlaveInfosDetailsSizer)
+        
+        self.SetSizer(self.MainSizer)
+    
+    def _init_ctrls(self, prnt):
+        wx.Panel.__init__(self, id=ID_SLAVEPANEL, name='SlavePanel', parent=prnt,
+              size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+        
+        self.TypeLabel = wx.StaticText(id=ID_SLAVEPANELTYPELABEL,
+              label=_('Type:'), name='TypeLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.Type = wx.TextCtrl(id=ID_SLAVEPANELTYPE, value='',
+              name='Type', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 24), style=wx.TE_READONLY)
+        
+        self.TypeBrowse = wx.Button(id=ID_SLAVEPANELTYPEBROWSE, label='...',
+              name='TypeBrowse', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(30, 24), style=0)
+        self.Bind(wx.EVT_BUTTON, self.OnTypeBrowseClick, id=ID_SLAVEPANELTYPEBROWSE)
+        
+        self.AliasLabel = wx.StaticText(id=ID_SLAVEPANELALIASLABEL,
+              label=_('Alias:'), name='AliasLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.Alias = wx.SpinCtrl(id=ID_SLAVEPANELALIAS,
+              name='Alias', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=0, max=0xffff)
+        self.Bind(wx.EVT_SPINCTRL, self.OnAliasChanged, id=ID_SLAVEPANELALIAS)
+        
+        self.PosLabel = wx.StaticText(id=ID_SLAVEPANELPOSLABEL,
+              label=_('Position:'), name='PositionLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.Pos = wx.SpinCtrl(id=ID_SLAVEPANELPOS,
+              name='Pos', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=0, max=0xffff)
+        self.Bind(wx.EVT_SPINCTRL, self.OnPositionChanged, id=ID_SLAVEPANELPOS)
+        
+        self.SlaveInfosStaticBox = wx.StaticBox(id=ID_SLAVEPANELSLAVEINFOSSTATICBOX,
+              label=_('Slave infos:'), name='SlaveInfosStaticBox', parent=self,
+              pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0)
+        
+        self.VendorLabel = wx.StaticText(id=ID_SLAVEPANELVENDORLABEL,
+              label=_('Vendor:'), name='VendorLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.Vendor = wx.TextCtrl(id=ID_SLAVEPANELVENDOR, value='',
+              name='Vendor', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 24), style=wx.TE_READONLY)
+        
+        self.ProductCodeLabel = wx.StaticText(id=ID_SLAVEPANELPRODUCTCODELABEL,
+              label=_('Product code:'), name='ProductCodeLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.ProductCode = wx.TextCtrl(id=ID_SLAVEPANELPRODUCTCODE, value='',
+              name='ProductCode', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 24), style=wx.TE_READONLY)
+        
+        self.RevisionNumberLabel = wx.StaticText(id=ID_SLAVEPANELREVISIONNUMBERLABEL,
+              label=_('Revision number:'), name='RevisionNumberLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.RevisionNumber = wx.TextCtrl(id=ID_SLAVEPANELREVISIONNUMBER, value='',
+              name='RevisionNumber', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 24), style=wx.TE_READONLY)
+        
+        self.PhysicsLabel = wx.StaticText(id=ID_SLAVEPANELPHYSICSLABEL,
+              label=_('Physics:'), name='PhysicsLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.Physics = wx.TextCtrl(id=ID_SLAVEPANELPHYSICS, value='',
+              name='Physics', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 24), style=wx.TE_READONLY)
+        
+        self.PDOsLabel =  wx.StaticText(id=ID_SLAVEPANELPDOSLABEL,
+              label=_('PDO entries:'), name='PDOsLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.PDOsGrid = CustomGrid(id=ID_SLAVEPANELPDOSGRID,
+              name='PDOsGrid', parent=self, pos=wx.Point(0, 0), 
+              size=wx.Size(0, 0), style=wx.VSCROLL)
+        
+        self.VariablesLabel =  wx.StaticText(id=ID_SLAVEPANELVARIABLESLABEL,
+              label=_('Variable entries:'), name='VariablesLabel', parent=self,
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
+        
+        self.VariablesGrid = CustomGrid(id=ID_SLAVEPANELPDOSGRID,
+              name='PDOsGrid', parent=self, pos=wx.Point(0, 0), 
+              size=wx.Size(0, 0), style=wx.VSCROLL)
+        if wx.VERSION >= (2, 5, 0):
+            self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnVariablesGridCellLeftClick)
+        else:
+            wx.grid.EVT_GRID_CELL_LEFT_CLICK(self.VariablesGrid, self.OnVariablesGridCellLeftClick)
+        
+        self._init_sizers()
+    
+    def __init__(self, parent, controler, window, slave):
+        self._init_ctrls(parent)
+        
+        self.Controler = controler
+        self.ParentWindow = window
+        self.Slave = slave
+        
+        self.PDOsTable = PDOsTable(self, [], GetPDOsTableColnames())
+        self.PDOsGrid.SetTable(self.PDOsTable)
+        self.PDOsGridColAlignements = [wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
+        self.PDOsGridColSizes = [40, 100, 150, 150]
+        self.PDOsGrid.SetRowLabelSize(0)
+        for col in range(self.PDOsTable.GetNumberCols()):
+            attr = wx.grid.GridCellAttr()
+            attr.SetAlignment(self.PDOsGridColAlignements[col], wx.ALIGN_CENTRE)
+            self.PDOsGrid.SetColAttr(col, attr)
+            self.PDOsGrid.SetColMinimalWidth(col, self.PDOsGridColSizes[col])
+            self.PDOsGrid.AutoSizeColumn(col, False)
+        
+        self.VariablesTable = VariablesTable(self, [], GetVariablesTableColnames())
+        self.VariablesGrid.SetTable(self.VariablesTable)
+        self.VariablesGridColAlignements = [wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_RIGHT]
+        self.VariablesGridColSizes = [40, 100, 100, 150, 150, 100]
+        self.VariablesGrid.SetRowLabelSize(0)
+        for col in range(self.VariablesTable.GetNumberCols()):
+            attr = wx.grid.GridCellAttr()
+            attr.SetAlignment(self.VariablesGridColAlignements[col], wx.ALIGN_CENTRE)
+            self.VariablesGrid.SetColAttr(col, attr)
+            self.VariablesGrid.SetColMinimalWidth(col, self.VariablesGridColSizes[col])
+            self.VariablesGrid.AutoSizeColumn(col, False)
+        
+        self.RefreshView()
+    
+    def GetSlaveTitle(self):
+        type_infos = self.Controler.GetSlaveType(self.Slave)
+        return "%s (%d:%d)" % (type_infos["device_type"], self.Slave[0], self.Slave[1])
+    
+    def GetSlave(self):
+        return self.Slave
+    
+    def SetSlave(self, slave):
+        if self.Slave != slave:
+            self.Slave = slave
+            self.RefreshView()
+
+    def RefreshView(self):
+        self.Alias.SetValue(self.Slave[0])
+        self.Pos.SetValue(self.Slave[1])
+        slave_infos = self.Controler.GetSlaveInfos(self.Slave)
+        if slave_infos is not None:
+            self.Type.SetValue(slave_infos["device_type"])
+            self.Vendor.SetValue(slave_infos["vendor"])
+            self.ProductCode.SetValue(slave_infos["product_code"])
+            self.RevisionNumber.SetValue(slave_infos["revision_number"])
+            self.Physics.SetValue(slave_infos["physics"])
+            self.PDOsTable.SetData(slave_infos["pdos"])
+            self.PDOsTable.ResetView(self.PDOsGrid)
+            self.VariablesTable.SetData(slave_infos["variables"])
+            self.VariablesTable.ResetView(self.VariablesGrid)
+        else:
+            type_infos = self.Controler.GetSlaveType(self.Slave)
+            self.Type.SetValue(type_infos["device_type"])
+        
+    def OnAliasChanged(self, event):
+        alias = self.Alias.GetValue()
+        if alias != self.Slave[0]:
+            result = self.Controler.SetSlavePos(self.Slave[:2], alias = alias)
+            if result is not None:
+                message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+            else:
+                wx.CallAfter(self.ParentWindow.RefreshView, (alias, self.Slave[1]))
+                wx.CallAfter(self.ParentWindow.RefreshParentWindow)
+        event.Skip()
+        
+    def OnPositionChanged(self, event):
+        position = self.Pos.GetValue()
+        if position != self.Slave[1]:
+            result = self.Controler.SetSlavePos(self.Slave, position = position)
+            if result is not None:
+                message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+            else:
+                wx.CallAfter(self.ParentWindow.RefreshView, (self.Slave[0], position))
+                wx.CallAfter(self.ParentWindow.RefreshParentWindow)
+        event.Skip()
+
+    def OnTypeBrowseClick(self, event):
+        dialog = SlaveTypeChoiceDialog(self, self.Controler, self.Controler.GetSlaveType(self.Slave))
+        if dialog.ShowModal() == wx.ID_OK:
+            result = self.Controler.SetSlaveType(self.Slave, dialog.GetType())
+            if result is not None:
+                message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+            else:
+                wx.CallAfter(self.RefreshView)
+                wx.CallAfter(self.ParentWindow.RefreshSlaveNodesTitles)
+                wx.CallAfter(self.ParentWindow.RefreshParentWindow)
+        dialog.Destroy()
+        event.Skip()
+
+    def OnVariablesGridCellLeftClick(self, event):
+        if event.GetCol() == 0:
+            row = event.GetRow()
+            data_type = self.VariablesTable.GetValueByName(row, "Type")
+            var_name = self.VariablesTable.GetValueByName(row, "Name")
+            entry_index = self.Controler.ExtractHexDecValue(self.VariablesTable.GetValueByName(row, "Index"))
+            entry_subindex = self.VariablesTable.GetValueByName(row, "SubIndex")
+            pdo_index = self.VariablesTable.GetValueByName(row, "PDO")
+            for pdo_row in xrange(self.PDOsTable.GetNumberRows()):
+                if self.PDOsTable.GetValueByName(row, "Index") == pdo_index:
+                    if self.PDOsTable.GetValueByName(row, "Type") == "Transmit":
+                        dir = "%I"
+                    else:
+                        dir = "%Q"
+                    break
+            location = "%s%s" % (dir, self.Controler.GetSizeOfType(data_type)) + \
+                       ".".join(map(lambda x:str(x), self.Controler.GetCurrentLocation() + self.Slave + (entry_index, entry_subindex)))
+            data = wx.TextDataObject(str((location, "location", data_type, var_name, "")))
+            dragSource = wx.DropSource(self.VariablesGrid)
+            dragSource.SetData(data)
+            dragSource.DoDragDrop()
+        event.Skip()
+
+[ID_CONFIGEDITOR, ID_CONFIGEDITORADDSLAVEBUTTON,
+ ID_CONFIGEDITORDELETESLAVEBUTTON, ID_CONFIGEDITORSLAVENODES,
+] = [wx.NewId() for _init_ctrls in range(4)]
+
+class ConfigEditor(EditorPanel):
+    
+    ID = ID_CONFIGEDITOR
+    
+    def _init_coll_MainSizer_Items(self, parent):
+        parent.AddSizer(self.ButtonSizer, 0, border=5, flag=wx.ALIGN_RIGHT|wx.TOP|wx.LEFT|wx.RIGHT)
+        parent.AddWindow(self.SlaveNodes, 0, border=5, flag=wx.GROW|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+    def _init_coll_MainSizer_Growables(self, parent):
+        parent.AddGrowableCol(0)
+        parent.AddGrowableRow(1)
+    
+    def _init_coll_ButtonSizer_Items(self, parent):
+        parent.AddWindow(self.AddSlaveButton, 0, border=5, flag=wx.RIGHT)
+        parent.AddWindow(self.DeleteSlaveButton, 0, border=5, flag=0)
+        
+    def _init_sizers(self):
+        self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
+        self.ButtonSizer = wx.BoxSizer(wx.HORIZONTAL)
+        
+        self._init_coll_MainSizer_Items(self.MainSizer)
+        self._init_coll_MainSizer_Growables(self.MainSizer)
+        self._init_coll_ButtonSizer_Items(self.ButtonSizer)
+        
+        self.Editor.SetSizer(self.MainSizer)
+    
+    def _init_Editor(self, prnt):
+        self.Editor = wx.Panel(id=-1, parent=prnt, pos=wx.Point(0, 0), 
+                size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+    
+        self.AddSlaveButton = wx.Button(id=ID_CONFIGEDITORADDSLAVEBUTTON, label=_('Add slave'),
+              name='AddSlaveButton', parent=self.Editor, pos=wx.Point(0, 0),
+              size=wx.DefaultSize, style=0)
+        self.Bind(wx.EVT_BUTTON, self.OnAddSlaveButtonClick, id=ID_CONFIGEDITORADDSLAVEBUTTON)
+        
+        self.DeleteSlaveButton = wx.Button(id=ID_CONFIGEDITORDELETESLAVEBUTTON, label=_('Delete slave'),
+              name='DeleteSlaveButton', parent=self.Editor, pos=wx.Point(0, 0),
+              size=wx.DefaultSize, style=0)
+        self.Bind(wx.EVT_BUTTON, self.OnDeleteSlaveButtonClick, id=ID_CONFIGEDITORDELETESLAVEBUTTON)
+        
+        self.SlaveNodes = wx.Notebook(id=ID_CONFIGEDITORSLAVENODES,
+              name='SlaveNodes', parent=self.Editor, pos=wx.Point(0, 0),
+              size=wx.Size(0, 0), style=wx.NB_LEFT)
+        
+        self._init_sizers()
+    
+    def __init__(self, parent, controler, window):
+        EditorPanel.__init__(self, parent, "", window, controler)
+        
+        img = wx.Bitmap(self.Controler.GetIconPath("Cfile.png"), wx.BITMAP_TYPE_PNG).ConvertToImage()
+        self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16)))
+        
+    def GetTitle(self):
+        filename = self.Controler.GetFilename()
+        if not self.Controler.ConfigIsSaved():
+            return "~%s~" % filename
+        return filename
+    
+    def GetBufferState(self):
+        return self.Controler.GetBufferState()
+        
+    def Undo(self):
+        self.Controler.LoadPrevious()
+        self.RefreshView()
+            
+    def Redo(self):
+        self.Controler.LoadNext()
+        self.RefreshView()
+    
+    def RefreshView(self, slave_pos=None):
+        slaves = self.Controler.GetSlaves()
+        for i, slave in enumerate(slaves):
+            if i < self.SlaveNodes.GetPageCount():
+                panel = self.SlaveNodes.GetPage(i)
+                panel.SetSlave(slave)
+            else:
+                panel = SlavePanel(self.SlaveNodes, self.Controler, self, slave)
+                self.SlaveNodes.AddPage(panel, "")
+        while self.SlaveNodes.GetPageCount() > len(slaves):
+            self.SlaveNodes.RemovePage(len(slaves))
+        self.RefreshSlaveNodesTitles()
+        self.RefreshButtons()
+        if slave_pos is not None:
+            self.SelectSlave(slave_pos)
+    
+    def RefreshParentWindow(self):
+        self.ParentWindow.RefreshTitle()
+        self.ParentWindow.RefreshFileMenu()
+        self.ParentWindow.RefreshEditMenu()
+        self.ParentWindow.RefreshPageTitles()
+    
+    def RefreshSlaveNodesTitles(self):
+        for idx in xrange(self.SlaveNodes.GetPageCount()):
+            panel = self.SlaveNodes.GetPage(idx)
+            self.SlaveNodes.SetPageText(idx, panel.GetSlaveTitle())
+            
+    def RefreshButtons(self):
+        self.DeleteSlaveButton.Enable(self.SlaveNodes.GetPageCount() > 0)
+    
+    def SelectSlave(self, slave):
+        for idx in xrange(self.SlaveNodes.GetPageCount()):
+            panel = self.SlaveNodes.GetPage(idx)
+            if panel.GetSlave() == slave:
+                self.SlaveNodes.SetSelection(idx)
+                return
+    
+    def OnAddSlaveButtonClick(self, event):
+        slave = self.Controler.AddSlave()
+        self.RefreshParentWindow()
+        wx.CallAfter(self.RefreshView, slave)
+        event.Skip()
+    
+    def OnDeleteSlaveButtonClick(self, event):
+        selected = self.SlaveNodes.GetSelection()
+        if selected != -1:
+            panel = self.SlaveNodes.GetPage(selected)
+            if self.Controler.RemoveSlave(panel.GetSlave()[:2]):
+                self.RefreshParentWindow()
+                wx.CallAfter(self.RefreshView)
+            
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/EtherCATBase.xsd	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,654 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- edited with XMLSpy v2006 sp2 U (http://www.altova.com) by Beckmann (BECKHOFF Automation GmbH) -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:complexType name="AccessType">
+		<xs:simpleContent>
+			<xs:extension base="xs:NMTOKEN">
+				<xs:attribute name="ReadRestrictions">
+					<xs:simpleType>
+						<xs:restriction base="xs:NMTOKEN">
+							<xs:enumeration value="PreOp"/>
+							<xs:enumeration value="PreOP_SafeOP"/>
+							<xs:enumeration value="PreOP_OP"/>
+							<xs:enumeration value="SafeOP"/>
+							<xs:enumeration value="SafeOP_OP"/>
+							<xs:enumeration value="OP"/>
+						</xs:restriction>
+					</xs:simpleType>
+				</xs:attribute>
+				<xs:attribute name="WriteRestrictions">
+					<xs:simpleType>
+						<xs:restriction base="xs:NMTOKEN">
+							<xs:enumeration value="PreOp"/>
+							<xs:enumeration value="PreOP_SafeOP"/>
+							<xs:enumeration value="PreOP_OP"/>
+							<xs:enumeration value="SafeOP"/>
+							<xs:enumeration value="SafeOP_OP"/>
+							<xs:enumeration value="OP"/>
+						</xs:restriction>
+					</xs:simpleType>
+				</xs:attribute>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	<xs:complexType name="ArrayInfoType">
+		<xs:sequence>
+			<xs:element name="LBound" type="xs:integer"/>
+			<xs:element name="Elements" type="xs:integer"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="DataTypeType">
+		<xs:sequence>
+			<xs:element name="Index" type="HexDecValue" minOccurs="0"/>
+			<xs:element name="Name" type="xs:string"/>
+			<xs:element name="BaseType" type="xs:string" minOccurs="0"/>
+			<xs:element name="Comment" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="BitSize" type="xs:int"/>
+			<xs:choice minOccurs="0">
+				<xs:element name="ArrayInfo" type="ArrayInfoType" minOccurs="0" maxOccurs="3"/>
+				<xs:element name="SubItem" type="SubItemType" minOccurs="0" maxOccurs="unbounded"/>
+				<xs:element name="EnumInfo" type="EnumInfoType" minOccurs="0" maxOccurs="unbounded"/>
+			</xs:choice>
+			<xs:element name="Properties" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Xml" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="PropertyType">
+		<xs:sequence>
+			<xs:element name="Name" type="xs:string"/>
+			<xs:element name="Value" type="xs:string" minOccurs="0"/>
+			<xs:element name="Desc" type="NameType" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SubItemType">
+		<xs:sequence>
+			<xs:element name="SubIdx" type="HexDecValue" minOccurs="0"/>
+			<xs:element name="Name" type="xs:string"/>
+			<xs:element name="DisplayName" type="NameType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation>for future use</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Type" type="xs:string"/>
+			<xs:element name="Comment" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="BitSize" type="xs:int"/>
+			<xs:element name="BitOffs" type="xs:int"/>
+			<xs:choice minOccurs="0">
+				<xs:element name="DefaultString" type="xs:string" minOccurs="0">
+					<xs:annotation>
+						<xs:documentation>obsolete</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="DefaultData" type="xs:hexBinary" minOccurs="0">
+					<xs:annotation>
+						<xs:documentation>obsolete</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:sequence minOccurs="0">
+					<xs:element name="MinValue" type="HexDecValue" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation>obsolete</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="MaxValue" type="HexDecValue" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation>obsolete</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="DefaultValue" type="HexDecValue" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation>obsolete</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:choice>
+			<xs:element name="Flags" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Access" minOccurs="0">
+							<xs:complexType>
+								<xs:simpleContent>
+									<xs:restriction base="AccessType">
+										<xs:pattern value="ro"/>
+										<xs:pattern value="rw"/>
+										<xs:pattern value="wo"/>
+									</xs:restriction>
+								</xs:simpleContent>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="Category" minOccurs="0">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="m"/>
+									<xs:enumeration value="o"/>
+									<xs:enumeration value="c"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="PdoMapping" minOccurs="0">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="T"/>
+									<xs:enumeration value="R"/>
+									<xs:enumeration value="TR"/>
+									<xs:enumeration value="RT"/>
+									<xs:enumeration value="t"/>
+									<xs:enumeration value="r"/>
+									<xs:enumeration value="tr"/>
+									<xs:enumeration value="rt"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="SafetyMapping" minOccurs="0">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="si"/>
+									<xs:enumeration value="SI"/>
+									<xs:enumeration value="so"/>
+									<xs:enumeration value="SO"/>
+									<xs:enumeration value="sio"/>
+									<xs:enumeration value="SIO"/>
+									<xs:enumeration value="sp"/>
+									<xs:enumeration value="SP"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="Attribute" type="HexDecValue" minOccurs="0"/>
+						<xs:element name="Backup" type="xs:int" minOccurs="0"/>
+						<xs:element name="Setting" type="xs:int" minOccurs="0"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="Xml" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>obsolete</xs:documentation>
+				</xs:annotation>
+				<xs:complexType>
+					<xs:sequence>
+						<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="EnumInfoType">
+		<xs:sequence>
+			<xs:element name="Text" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="Enum" type="xs:int"/>
+			<xs:element name="Comment" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="NameType">
+		<xs:simpleContent>
+			<xs:extension base="xs:string">
+				<xs:attribute name="LcId" type="xs:integer" use="optional" default="1033"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	<xs:complexType name="DictionaryType">
+		<xs:sequence>
+			<xs:element name="DataTypes" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="DataType" type="DataTypeType" minOccurs="0" maxOccurs="unbounded">
+							<xs:key name="SubItemKey">
+								<xs:selector xpath="./SubItem"/>
+								<xs:field xpath="Name"/>
+							</xs:key>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+				<xs:key name="DataTypeKey">
+					<xs:selector xpath="./DataType"/>
+					<xs:field xpath="Name"/>
+				</xs:key>
+				<xs:keyref name="BaseTypeRef" refer="DataTypeKey">
+					<xs:selector xpath="./DataType"/>
+					<xs:field xpath="BaseType"/>
+				</xs:keyref>
+				<xs:keyref name="SubItemTypeRef" refer="DataTypeKey">
+					<xs:selector xpath="./DataType/SubItem"/>
+					<xs:field xpath="Type"/>
+				</xs:keyref>
+			</xs:element>
+			<xs:element name="Objects">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Object" type="ObjectType" minOccurs="0" maxOccurs="unbounded"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:simpleType name="HexDecValue">
+		<xs:restriction base="xs:string">
+			<xs:pattern value="[+-]?[0-9]{1,}"/>
+			<xs:pattern value="#x[0-9|a-f|A-F]{1,}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="ObjectType">
+		<xs:sequence>
+			<xs:element name="Index">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="HexDecValue">
+							<xs:attribute name="DependOnSlot" type="xs:boolean" use="optional"/>
+							<xs:attribute name="DependOnSlotGroup" type="xs:boolean" use="optional"/>
+							<xs:attribute name="OverwrittenByModule" type="xs:boolean" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Name" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="Comment" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="Type" type="xs:string"/>
+			<xs:element name="BitSize" type="xs:int"/>
+			<xs:element name="Info" type="ObjectInfoType" minOccurs="0"/>
+			<xs:element name="Flags" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Access" minOccurs="0">
+							<xs:complexType>
+								<xs:simpleContent>
+									<xs:restriction base="AccessType">
+										<xs:pattern value="ro"/>
+										<xs:pattern value="rw"/>
+										<xs:pattern value="wo"/>
+									</xs:restriction>
+								</xs:simpleContent>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="Category" minOccurs="0">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="m"/>
+									<xs:enumeration value="o"/>
+									<xs:enumeration value="c"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="PdoMapping" minOccurs="0">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="T"/>
+									<xs:enumeration value="R"/>
+									<xs:enumeration value="TR"/>
+									<xs:enumeration value="RT"/>
+									<xs:enumeration value="t"/>
+									<xs:enumeration value="r"/>
+									<xs:enumeration value="tr"/>
+									<xs:enumeration value="rt"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="SafetyMapping" minOccurs="0">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="si"/>
+									<xs:enumeration value="SI"/>
+									<xs:enumeration value="so"/>
+									<xs:enumeration value="SO"/>
+									<xs:enumeration value="sio"/>
+									<xs:enumeration value="SIO"/>
+									<xs:enumeration value="sp"/>
+									<xs:enumeration value="SP"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="Attribute" type="HexDecValue" minOccurs="0"/>
+						<xs:element name="Transition" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>obsolete</xs:documentation>
+							</xs:annotation>
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="IP"/>
+									<xs:enumeration value="PS"/>
+									<xs:enumeration value="SO"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="SdoAccess" minOccurs="0">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="CompleteAccess"/>
+									<xs:enumeration value="SubIndexAccess"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Properties" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Xml" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ObjectInfoType">
+		<xs:sequence>
+			<xs:choice minOccurs="0">
+				<xs:element name="DefaultString" type="xs:string"/>
+				<xs:sequence>
+					<xs:element name="MinData" type="xs:hexBinary" minOccurs="0"/>
+					<xs:element name="MaxData" type="xs:hexBinary" minOccurs="0"/>
+					<xs:element name="DefaultData" type="xs:hexBinary" minOccurs="0"/>
+				</xs:sequence>
+				<xs:sequence>
+					<xs:element name="MinValue" type="HexDecValue" minOccurs="0"/>
+					<xs:element name="MaxValue" type="HexDecValue" minOccurs="0"/>
+					<xs:element name="DefaultValue" type="HexDecValue" minOccurs="0"/>
+				</xs:sequence>
+				<xs:element name="SubItem" maxOccurs="unbounded">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="Name" type="xs:string"/>
+							<xs:element name="Info" type="ObjectInfoType"/>
+						</xs:sequence>
+					</xs:complexType>
+				</xs:element>
+			</xs:choice>
+			<xs:element name="Unit" type="HexDecValue" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="EntryType">
+		<xs:sequence>
+			<xs:element name="Index">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="HexDecValue">
+							<xs:attribute name="DependOnSlot" type="xs:boolean" use="optional"/>
+							<xs:attribute name="DependOnSlotGroup" type="xs:boolean" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="SubIndex" type="HexDecValue" minOccurs="0"/>
+			<xs:element name="BitLen" type="xs:int"/>
+			<xs:element name="Name" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+			<xs:element name="DataType" minOccurs="0">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="DScale" use="optional">
+								<xs:simpleType>
+									<xs:restriction base="xs:string">
+										<xs:enumeration value="+/-10"/>
+										<xs:enumeration value="0-10"/>
+										<xs:enumeration value="0-20"/>
+										<xs:enumeration value="4-20"/>
+										<xs:enumeration value="0.1°"/>
+										<xs:enumeration value="0-10(16)"/>
+										<xs:enumeration value="0-20(16)"/>
+										<xs:enumeration value="4-20(16)"/>
+										<xs:enumeration value="0.01°"/>
+										<xs:enumeration value="0-5"/>
+										<xs:enumeration value="0-30"/>
+										<xs:enumeration value="0-50"/>
+										<xs:enumeration value="+/-5"/>
+										<xs:enumeration value="+/-2.5"/>
+										<xs:enumeration value="+/-100"/>
+										<xs:enumeration value="0-5(16)"/>
+										<xs:enumeration value="0-30(16)"/>
+										<xs:enumeration value="0-50(16)"/>
+										<xs:enumeration value="+/-75mV"/>
+									</xs:restriction>
+								</xs:simpleType>
+							</xs:attribute>
+							<xs:attribute name="SwapData" use="optional">
+								<xs:simpleType>
+									<xs:restriction base="xs:NMTOKEN">
+										<xs:enumeration value="Swap_HB_LB"/>
+										<xs:enumeration value="Swap_HW_LW"/>
+										<xs:enumeration value="Swap_HB_LB_HW_LW"/>
+									</xs:restriction>
+								</xs:simpleType>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="PdoType">
+		<xs:sequence>
+			<xs:element name="Index">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="HexDecValue">
+							<xs:attribute name="DependOnSlot" type="xs:boolean" use="optional"/>
+							<xs:attribute name="DependOnSlotGroup" type="xs:boolean" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Name" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="Exclude" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="HexDecValue">
+							<xs:attribute name="DependOnSlot" type="xs:boolean" use="optional"/>
+							<xs:attribute name="DependOnSlotGroup" type="xs:boolean" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Entry" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:complexContent>
+						<xs:extension base="EntryType">
+							<xs:attribute name="Fixed" type="xs:boolean" use="optional"/>
+						</xs:extension>
+					</xs:complexContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="ExcludedSm" type="xs:int" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:attribute name="Fixed" type="xs:boolean" use="optional"/>
+		<xs:attribute name="Mandatory" type="xs:boolean" use="optional"/>
+		<xs:attribute name="Virtual" type="xs:boolean" use="optional"/>
+		<xs:attribute name="Sm" type="xs:int" use="optional"/>
+		<xs:attribute name="Su" type="xs:int" use="optional"/>
+		<xs:attribute name="PdoOrder" type="xs:int" use="optional">
+			<xs:annotation>
+				<xs:documentation>obsolete</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="OSFac" type="xs:int" use="optional"/>
+		<xs:attribute name="OSMin" type="xs:int" use="optional"/>
+		<xs:attribute name="OSMax" type="xs:int" use="optional"/>
+		<xs:attribute name="OSIndexInc" type="xs:int" use="optional"/>
+		<xs:attribute name="OverwrittenByModule" type="xs:boolean" use="optional"/>
+	</xs:complexType>
+	<xs:complexType name="VendorSpecificType">
+		<xs:sequence>
+			<xs:any namespace="##any" processContents="skip" maxOccurs="unbounded"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProfileType">
+		<xs:sequence>
+			<xs:element name="ProfileNo" type="xs:int" minOccurs="0"/>
+			<xs:element name="AddInfo" type="xs:int" minOccurs="0"/>
+			<xs:choice minOccurs="0">
+				<xs:element name="ChannelCount" type="xs:int"/>
+				<xs:element name="ChannelInfo" maxOccurs="unbounded">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="ProfileNo" type="xs:int"/>
+							<xs:element name="AddInfo" type="xs:int" minOccurs="0"/>
+							<xs:element name="DisplayName" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+						</xs:sequence>
+						<xs:attribute name="OverwrittenByModule" type="xs:boolean" use="optional"/>
+					</xs:complexType>
+				</xs:element>
+			</xs:choice>
+			<xs:choice minOccurs="0">
+				<xs:element name="DictionaryFile" type="xs:string" minOccurs="0"/>
+				<xs:element name="Dictionary" type="DictionaryType" minOccurs="0">
+					<xs:keyref name="ObjectTypesRef" refer="DataTypesKey">
+						<xs:selector xpath="./Objects/Object"/>
+						<xs:field xpath="Type"/>
+					</xs:keyref>
+					<xs:key name="DataTypesKey">
+						<xs:selector xpath="./DataTypes/DataType"/>
+						<xs:field xpath="Name"/>
+					</xs:key>
+				</xs:element>
+			</xs:choice>
+			<xs:element name="DiagMessages" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="DiagMessage" maxOccurs="unbounded">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="TextId" type="HexDecValue"/>
+									<xs:element name="MessageText" type="NameType" maxOccurs="unbounded"/>
+								</xs:sequence>
+							</xs:complexType>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VendorType">
+		<xs:sequence>
+			<xs:element name="Id" type="HexDecValue"/>
+			<xs:element name="Name" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="Comment" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="URL" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="DescriptionURL" type="xs:string" minOccurs="0"/>
+			<xs:choice>
+				<xs:element name="Image16x14" type="xs:string">
+					<xs:annotation>
+						<xs:documentation>obsolete</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="ImageFile16x14" type="xs:string"/>
+				<xs:element name="ImageData16x14" type="xs:hexBinary"/>
+			</xs:choice>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+		</xs:sequence>
+		<xs:attribute name="UniqueName" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>obsolete</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+	</xs:complexType>
+	<xs:complexType name="ModuleType">
+		<xs:sequence>
+			<xs:element name="Type">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="ModuleIdent" type="HexDecValue" use="required"/>
+							<xs:attribute name="ModuleClass" type="xs:string" use="optional"/>
+							<xs:attribute name="ModulePdoGroup" type="xs:int" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Name" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="RxPdo" type="PdoType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="TxPdo" type="PdoType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="SafetyParaMapping" type="PdoType" minOccurs="0"/>
+			<xs:element name="Mailbox" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="CoE" minOccurs="0">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="InitCmd" minOccurs="0" maxOccurs="unbounded">
+										<xs:complexType>
+											<xs:sequence>
+												<xs:element name="Transition" maxOccurs="unbounded">
+													<xs:simpleType>
+														<xs:restriction base="xs:NMTOKEN">
+															<xs:enumeration value="PS"/>
+															<xs:enumeration value="SO"/>
+															<xs:enumeration value="SP"/>
+															<xs:enumeration value="OP"/>
+															<xs:enumeration value="OS"/>
+														</xs:restriction>
+													</xs:simpleType>
+												</xs:element>
+												<xs:element name="Index">
+													<xs:complexType>
+														<xs:simpleContent>
+															<xs:extension base="HexDecValue">
+																<xs:attribute name="DependOnSlot" type="xs:boolean" use="optional"/>
+																<xs:attribute name="DependOnSlotGroup" type="xs:boolean" use="optional"/>
+															</xs:extension>
+														</xs:simpleContent>
+													</xs:complexType>
+												</xs:element>
+												<xs:element name="SubIndex" type="HexDecValue"/>
+												<xs:element name="Data">
+													<xs:complexType>
+														<xs:simpleContent>
+															<xs:extension base="xs:hexBinary">
+																<xs:attribute name="AdaptAutomatically" type="xs:boolean" use="optional"/>
+															</xs:extension>
+														</xs:simpleContent>
+													</xs:complexType>
+												</xs:element>
+												<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+											</xs:sequence>
+											<xs:attribute name="Fixed" type="xs:boolean" use="optional"/>
+											<xs:attribute name="CompleteAccess" type="xs:boolean" use="optional"/>
+										</xs:complexType>
+									</xs:element>
+								</xs:sequence>
+								<xs:attribute name="SdoInfo" type="xs:boolean" use="optional"/>
+								<xs:attribute name="PdoAssign" type="xs:boolean" use="optional"/>
+								<xs:attribute name="PdoConfig" type="xs:boolean" use="optional"/>
+								<xs:attribute name="PdoUpload" type="xs:boolean" use="optional"/>
+								<xs:attribute name="CompleteAccess" type="xs:boolean" use="optional"/>
+								<xs:attribute name="EdsFile" type="xs:string" use="optional"/>
+								<xs:attribute name="SegmentedSdo" type="xs:boolean" use="optional"/>
+								<xs:attribute name="ModuleOD" type="xs:boolean" use="optional"/>
+							</xs:complexType>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Profile" type="ProfileType" minOccurs="0"/>
+			<xs:element name="DcOpModeName" type="xs:string" minOccurs="0"/>
+			<xs:choice minOccurs="0">
+				<xs:element name="Image16x14" type="xs:string">
+					<xs:annotation>
+						<xs:documentation>obsolete</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="ImageFile16x14" type="xs:string"/>
+				<xs:element name="ImageData16x14" type="xs:hexBinary"/>
+			</xs:choice>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/EtherCATConfig.xsd	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,1122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:element name="EtherCATConfig">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="Config">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="Master">
+								<xs:annotation>
+									<xs:documentation>Description of the master </xs:documentation>
+								</xs:annotation>
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element name="Info">
+											<xs:annotation>
+												<xs:documentation>General information abaout the master</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="Name" type="xs:string">
+														<xs:annotation>
+															<xs:documentation>name of the master</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Destination" type="xs:hexBinary">
+														<xs:annotation>
+															<xs:documentation>destination MAC address</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Source" type="xs:hexBinary">
+														<xs:annotation>
+															<xs:documentation>source MAC address</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="EtherType" type="xs:hexBinary" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>Ether type.</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="MailboxStates" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>If this tag exists the master checks the mailbox of one or more slaves for new messages during the cylcic process data communication.</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="StartAddr" type="xs:int">
+														<xs:annotation>
+															<xs:documentation>Start address of the logical address area, that is configured to the written bit of the input mailibox sync manager. In the cyclic frame the master will then include a LRD command with laddr = StartAddr.</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Count" type="xs:int">
+														<xs:annotation>
+															<xs:documentation>Number of slave devices of which the state of the mailbox is tested by the master.</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="EoE" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Ethernet over EtherCAT settings</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="MaxPorts" type="xs:int"/>
+													<xs:element name="MaxFrames" type="xs:int"/>
+													<xs:element name="MaxMACs" type="xs:int"/>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="InitCmds" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Initialization commands that are directed at all slaves.</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="InitCmd" type="ECatCmdType" minOccurs="0" maxOccurs="unbounded"/>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+									</xs:sequence>
+								</xs:complexType>
+							</xs:element>
+							<xs:element name="Slave" minOccurs="0" maxOccurs="unbounded">
+								<xs:annotation>
+									<xs:documentation>Description of one or more EtherCAT slave devices.</xs:documentation>
+								</xs:annotation>
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element name="Info">
+											<xs:annotation>
+												<xs:documentation>General information about the EtherCAT slave device</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="Name" type="xs:string">
+														<xs:annotation>
+															<xs:documentation>Name of  the slave device. </xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:sequence minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>Slave device has EtherCAT Slave Controller</xs:documentation>
+														</xs:annotation>
+														<xs:element name="PhysAddr" type="xs:int">
+															<xs:annotation>
+																<xs:documentation>Fixed EtherCAT address of the slave device.</xs:documentation>
+															</xs:annotation>
+														</xs:element>
+														<xs:element name="AutoIncAddr" type="xs:int">
+															<xs:annotation>
+																<xs:documentation>Auto Increment address of the slave device.</xs:documentation>
+															</xs:annotation>
+														</xs:element>
+														<xs:element name="Physics" type="PhysicsType">
+															<xs:annotation>
+																<xs:documentation>Physics at the individual ports(A,B,C,D) of the slave.</xs:documentation>
+															</xs:annotation>
+														</xs:element>
+													</xs:sequence>
+													<xs:element name="VendorId" type="xs:int">
+														<xs:annotation>
+															<xs:documentation>EtherCAT VendorId. VendorId, ProductCode and RevisionNo are used to identify a specific slave.</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="ProductCode" type="xs:int"/>
+													<xs:element name="RevisionNo" type="xs:int"/>
+													<xs:element name="SerialNo" type="xs:int"/>
+													<xs:element name="ProductRevision" type="xs:string" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>User friendly name generated from ProductCode  and RevisionNo with the help of a vendor specific algorithmn</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="ProcessData" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Description of the process data of this slave</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="Send" minOccurs="0" maxOccurs="unbounded">
+														<xs:annotation>
+															<xs:documentation>Description of the output process data</xs:documentation>
+														</xs:annotation>
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="BitStart" type="xs:int">
+																	<xs:annotation>
+																		<xs:documentation>Start address of the process data of this slave in the output image of the master</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+																<xs:element name="BitLength" type="xs:int">
+																	<xs:annotation>
+																		<xs:documentation>Length of the send process data</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="Recv" minOccurs="0" maxOccurs="unbounded">
+														<xs:annotation>
+															<xs:documentation>Description of the input process data</xs:documentation>
+														</xs:annotation>
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="BitStart" type="xs:int">
+																	<xs:annotation>
+																		<xs:documentation>Start address of the process data of this slave in the inpute image of the master</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+																<xs:element name="BitLength" type="xs:int">
+																	<xs:annotation>
+																		<xs:documentation>Length of the recv process data</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="Sm0" type="SyncManagerSettings" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>Settings of sync manager 0</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Sm1" type="SyncManagerSettings" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>Settings of sync manager 1</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Sm2" type="SyncManagerSettings" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>Settings of sync manager 2</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Sm3" type="SyncManagerSettings" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>Settings of sync manager 3</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:choice minOccurs="0" maxOccurs="unbounded">
+														<xs:element name="RxPdo" type="PdoType">
+															<xs:annotation>
+																<xs:documentation>Ouput Pdos</xs:documentation>
+															</xs:annotation>
+														</xs:element>
+														<xs:element name="TxPdo" type="PdoType">
+															<xs:annotation>
+																<xs:documentation>Input Pdos</xs:documentation>
+															</xs:annotation>
+														</xs:element>
+													</xs:choice>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="Mailbox" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Mailbox settings</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="Send" type="MailboxSendInfoType">
+														<xs:annotation>
+															<xs:documentation>Output mailbox settings</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Recv" type="MailboxRecvInfoType">
+														<xs:annotation>
+															<xs:documentation>Input mailbox settings</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="BootStrap" minOccurs="0">
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="Send" type="MailboxSendInfoType">
+																	<xs:annotation>
+																		<xs:documentation>Output mailbox settings for bootstrap state</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+																<xs:element name="Recv" type="MailboxRecvInfoType">
+																	<xs:annotation>
+																		<xs:documentation>Input mailbox settings for bootstrap state</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="Protocol" minOccurs="0" maxOccurs="unbounded">
+														<xs:annotation>
+															<xs:documentation>Supported protocols</xs:documentation>
+														</xs:annotation>
+														<xs:simpleType>
+															<xs:restriction base="xs:NMTOKEN">
+																<xs:enumeration value="AoE"/>
+																<xs:enumeration value="EoE"/>
+																<xs:enumeration value="CoE"/>
+																<xs:enumeration value="SoE"/>
+																<xs:enumeration value="FoE"/>
+																<xs:enumeration value="VoE"/>
+															</xs:restriction>
+														</xs:simpleType>
+													</xs:element>
+													<xs:element name="CoE" minOccurs="0">
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="InitCmds" minOccurs="0">
+																	<xs:complexType>
+																		<xs:sequence>
+																			<xs:element name="InitCmd" minOccurs="0" maxOccurs="unbounded">
+																				<xs:annotation>
+																					<xs:documentation>SDO download cmds</xs:documentation>
+																				</xs:annotation>
+																				<xs:complexType>
+																					<xs:sequence>
+																						<xs:element name="Transition" type="TransitionType" maxOccurs="unbounded">
+																							<xs:annotation>
+																								<xs:documentation>init cmd will be send at the defined transitions</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+																						<xs:element name="Timeout" type="xs:int">
+																							<xs:annotation>
+																								<xs:documentation>Timeout in ms</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="Ccs" type="xs:int"/>
+																						<xs:element name="Index" type="xs:int">
+																							<xs:annotation>
+																								<xs:documentation>SDO index</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="SubIndex" type="xs:int">
+																							<xs:annotation>
+																								<xs:documentation>SDO subindex</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="Data" type="xs:hexBinary" minOccurs="0">
+																							<xs:annotation>
+																								<xs:documentation>SDO data</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="Disabled" type="xs:boolean" minOccurs="0">
+																							<xs:annotation>
+																								<xs:documentation>If true the init command should not be sent</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																					</xs:sequence>
+																					<xs:attribute name="Fixed" type="xs:boolean" use="optional"/>
+																					<xs:attribute name="CompleteAccess" type="xs:boolean" use="optional"/>
+																				</xs:complexType>
+																			</xs:element>
+																		</xs:sequence>
+																	</xs:complexType>
+																</xs:element>
+																<xs:element name="Profile" type="ProfileType" minOccurs="0"/>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="SoE" minOccurs="0">
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="InitCmds" minOccurs="0">
+																	<xs:complexType>
+																		<xs:sequence>
+																			<xs:element name="InitCmd" minOccurs="0" maxOccurs="unbounded">
+																				<xs:annotation>
+																					<xs:documentation>service channel write req</xs:documentation>
+																				</xs:annotation>
+																				<xs:complexType>
+																					<xs:sequence>
+																						<xs:element name="Transition" maxOccurs="unbounded">
+																							<xs:annotation>
+																								<xs:documentation>init cmd will be send at the defined transitions</xs:documentation>
+																							</xs:annotation>
+																							<xs:simpleType>
+																								<xs:restriction base="xs:NMTOKEN">
+																									<xs:enumeration value="PS"/>
+																									<xs:enumeration value="SO"/>
+																									<xs:enumeration value="SP"/>
+																									<xs:enumeration value="OP"/>
+																									<xs:enumeration value="OS"/>
+																								</xs:restriction>
+																							</xs:simpleType>
+																						</xs:element>
+																						<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+																						<xs:element name="Timeout" type="xs:int">
+																							<xs:annotation>
+																								<xs:documentation>Timeout in ms</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="OpCode" type="xs:int">
+																							<xs:annotation>
+																								<xs:documentation>Op Code</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="DriveNo" type="xs:int">
+																							<xs:annotation>
+																								<xs:documentation>Drive number</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="IDN" type="xs:int">
+																							<xs:annotation>
+																								<xs:documentation>IDN to write</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="Elements" type="xs:int"/>
+																						<xs:element name="Attribute" type="xs:int"/>
+																						<xs:element name="Data" type="xs:hexBinary" minOccurs="0">
+																							<xs:annotation>
+																								<xs:documentation>data to write</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																						<xs:element name="Disabled" type="xs:boolean" minOccurs="0">
+																							<xs:annotation>
+																								<xs:documentation>If true the init command should not be sent</xs:documentation>
+																							</xs:annotation>
+																						</xs:element>
+																					</xs:sequence>
+																					<xs:attribute name="Fixed" type="xs:boolean" use="optional" default="0"/>
+																				</xs:complexType>
+																			</xs:element>
+																		</xs:sequence>
+																	</xs:complexType>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="AoE" minOccurs="0">
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="InitCmds" minOccurs="0">
+																	<xs:complexType>
+																		<xs:sequence>
+																			<xs:element name="InitCmd" type="MailboxCmdType" minOccurs="0" maxOccurs="unbounded"/>
+																		</xs:sequence>
+																	</xs:complexType>
+																</xs:element>
+																<xs:element name="NetId" type="xs:string" minOccurs="0"/>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="EoE" minOccurs="0">
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="InitCmds" minOccurs="0">
+																	<xs:complexType>
+																		<xs:sequence>
+																			<xs:element name="InitCmd" type="MailboxCmdType" minOccurs="0" maxOccurs="unbounded"/>
+																		</xs:sequence>
+																	</xs:complexType>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="FoE" minOccurs="0">
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="InitCmds" minOccurs="0">
+																	<xs:complexType>
+																		<xs:sequence>
+																			<xs:element name="InitCmd" type="MailboxCmdType" minOccurs="0" maxOccurs="unbounded"/>
+																		</xs:sequence>
+																	</xs:complexType>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+													<xs:element name="VoE" minOccurs="0">
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="InitCmds" minOccurs="0">
+																	<xs:complexType>
+																		<xs:sequence>
+																			<xs:element name="InitCmd" type="MailboxCmdType" minOccurs="0" maxOccurs="unbounded"/>
+																		</xs:sequence>
+																	</xs:complexType>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+												</xs:sequence>
+												<xs:attribute name="DataLinkLayer" type="xs:boolean"/>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="InitCmds" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Initialization commands that are necessary for the slave device to run-up.</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="InitCmd" type="ECatCmdType" minOccurs="0" maxOccurs="unbounded"/>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="PreviousPort" minOccurs="0" maxOccurs="unbounded">
+											<xs:annotation>
+												<xs:documentation>Possible previous port. The current previous port is set with the Selected attribute</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="DeviceId" type="xs:int" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>deprecated</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Port">
+														<xs:annotation>
+															<xs:documentation>Port of the previous slave device this device is connected to</xs:documentation>
+														</xs:annotation>
+														<xs:simpleType>
+															<xs:restriction base="xs:NMTOKEN">
+																<xs:enumeration value="B"/>
+																<xs:enumeration value="C"/>
+																<xs:enumeration value="D"/>
+															</xs:restriction>
+														</xs:simpleType>
+													</xs:element>
+													<xs:element name="PhysAddr" type="xs:int" minOccurs="0">
+														<xs:annotation>
+															<xs:documentation>Fixed EtherCAT Address of slave device</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+												</xs:sequence>
+												<xs:attribute name="Selected" type="xs:int" use="optional" default="0"/>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="HotConnect" minOccurs="0">
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="GroupMemberCnt" type="xs:int"/>
+													<xs:element name="IdentifyCmd" type="ECatCmdType" maxOccurs="unbounded"/>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="DC" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Distributed clock settings</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="ReferenceClock" type="xs:boolean">
+														<xs:annotation>
+															<xs:documentation>Determines if this device is the reference clock</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="CycleTime0" type="xs:int"/>
+													<xs:element name="CycleTime1" type="xs:int"/>
+													<xs:element name="ShiftTime" type="xs:int"/>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+									</xs:sequence>
+								</xs:complexType>
+							</xs:element>
+							<xs:element name="Cyclic" minOccurs="0" maxOccurs="unbounded">
+								<xs:annotation>
+									<xs:documentation>Cycles in which frames are sent</xs:documentation>
+								</xs:annotation>
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+										<xs:element name="CycleTime" type="xs:int" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Cycle time of the task sending the frames</xs:documentation>
+											</xs:annotation>
+										</xs:element>
+										<xs:element name="Priority" type="xs:int" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Priority of the task sending the frames</xs:documentation>
+											</xs:annotation>
+										</xs:element>
+										<xs:element name="TaskId" type="xs:string" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Id of the task sending the frames</xs:documentation>
+											</xs:annotation>
+										</xs:element>
+										<xs:element name="Frame" maxOccurs="unbounded">
+											<xs:annotation>
+												<xs:documentation>Frames to be sent in this cycle</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+													<xs:element name="Cmd" maxOccurs="unbounded">
+														<xs:annotation>
+															<xs:documentation>EtherCAT sub command</xs:documentation>
+														</xs:annotation>
+														<xs:complexType>
+															<xs:sequence>
+																<xs:element name="State" maxOccurs="4">
+																	<xs:annotation>
+																		<xs:documentation>Master state the command should be sent in. If the command should not be sent in the current master state one can either remove this command form the frame or set Cmd to Nop.</xs:documentation>
+																	</xs:annotation>
+																	<xs:simpleType>
+																		<xs:restriction base="xs:NMTOKEN">
+																			<xs:enumeration value="INIT"/>
+																			<xs:enumeration value="PREOP"/>
+																			<xs:enumeration value="SAFEOP"/>
+																			<xs:enumeration value="OP"/>
+																		</xs:restriction>
+																	</xs:simpleType>
+																</xs:element>
+																<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+																<xs:element name="Cmd" type="xs:int"/>
+																<xs:choice>
+																	<xs:sequence>
+																		<xs:element name="Adp" type="xs:int" minOccurs="0">
+																			<xs:annotation>
+																				<xs:documentation>Adress position. Either Auto Increment Address or fixed EtherCAT Address</xs:documentation>
+																			</xs:annotation>
+																		</xs:element>
+																		<xs:element name="Ado" type="xs:int">
+																			<xs:annotation>
+																				<xs:documentation>Offset in DPRAM of the EtherCAT Slave Controller</xs:documentation>
+																			</xs:annotation>
+																		</xs:element>
+																	</xs:sequence>
+																	<xs:element name="Addr" type="xs:int">
+																		<xs:annotation>
+																			<xs:documentation>Logical Address</xs:documentation>
+																		</xs:annotation>
+																	</xs:element>
+																</xs:choice>
+																<xs:choice>
+																	<xs:element name="Data" type="xs:hexBinary">
+																		<xs:annotation>
+																			<xs:documentation>Data that should sent</xs:documentation>
+																		</xs:annotation>
+																	</xs:element>
+																	<xs:element name="DataLength" type="xs:int">
+																		<xs:annotation>
+																			<xs:documentation>Length of the data that should be sent. The data is then filled with 0.</xs:documentation>
+																		</xs:annotation>
+																	</xs:element>
+																</xs:choice>
+																<xs:element name="Cnt" type="xs:int" minOccurs="0">
+																	<xs:annotation>
+																		<xs:documentation>Expected working counter.</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+																<xs:element name="InputOffs" type="xs:int">
+																	<xs:annotation>
+																		<xs:documentation>Offset in the input image</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+																<xs:element name="OutputOffs" type="xs:int">
+																	<xs:annotation>
+																		<xs:documentation>Offset in the output image</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+																<xs:element name="CopyInfos" type="CopyInfosType" minOccurs="0">
+																	<xs:annotation>
+																		<xs:documentation>Copy information for slave to slave communication. The master has to copy valid input data of this command from the source offest (bit offs in the complete process image) to a destination offset.</xs:documentation>
+																	</xs:annotation>
+																</xs:element>
+															</xs:sequence>
+														</xs:complexType>
+													</xs:element>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+									</xs:sequence>
+								</xs:complexType>
+							</xs:element>
+							<xs:element name="ProcessImage" minOccurs="0">
+								<xs:annotation>
+									<xs:documentation>Description of the process image of the master</xs:documentation>
+								</xs:annotation>
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element name="Inputs" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Input process image of the master</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="ByteSize" type="xs:int">
+														<xs:annotation>
+															<xs:documentation>Size of the input image</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Variable" type="VariableType" minOccurs="0" maxOccurs="unbounded">
+														<xs:annotation>
+															<xs:documentation>Input variables</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+										<xs:element name="Outputs" minOccurs="0">
+											<xs:annotation>
+												<xs:documentation>Output process image of the master</xs:documentation>
+											</xs:annotation>
+											<xs:complexType>
+												<xs:sequence>
+													<xs:element name="ByteSize" type="xs:int">
+														<xs:annotation>
+															<xs:documentation>Size of the output image</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+													<xs:element name="Variable" type="VariableType" minOccurs="0" maxOccurs="unbounded">
+														<xs:annotation>
+															<xs:documentation>Output variables</xs:documentation>
+														</xs:annotation>
+													</xs:element>
+												</xs:sequence>
+											</xs:complexType>
+										</xs:element>
+									</xs:sequence>
+								</xs:complexType>
+							</xs:element>
+						</xs:sequence>
+					</xs:complexType>
+				</xs:element>
+			</xs:sequence>
+			<xs:attribute name="Version" type="xs:string" use="optional">
+				<xs:annotation>
+					<xs:documentation>Schema version (actual 1.3)</xs:documentation>
+				</xs:annotation>
+			</xs:attribute>
+		</xs:complexType>
+	</xs:element>
+	<xs:complexType name="ECatCmdType">
+		<xs:sequence>
+			<xs:element name="Transition" type="TransitionType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation>Transition this command should be sent in</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="BeforeSlave" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>If BeforeSlave is true this command will be sent before the slave init commands defined for this transition</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+			<xs:element name="Requires" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>If Requires is set to cycle, this command has to be sent in a seperate cycle. If Requires is set to cycle, this command has to be sent in a seperate frame. </xs:documentation>
+				</xs:annotation>
+				<xs:simpleType>
+					<xs:restriction base="xs:NMTOKEN">
+						<xs:enumeration value="frame"/>
+						<xs:enumeration value="cycle"/>
+					</xs:restriction>
+				</xs:simpleType>
+			</xs:element>
+			<xs:element name="Cmd" type="xs:int">
+				<xs:annotation>
+					<xs:documentation>EtherCAT Command Id</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:choice>
+				<xs:sequence>
+					<xs:element name="Adp" type="xs:int" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation>Adress position. Either Auto Increment Address or fixed EtherCAT Address</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="Ado" type="xs:int">
+						<xs:annotation>
+							<xs:documentation>Offset in DPRAM of the EtherCAT Slave Controller</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+				<xs:element name="Addr" type="xs:int">
+					<xs:annotation>
+						<xs:documentation>Logical Address</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+			</xs:choice>
+			<xs:choice>
+				<xs:element name="Data" type="xs:hexBinary">
+					<xs:annotation>
+						<xs:documentation>Data that should sent</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="DataLength" type="xs:int">
+					<xs:annotation>
+						<xs:documentation>Length of the data that should be sent. The data is then filled with 0.</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+			</xs:choice>
+			<xs:element name="Cnt" type="xs:int" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>Expected working counter. If the returned working counter is not equal to this value the init command fails.</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Retries" type="xs:int" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>Defines how many times the master should retry sending the command before the init command fails.</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Validate" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>If validate is set the returned data has to be validated by the master.</xs:documentation>
+				</xs:annotation>
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Data" type="xs:hexBinary">
+							<xs:annotation>
+								<xs:documentation>Binary data with which the returned data has to be compared with.</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="DataMask" type="xs:hexBinary" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>If a data mask is set, the returned data and the data mask is combined with an AND operatore, before comparing the data.</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="Timeout" type="xs:int">
+							<xs:annotation>
+								<xs:documentation>Timeout in ms. Determis how long the master retries to read out the date, if the validation has failed.</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SyncManagerSettings">
+		<xs:sequence>
+			<xs:element name="Type">
+				<xs:annotation>
+					<xs:documentation>Type of Sync Manager (e.g. Outputs)</xs:documentation>
+				</xs:annotation>
+				<xs:simpleType>
+					<xs:restriction base="xs:NMTOKEN">
+						<xs:enumeration value="MBoxOut"/>
+						<xs:enumeration value="MBoxIn"/>
+						<xs:enumeration value="Outputs"/>
+						<xs:enumeration value="Inputs"/>
+					</xs:restriction>
+				</xs:simpleType>
+			</xs:element>
+			<xs:element name="MinSize" type="xs:int" minOccurs="0"/>
+			<xs:element name="MaxSize" type="xs:int" minOccurs="0"/>
+			<xs:element name="DefaultSize" type="xs:int" minOccurs="0"/>
+			<xs:element name="StartAddress" type="xs:int"/>
+			<xs:element name="ControlByte" type="xs:int"/>
+			<xs:element name="Enable" type="xs:boolean"/>
+			<xs:element name="Virtual" type="xs:boolean" minOccurs="0"/>
+			<xs:element name="Watchdog" type="xs:int" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>Watchdog setting of the sync manager</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Pdo" type="xs:int" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation>Pdo indices</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:simpleType name="HexDecValue">
+		<xs:restriction base="xs:string">
+			<xs:pattern value="[+-]?[0-9]{1,}"/>
+			<xs:pattern value="#x[0-9|a-f|A-F]{1,}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="NameType">
+		<xs:simpleContent>
+			<xs:extension base="xs:string">
+				<xs:attribute name="LcId" type="xs:integer" default="1033"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	<xs:complexType name="PdoType">
+		<xs:sequence>
+			<xs:element name="Index">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="HexDecValue">
+							<xs:attribute name="DependOnSlot" type="xs:boolean">
+								<xs:annotation>
+									<xs:documentation>The index of the PDO will be adapted depend on the slot number and the SlotPdoIncrement value in the Slots-part of the device description</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="DependOnSlotGroup" type="xs:boolean">
+								<xs:annotation>
+									<xs:documentation>The index of the PDO will be adapted depend on the slot group number and the SlotGroupPdoIncrement value in the Slots-part of the device description</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Name" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="Exclude" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation>List of pdo indicies that are excluded if this pdo is in sync manager</xs:documentation>
+				</xs:annotation>
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="HexDecValue">
+							<xs:attribute name="DependOnSlot" type="xs:boolean">
+								<xs:annotation>
+									<xs:documentation>The index of the Exclude PDO will be adapted depend on the slot number and the SlotPdoIncrement value in the Slots-part of the device description</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="DependOnSlotGroup" type="xs:boolean">
+								<xs:annotation>
+									<xs:documentation>The index of the Exclude-PDO will be adapted depend on the slot group number and the SlotPdoIncrement value in the Slots-part of the device description</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Entry" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:complexContent>
+						<xs:extension base="EntryType">
+							<xs:attribute name="Fixed" type="xs:boolean"/>
+						</xs:extension>
+					</xs:complexContent>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+		<xs:attribute name="Fixed" type="xs:boolean" use="optional">
+			<xs:annotation>
+				<xs:documentation>pdo is not configurable</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="Mandatory" type="xs:boolean" use="optional">
+			<xs:annotation>
+				<xs:documentation>pdo must be configured in a sync manager</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="Virtual" type="xs:boolean" use="optional">
+			<xs:annotation>
+				<xs:documentation>pdo will be configured internally (based on the configured variables)</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="Sm" type="xs:int" use="optional">
+			<xs:annotation>
+				<xs:documentation>default sync manager for this pdo (if set, this PDO will be include in the process image)</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="Su" type="xs:int" use="optional">
+			<xs:annotation>
+				<xs:documentation>default sync unit for this pdo</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="PdoOrder" type="xs:int" use="optional"/>
+		<xs:attribute name="OSFac" type="xs:int" use="optional">
+			<xs:annotation>
+				<xs:documentation>default oversampling factor</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="OSMin" type="xs:int" use="optional">
+			<xs:annotation>
+				<xs:documentation>min. oversampling factor</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="OSMax" type="xs:int" use="optional">
+			<xs:annotation>
+				<xs:documentation>max. oversampling factor</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="OSIndexInc" type="xs:int" use="optional">
+			<xs:annotation>
+				<xs:documentation>oversampling increment for entry indicies</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="OverwrittenByModule" type="xs:boolean">
+			<xs:annotation>
+				<xs:documentation>If this attribute is True, the PDO shall not be considered if the configurator supports the modular device description because this PDO will be defined via the module definition (only for configurators supporting V1.3). </xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+	</xs:complexType>
+	<xs:complexType name="EntryType">
+		<xs:sequence>
+			<xs:element name="Index">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="HexDecValue">
+							<xs:attribute name="DependOnSlot" type="xs:boolean">
+								<xs:annotation>
+									<xs:documentation>The index will be adapted depend on the slot number and the SlotIndexIncrement value in the Slots-part of the device description</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="DependOnSlotGroup" type="xs:boolean">
+								<xs:annotation>
+									<xs:documentation>The index will be adapted depend on the slot group number and the SlotGroupIndexIncrement value in the Slots-part of the device description</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="SubIndex" type="HexDecValue" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>Default value = 0</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="BitLen" type="xs:int"/>
+			<xs:element name="Name" type="NameType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation>Name is mandatory if Index != 0</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+			<xs:element name="DataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>DataType is mandatory if Index != 0</xs:documentation>
+				</xs:annotation>
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="DScale" use="optional">
+								<xs:simpleType>
+									<xs:restriction base="xs:string">
+										<xs:enumeration value="+/-10"/>
+										<xs:enumeration value="0-10"/>
+										<xs:enumeration value="0-20"/>
+										<xs:enumeration value="4-20"/>
+										<xs:enumeration value="0.1°"/>
+									</xs:restriction>
+								</xs:simpleType>
+							</xs:attribute>
+							<xs:attribute name="SwapData" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>1 = swap hi and lo bytes; 2 = swap hi and lo words; 3 =  swap both</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:simpleType name="TransitionType">
+		<xs:restriction base="xs:NMTOKEN">
+			<xs:enumeration value="II"/>
+			<xs:enumeration value="IP"/>
+			<xs:enumeration value="PP"/>
+			<xs:enumeration value="PO"/>
+			<xs:enumeration value="PS"/>
+			<xs:enumeration value="PI"/>
+			<xs:enumeration value="SS"/>
+			<xs:enumeration value="SP"/>
+			<xs:enumeration value="SO"/>
+			<xs:enumeration value="SI"/>
+			<xs:enumeration value="OS"/>
+			<xs:enumeration value="OP"/>
+			<xs:enumeration value="OI"/>
+			<xs:enumeration value="IB"/>
+			<xs:enumeration value="BI"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="VariableType">
+		<xs:sequence>
+			<xs:element name="Name" type="xs:string">
+				<xs:annotation>
+					<xs:documentation>Name of the variable</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+			<xs:element name="DataType" type="xs:string" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>Datatype of the variable</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="BitSize" type="xs:int">
+				<xs:annotation>
+					<xs:documentation>Size of the variable in bits</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="BitOffs" type="xs:int">
+				<xs:annotation>
+					<xs:documentation>Bit offset of the variable in the image</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VendorSpecificType">
+		<xs:sequence>
+			<xs:any namespace="##any" processContents="skip" maxOccurs="unbounded"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProfileType">
+		<xs:sequence>
+			<xs:element name="ChannelInfo" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="ProfileNo" type="xs:int"/>
+						<xs:element name="AddInfo" type="xs:string" minOccurs="0"/>
+						<xs:element name="DisplayName" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+					</xs:sequence>
+					<xs:attribute name="OverwrittenByModule" type="xs:boolean">
+						<xs:annotation>
+							<xs:documentation>If this attribute is True, the object shall not be considered if the configurator supports the modular device description because this object will be defined via the module definition (only for configurators supporting V1.3). </xs:documentation>
+						</xs:annotation>
+					</xs:attribute>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:simpleType name="PhysicsType">
+		<xs:restriction base="xs:string">
+			<xs:pattern value="[Y,K, ,B]{0,4}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="MailboxCmdType">
+		<xs:sequence>
+			<xs:element name="Transition" type="TransitionType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation>init cmd will be send at the defined transitions</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+			<xs:element name="Timeout" type="xs:int">
+				<xs:annotation>
+					<xs:documentation>Timeout in ms</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Data" type="xs:hexBinary">
+				<xs:annotation>
+					<xs:documentation>data of the mailbox cmd (excl. the mailbox)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="Disabled" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>If true the init command should not be sent</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+		<xs:attribute name="Fixed" type="xs:boolean" use="optional" default="0"/>
+	</xs:complexType>
+	<xs:complexType name="MailboxSendInfoType">
+		<xs:sequence>
+			<xs:element name="Start" type="xs:int"/>
+			<xs:element name="Length" type="xs:int"/>
+			<xs:element name="ShortSend" type="xs:boolean" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="MailboxRecvInfoType">
+		<xs:sequence>
+			<xs:element name="Start" type="xs:int"/>
+			<xs:element name="Length" type="xs:int"/>
+			<xs:element name="PollTime" type="xs:int" minOccurs="0"/>
+			<xs:element name="StatusBitAddr" type="xs:int" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="CopyInfosType">
+		<xs:sequence>
+			<xs:element name="CopyInfo" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="SrcBitOffs" type="HexDecValue"/>
+						<xs:element name="DstBitOffs" type="HexDecValue"/>
+						<xs:element name="BitSize" type="HexDecValue"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/EtherCATInfo.xsd	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,955 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:include schemaLocation="EtherCATBase.xsd"/>
+	<xs:element name="EtherCATInfo">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="InfoReference" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+				<xs:element name="Vendor">
+					<xs:complexType>
+						<xs:complexContent>
+							<xs:extension base="VendorType">
+								<xs:attribute name="FileVersion" type="xs:int"/>
+							</xs:extension>
+						</xs:complexContent>
+					</xs:complexType>
+				</xs:element>
+				<xs:element name="Descriptions">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="Groups">
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element name="Group" minOccurs="0" maxOccurs="unbounded">
+											<xs:complexType>
+												<xs:complexContent>
+													<xs:extension base="GroupType">
+														<xs:attribute name="SortOrder" type="xs:int">
+															<xs:annotation>
+																<xs:documentation>Helps to display multiple groups in the order intended by the vendor</xs:documentation>
+															</xs:annotation>
+														</xs:attribute>
+														<xs:attribute name="ParentGroup" type="xs:string">
+															<xs:annotation>
+																<xs:documentation>Type of an optional parent group - only for additional display order possibilities</xs:documentation>
+															</xs:annotation>
+														</xs:attribute>
+													</xs:extension>
+												</xs:complexContent>
+											</xs:complexType>
+										</xs:element>
+									</xs:sequence>
+								</xs:complexType>
+							</xs:element>
+							<xs:element name="Devices">
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element name="Device" minOccurs="0" maxOccurs="unbounded">
+											<xs:complexType>
+												<xs:complexContent>
+													<xs:extension base="DeviceType">
+														<xs:attribute name="Invisible" type="xs:boolean" use="optional"/>
+														<xs:attribute name="Physics" type="PhysicsType" use="required"/>
+														<xs:attribute name="Crc32" type="HexDecValue" use="optional"/>
+													</xs:extension>
+												</xs:complexContent>
+											</xs:complexType>
+										</xs:element>
+									</xs:sequence>
+								</xs:complexType>
+							</xs:element>
+							<xs:element name="Modules" minOccurs="0">
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element name="Module" minOccurs="0" maxOccurs="unbounded">
+											<xs:complexType>
+												<xs:complexContent>
+													<xs:extension base="ModuleType">
+														<xs:attribute name="Crc32" type="HexDecValue" use="optional"/>
+													</xs:extension>
+												</xs:complexContent>
+											</xs:complexType>
+										</xs:element>
+									</xs:sequence>
+								</xs:complexType>
+							</xs:element>
+						</xs:sequence>
+					</xs:complexType>
+				</xs:element>
+			</xs:sequence>
+			<xs:attribute name="Version" type="xs:string" use="optional">
+				<xs:annotation>
+					<xs:documentation>Schema version (1.4)</xs:documentation>
+				</xs:annotation>
+			</xs:attribute>
+		</xs:complexType>
+	</xs:element>
+	<xs:complexType name="DeviceType">
+		<xs:sequence>
+			<xs:element name="Type">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="ProductCode" type="HexDecValue" use="optional"/>
+							<xs:attribute name="RevisionNo" type="HexDecValue" use="optional"/>
+							<xs:attribute name="SerialNo" type="HexDecValue" use="optional"/>
+							<xs:attribute name="CheckProductCode" use="optional">
+								<xs:simpleType>
+									<xs:restriction base="xs:NMTOKEN">
+										<xs:enumeration value="NONE"/>
+										<xs:enumeration value="EQ"/>
+									</xs:restriction>
+								</xs:simpleType>
+							</xs:attribute>
+							<xs:attribute name="CheckRevisionNo" use="optional">
+								<xs:simpleType>
+									<xs:restriction base="xs:NMTOKEN">
+										<xs:enumeration value="NONE"/>
+										<xs:enumeration value="EQ"/>
+										<xs:enumeration value="EQ_OR_G"/>
+										<xs:enumeration value="LW_EQ"/>
+										<xs:enumeration value="LW_EQ_HW_EQ_OR_G"/>
+										<xs:enumeration value="HW_EQ"/>
+										<xs:enumeration value="HW_EQ_LW_EQ_OR_G"/>
+									</xs:restriction>
+								</xs:simpleType>
+							</xs:attribute>
+							<xs:attribute name="CheckSerialNo" use="optional">
+								<xs:simpleType>
+									<xs:restriction base="xs:NMTOKEN">
+										<xs:enumeration value="NONE"/>
+										<xs:enumeration value="EQ"/>
+									</xs:restriction>
+								</xs:simpleType>
+							</xs:attribute>
+							<xs:attribute name="TcSmClass" type="xs:string" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="TcCfgModeSafeOp" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="UseLrdLwr" type="xs:boolean" use="optional"/>
+							<xs:attribute name="ModulePdoGroup" type="xs:int" use="optional"/>
+							<xs:attribute name="DownloadModuleList" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>for future use</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="HideType" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="ProductCode" type="HexDecValue" use="optional"/>
+							<xs:attribute name="RevisionNo" type="HexDecValue" use="optional"/>
+							<xs:attribute name="ProductRevision" type="xs:string" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="AlternativeType" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="ProductCode" type="HexDecValue" use="optional">
+								<xs:annotation>
+									<xs:documentation>for future use</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="RevisionNo" type="HexDecValue" use="optional">
+								<xs:annotation>
+									<xs:documentation>for future use</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="SubDevice" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation> </xs:documentation>
+				</xs:annotation>
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="ProductCode" type="HexDecValue" use="optional">
+								<xs:annotation>
+									<xs:documentation>for future use</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="RevisionNo" type="HexDecValue" use="optional">
+								<xs:annotation>
+									<xs:documentation>for future use</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="PreviousDevice" type="xs:int" use="optional"/>
+							<xs:attribute name="PreviousPortNo" type="xs:int" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Name" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="Comment" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="URL" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="Info" type="InfoType" minOccurs="0"/>
+			<xs:element name="GroupType" type="xs:string"/>
+			<xs:element name="Profile" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:complexContent>
+						<xs:extension base="ProfileType">
+							<xs:attribute name="Channel" type="xs:int" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:complexContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Fmmu" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="OpOnly" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="Sm" type="xs:int" use="optional"/>
+							<xs:attribute name="Su" type="xs:int" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Sm" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="MinSize" type="HexDecValue" use="optional"/>
+							<xs:attribute name="MaxSize" type="HexDecValue" use="optional"/>
+							<xs:attribute name="DefaultSize" type="HexDecValue" use="optional"/>
+							<xs:attribute name="StartAddress" type="HexDecValue" use="optional"/>
+							<xs:attribute name="ControlByte" type="HexDecValue" use="optional"/>
+							<xs:attribute name="Enable" type="HexDecValue" use="optional"/>
+							<xs:attribute name="OneByteMode" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="Virtual" type="xs:boolean" use="optional"/>
+							<xs:attribute name="Watchdog" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="OpOnly" type="xs:boolean" use="optional"/>
+							<xs:attribute name="FixedAssignment" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>obsolete</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Su" minOccurs="0" maxOccurs="unbounded">
+				<xs:complexType>
+					<xs:simpleContent>
+						<xs:extension base="xs:string">
+							<xs:attribute name="SeparateSu" type="xs:boolean" use="optional"/>
+							<xs:attribute name="SeparateFrame" type="xs:boolean" use="optional"/>
+							<xs:attribute name="DependOnInputState" type="xs:boolean" use="optional">
+								<xs:annotation>
+									<xs:documentation>for future use</xs:documentation>
+								</xs:annotation>
+							</xs:attribute>
+							<xs:attribute name="FrameRepeatSupport" type="xs:boolean" use="optional"/>
+						</xs:extension>
+					</xs:simpleContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="RxPdo" type="PdoType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="TxPdo" type="PdoType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element name="Mailbox" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="AoE" minOccurs="0">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="InitCmd" minOccurs="0" maxOccurs="unbounded">
+										<xs:complexType>
+											<xs:sequence>
+												<xs:element name="Transition" maxOccurs="unbounded">
+													<xs:simpleType>
+														<xs:restriction base="xs:NMTOKEN">
+															<xs:enumeration value="PS"/>
+															<xs:enumeration value="SO"/>
+															<xs:enumeration value="SP"/>
+															<xs:enumeration value="OP"/>
+															<xs:enumeration value="OS"/>
+														</xs:restriction>
+													</xs:simpleType>
+												</xs:element>
+												<xs:element name="Data" type="xs:hexBinary"/>
+												<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+											</xs:sequence>
+										</xs:complexType>
+									</xs:element>
+								</xs:sequence>
+								<xs:attribute name="AdsRouter" type="xs:boolean" use="optional"/>
+								<xs:attribute name="GenerateOwnNetId" type="xs:boolean" use="optional"/>
+								<xs:attribute name="InitializeOwnNetId" type="xs:boolean" use="optional"/>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="EoE" minOccurs="0">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="InitCmd" minOccurs="0" maxOccurs="unbounded">
+										<xs:complexType>
+											<xs:sequence>
+												<xs:element name="Transition" maxOccurs="unbounded">
+													<xs:simpleType>
+														<xs:restriction base="xs:NMTOKEN">
+															<xs:enumeration value="PS"/>
+															<xs:enumeration value="SO"/>
+															<xs:enumeration value="SP"/>
+															<xs:enumeration value="OP"/>
+															<xs:enumeration value="OS"/>
+														</xs:restriction>
+													</xs:simpleType>
+												</xs:element>
+												<xs:element name="Type" type="xs:int"/>
+												<xs:element name="Data" type="xs:hexBinary"/>
+												<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+											</xs:sequence>
+										</xs:complexType>
+									</xs:element>
+								</xs:sequence>
+								<xs:attribute name="IP" type="xs:boolean" use="optional" default="0"/>
+								<xs:attribute name="MAC" type="xs:boolean" use="optional" default="0"/>
+								<xs:attribute name="TimeStamp" type="xs:boolean" use="optional" default="0"/>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="CoE" minOccurs="0">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="Object" minOccurs="0" maxOccurs="unbounded">
+										<xs:annotation>
+											<xs:documentation>obsolete</xs:documentation>
+										</xs:annotation>
+										<xs:complexType>
+											<xs:sequence>
+												<xs:element name="Index" type="xs:int">
+													<xs:annotation>
+														<xs:documentation>obsolete</xs:documentation>
+													</xs:annotation>
+												</xs:element>
+												<xs:element name="SubIndex" type="xs:int">
+													<xs:annotation>
+														<xs:documentation>obsolete</xs:documentation>
+													</xs:annotation>
+												</xs:element>
+												<xs:element name="Data" type="xs:hexBinary">
+													<xs:annotation>
+														<xs:documentation>obsolete</xs:documentation>
+													</xs:annotation>
+												</xs:element>
+												<xs:element name="Comment" type="xs:string" minOccurs="0">
+													<xs:annotation>
+														<xs:documentation>obsolete</xs:documentation>
+													</xs:annotation>
+												</xs:element>
+											</xs:sequence>
+										</xs:complexType>
+									</xs:element>
+									<xs:element name="InitCmd" minOccurs="0" maxOccurs="unbounded">
+										<xs:complexType>
+											<xs:sequence>
+												<xs:element name="Transition" maxOccurs="unbounded">
+													<xs:simpleType>
+														<xs:restriction base="xs:NMTOKEN">
+															<xs:enumeration value="PS"/>
+															<xs:enumeration value="SO"/>
+															<xs:enumeration value="SP"/>
+															<xs:enumeration value="OP"/>
+															<xs:enumeration value="OS"/>
+														</xs:restriction>
+													</xs:simpleType>
+												</xs:element>
+												<xs:element name="Index" type="HexDecValue"/>
+												<xs:element name="SubIndex" type="HexDecValue"/>
+												<xs:element name="Data">
+													<xs:complexType>
+														<xs:simpleContent>
+															<xs:extension base="xs:hexBinary">
+																<xs:attribute name="AdaptAutomatically" type="xs:boolean" use="optional"/>
+															</xs:extension>
+														</xs:simpleContent>
+													</xs:complexType>
+												</xs:element>
+												<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+											</xs:sequence>
+											<xs:attribute name="Fixed" type="xs:boolean" use="optional">
+												<xs:annotation>
+													<xs:documentation>obsolete</xs:documentation>
+												</xs:annotation>
+											</xs:attribute>
+											<xs:attribute name="CompleteAccess" type="xs:boolean" use="optional"/>
+											<xs:attribute name="OverwrittenByModule" type="xs:boolean" use="optional"/>
+										</xs:complexType>
+									</xs:element>
+								</xs:sequence>
+								<xs:attribute name="SdoInfo" type="xs:boolean" use="optional"/>
+								<xs:attribute name="PdoAssign" type="xs:boolean" use="optional"/>
+								<xs:attribute name="PdoConfig" type="xs:boolean" use="optional"/>
+								<xs:attribute name="PdoUpload" type="xs:boolean" use="optional"/>
+								<xs:attribute name="CompleteAccess" type="xs:boolean" use="optional"/>
+								<xs:attribute name="EdsFile" type="xs:string" use="optional"/>
+								<xs:attribute name="DS402Channels" type="xs:int" use="optional">
+									<xs:annotation>
+										<xs:documentation>obsolete</xs:documentation>
+									</xs:annotation>
+								</xs:attribute>
+								<xs:attribute name="SegmentedSdo" type="xs:boolean" use="optional"/>
+								<xs:attribute name="DiagHistory" type="xs:boolean" use="optional"/>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="FoE" minOccurs="0"/>
+						<xs:element name="SoE" minOccurs="0">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="InitCmd" minOccurs="0" maxOccurs="unbounded">
+										<xs:complexType>
+											<xs:sequence>
+												<xs:element name="Transition" maxOccurs="unbounded">
+													<xs:simpleType>
+														<xs:restriction base="xs:NMTOKEN">
+															<xs:enumeration value="PS"/>
+															<xs:enumeration value="SO"/>
+															<xs:enumeration value="SP"/>
+															<xs:enumeration value="OP"/>
+															<xs:enumeration value="OS"/>
+														</xs:restriction>
+													</xs:simpleType>
+												</xs:element>
+												<xs:element name="IDN" type="xs:int"/>
+												<xs:element name="Data" type="xs:hexBinary"/>
+												<xs:element name="Comment" type="xs:string" minOccurs="0"/>
+											</xs:sequence>
+											<xs:attribute name="Chn" type="xs:int" use="optional" default="0"/>
+										</xs:complexType>
+									</xs:element>
+								</xs:sequence>
+								<xs:attribute name="ChannelCount" type="xs:int" use="optional"/>
+								<xs:attribute name="DriveFollowsBit3Support" type="xs:boolean" use="optional"/>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="VoE" minOccurs="0">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:any minOccurs="0" maxOccurs="unbounded"/>
+								</xs:sequence>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+					</xs:sequence>
+					<xs:attribute name="DataLinkLayer" type="xs:boolean" use="optional" default="0"/>
+					<xs:attribute name="RealTimeMode" type="xs:boolean" use="optional" default="0">
+						<xs:annotation>
+							<xs:documentation>for future use</xs:documentation>
+						</xs:annotation>
+					</xs:attribute>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Dc" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="OpMode" minOccurs="0" maxOccurs="unbounded">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="Name" type="xs:string"/>
+									<xs:element name="Desc" type="xs:string" minOccurs="0"/>
+									<xs:element name="AssignActivate" type="HexDecValue"/>
+									<xs:element name="CycleTimeSync0" minOccurs="0">
+										<xs:complexType>
+											<xs:simpleContent>
+												<xs:extension base="xs:int">
+													<xs:attribute name="Factor" type="xs:int" use="optional"/>
+												</xs:extension>
+											</xs:simpleContent>
+										</xs:complexType>
+									</xs:element>
+									<xs:element name="ShiftTimeSync0" minOccurs="0">
+										<xs:complexType>
+											<xs:simpleContent>
+												<xs:extension base="xs:int">
+													<xs:attribute name="Factor" type="xs:int" use="optional"/>
+													<xs:attribute name="Input" type="xs:boolean" use="optional"/>
+													<xs:attribute name="OutputDelayTime" type="xs:int" use="optional"/>
+													<xs:attribute name="InputDelayTime" type="xs:int" use="optional"/>
+												</xs:extension>
+											</xs:simpleContent>
+										</xs:complexType>
+									</xs:element>
+									<xs:element name="CycleTimeSync1" minOccurs="0">
+										<xs:complexType>
+											<xs:simpleContent>
+												<xs:extension base="xs:int">
+													<xs:attribute name="Factor" type="xs:int" use="optional"/>
+												</xs:extension>
+											</xs:simpleContent>
+										</xs:complexType>
+									</xs:element>
+									<xs:element name="ShiftTimeSync1" minOccurs="0">
+										<xs:complexType>
+											<xs:simpleContent>
+												<xs:extension base="xs:int">
+													<xs:attribute name="Factor" type="xs:int" use="optional">
+														<xs:annotation>
+															<xs:documentation>for future use</xs:documentation>
+														</xs:annotation>
+													</xs:attribute>
+													<xs:attribute name="Input" type="xs:boolean" use="optional"/>
+													<xs:attribute name="OutputDelayTime" type="xs:int" use="optional"/>
+													<xs:attribute name="InputDelayTime" type="xs:int" use="optional"/>
+												</xs:extension>
+											</xs:simpleContent>
+										</xs:complexType>
+									</xs:element>
+									<xs:element name="Sm" minOccurs="0" maxOccurs="unbounded">
+										<xs:complexType>
+											<xs:sequence>
+												<xs:element name="SyncType" type="xs:int" minOccurs="0">
+													<xs:annotation>
+														<xs:documentation>obsolete</xs:documentation>
+													</xs:annotation>
+												</xs:element>
+												<xs:element name="CycleTime" minOccurs="0">
+													<xs:annotation>
+														<xs:documentation>obsolete</xs:documentation>
+													</xs:annotation>
+													<xs:complexType>
+														<xs:simpleContent>
+															<xs:extension base="xs:int">
+																<xs:attribute name="Factor" type="xs:int" use="optional">
+																	<xs:annotation>
+																		<xs:documentation>obsolete</xs:documentation>
+																	</xs:annotation>
+																</xs:attribute>
+															</xs:extension>
+														</xs:simpleContent>
+													</xs:complexType>
+												</xs:element>
+												<xs:element name="ShiftTime" minOccurs="0">
+													<xs:annotation>
+														<xs:documentation>obsolete</xs:documentation>
+													</xs:annotation>
+													<xs:complexType>
+														<xs:simpleContent>
+															<xs:extension base="xs:int">
+																<xs:attribute name="MinAfterSync" type="xs:int" use="optional">
+																	<xs:annotation>
+																		<xs:documentation>obsolete</xs:documentation>
+																	</xs:annotation>
+																</xs:attribute>
+																<xs:attribute name="MinBeforeFrame" type="xs:int" use="optional">
+																	<xs:annotation>
+																		<xs:documentation>obsolete</xs:documentation>
+																	</xs:annotation>
+																</xs:attribute>
+															</xs:extension>
+														</xs:simpleContent>
+													</xs:complexType>
+												</xs:element>
+												<xs:element name="Pdo" minOccurs="0" maxOccurs="unbounded">
+													<xs:complexType>
+														<xs:simpleContent>
+															<xs:extension base="HexDecValue">
+																<xs:attribute name="OSFac" type="xs:int"/>
+															</xs:extension>
+														</xs:simpleContent>
+													</xs:complexType>
+												</xs:element>
+											</xs:sequence>
+											<xs:attribute name="No" type="xs:int" use="required"/>
+										</xs:complexType>
+									</xs:element>
+									<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+								</xs:sequence>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+					</xs:sequence>
+					<xs:attribute name="UnknownFRMW" type="xs:boolean" use="optional"/>
+					<xs:attribute name="Unknown64Bit" type="xs:boolean" use="optional"/>
+					<xs:attribute name="ExternalRefClock" type="xs:boolean" use="optional"/>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Slots" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Slot" type="SlotType" minOccurs="0" maxOccurs="unbounded"/>
+						<xs:element name="ModulePdoGroup" minOccurs="0" maxOccurs="unbounded">
+							<xs:complexType>
+								<xs:simpleContent>
+									<xs:extension base="xs:string">
+										<xs:attribute name="Alignment" type="xs:int" use="optional"/>
+										<xs:attribute name="RxPdo" type="HexDecValue" use="optional"/>
+										<xs:attribute name="TxPdo" type="HexDecValue" use="optional"/>
+									</xs:extension>
+								</xs:simpleContent>
+							</xs:complexType>
+						</xs:element>
+					</xs:sequence>
+					<xs:attribute name="MaxSlotCount" type="HexDecValue" use="optional"/>
+					<xs:attribute name="MaxSlotGroupCount" type="HexDecValue" use="optional"/>
+					<xs:attribute name="SlotPdoIncrement" type="HexDecValue" use="optional"/>
+					<xs:attribute name="SlotGroupPdoIncrement" type="HexDecValue" use="optional"/>
+					<xs:attribute name="SlotIndexIncrement" type="HexDecValue" use="optional"/>
+					<xs:attribute name="SlotGroupIndexIncrement" type="HexDecValue" use="optional"/>
+					<xs:attribute name="IdentifyModuleBy">
+						<xs:annotation>
+							<xs:documentation>obsolete</xs:documentation>
+						</xs:annotation>
+						<xs:simpleType>
+							<xs:restriction base="xs:NMTOKEN">
+								<xs:enumeration value="ModuleIdent"/>
+								<xs:enumeration value="IdentityObjekt"/>
+							</xs:restriction>
+						</xs:simpleType>
+					</xs:attribute>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="ESC" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Reg0108" type="HexDecValue" minOccurs="0"/>
+						<xs:element name="Reg0400" type="HexDecValue" minOccurs="0"/>
+						<xs:element name="Reg0410" type="HexDecValue" minOccurs="0"/>
+						<xs:element name="Reg0420" type="HexDecValue" minOccurs="0"/>
+						<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Eeprom" minOccurs="0">
+				<xs:complexType>
+					<xs:complexContent>
+						<xs:extension base="EepromType">
+							<xs:attribute name="AssignToPdi" type="xs:boolean"/>
+						</xs:extension>
+					</xs:complexContent>
+				</xs:complexType>
+			</xs:element>
+			<xs:choice minOccurs="0">
+				<xs:element name="Image16x14" type="xs:string">
+					<xs:annotation>
+						<xs:documentation>obsolete</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="ImageFile16x14" type="xs:string"/>
+				<xs:element name="ImageData16x14" type="xs:hexBinary"/>
+			</xs:choice>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="GroupType">
+		<xs:sequence>
+			<xs:element name="Type" type="xs:string"/>
+			<xs:element name="Name" type="NameType" maxOccurs="unbounded"/>
+			<xs:element name="Comment" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:choice>
+				<xs:element name="Image16x14" type="xs:string">
+					<xs:annotation>
+						<xs:documentation>obsolete</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="ImageFile16x14" type="xs:string"/>
+				<xs:element name="ImageData16x14" type="xs:hexBinary"/>
+			</xs:choice>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="EepromType">
+		<xs:sequence>
+			<xs:choice>
+				<xs:element name="Data" type="xs:hexBinary"/>
+				<xs:sequence>
+					<xs:element name="ByteSize" type="xs:int"/>
+					<xs:element name="ConfigData" type="xs:hexBinary"/>
+					<xs:element name="BootStrap" type="xs:hexBinary" minOccurs="0"/>
+					<xs:element name="Category" minOccurs="0" maxOccurs="unbounded">
+						<xs:complexType>
+							<xs:sequence>
+								<xs:element name="CatNo">
+									<xs:complexType>
+										<xs:simpleContent>
+											<xs:extension base="xs:int"/>
+										</xs:simpleContent>
+									</xs:complexType>
+								</xs:element>
+								<xs:choice>
+									<xs:element name="Data" type="xs:hexBinary"/>
+									<xs:element name="DataString" type="xs:string"/>
+									<xs:element name="DataUINT" type="xs:int"/>
+									<xs:element name="DataUDINT" type="xs:int"/>
+								</xs:choice>
+							</xs:sequence>
+							<xs:attribute name="PreserveOnlineData" type="xs:boolean" use="optional"/>
+						</xs:complexType>
+					</xs:element>
+				</xs:sequence>
+			</xs:choice>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InfoType">
+		<xs:sequence>
+			<xs:element name="Electrical" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="EBusCurrent" type="xs:int"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="StateMachine" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Timeout" minOccurs="0">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="PreopTimeout" type="xs:int"/>
+									<xs:element name="SafeopOpTimeout" type="xs:int"/>
+									<xs:element name="BackToInitTimeout" type="xs:int"/>
+									<xs:element name="BackToSafeopTimeout" type="xs:int"/>
+								</xs:sequence>
+							</xs:complexType>
+						</xs:element>
+						<xs:element name="Behavior" minOccurs="0">
+							<xs:complexType>
+								<xs:attribute name="StartToInit" type="xs:boolean" use="optional"/>
+								<xs:attribute name="StartToPreop" type="xs:boolean" use="optional"/>
+								<xs:attribute name="StartToSafeop" type="xs:boolean" use="optional"/>
+								<xs:attribute name="StartToSafeopNoSync" type="xs:boolean" use="optional"/>
+							</xs:complexType>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Mailbox" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Timeout">
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="RequestTimeout" type="xs:int"/>
+									<xs:element name="ResponseTimeout" type="xs:int"/>
+								</xs:sequence>
+							</xs:complexType>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="EtherCATController" minOccurs="0">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="DpramSize" type="xs:int" default="4096" minOccurs="0"/>
+						<xs:element name="SmCount" type="xs:int" minOccurs="0"/>
+						<xs:element name="FmmuCount" type="xs:int" minOccurs="0"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="Port" minOccurs="0" maxOccurs="4">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Type">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="MII"/>
+									<xs:enumeration value="EBUS"/>
+									<xs:enumeration value="NONE"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="Connector" type="xs:string" minOccurs="0"/>
+						<xs:element name="Label" type="xs:string" minOccurs="0"/>
+						<xs:element name="RxDelay" type="xs:int" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>in 100ps</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="TxDelay" type="xs:int" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>in 100ps</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="PhysicalPhyAddr" type="xs:int" minOccurs="0"/>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="ExecutionUnit" minOccurs="0" maxOccurs="2">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Type">
+							<xs:simpleType>
+								<xs:restriction base="xs:NMTOKEN">
+									<xs:enumeration value="PRIMARY"/>
+									<xs:enumeration value="SECONDARY"/>
+									<xs:enumeration value="NONE"/>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:element>
+						<xs:element name="RxDelay" type="xs:int" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>in 100ps</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="TxDelay" type="xs:int" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>in 100ps</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="VendorSpecific" type="VendorSpecificType" minOccurs="0"/>
+			<xs:element name="StationAliasSupported" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation>obsolete</xs:documentation>
+				</xs:annotation>
+				<xs:simpleType>
+					<xs:restriction base="xs:NMTOKEN">
+						<xs:enumeration value="NO_SUPPORT"/>
+						<xs:enumeration value="REGISTER_SUPPORT"/>
+						<xs:enumeration value="PROCESSDATA_SUPPORT"/>
+					</xs:restriction>
+				</xs:simpleType>
+			</xs:element>
+			<xs:element name="IdentificationAdo" type="HexDecValue" minOccurs="0"/>
+			<xs:element name="DeviceFeature" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation>for future use</xs:documentation>
+				</xs:annotation>
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element name="Name" type="xs:string">
+							<xs:annotation>
+								<xs:documentation>for future use</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="Value" type="xs:string" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>for future use</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="Description" type="xs:string" minOccurs="0">
+							<xs:annotation>
+								<xs:documentation>for future use</xs:documentation>
+							</xs:annotation>
+						</xs:element>
+						<xs:element name="Register" minOccurs="0" maxOccurs="unbounded">
+							<xs:annotation>
+								<xs:documentation>for future use</xs:documentation>
+							</xs:annotation>
+							<xs:complexType>
+								<xs:sequence>
+									<xs:element name="StartAddress" type="xs:int">
+										<xs:annotation>
+											<xs:documentation>for future use;
+in bytes</xs:documentation>
+										</xs:annotation>
+									</xs:element>
+									<xs:element name="Length" type="xs:int">
+										<xs:annotation>
+											<xs:documentation>for future use;
+in bytes</xs:documentation>
+										</xs:annotation>
+									</xs:element>
+									<xs:element name="BitMask" type="HexDecValue" minOccurs="0">
+										<xs:annotation>
+											<xs:documentation>for future use</xs:documentation>
+										</xs:annotation>
+									</xs:element>
+								</xs:sequence>
+							</xs:complexType>
+						</xs:element>
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:simpleType name="PhysicsType">
+		<xs:restriction base="xs:string">
+			<xs:pattern value="[Y,K, ]{0,4}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="SlotType">
+		<xs:sequence>
+			<xs:element name="Name" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:choice>
+				<xs:element name="ModuleIdent" maxOccurs="unbounded">
+					<xs:complexType>
+						<xs:simpleContent>
+							<xs:extension base="HexDecValue">
+								<xs:attribute name="Default" type="HexDecValue" use="optional"/>
+							</xs:extension>
+						</xs:simpleContent>
+					</xs:complexType>
+				</xs:element>
+				<xs:element name="ModuleClass" maxOccurs="unbounded">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="Class" type="xs:string"/>
+							<xs:element name="VendorId" type="HexDecValue" minOccurs="0"/>
+							<xs:element name="Name" type="NameType" minOccurs="0" maxOccurs="unbounded"/>
+							<xs:choice minOccurs="0">
+								<xs:element name="Image16x14" type="xs:string">
+									<xs:annotation>
+										<xs:documentation>obsolete</xs:documentation>
+									</xs:annotation>
+								</xs:element>
+								<xs:element name="ImageFile16x14" type="xs:string"/>
+								<xs:element name="ImageData16x14" type="xs:hexBinary"/>
+							</xs:choice>
+						</xs:sequence>
+					</xs:complexType>
+				</xs:element>
+			</xs:choice>
+			<xs:choice minOccurs="0">
+				<xs:element name="Image16x14" type="xs:string">
+					<xs:annotation>
+						<xs:documentation>obsolete</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="ImageFile16x14" type="xs:string"/>
+				<xs:element name="ImageData16x14" type="xs:hexBinary"/>
+			</xs:choice>
+		</xs:sequence>
+		<xs:attribute name="SlotGroup" type="HexDecValue" use="optional"/>
+		<xs:attribute name="MinInstances" type="HexDecValue" use="required"/>
+		<xs:attribute name="MaxInstances" type="HexDecValue" use="required"/>
+		<xs:attribute name="SlotPdoIncrement" type="HexDecValue" use="optional"/>
+		<xs:attribute name="SlotGroupPdoIncrement" type="HexDecValue" use="optional"/>
+		<xs:attribute name="SlotIndexIncrement" type="HexDecValue" use="optional"/>
+		<xs:attribute name="SlotGroupIndexIncrement" type="HexDecValue" use="optional"/>
+		<xs:attribute name="TreeView" use="optional">
+			<xs:simpleType>
+				<xs:restriction base="xs:NMTOKEN">
+					<xs:enumeration value="SLOTGROUP"/>
+					<xs:enumeration value="SLOT"/>
+					<xs:enumeration value="PDO"/>
+				</xs:restriction>
+			</xs:simpleType>
+		</xs:attribute>
+	</xs:complexType>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/README	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,1 @@
+Ethercat
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/__init__.py	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,1 @@
+from etherlab import *
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/etherlab.py	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,672 @@
+import os, shutil
+import cPickle
+from xml.dom import minidom
+
+import wx
+
+from xmlclass import *
+from PLCControler import UndoBuffer
+from ConfigEditor import ConfigEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
+
+TYPECONVERSION = {"BOOL" : "X", "SINT" : "B", "INT" : "W", "DINT" : "D", "LINT" : "L",
+    "USINT" : "B", "UINT" : "W", "UDINT" : "D", "ULINT" : "L", 
+    "BYTE" : "B", "WORD" : "W", "DWORD" : "D", "LWORD" : "L"}
+
+DATATYPECONVERSION = {"BOOL" : "BIT", "SINT" : "S8", "INT" : "S16", "DINT" : "S32", "LINT" : "S64",
+    "USINT" : "U8", "UINT" : "U16", "UDINT" : "U32", "ULINT" : "U64", 
+    "BYTE" : "U8", "WORD" : "U16", "DWORD" : "U32", "LWORD" : "U64"}
+
+#--------------------------------------------------
+#                 Ethercat MASTER
+#--------------------------------------------------
+
+EtherCATConfigClasses = GenerateClassesFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATConfig.xsd")) 
+
+def ExtractHexDecValue(value):
+    try:
+        return int(value)
+    except:
+        pass
+    try:
+        return int(value.replace("#", "0"), 16)
+    except:
+        raise "Invalid value for HexDecValue \"%s\"" % value
+
+def GenerateHexDecValue(value, base=10):
+    if base == 10:
+        return str(value)
+    elif base == 16:
+        return "#x%.8x" % value
+    else:
+        raise "Not supported base"
+
+cls = EtherCATConfigClasses.get("Config_Slave", None)
+if cls:
+    
+    def getType(self):
+        slave_info = self.getInfo()
+        return {"device_type": slave_info.getName(),
+                "vendor": GenerateHexDecValue(slave_info.getVendorId()),
+                "product_code": GenerateHexDecValue(slave_info.getProductCode(), 16),
+                "revision_number": GenerateHexDecValue(slave_info.getRevisionNo(), 16)}
+    setattr(cls, "getType", getType)
+
+    def setType(self, type_infos):
+        slave_info = self.getInfo()
+        slave_info.setName(type_infos["device_type"])
+        slave_info.setVendorId(ExtractHexDecValue(type_infos["vendor"]))
+        slave_info.setProductCode(ExtractHexDecValue(type_infos["product_code"]))
+        slave_info.setRevisionNo(ExtractHexDecValue(type_infos["revision_number"]))
+    setattr(cls, "setType", setType)
+    
+cls = EtherCATConfigClasses.get("Slave_Info", None)
+if cls:
+
+    def getSlavePosition(self):
+        return self.getPhysAddr(), self.getAutoIncAddr()
+    setattr(cls, "getSlavePosition", getSlavePosition)
+
+    def setSlavePosition(self, alias, pos):
+        self.setPhysAddr(alias)
+        self.setAutoIncAddr(pos)
+    setattr(cls, "setSlavePosition", setSlavePosition)
+
+class _EthercatPlug:
+    XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
+    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+      <xsd:element name="EtherlabNode">
+        <xsd:complexType>
+          <xsd:attribute name="MasterNumber" type="xsd:integer" use="optional" default="0"/>
+          <xsd:attribute name="ConfigurePDOs" type="xsd:boolean" use="optional" default="true"/>
+        </xsd:complexType>
+      </xsd:element>
+    </xsd:schema>
+    """
+    
+    def __init__(self):
+        filepath = self.ConfigFileName()
+        
+        self.Config = EtherCATConfigClasses["EtherCATConfig"]()
+        if os.path.isfile(filepath):
+            xmlfile = open(filepath, 'r')
+            tree = minidom.parse(xmlfile)
+            xmlfile.close()
+            
+            for child in tree.childNodes:
+                if child.nodeType == tree.ELEMENT_NODE and child.nodeName == "EtherCATConfig":
+                    self.Config.loadXMLTree(child, ["xmlns:xsi", "xsi:noNamespaceSchemaLocation"])
+                    self.CreateConfigBuffer(True)
+        else:
+            self.CreateConfigBuffer(False)
+            self.OnPlugSave()
+
+    def ExtractHexDecValue(self, value):
+        return ExtractHexDecValue(value)
+
+    def GetSizeOfType(self, type):
+        return TYPECONVERSION.get(self.GetPlugRoot().GetBaseType(type), None)
+
+    def ConfigFileName(self):
+        return os.path.join(self.PlugPath(), "config.xml")
+
+    def GetFilename(self):
+        return self.MandatoryParams[1].getName()
+    
+    def GetSlaves(self):
+        slaves = []
+        for slave in self.Config.getConfig().getSlave():
+            slaves.append(slave.getInfo().getSlavePosition())
+        slaves.sort()
+        return slaves
+
+    def GetSlave(self, slave_pos):
+        for slave in self.Config.getConfig().getSlave():
+            slave_info = slave.getInfo()
+            if slave_info.getSlavePosition() == slave_pos:
+                return slave
+        return None
+
+    def AddSlave(self):
+        slaves = self.GetSlaves()
+        if len(slaves) > 0:
+            new_pos = (slaves[-1][0] + 1, 0)
+        else:
+            new_pos = (0, 0)
+        slave = EtherCATConfigClasses["Config_Slave"]()
+        slave_infos = slave.getInfo()
+        slave_infos.setName("undefined")
+        slave_infos.setSlavePosition(new_pos[0], new_pos[1])
+        self.Config.getConfig().appendSlave(slave)
+        self.BufferConfig()
+        return new_pos
+    
+    def RemoveSlave(self, slave_pos):
+        config = self.Config.getConfig()
+        for idx, slave in enumerate(config.getSlave()):
+            slave_infos = slave.getInfo()
+            if slave_infos.getSlavePosition() == slave_pos:
+                config.removeSlave(idx)
+                self.BufferConfig()
+                return True
+        return False
+    
+    def SetSlavePos(self, slave_pos, alias=None, position=None):
+        slave = self.GetSlave(slave_pos)
+        if slave is not None:
+            slave_info = slave.getInfo()
+            new_pos = slave_pos
+            if alias is not None:
+                new_pos = (alias, new_pos[1])
+            if position is not None:
+                new_pos = (new_pos[0], position)
+            if self.GetSlave(new_pos) is not None:
+                return _("Slave with position \"%d:%d\" already exists!" % new_pos)
+            slave_info.setSlavePosition(*new_pos)
+            self.BufferConfig()
+        return None
+    
+    def GetSlaveType(self, slave_pos):
+        slave = self.GetSlave(slave_pos)
+        if slave is not None:
+            return slave.getType()
+        return None
+    
+    def SetSlaveType(self, slave_pos, type_infos):
+        slave = self.GetSlave(slave_pos)
+        if slave is not None:
+            slave.setType(type_infos)
+            self.BufferConfig()
+        return None
+    
+    def GetSlaveInfos(self, slave_pos):
+        slave = self.GetSlave(slave_pos)
+        if slave is not None:
+            type_infos = slave.getType()
+            device = self.GetModuleInfos(type_infos)
+            if device is not None:
+                infos = type_infos.copy()
+                infos.update({"physics": device.getPhysics(),
+                              "pdos": [],
+                              "variables": []})
+                for TxPdo in device.getTxPdo():
+                    ExtractPdoInfos(TxPdo, "Transmit", infos)
+                for RxPdo in device.getRxPdo():
+                    ExtractPdoInfos(RxPdo, "Receive", infos)
+                return infos
+        return None
+    
+    def GetModuleInfos(self, type_infos):
+        return self.PlugParent.GetModuleInfos(type_infos)
+    
+    def GetSlaveTypesLibrary(self):
+        return self.PlugParent.GetModulesLibrary()
+    
+    def _OpenView(self):
+        app_frame = self.GetPlugRoot().AppFrame
+        
+        configeditor = ConfigEditor(app_frame.TabsOpened, self, app_frame)
+        
+        app_frame.EditProjectElement(configeditor, self.GetFilename())
+                
+    PluginMethods = [
+        {"bitmap" : os.path.join("images", "EditCfile"),
+         "name" : _("Edit Config"), 
+         "tooltip" : _("Edit Config"),
+         "method" : "_OpenView"},
+    ]
+
+    def PlugTestModified(self):
+        return self.ChangesToSave or not self.ConfigIsSaved()    
+
+    def OnPlugSave(self):
+        filepath = self.ConfigFileName()
+        
+        text = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
+        extras = {"xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance",
+                  "xsi:noNamespaceSchemaLocation" : "EtherCATInfo.xsd"}
+        text += self.Config.generateXMLText("EtherCATConfig", 0, extras)
+
+        xmlfile = open(filepath,"w")
+        xmlfile.write(text.encode("utf-8"))
+        xmlfile.close()
+        
+        self.ConfigBuffer.CurrentSaved()
+        return True
+
+    def PlugGenerate_C(self, buildpath, locations):
+        """
+        Generate C code
+        @param current_location: Tupple containing plugin IEC location : %I0.0.4.5 => (0,0,4,5)
+        @param locations: List of complete variables locations \
+            [{"IEC_TYPE" : the IEC type (i.e. "INT", "STRING", ...)
+            "NAME" : name of the variable (generally "__IW0_1_2" style)
+            "DIR" : direction "Q","I" or "M"
+            "SIZE" : size "X", "B", "W", "D", "L"
+            "LOC" : tuple of interger for IEC location (0,1,2,...)
+            }, ...]
+        @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND
+        """
+        current_location = self.GetCurrentLocation()
+        # define a unique name for the generated C file
+        location_str = "_".join(map(lambda x:str(x), current_location))
+        
+        Gen_Ethercatfile_path = os.path.join(buildpath, "ethercat_%s.c"%location_str)
+        
+        file_generator = _EthercatCFileGenerator(self, Gen_Ethercatfile_path)
+        
+        for location in locations:
+            loc = location["LOC"][len(current_location):]
+            file_generator.DeclareVariable(loc[:2], loc[2], loc[3], location["IEC_TYPE"], location["DIR"], location["NAME"])
+        
+        file_generator.GenerateCFile()
+        
+        return [(Gen_Ethercatfile_path, '"-I%s"'%os.path.abspath(self.GetPlugRoot().GetIECLibPath()))], "-lethercat -lrtdm", True
+
+#-------------------------------------------------------------------------------
+#                      Current Buffering Management Functions
+#-------------------------------------------------------------------------------
+
+    """
+    Return a copy of the config
+    """
+    def Copy(self, model):
+        return cPickle.loads(cPickle.dumps(model))
+    
+    def CreateConfigBuffer(self, saved):
+        self.ConfigBuffer = UndoBuffer(cPickle.dumps(self.Config), saved)
+        
+    def BufferConfig(self):
+        self.ConfigBuffer.Buffering(cPickle.dumps(self.Config))
+    
+    def ConfigIsSaved(self):
+        if self.ConfigBuffer is not None:
+            return self.ConfigBuffer.IsCurrentSaved()
+        else:
+            return True
+
+    def LoadPrevious(self):
+        self.Config = cPickle.loads(self.ConfigBuffer.Previous())
+    
+    def LoadNext(self):
+        self.Config = cPickle.loads(self.ConfigBuffer.Next())
+    
+    def GetBufferState(self):
+        first = self.ConfigBuffer.IsFirst()
+        last = self.ConfigBuffer.IsLast()
+        return not first, not last
+
+
+SLAVE_PDOS_CONFIGURATION_DECLARATION = """
+/* Slave %(slave)d, "%(device_type)s"
+ * Vendor ID:       0x%(vendor).8x
+ * Product code:    0x%(product_code).8x
+ * Revision number: 0x%(revision_number).8x
+ */
+
+ec_pdo_entry_info_t slave_%(slave)d_pdo_entries[] = {
+%(pdos_entries_infos)s
+};
+
+ec_pdo_info_t slave_%(slave)d_pdos[] = {
+%(pdos_infos)s
+};
+
+ec_sync_info_t slave_%(slave)d_syncs[] = {
+%(pdos_sync_infos)s
+    {0xff}
+};
+"""
+
+SLAVE_CONFIGURATION_TEMPLATE = """
+    if (!(slave%(slave)d = ecrt_master_slave_config(master, %(alias)d, %(position)d, 0x%(vendor).8x, 0x%(product_code).8x))) {
+        fprintf(stderr, "Failed to get slave %(device_type)s configuration at alias %(alias)d and position %(position)d.\\n");
+        return -1;
+    }
+
+    if (ecrt_slave_config_pdos(slave%(slave)d, EC_END, slave_%(slave)d_syncs)) {
+        fprintf(stderr, "Failed to configure PDOs for slave %(device_type)s at alias %(alias)d and position %(position)d.\\n");
+        return -1;
+    }
+"""
+
+class _EthercatCFileGenerator:
+    
+    def __init__(self, controler, filepath):
+        self.Controler = controler
+        self.FilePath = filepath
+        
+        self.UsedVariables = {}
+        
+    def __del__(self):
+        self.Controler = None
+
+    def DeclareVariable(self, slave_identifier, index, subindex, iec_type, dir, name):
+        slave_variables = self.UsedVariables.setdefault(slave_identifier, {})
+        
+        entry_infos = slave_variables.get((index, subindex), None)
+        if entry_infos is None:
+            slave_variables[(index, subindex)] = (iec_type, dir, name)
+        elif entry_infos != (iec_type, dir, name):
+            raise ValueError, _("Definition conflict for location \"%s\"") % name 
+    
+    def GenerateCFile(self):
+        
+        current_location = self.Controler.GetCurrentLocation()
+        # define a unique name for the generated C file
+        location_str = "_".join(map(lambda x:str(x), current_location))
+        
+        plc_etherlab_filepath = os.path.join(os.path.split(__file__)[0], "plc_etherlab.c")
+        plc_etherlab_file = open(plc_etherlab_filepath, 'r')
+        plc_etherlab_code = plc_etherlab_file.read()
+        plc_etherlab_file.close()
+        
+        str_completion = {
+            "location": location_str,
+            "configure_pdos": int(self.Controler.EtherlabNode.getConfigurePDOs()),
+            "master_number": self.Controler.EtherlabNode.getMasterNumber(),
+            "located_variables_declaration": [],
+            "used_pdo_entry_offset_variables_declaration": [],
+            "used_pdo_entry_configuration": [],
+            "pdos_configuration_declaration": "",
+            "slaves_declaration": "",
+            "slaves_configuration": "",
+            "retrieve_variables": [],
+            "publish_variables": [],
+        }
+        
+        for slave_idx, slave_pos in enumerate(self.Controler.GetSlaves()):
+            
+            slave = self.Controler.GetSlave(slave_pos)
+            if slave is not None:
+                type_infos = slave.getType()
+                
+                device = self.Controler.GetModuleInfos(type_infos)
+                if device is not None:                
+                    
+                    pdos = device.getTxPdo() + device.getRxPdo()
+                    if len(pdos) > 0:
+                        slave_variables = self.UsedVariables.get(slave_pos, {})
+                        
+                        for element in ["vendor", "product_code", "revision_number"]:
+                            type_infos[element] = ExtractHexDecValue(type_infos[element])
+                        type_infos.update(dict(zip(["slave", "alias", "position"], (slave_idx,) + slave_pos)))
+                    
+                        str_completion["slaves_declaration"] += "static ec_slave_config_t *slave%(slave)d = NULL;\n" % type_infos
+                        str_completion["slaves_configuration"] += SLAVE_CONFIGURATION_TEMPLATE % type_infos
+    
+                        pdos_infos = {
+                            "pdos_entries_infos": [],
+                            "pdos_infos": [],
+                            "pdos_sync_infos": [], 
+                        }
+                        pdos_infos.update(type_infos)
+                        
+                        sync_managers = []
+                        for sync_manager_idx, sync_manager in enumerate(device.getSm()):
+                            sync_manager_infos = {
+                                "index": sync_manager_idx, 
+                                "slave": slave_idx,
+                                "pdos_number": 0,
+                            }
+                            
+                            sync_manager_control_byte = ExtractHexDecValue(sync_manager.getControlByte())
+                            sync_manager_direction = sync_manager_control_byte & 0x0c
+                            sync_manager_watchdog = sync_manager_control_byte & 0x40
+                            if sync_manager_direction:
+                                sync_manager_infos["sync_manager_type"] = "EC_DIR_OUTPUT"
+                            else:
+                                sync_manager_infos["sync_manager_type"] = "EC_DIR_INPUT"
+                            if sync_manager_watchdog:
+                                sync_manager_infos["watchdog"] = "EC_WD_ENABLE"
+                            else:
+                                sync_manager_infos["watchdog"] = "EC_WD_DISABLE"
+                            
+                            sync_managers.append(sync_manager_infos)
+                        
+                        entry_offset = 0
+                        for pdo in pdos:
+                            sync_managers[pdo.getSm()]["pdos_number"] += 1
+                            entries = pdo.getEntry()
+                            
+                            pdo_infos = {
+                                "slave": slave_idx,
+                                "index": ExtractHexDecValue(pdo.getIndex().getcontent()),
+                                "name": ExtractName(pdo.getName()),
+                                "offset": entry_offset,
+                                "entries_number": len(entries)
+                            }
+                            pdos_infos["pdos_infos"].append("    {0x%(index).4x, %(entries_number)d, slave_%(slave)d_pdo_entries + %(offset)d}, /* %(name)s */" % pdo_infos)
+                            entry_offset += len(entries)
+                            
+                            for entry in pdo.getEntry():
+                                index = ExtractHexDecValue(entry.getIndex().getcontent())
+                                subindex = ExtractHexDecValue(entry.getSubIndex())
+                                entry_infos = {
+                                    "index": index,
+                                    "subindex": subindex,
+                                    "name": ExtractName(entry.getName()),
+                                    "bitlen": entry.getBitLen(),
+                                }
+                                entry_infos.update(type_infos)
+                                pdos_infos["pdos_entries_infos"].append("    {0x%(index).4x, 0x%(subindex).2x, %(bitlen)d}, /* %(name)s */" % entry_infos)
+                                
+                                entry_declaration = slave_variables.get((index, subindex), None)
+                                if entry_declaration is not None:
+                                    entry_infos.update(dict(zip(["var_type", "dir", "var_name"], entry_declaration)))
+                                    
+                                    if entry_infos["var_type"] != entry.getDataType().getcontent():
+                                        raise ValueError, _("Wrong type for location \"%s\"!") % entry_infos["var_name"]
+                                    
+                                    data_type = DATATYPECONVERSION.get(entry_infos["var_type"], None)
+                                    if data_type is None:
+                                        raise ValueError, _("Type of location \"%s\" not yet supported!") % entry_infos["var_name"]
+                                    
+                                    if (entry_infos["dir"] == "I" and sync_managers[pdo.getSm()]["sync_manager_type"] != "EC_DIR_INPUT" or 
+                                        entry_infos["dir"] == "Q" and sync_managers[pdo.getSm()]["sync_manager_type"] != "EC_DIR_OUTPUT"):
+                                        raise ValueError, _("Wrong direction for location \"%s\"!") % entry_infos["var_name"]
+                                    
+                                    str_completion["located_variables_declaration"].extend(["IEC_%(var_type)s beremiz%(var_name)s;" % entry_infos,
+                                                                                            "IEC_%(var_type)s *%(var_name)s = &beremiz%(var_name)s;" % entry_infos])
+                                    if data_type == "BIT":
+                                        str_completion["used_pdo_entry_offset_variables_declaration"].extend(["static unsigned int slave%(slave)d_%(index).4x_%(subindex).2x;" % entry_infos,
+                                                                                                              "static unsigned int slave%(slave)d_%(index).4x_%(subindex).2x_bit;" % entry_infos])
+                                        
+                                        str_completion["used_pdo_entry_configuration"].append("    {%(alias)d, %(position)d, 0x%(vendor).8x, 0x%(product_code).8x, 0x%(index).4x, %(subindex)d, &slave%(slave)d_%(index).4x_%(subindex).2x, &slave%(slave)d_%(index).4x_%(subindex).2x_bit}," % entry_infos)
+                                        
+                                        if entry_infos["dir"] == "I":
+                                            str_completion["retrieve_variables"].append("    beremiz%(name)s = EC_READ_BIT(domain1_pd + slave%(slave)d_%(index).4x_%(subindex).2x, slave%(slave)d_%(index).4x_%(subindex).2x_bit);" % entry_infos)
+                                        elif entry_infos["dir"] == "Q":
+                                            str_completion["publish_variables"].append("    EC_WRITE_BIT(domain1_pd + slave%(slave)d_%(index).4x_%(subindex).2x, slave%(slave)d_%(index).4x_%(subindex).2x_bit, beremiz%(var_name)s);" % entry_infos)
+                                    
+                                    else:
+                                        entry_infos["data_type"] = data_type
+                                        
+                                        str_completion["used_pdo_entry_offset_variables_declaration"].append("static unsigned int slave%(slave)d_%(index).4x_%(subindex).2x;" % entry_infos)
+                                        
+                                        str_completion["used_pdo_entry_configuration"].append("    {%(alias)d, %(position)d, 0x%(vendor).8x, 0x%(product_code).8x, 0x%(index).4x, %(subindex)d, &slave%(slave)d_%(index).4x_%(subindex).2x}," % entry_infos)
+                                        
+                                        if entry_infos["dir"] == "I":
+                                            str_completion["retrieve_variables"].append("    beremiz%(name)s = EC_READ_BIT(domain1_pd + slave%(slave)d_%(index).4x_%(subindex).2x);" % entry_infos)
+                                        elif entry_infos["dir"] == "Q":
+                                            str_completion["publish_variables"].append("    EC_WRITE_BIT(domain1_pd + slave%(slave)d_%(index).4x_%(subindex).2x, beremiz%(var_name)s);" % entry_infos)
+                        
+                        pdo_offset = 0
+                        for sync_manager_infos in sync_managers:
+                            sync_manager_infos["offset"] = pdo_offset
+                            pdos_infos["pdos_sync_infos"].append("    {%(index)d, %(sync_manager_type)s, %(pdos_number)d, slave_%(slave)d_pdos + %(offset)d, %(watchdog)s}," % sync_manager_infos)
+                            pdo_offset += sync_manager_infos["pdos_number"]
+                        
+                        for element in ["pdos_entries_infos", "pdos_infos", "pdos_sync_infos"]:
+                            pdos_infos[element] = "\n".join(pdos_infos[element])
+                        
+                        str_completion["pdos_configuration_declaration"] += SLAVE_PDOS_CONFIGURATION_DECLARATION % pdos_infos
+        
+        for element in ["used_pdo_entry_offset_variables_declaration", "used_pdo_entry_configuration", "located_variables_declaration", "retrieve_variables", "publish_variables"]:
+            str_completion[element] = "\n".join(str_completion[element])
+        
+        etherlabfile = open(self.FilePath,'w')
+        etherlabfile.write(plc_etherlab_code % str_completion)
+        etherlabfile.close()
+
+#--------------------------------------------------
+#                 Ethercat Plugin
+#--------------------------------------------------
+
+EtherCATInfoClasses = GenerateClassesFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATInfo.xsd")) 
+
+def GroupItemCompare(x, y):
+    if x["type"] == y["type"]:
+        if x["type"] == ETHERCAT_GROUP:
+            return x["order"].__cmp__(y["order"])
+        else:
+            return x["name"].__cmp__(y["name"])
+    elif x["type"] == ETHERCAT_GROUP:
+        return -1
+    return 1
+
+def SortGroupItems(group):
+    for item in group["children"]:
+        if item["type"] == ETHERCAT_GROUP:
+            SortGroupItems(item)
+    group["children"].sort(GroupItemCompare)
+
+def ExtractName(names, default=None):
+    if len(names) == 1:
+        return names[0].getcontent()
+    else:
+        for name in names:
+            if name.getLcId() == 1033:
+                return name.getcontent()
+    return default
+
+def ExtractPdoInfos(pdo, pdo_type, infos):
+    pdo_index = pdo.getIndex().getcontent()
+    infos["pdos"].append({"Index": pdo_index,
+                          "Name": ExtractName(pdo.getName()),
+                          "Type": pdo_type})
+    for entry in pdo.getEntry():
+        infos["variables"].append({"Index": entry.getIndex().getcontent(),
+                                   "SubIndex": entry.getSubIndex(),
+                                   "Name": ExtractName(entry.getName()),
+                                   "Type": entry.getDataType().getcontent(),
+                                   "PDO": pdo_index})
+
+class RootClass:
+    
+    PlugChildsTypes = [("EthercatNode",_EthercatPlug,"Ethercat Master")]
+    
+    def __init__(self):
+        self.LoadModulesLibrary()
+    
+    def GetModulesLibraryPath(self):
+        library_path = os.path.join(self.PlugPath(), "modules")
+        if not os.path.exists(library_path):
+            os.mkdir(library_path)
+        return library_path
+    
+    def _ImportModuleLibrary(self):
+        dialog = wx.FileDialog(self.GetPlugRoot().AppFrame, _("Choose an XML file"), os.getcwd(), "",  _("XML files (*.xml)|*.xml|All files|*.*"), wx.OPEN)
+        if dialog.ShowModal() == wx.ID_OK:
+            filepath = dialog.GetPath()
+            if os.path.isfile(filepath):
+                shutil.copy(filepath, self.GetModulesLibraryPath())
+                self.LoadModulesLibrary()
+            else:
+                self.GetPlugRoot().logger.write_error(_("No such XML file: %s\n") % filepath)
+        dialog.Destroy()  
+    
+    PluginMethods = [
+        {"bitmap" : os.path.join("images", "ImportDEF"),
+         "name" : _("Import module library"), 
+         "tooltip" : _("Import module library"),
+         "method" : "_ImportModuleLibrary"},
+    ]
+    
+    def LoadModulesLibrary(self):
+        self.ModulesLibrary = {}
+        
+        library_path = self.GetModulesLibraryPath()
+        
+        files = os.listdir(library_path)
+        for file in files:
+            filepath = os.path.join(library_path, file)
+            if os.path.isfile(filepath) and os.path.splitext(filepath)[-1] == ".xml":
+                xmlfile = open(filepath, 'r')
+                xml_tree = minidom.parse(xmlfile)
+                xmlfile.close()
+                
+                modules_infos = None
+                for child in xml_tree.childNodes:
+                    if child.nodeType == xml_tree.ELEMENT_NODE and child.nodeName == "EtherCATInfo":
+                        modules_infos = EtherCATInfoClasses["EtherCATInfo.xsd"]["EtherCATInfo"]()
+                        modules_infos.loadXMLTree(child, ["xmlns:xsi", "xsi:noNamespaceSchemaLocation"])
+                
+                if modules_infos is not None:
+                    vendor = modules_infos.getVendor()
+                    
+                    vendor_category = self.ModulesLibrary.setdefault(vendor.getId(), {"name": ExtractName(vendor.getName(), _("Miscellaneous")), 
+                                                                                      "groups": {}})
+                    
+                    for group in modules_infos.getDescriptions().getGroups().getGroup():
+                        group_type = group.getType()
+                        
+                        vendor_category["groups"].setdefault(group_type, {"name": ExtractName(group.getName(), group_type), 
+                                                                          "parent": group.getParentGroup(),
+                                                                          "order": group.getSortOrder(), 
+                                                                          "devices": []})
+                    
+                    for device in modules_infos.getDescriptions().getDevices().getDevice():
+                        device_group = device.getGroupType()
+                        if not vendor_category["groups"].has_key(device_group):
+                            raise ValueError, "Not such group \"%\"" % device_group
+                        vendor_category["groups"][device_group]["devices"].append((device.getType().getcontent(), device))
+    
+    def GetModulesLibrary(self):
+        library = []
+        children_dict = {}
+        for vendor_id, vendor in self.ModulesLibrary.iteritems():
+            groups = []
+            library.append({"name": vendor["name"],
+                            "type": ETHERCAT_VENDOR,
+                            "children": groups})
+            for group_type, group in vendor["groups"].iteritems():
+                group_infos = {"name": group["name"],
+                               "order": group["order"],
+                               "type": ETHERCAT_GROUP,
+                               "children": children_dict.setdefault(group_type, [])}
+                if group["parent"] is not None:
+                    parent_children = children_dict.setdefault(group["parent"], [])
+                    parent_children.append(group_infos)
+                else:
+                    groups.append(group_infos)
+                device_dict = {}
+                for device_type, device in group["devices"]:
+                    device_infos = {"name": ExtractName(device.getName()),
+                                    "type": ETHERCAT_DEVICE,
+                                    "infos": {"device_type": device_type,
+                                              "vendor": vendor_id,
+                                              "product_code": device.getType().getProductCode(),
+                                              "revision_number": device.getType().getRevisionNo()}}
+                    group_infos["children"].append(device_infos)
+                    device_type_occurrences = device_dict.setdefault(device_type, [])
+                    device_type_occurrences.append(device_infos)
+                for device_type_occurrences in device_dict.itervalues():
+                    if len(device_type_occurrences) > 1:
+                        for occurrence in device_type_occurrences:
+                            occurrence["name"] += _(" (rev. %s)") % occurrence["infos"]["revision_number"]
+        library.sort(lambda x, y: x["name"].__cmp__(y["name"]))
+        return library
+    
+    def GetModuleInfos(self, type_infos):
+        vendor = self.ModulesLibrary.get(type_infos["vendor"], None)
+        if vendor is not None:
+            for group_name, group in vendor["groups"].iteritems():
+                for device_type, device in group["devices"]:
+                    product_code = device.getType().getProductCode()
+                    revision_number = device.getType().getRevisionNo()
+                    if (device_type == type_infos["device_type"] and
+                        product_code == type_infos["product_code"] and
+                        revision_number == type_infos["revision_number"]):
+                        return device
+        return None
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/plc_etherlab.c	Sun Dec 18 19:42:13 2011 +0100
@@ -0,0 +1,123 @@
+/*
+ * Etherlab Asynchronous execution code
+ *
+ * */
+
+#include <rtdm/rtdm.h>
+#include <native/task.h>
+#include <native/timer.h>
+
+#include "ecrt.h"
+#include "ec_rtdm.h"
+
+#ifdef _WINDOWS_H
+  #include "iec_types.h"
+#else
+  #include "iec_std_lib.h"
+#endif
+
+// declaration of interface variables
+%(located_variables_declaration)s
+
+// Optional features
+#define CONFIGURE_PDOS  %(configure_pdos)d
+
+// process data
+static uint8_t *domain1_pd = NULL;
+%(used_pdo_entry_offset_variables_declaration)s
+
+const static ec_pdo_entry_reg_t domain1_regs[] = {
+%(used_pdo_entry_configuration)s
+    {}
+};
+/*****************************************************************************/
+
+#if CONFIGURE_PDOS
+%(pdos_configuration_declaration)s
+#endif
+
+int rt_fd = -1;
+CstructMstrAttach MstrAttach;
+char rt_dev_file[64];
+long long wait_period_ns = 100000LL;
+
+// EtherCAT
+static ec_master_t *master = NULL;
+static ec_domain_t *domain1 = NULL;
+%(slaves_declaration)s
+
+/* Beremiz plugin functions */
+int __init_%(location)s(int argc,char **argv)
+{
+	int rtstatus;
+
+	MstrAttach.masterindex = %(master_number)d;
+
+	master = ecrt_request_master(MstrAttach.masterindex);
+	if (!master) return -1;
+
+	domain1 = ecrt_master_create_domain(master);
+	if (!domain1) return -1;
+
+#if CONFIGURE_PDOS
+	%(slaves_configuration)s
+#endif
+
+    if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {
+        fprintf(stderr, "PDO entry registration failed!\n");
+        return -1;
+    }
+
+    sprintf(&rt_dev_file[0],"%%s%%u",EC_RTDM_DEV_FILE_NAME,0);
+    rt_fd = rt_dev_open( &rt_dev_file[0], 0);
+    if (rt_fd < 0) {
+        printf("Can't open %%s\n", &rt_dev_file[0]);
+        return -1;
+    }
+
+    // attach the master over rtdm driver
+    MstrAttach.domainindex = ecrt_domain_index(domain1);
+    rtstatus = ecrt_rtdm_master_attach(rt_fd, &MstrAttach);
+    if (rtstatus < 0) {
+        printf("Cannot attach to master over rtdm\n");
+        return -1;
+    }
+
+    if (ecrt_master_activate(master))
+        return -1;
+
+    if (!(domain1_pd = ecrt_domain_data(domain1))) {
+        fprintf(stderr, "domain1_pd:  0x%%.6lx\n", (unsigned long)domain1_pd);
+        return -1;
+    }
+
+    fprintf(stdout, "Master %(master_number)d activated...\n");
+    return 0;
+}
+
+void __cleanup_%(location)s(void)
+{
+	if (rt_fd >= 0) {
+		rt_dev_close(rt_fd);
+	}
+}
+
+void __retrieve_%(location)s(void)
+{
+    // receive ethercat
+    ecrt_rtdm_master_recieve(rt_fd);
+    ecrt_rtdm_domain_process(rt_fd);
+
+    rt_task_sleep(rt_timer_ns2tsc(wait_period_ns));
+
+    // send process data
+    ecrt_rtdm_domain_queque(rt_fd);
+    ecrt_rtdm_master_send(rt_fd);
+
+%(retrieve_variables)s
+}
+
+void __publish_%(location)s(void)
+{
+%(publish_variables)s
+}