Skip to content
Snippets Groups Projects
Commit d4b04e2d authored by al.schwinn's avatar al.schwinn
Browse files

Bug 1407 - Remove Plugin specific design validation Rules

parent 99f57668
No related branches found
No related tags found
No related merge requests found
...@@ -149,40 +149,6 @@ def fillAttributes(element, attrs): ...@@ -149,40 +149,6 @@ def fillAttributes(element, attrs):
element.setProp(name, value) element.setProp(name, value)
return element return element
#-------------------------------------------------------------------------
# Given an SILECS data type, returns the corresponding FESA data type
# For the time being FESA does not support unsigned data types in properties
# so here unsigned types are considered as signed to allow users to link
# any field to properties
#-------------------------------------------------------------------------
def getFesaDataType(silecsDataType):
return {
'int8' :'int8_t',
'uint8' :'int16_t',
'int16' :'int16_t',
'uint16' :'int32_t',
'int32' :'int32_t',
'uint32' :'int64_t',
'int64' :'int64_t',
'uint64' :'uint64_t', # only for PXI, but not supported from Java! Not possible to use it in FESA properties
'float32' :'float',
'float64' :'double',
'date' :'double',
'char' :'int8_t',
'byte' :'int16_t',
'word' :'int32_t',
'dword' :'int64_t',
'int' :'int16_t',
'dint' :'int32_t',
'real' :'float',
'dt' :'double',
'string' :'char'
}[silecsDataType]
def registerFormatType2FesaType(registerFormatType):
type = iecommon.getSilecsDataType(registerFormatType)
return getFesaDataType(type)
def getCDataType(silecsDataType): def getCDataType(silecsDataType):
return { return {
'int8' :'int8_t', 'int8' :'int8_t',
...@@ -207,9 +173,6 @@ def getCDataType(silecsDataType): ...@@ -207,9 +173,6 @@ def getCDataType(silecsDataType):
'string' :'std::string' 'string' :'std::string'
}[silecsDataType] }[silecsDataType]
def registerFormatType2CType(registerFormatType):
type = iecommon.getSilecsDataType(registerFormatType)
return getCDataType(type)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Given PLC data type, returns the corresponding # Given PLC data type, returns the corresponding
# SILECS data type # SILECS data type
...@@ -245,11 +208,6 @@ def getSilecsDataType(registerFormatType): ...@@ -245,11 +208,6 @@ def getSilecsDataType(registerFormatType):
'string' : 'string' 'string' : 'string'
}[registerFormatType] }[registerFormatType]
def isUnsignedType(registerFormatType):
type = iecommon.getSilecsDataType(registerFormatType)
if type[0] == 'u':
return True
return False
#Needed for SilecsMethodNames #Needed for SilecsMethodNames
def getSilecsDataTypeUpperCase(registerFormatType): def getSilecsDataTypeUpperCase(registerFormatType):
type = iecommon.getSilecsDataType(registerFormatType) type = iecommon.getSilecsDataType(registerFormatType)
......
...@@ -20,9 +20,6 @@ import libxml2 ...@@ -20,9 +20,6 @@ import libxml2
class Register(object): class Register(object):
def __init__(self, xmlNode): def __init__(self, xmlNode):
self.initWithDesignRegisterNode(xmlNode)
def initWithDesignRegisterNode(self, xmlNode):
self.xmlNode = xmlNode self.xmlNode = xmlNode
#xmlNode.shellPrintNode() #xmlNode.shellPrintNode()
...@@ -56,14 +53,29 @@ class Register(object): ...@@ -56,14 +53,29 @@ class Register(object):
self.format = self.valueTypeNode.prop("format") self.format = self.valueTypeNode.prop("format")
def isUnsigned(self):
type = iecommon.getSilecsDataType(self.format)
if type[0] == 'u':
return True
return False
def getCType():
type = iecommon.getSilecsDataType(self.format)
return iecommon.getCDataType(type)
def getSilecsTypeCapitalized(self):
return iecommon.getSilecsDataTypeUpperCase(self.format)
def isArray(self): def isArray(self):
return self.valueType == 'array' or 'stringArray' return self.valueType == 'array' or self.valueType == 'stringArray'
def isArray2D(self): def isArray2D(self):
return self.valueType == 'array2D' or 'stringArray2D' return self.valueType == 'array2D' or self.valueType == 'stringArray2D'
def isStringType(self): def isStringType(self):
return self.valueType == 'string' or 'stringArray' or 'stringArray2D' return self.valueType == 'string' or self.valueType == 'stringArray' or self.valueType == 'stringArray2D'
#has some additionalValues #has some additionalValues
class ParamRegister(Register): class ParamRegister(Register):
...@@ -95,12 +107,70 @@ class ParamRegister(Register): ...@@ -95,12 +107,70 @@ class ParamRegister(Register):
class DesignRegister(Register): class DesignRegister(Register):
def __init__(self, xmlNode): def __init__(self, xmlNode):
super(DesignRegister, self).__init__(xmlNode) super(DesignRegister, self).__init__(xmlNode)
self.fesaFieldName = "" self.fesaFieldName = self.name
self.generateFesaValueItem = True
if self.xmlNode.hasProp("fesaFieldName"): if self.xmlNode.hasProp("fesaFieldName"):
self.fesaFieldName = xmlNode.prop("fesaFieldName") self.fesaFieldName = xmlNode.prop("fesaFieldName")
if self.xmlNode.hasProp("generateFesaValueItem"): #SilecsHEader does not have this attribute if self.xmlNode.hasProp("generateFesaValueItem"): #SilecsHEader does not have this attribute
self.generateFesaValueItem = xsdBooleanToBoolean(xmlNode.prop("generateFesaValueItem")) self.generateFesaValueItem = xsdBooleanToBoolean(xmlNode.prop("generateFesaValueItem"))
def getFesaName(self):
if self.fesaFieldName == "": def getFesaFieldName(self):
return self.name
return self.fesaFieldName return self.fesaFieldName
#-------------------------------------------------------------------------
# Given an SILECS data type, returns the corresponding FESA data type
# For the time being FESA does not support unsigned data types in properties
# so here unsigned types are considered as signed to allow users to link
# any field to properties
#-------------------------------------------------------------------------
def getFesaType(self):
return {
'int8' :'int8_t',
'uint8' :'int16_t',
'int16' :'int16_t',
'uint16' :'int32_t',
'int32' :'int32_t',
'uint32' :'int64_t',
'int64' :'int64_t',
'uint64' :'uint64_t', # only for PXI, but not supported from Java! Not possible to use it in FESA properties
'float32' :'float',
'float64' :'double',
'date' :'double',
'char' :'int8_t',
'byte' :'int16_t',
'word' :'int32_t',
'dword' :'int64_t',
'int' :'int16_t',
'dint' :'int32_t',
'real' :'float',
'dt' :'double',
'string' :'char'
}[iecommon.getSilecsDataType(self.format)]
def getFesaFieldNameCapitalized(self):
return iecommon.capitalizeString(self.fesaFieldName)
def getFesaDataType(self,silecsDataType):
return {
'int8' :'int8_t',
'uint8' :'int16_t',
'int16' :'int16_t',
'uint16' :'int32_t',
'int32' :'int32_t',
'uint32' :'int64_t',
'int64' :'int64_t',
'uint64' :'uint64_t', # only for PXI, but not supported from Java! Not possible to use it in FESA properties
'float32' :'float',
'float64' :'double',
'date' :'double',
'char' :'int8_t',
'byte' :'int16_t',
'word' :'int32_t',
'dword' :'int64_t',
'int' :'int16_t',
'dint' :'int32_t',
'real' :'float',
'dt' :'double',
'string' :'char'
}[silecsDataType]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment