From 8766ff9d9663473d10c20e6b5311c0d91e99662e Mon Sep 17 00:00:00 2001 From: Christian Sueltrop Date: Fri, 21 Feb 2014 15:37:40 +0100 Subject: [PATCH] Added at least some comments. --- CANLibrary/Sym2Lib.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/CANLibrary/Sym2Lib.py b/CANLibrary/Sym2Lib.py index 03719d1..49c7bf8 100644 --- a/CANLibrary/Sym2Lib.py +++ b/CANLibrary/Sym2Lib.py @@ -9,10 +9,12 @@ Created on 12.12.2013 ''' from CanMessage import CanMessage from CanSignal import CanSignal -#from pandas import DataFrame from pprint import pprint def readSym(symfile): + ''' + Read in a .sym-file created with PEAK PCAN Symbol Editor containing CAN message and signal definitions. + ''' sym = open(symfile, "r") message = {} @@ -136,7 +138,11 @@ def readSym(symfile): tmp[titel] = signal return message -def Sym2Code(symfile, adapter = "pcan"): +def Sym2Code(symfile, adapter): + ''' + Create code for message configuration. + The code created can be used for static message defintions where the .sym-file shall not be included into the project. + ''' mes = readSym(symfile) for i in mes.keys(): if i == "ENUMS": @@ -152,7 +158,7 @@ def Sym2Code(symfile, adapter = "pcan"): def Add2Adapter(pcan, symfile): ''' - + Add message configuration to a pcan adapter instance. ''' mes = readSym(symfile) print "" @@ -188,12 +194,7 @@ def _get_easy_Dict_(mes): symDict[i].append(sig) return symDict -#def get_DataFrameDict(symfile): -# mes = readSym(symfile) -# symDict = _get_easy_Dict_(mes) -# dfDict = {} -# for i in symDict.keys(): -# dfDict.update( { i : DataFrame(columns = symDict[i]) } ) -# return dfDict -Sym2Code("H:\umzug desktop\Symboldatei_multiport.sym") + + +Sym2Code("H:\umzug desktop\Symboldatei_multiport.sym", "pcan")