Added at least some comments.
This commit is contained in:
parent
ed55c6c877
commit
8766ff9d96
1 changed files with 12 additions and 11 deletions
|
|
@ -9,10 +9,12 @@ Created on 12.12.2013
|
||||||
'''
|
'''
|
||||||
from CanMessage import CanMessage
|
from CanMessage import CanMessage
|
||||||
from CanSignal import CanSignal
|
from CanSignal import CanSignal
|
||||||
#from pandas import DataFrame
|
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
def readSym(symfile):
|
def readSym(symfile):
|
||||||
|
'''
|
||||||
|
Read in a .sym-file created with PEAK PCAN Symbol Editor containing CAN message and signal definitions.
|
||||||
|
'''
|
||||||
sym = open(symfile, "r")
|
sym = open(symfile, "r")
|
||||||
|
|
||||||
message = {}
|
message = {}
|
||||||
|
|
@ -136,7 +138,11 @@ def readSym(symfile):
|
||||||
tmp[titel] = signal
|
tmp[titel] = signal
|
||||||
return message
|
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)
|
mes = readSym(symfile)
|
||||||
for i in mes.keys():
|
for i in mes.keys():
|
||||||
if i == "ENUMS":
|
if i == "ENUMS":
|
||||||
|
|
@ -152,7 +158,7 @@ def Sym2Code(symfile, adapter = "pcan"):
|
||||||
|
|
||||||
def Add2Adapter(pcan, symfile):
|
def Add2Adapter(pcan, symfile):
|
||||||
'''
|
'''
|
||||||
|
Add message configuration to a pcan adapter instance.
|
||||||
'''
|
'''
|
||||||
mes = readSym(symfile)
|
mes = readSym(symfile)
|
||||||
print ""
|
print ""
|
||||||
|
|
@ -188,12 +194,7 @@ def _get_easy_Dict_(mes):
|
||||||
symDict[i].append(sig)
|
symDict[i].append(sig)
|
||||||
return symDict
|
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")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue