-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a check for the installation of
go
- Updated the dotnet check to check for at least version 4.5.2 - Added code generation for C# enums
- Loading branch information
Showing
13 changed files
with
4,226 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
build-utils/language-cs/src/main/resources/templates/cs/enum-template.ftlh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<#-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
<#-- Prevent freemarker from escaping stuff --> | ||
<#outputformat "undefined"> | ||
<#-- Declare the name and type of variables passed in to the template --> | ||
<#-- @ftlvariable name="languageName" type="java.lang.String" --> | ||
<#-- @ftlvariable name="protocolName" type="java.lang.String" --> | ||
<#-- @ftlvariable name="outputFlavor" type="java.lang.String" --> | ||
<#-- @ftlvariable name="helper" type="org.apache.plc4x.language.cs.CsLanguageTemplateHelper" --> | ||
<#-- @ftlvariable name="type" type="org.apache.plc4x.plugins.codegenerator.types.definitions.EnumTypeDefinition" --> | ||
<#-- @ftlvariable name="simpleTypeReference" type="org.apache.plc4x.plugins.codegenerator.types.references.SimpleTypeReference" --> | ||
${helper.fileName(protocolName, languageName, outputFlavor)?replace(".", "/")}/model/${type.name}.cs | ||
// | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
namespace org.apache.plc4net.drivers.${protocolName?replace("-", "")}.${outputFlavor?replace("-", "")}.model | ||
{ | ||
|
||
public enum ${type.name}<#if !helper.isStringTypeReference(type.type)> : ${helper.getLanguageTypeNameForTypeReference(type.type)}</#if> | ||
{ | ||
|
||
<#list type.enumValues as enumValue> | ||
${enumValue.name}<#if !helper.isStringTypeReference(type.type)> = ${enumValue.value}</#if>, | ||
</#list> | ||
|
||
} | ||
|
||
<#if type.constantNames?has_content> | ||
public static class ${type.name}Info | ||
{ | ||
<#list type.constantNames as constantName> | ||
|
||
public static ${helper.getLanguageTypeNameForTypeReference(type.getConstantType(constantName))} ${constantName?cap_first}(this ${type.name} value) | ||
{ | ||
switch (value) | ||
{ | ||
<#list helper.getUniqueEnumValues(type.enumValues) as enumValue> | ||
case ${type.name}.${enumValue.name}: { /* '${enumValue.value}' */ | ||
return ${helper.escapeEnumValue(type.getConstantType(constantName), enumValue.getConstant(constantName))}; | ||
} | ||
</#list> | ||
default: { | ||
return ${helper.getNullValueForTypeReference(type.getConstantType(constantName))}; | ||
} | ||
} | ||
} | ||
</#list> | ||
} | ||
|
||
</#if> | ||
} | ||
|
||
</#outputformat> |
20 changes: 19 additions & 1 deletion
20
sandbox/plc4net/drivers/knxnetip-test/test/knxnetip/readwrite/model/KnxDatapointTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
sandbox/plc4net/drivers/knxnetip/src/knxnetip/readwrite/model/APCI.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
namespace org.apache.plc4net.drivers.knxnetip.readwrite.model | ||
{ | ||
|
||
public enum APCI : byte | ||
{ | ||
|
||
GROUP_VALUE_READ_PDU = 0x0, | ||
GROUP_VALUE_RESPONSE_PDU = 0x1, | ||
GROUP_VALUE_WRITE_PDU = 0x2, | ||
INDIVIDUAL_ADDRESS_WRITE_PDU = 0x3, | ||
INDIVIDUAL_ADDRESS_READ_PDU = 0x4, | ||
INDIVIDUAL_ADDRESS_RESPONSE_PDU = 0x5, | ||
ADC_READ_PDU = 0x6, | ||
ADC_RESPONSE_PDU = 0x7, | ||
MEMORY_READ_PDU = 0x8, | ||
MEMORY_RESPONSE_PDU = 0x9, | ||
MEMORY_WRITE_PDU = 0xA, | ||
USER_MESSAGE_PDU = 0xB, | ||
DEVICE_DESCRIPTOR_READ_PDU = 0xC, | ||
DEVICE_DESCRIPTOR_RESPONSE_PDU = 0xD, | ||
RESTART_PDU = 0xE, | ||
OTHER_PDU = 0xF, | ||
|
||
} | ||
|
||
} | ||
|
34 changes: 34 additions & 0 deletions
34
sandbox/plc4net/drivers/knxnetip/src/knxnetip/readwrite/model/CEMIPriority.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
namespace org.apache.plc4net.drivers.knxnetip.readwrite.model | ||
{ | ||
|
||
public enum CEMIPriority : byte | ||
{ | ||
|
||
SYSTEM = 0x0, | ||
NORMAL = 0x1, | ||
URGENT = 0x2, | ||
LOW = 0x3, | ||
|
||
} | ||
|
||
} | ||
|
32 changes: 32 additions & 0 deletions
32
sandbox/plc4net/drivers/knxnetip/src/knxnetip/readwrite/model/HostProtocolCode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
namespace org.apache.plc4net.drivers.knxnetip.readwrite.model | ||
{ | ||
|
||
public enum HostProtocolCode : byte | ||
{ | ||
|
||
IPV4_UDP = 0x01, | ||
IPV4_TCP = 0x02, | ||
|
||
} | ||
|
||
} | ||
|
Oops, something went wrong.