--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/objdictgen/config/DS-302.prf Mon Apr 30 16:56:21 2007 +0200
@@ -0,0 +1,21 @@
+global Mapping, AddMenuEntries
+
+"""
+MappingDictionary for DS-302
+"""
+
+Mapping = {
+ 0x1F20 : {"name" : "Store DCF", "struct" : rec, "need" : False, "values" :
+ [{"name" : "Number of Entries", "type" : 0x02, "access" : 'ro', "pdo" : False},
+ {"name" : "Store DCF for node %d[(sub)]", "type" : 0x0F, "access" : 'rw', "pdo" : False, "nbmax" : 0x7F}]},
+
+ 0x1F21 : {"name" : "Storage Format", "struct" : rec, "need" : False, "values" :
+ [{"name" : "Number of Entries", "type" : 0x02, "access" : 'ro', "pdo" : False},
+ {"name" : "Storage Format for Node %d[(sub)]", "type" : 0x02, "access" : 'rw', "pdo" : False, "nbmax" : 0x7F}]},
+
+ 0x1F22 : {"name" : "Concise DCF", "struct" : rec, "need" : False, "values" :
+ [{"name" : "Number of Entries", "type" : 0x02, "access" : 'ro', "pdo" : False},
+ {"name" : "Concise DCF for Node %d[(sub)]", "type" : 0x0F, "access" : 'rw', "pdo" : False, "nbmax" : 0x7F}]}
+}
+
+AddMenuEntries = []
\ No newline at end of file
--- a/objdictgen/gen_cfile.py Tue Apr 24 16:49:40 2007 +0200
+++ b/objdictgen/gen_cfile.py Mon Apr 30 16:56:21 2007 +0200
@@ -61,6 +61,8 @@
return "UNS8", "[10]", "visible_string"
else:
return "UNS8", "[%s]"%values[1], "visible_string"
+ elif values[0] == "DOMAIN":
+ return "UNS8*", "", "domain"
return None
def WriteFile(filepath, content):
@@ -213,6 +215,8 @@
sep = ""
if typeinfos[2] == "visible_string":
value = "\"%s\""%value
+ if typeinfos[2] == "domain":
+ value = "\"%s\""%''.join(["\\x%2.2x"%ord(char) for char in value])
else:
comment = "\t/* %s */"%str(value)
value = "0x%X"%value
@@ -294,16 +298,16 @@
name = FormatName("%s_%s"%(entry_infos["name"],subentry_infos["name"]))
else:
name = "%s_obj%04X_%s"%(texts["NodeName"], texts["index"], FormatName(subentry_infos["name"]))
- if subIndexType == "visible_string":
- sizeof = name
- else:
- sizeof = typeinfos[0]
+ if subIndexType in ["visible_string", "domain"]:
+ sizeof = str(len(values[subIndex]))
+ else:
+ sizeof = "sizeof (%s)"%typeinfos[0]
params = Manager.GetCurrentParamsEntry(index, subIndex)
if params["save"]:
save = "|TO_BE_SAVE"
else:
save = ""
- strIndex += " { %s%s, %s, sizeof (%s), (void*)&%s }%s\n"%(subentry_infos["access"].upper(),save,subIndexType,sizeof,name,sep)
+ strIndex += " { %s%s, %s, %s, (void*)&%s }%s\n"%(subentry_infos["access"].upper(),save,subIndexType,sizeof,name,sep)
strIndex += " };\n"
indexContents[index] = strIndex
--- a/objdictgen/node.py Tue Apr 24 16:49:40 2007 +0200
+++ b/objdictgen/node.py Mon Apr 30 16:56:21 2007 +0200
@@ -85,7 +85,7 @@
0x000B : {"name" : "UNICODE_STRING", "struct" : nosub, "size" : 16, "default" : "", "values" : []},
# 0x000C : {"name" : "TIME_OF_DAY", "struct" : nosub, "size" : 48, "default" : 0, "values" : []},
# 0x000D : {"name" : "TIME_DIFFERENCE", "struct" : nosub, "size" : 48, "default" : 0, "values" : []},
-# 0x000F : {"name" : "DOMAIN", "struct" : nosub, "size" : 0, "default" : "", "values" : []},
+ 0x000F : {"name" : "DOMAIN", "struct" : nosub, "size" : 0, "default" : "", "values" : []},
0x0010 : {"name" : "INTEGER24", "struct" : nosub, "size" : 24, "default" : 0, "values" : []},
0x0011 : {"name" : "REAL64", "struct" : nosub, "size" : 64, "default" : 0.0, "values" : []},
0x0012 : {"name" : "INTEGER40", "struct" : nosub, "size" : 40, "default" : 0, "values" : []},
@@ -336,7 +336,7 @@
"""
def ExtendSpecificMenu(self, specificmenu):
- self.SpecificMenu.extend(AddMenuEntries)
+ self.SpecificMenu.extend(specificmenu)
"""
Function which return the different Mappings available for this node
--- a/objdictgen/nodemanager.py Tue Apr 24 16:49:40 2007 +0200
+++ b/objdictgen/nodemanager.py Mon Apr 30 16:56:21 2007 +0200
@@ -379,11 +379,9 @@
# Charging DS-302 profile if choosen by user
if os.path.isfile("config/DS-302.prf"):
try:
- Mapping = {}
- AddMenuEntries = []
- execfile("config/DS-302.prf")
- self.CurrentNode.SetDS302Profile(Mapping)
- self.CurrentNode.ExtendSpecificMenu(AddMenuEntries)
+ execfile("config/DS-302.prf")
+ self.CurrentNode.SetDS302Profile(Mapping)
+ self.CurrentNode.ExtendSpecificMenu(AddMenuEntries)
except:
return "Problem with DS-302! Syntax Error."
else:
@@ -780,6 +778,14 @@
self.CurrentNode.SetEntry(index, subIndex, value)
elif editor == "time":
self.CurrentNode.SetEntry(index, subIndex, value)
+ elif editor == "domain":
+ try:
+ if len(value) % 2 != 0:
+ value = "0" + value
+ value = value.decode('hex_codec')
+ self.CurrentNode.SetEntry(index, subIndex, value)
+ except:
+ pass
else:
subentry_infos = self.GetSubentryInfos(index, subIndex)
type = subentry_infos["type"]
@@ -1074,7 +1080,7 @@
if type(values) == ListType:
for i, value in enumerate(values):
data.append({"value" : value})
- data[-1].update(params[i])
+ data[-1].update(params[i])
else:
data.append({"value" : values})
data[-1].update(params)
@@ -1125,8 +1131,11 @@
else:
if dic["type"].startswith("VISIBLE_STRING"):
editor["value"] = "string"
- if dic["type"] in ["TIME_OF_DAY","TIME_DIFFERENCE"]:
+ elif dic["type"] in ["TIME_OF_DAY","TIME_DIFFERENCE"]:
editor["value"] = "time"
+ elif dic["type"] == "DOMAIN":
+ editor["value"] = "domain"
+ dic["value"] = dic["value"].encode('hex_codec')
elif dic["type"] == "BOOLEAN":
editor["value"] = "bool"
dic["value"] = BoolType[dic["value"]]
--- a/objdictgen/objdictedit.py Tue Apr 24 16:49:40 2007 +0200
+++ b/objdictgen/objdictedit.py Mon Apr 30 16:56:21 2007 +0200
@@ -294,6 +294,9 @@
elif editortype == "time":
editor = wxGridCellTextEditor()
renderer = wxGridCellStringRenderer()
+ elif editortype == "domain":
+ editor = wxGridCellTextEditor()
+ renderer = wxGridCellStringRenderer()
else:
grid.SetReadOnly(row, col, True)
@@ -2157,7 +2160,7 @@
label='DS-302 Profile', name='DS302', parent=self.MainPanel,
pos=wx.Point(256, 144), size=wx.Size(128, 24), style=0)
self.DS302.SetValue(False)
- self.DS302.Enable(False)
+ #self.DS302.Enable(False)
self.GenSYNC = wx.CheckBox(id=wxID_CREATENODEDIALOGGENSYNC,
label='Generate SYNC', name='GenSYNC', parent=self.MainPanel,