Hello Chris. It's me again, :-)
You have an example that shows that the "typeSwitch" tab allows an internal "typeSwitch" tab as presented. I have tried many combinations and it does not work for me. Thanking you for your help, El lun., 15 jun. 2020 a las 3:21, Christofer Dutz (< christofer.d...@c-ware.de>) escribió: > Hi Cesar, > > I just noticed your discriminated types in [2] don't have names ... as for > every case in the typeSwitch a new type is generated, you need to give them > names. > Please try that and check if the error goes away. > > Chris > > > Am 14.06.20, 17:59 schrieb "Cesar Garcia" <cesar.gar...@ceos.com.ve>: > > Very grateful for your prompt response, > > Corrected at point [1] > > Unfortunately, the build process still fails when I add the > 'typeSwitch' in > the structure as shown in [2], > > I attach the message of error in [3]. > > Thank you very much for any help you can provide, > > Best regards, > > > [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).cpuSubfunction'*]] > ] > ] > ] > > [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' > * [simple uint 16 'Mode']* > ] > ] > ] > > > [3] > > --- plc4x-maven-plugin:1.2.0:generate-driver (generate-driver) @ > plc4j-driver-s7 --- > Generating type DataItem > Generating type COTPParameterDisconnectAdditionalInformation > Generating type S7PayloadWriteVarRequest > > ------------------------------------------------------------------------ > BUILD FAILURE > > ------------------------------------------------------------------------ > Total time: 2.220 s > Finished at: 2020-06-14T11:27:37-04:00 > > ------------------------------------------------------------------------ > 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@5fa0141f"; > 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] > > To see the full stack trace of the errors, re-run Maven with the -e > switch. > Re-run Maven using the -X switch to enable full debug logging. > > For more information about the errors and possible solutions, please > read > the following articles: > [Help 1] > > http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException > > > > > El dom., 14 jun. 2020 a las 5:05, Christofer Dutz (< > christofer.d...@c-ware.de>) escribió: > > > 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>* > > > > > > -- > *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>* > > -- *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>*