Hi Cesar,

I just had a look at your mspec changes. I think it shouldn't be 
"getCpuSubfunction" but " cpuSubfunction" ... the code generator takes care of 
generating the right access code. For my C templates this code is sometimes 
greatly different from what you would expect in Java.

Actually that should be about all that has to be changed.

Chris


Am 13.06.20, 22:50 schrieb "Cesar Garcia" <cesar.gar...@ceos.com.ve>:

    Hi,

    I am trying to perform the migration to add the functionalities for the S7
    driver, associated with the subscription handling of alarm and system
    events, but I am generating a failure in compiling the driver from the
    mspec.

    In [1] I extend the step of the parameter 'cpuSubFunction' since I require
    it to indicate the subscription model. The change is in bold.

    In [2] I select the type based on the 'cpuSubFunction'.

    I try to generate the driver and the compiler sends me the message
    indicated in [3]. It points to 'S7PayloadWriteVarRequest', but I haven't
    touched it.

    I appreciate your comments,



    [1]

    [discriminatedType 'S7Payload' [uint 8 'messageType', S7Parameter
    'parameter']
        [typeSwitch 'parameter.discriminatorValues[0]', 'messageType'
            ['0x04','0x03' S7PayloadReadVarResponse
                [array S7VarPayloadDataItem 'items' count 'CAST(parameter,
    S7ParameterReadVarResponse).numItems' ['lastItem']]
            ]
            ['0x05','0x01' S7PayloadWriteVarRequest
                [array S7VarPayloadDataItem 'items' count
    'COUNT(CAST(parameter, S7ParameterWriteVarRequest).items)' ['lastItem']]
            ]
            ['0x05','0x03' S7PayloadWriteVarResponse
                [array S7VarPayloadStatusItem 'items' count 'CAST(parameter,
    S7ParameterWriteVarResponse).numItems']
            ]
            ['0x00','0x07' S7PayloadUserData
                [array S7PayloadUserDataItem 'items' count
    'COUNT(CAST(parameter, S7ParameterUserData).items)' ['CAST(CAST(parameter,
    S7ParameterUserData).items[0],
    S7ParameterUserDataItemCPUFunctions).cpuFunctionType',*
    'CAST(CAST(parameter, S7ParameterUserData).items[0],
    S7ParameterUserDataItemCPUFunctions).getCpuSubfunction']*]
            ]
        ]
    ]

    [2]

    [discriminatedType 'S7PayloadUserDataItem' [uint 4 'cpuFunctionType', uint
    8 'cpuSubfunction']
        [enum     DataTransportErrorCode 'returnCode']
        [enum     DataTransportSize      'transportSize']
        [implicit uint 16                'dataLength' 'lengthInBytes - 4']
















    *  [typeSwitch 'cpuSubfunction'        ['0x01'            [simple   SzlId
                   'szlId']            [simple   uint 16
     'szlIndex']            [typeSwitch 'cpuFunctionType'
    ['0x04' S7PayloadUserDataItemCpuFunctionReadSzlRequest                ]
                ['0x08' S7PayloadUserDataItemCpuFunctionReadSzlResponse
                [const    uint 16 'szlItemLength' '28']
    [implicit uint 16 'szlItemCount'  'COUNT(items)']                    [array
    SzlDataTreeItem 'items' count 'szlItemCount']                ]
    ]        ]        ['0x02'        ]    ]*
    ]

    [3]
    Failed to execute goal
    org.apache.plc4x.plugins:plc4x-maven-plugin:1.2.0:generate-driver
    (generate-driver) on project plc4j-driver-s7: Error generating sources:
    Error generating output for type 'S7PayloadWriteVarRequest': Java method
    
"org.apache.plc4x.language.java.JavaLanguageTemplateHelper.getArgumentType(org.apache.plc4x.plugins.codegenerator.types.references.TypeReference,
    int)" threw an exception when invoked on
    org.apache.plc4x.language.java.JavaLanguageTemplateHelper object
    "org.apache.plc4x.language.java.JavaLanguageTemplateHelper@8ac512e"; see
    cause exception in the Java stack trace.

    ----
    FTL stack trace ("~" means nesting-related):
    - Failed at: ${helper.getArgumentType(field.type, ...  [in template
    "templates/java/io-template.ftlh" at line 136, column 248]
    ----: Could not find definition of complex type S7VarPayloadDataItem
    -> [Help 1]


    -- 
    *CEOS Automatización, C.A.*
    *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
    *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

    *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
    *Ing. César García*

    *Cel: +58 414-760.98.95*

    *Hotline Técnica SIEMENS: 0800 1005080*

    *Email: support.aan.automat...@siemens.com
    <support.aan.automat...@siemens.com>*

Reply via email to