Server Extension Samples
Welcome to the TwinCAT HMI version 1.14 sample repository!
If you’re still using version 1.12, you can find the relevant samples
in the 1.12 branch.
Make sure to check it out if you haven’t upgraded yet.
Your feedback and contributions are highly appreciated. Happy coding!
This repository contains server extensions that showcase many features of the
server extension APIs for different programming languages, as well as various
aspects of the interaction between extensions and the server.
Here is a list of all sample extensions:
- ComplexConfig (.NET)
- ConfigListening (.NET)
- CustomConfig (.NET)
- CustomUserManagement (.NET)
- Diagnostics (.NET)
- DynamicSymbols (.NET)
- EditPermissions (.NET)
- ErrorHandling (.NET)
- EventListening (.NET)
- EventSystem (.NET)
- InterExtensionCommunication (.NET)
- LetsEncrypt (.NET)
- MinimalAuthentication (.NET)
- NetworkTime (.NET)
- ProtectedSymbol (.NET)
- RandomValue (.NET and Python)
- StartProcessFromService (.NET)
- StaticSymbols (.NET)
- WeatherData (Python)
For more TwinCAT HMI samples check out the related repositories:
Documentation for the .NET extension API
The documentation for the API can be found in the
Beckhoff Information System.
Getting started
Our suggestion is to start with the NetworkTime
(.NET) or the
RandomValue (.NET or
Python) samples. Both are relatively
short but contain many of the most commonly used features:
- Registering listeners
- Handling symbol requests
- Storing settings in the extension configuration
Every extension can define its own set of error codes. The ErrorHandling
(.NET) showcases how this should
be implemented.
The HMI server generates a configuration page for every server extension. If
you want to display additional status information on your extension’s
configuration page, have a look at the Diagnostics
(.NET) sample.
Advanced samples
Authentication
- MinimalAuthentication (.NET):
If you want to extend the authentication system of the HMI server, this sample
extension is the best starting point.
- CustomUserManagement (.NET):
A more realistic implementation of a user management extension that supports
adding, removing, renaming, as well as enabling and disabling users.
- EditPermissions (.NET): An
extension that edits symbol permissions and user groups at runtime.
Event system
- EventSystem (.NET): Use this
sample as a starting point if you want to write an extension that sends
messages or raises alarms.
- EventListening (.NET): If
your server extension is going to listen for messages and alarms from other
extensions or the HMI server, take a look at this sample.
Miscellaneous
- InterExtensionCommunication (.NET):
This sample will give you an understanding of how multiple extensions can
interact with each other, and with the HMI server.
- ConfigListening (.NET): If
your server extension wants to listen for changes to its configuration, take a
look at this sample.
- ComplexConfig (.NET): A server
extension with a complex configuration schema that showcases how an extension
can read and edit its own extension configuration.
- CustomConfig (.NET): The HMI
server generates a configuration page for every extension. This sample
showcases how this default page can be replaced with a custom HTML page.
- StaticSymbols (.NET): This
sample demonstrates how to automatically generate symbols based on .NET types
at compile time.
- DynamicSymbols (.NET): All
other samples provide a fixed list of symbols that clients can use to interact
with the extension. This sample demonstrates how an extension can provide a
dynamic list of symbols that changes at runtime.
- StartProcessFromService (.NET):
Starts a process from a server extension running as a service.
- LetsEncrypt (.NET): This server
extension generates an SSL certificate with
Let’s Encrypt.
- ProtectedSymbol (.NET):
Protect and encrypt symbols with the windows
DPAPI.
- WeatherData (.NET): Retrieve
current weather data for a specific location using a REST API to query an
online weather service.
Code Snippets
Descriptions of small blocks of reusable code that showcase concepts or
facilitate the development of a server extensions.
- Debugging the
Init method of a server extension in
.NET
- Inter-extension subscriptions in
.NET
Requirements
The following components must be installed to build the .NET samples:
评论