diff --git a/CHANGELOG.md b/CHANGELOG.md
index a685a73..1e88bc0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,27 @@
# Changelog
All notable changes to this project will be documented in this file.
+## Release 2.0.0
+
+### New features
+- Supports FlowConfig feature to set source to forward via HTTP request
+- Added 'Localhost' as interface to perform internal HTTP requests
+- Provide version of module via 'OnNewStatusModuleVersion'
+- Function 'getParameters' to provide PersistentData parameters
+- Check if features of module can be used on device and provide this via 'OnNewStatusModuleIsActive' event / 'getStatusModuleActive' function
+- Function to 'resetModule' to default setup
+
+### Improvements
+- Added parameters to 'addRequest'-function
+- Added ENUMs for RequestMode
+- New UI design available (e.g. selectable via CSK_Module_PersistentData v4.1.0 or higher), see 'OnNewStatusCSKStyle'
+- check if instance exists if selected
+- 'loadParameters' returns its success
+- 'sendParameters' can control if sent data should be saved directly by CSK_Module_PersistentData
+- Added UI icon and browser tab information
+
+### Bugfix
+- Error if module is not active but 'getInstancesAmount' was called
+
## Release 1.0.0
- Initial commit
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/pages/assets/CSK_Module_MultiHTTPClient/UI_sample.png b/CSK_Module_MultiHTTPClient/pages/assets/CSK_Module_MultiHTTPClient/UI_sample.png
new file mode 100644
index 0000000..25bd73d
Binary files /dev/null and b/CSK_Module_MultiHTTPClient/pages/assets/CSK_Module_MultiHTTPClient/UI_sample.png differ
diff --git a/CSK_Module_MultiHTTPClient/pages/assets/legacy/settings.json b/CSK_Module_MultiHTTPClient/pages/assets/legacy/settings.json
index 939ec2a..a845df1 100644
--- a/CSK_Module_MultiHTTPClient/pages/assets/legacy/settings.json
+++ b/CSK_Module_MultiHTTPClient/pages/assets/legacy/settings.json
@@ -1,3 +1,9 @@
{
-"showLoginButton": false
+ "canChangeLanguage": true,
+ "showLoginButton": false,
+ "defaultLanguage": "en",
+ "disableEditMode": true,
+ "showPageHistory": true,
+ "compactMode": false,
+ "canChangeCompactMode": false
}
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.css b/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.css
index 44160ef..58b571e 100644
--- a/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.css
+++ b/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.css
@@ -1,14 +1,108 @@
+.myCustomMarginTop2px_CSK_Module_MultiHTTPClient {
+ margin-top: 2px;
+}
+
+.myCustomMarginTop16px_CSK_Module_MultiHTTPClient {
+ margin-top: 16px;
+}
+
+.myCustomSpacerVert10_CSK_Module_MultiHTTPClient {
+ min-height: 10px;
+}
+
+.myCustomSpacerVert20_CSK_Module_MultiHTTPClient {
+ min-height: 20px;
+}
+
+.myCustomFrameLabel_CSK_Module_MultiHTTPClient {
+ background: white;
+ position:relative;
+ top: calc(-1.2rem);
+ left: calc(1rem);
+ font-size: medium;
+}
+
+.myCustomMargin99Percent_CSK_Module_MultiHTTPClient {
+ margin: calc(1rem);
+ margin-top: 20px;
+}
+
+.myCustomMarginFirstRow_CSK_Module_MultiHTTPClient {
+ margin-top: -49px;
+}
+
+.myCustomMarginLeft30PX_CSK_Module_MultiHTTPClient {
+ margin-left:30px;
+}
+
+.myCustomMarginLeft-30PX_CSK_Module_MultiHTTPClient {
+ margin-left:-30px;
+}
+
+.myCustomPersistentDataMargin_CSK_Module_MultiHTTPClient {
+ margin-top: -53px;
+ margin-left: 130px;
+}
+
+.myCustomPersistentDataMarginBack_CSK_Module_MultiHTTPClient {
+ margin-left: -127px;
+}
+
+.myCustomBorderBottom_CSK_Module_MultiHTTPClient {
+ border-bottom: 1px solid lightgray;
+ margin-inline: calc(1rem);
+}
+
+.myCustomBorderLeft_CSK_Module_MultiHTTPClient {
+ border-left: 1px solid lightgray;
+}
+
+.myCustomTabFrame_CSK_Module_MultiHTTPClient {
+ width: 98%;
+ align-self: center;
+}
+
+.myCustomLabel_CSK_Module_MultiHTTPClient {
+ font-size:30px;
+ color: grey;
+ margin-top: 10px;
+}
+
+.myCustomFrameNoColor_CSK_Module_MultiHTTPClient {
+ margin: 6px;
+ border-radius: 10px;
+ border-style: solid;
+ border-width: 0px;
+ border-color: 007CC1;
+ background-color: #FFFFFF;
+}
+
.myCustomFrame_CSK_Module_MultiHTTPClient {
+ margin: 6px;
+ border-radius: 10px;
border-style: solid;
border-width: 1px;
- border-color: grey;
+ border-color: #007CC1;
+ background-color: white;
+}
+
+.myCustomFrameNoColor_CSK_Module_MultiHTTPClient {
margin: 6px;
+ border-radius: 10px;
+ border-style: solid;
+ border-width: 0px;
+ border-color: 007CC1;
+ background-color: white;
}
-.myCustomMarginTop2px_CSK_Module_MultiHTTPClient {
- margin-top: 2px;
+.myCustomMarginTop7PX_CSK_Module_MultiHTTPClient {
+ margin-top: 7px;
}
-.myCustomMarginTop16px_CSK_Module_MultiHTTPClient {
- margin-top: 16px;
+.myCustomBackground_CSK_Module_MultiHTTPClient {
+}
+
+.myCustomButton_CSK_Module_MultiHTTPClient {
+ border-radius: 30px;
+ padding-right: 0px;
}
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.html b/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.html
index b10a0e3..4d5a266 100644
--- a/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.html
+++ b/CSK_Module_MultiHTTPClient/pages/pages/CSK_Module_MultiHTTPClient/CSK_Module_MultiHTTPClient.html
@@ -1,952 +1,1406 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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
-
-
-
-
-
-
-
-
- Periodic
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Add/Edit request
-
-
-
-
-
-
- Remove request
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Add instance
-
-
-
-
- Reset instances
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Please log in via UserManagement module.
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CA bundle(.pem)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pem
+
+
+ der
+
+
+ pkcs#12
+
+
+
+
+
+ Client certificate
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pem
+
+
+ der
+
+
+
+
+
+ Client certificate key
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GET
+
+
+ POST
+
+
+ HEAD
+
+
+ PUT
+
+
+ PATCH
+
+
+ DELETE
+
+
+ TRACE
+
+
+ OPTIONS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Periodic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Please log in via UserManagement module.
+
+
+
+
+
+
+
+
+
+
+
+ Module is not supported on this device...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/pages/src/converter.ts b/CSK_Module_MultiHTTPClient/pages/src/converter.ts
index 5556714..1e187a9 100644
--- a/CSK_Module_MultiHTTPClient/pages/src/converter.ts
+++ b/CSK_Module_MultiHTTPClient/pages/src/converter.ts
@@ -1,3 +1,64 @@
export function convertToList(value) {
return JSON.parse(value)
+}
+
+export function changeStyle(theme) {
+ const style: HTMLStyleElement = document.createElement('style');
+ style.id ='blub'
+ if (theme == 'CSK_Style'){
+ var headerToolbar = `.sopasjs-ui-header-toolbar-wrapper { background-color: #FFFFFF; }`
+ var uiHeader = `.sopasjs-ui-header>.app-logo { margin-right:0px; }`
+ var appLogo = `.app-logo { background-color:#FFFFFF; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAtCAIAAACmg/d8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAArZSURBVHhe7Zp7bFtXHccH6+i6AauYBu1AQgzGYLAJCQSiQMVLPIQE2garxiRAG0IM/iggjWpTmzZNX3k1aV5O4rycd7O8mrZJmjRJ7fgRO+80dhzHTvyIHdt52I7jt3PL17mue+z41ZJKm+Ovfn9Y9/zO8fX5nHN+v9+9fuROUgmtJOAEVxJwgisJOMGVBJzgSgJOcCUBJ7iSgBNcScAJriTgBFcScILrQwTYuOEe01nrJw0wgdqyYnP7G5L6PxQNsMdLKU2OitGl39Xefjl/+InUwe32zDnej5jj/+1WSAwbLu8m3ZGiKPaC6dl0fsB+XjE5rrPSraTc3k2txVk4pD1cNr7/DHfvSc5jKT7Dh32nBg+XTTCHdYsWJ9z8He7qh6Xj5G38rX3W30BobsX+g5IgtydTB19vEDvcoaMlsCICBt3eubWflE984iTnkePsmPblbOHlKYNnk0JfAL4+u0q2vlwwItKs0yPTgs+qzV03aThUMvboiXueIbYnhQ0H1ph+zR60ob9TNEq6/aVF6m8g9F7PPOkDeyFXNKSx4Kv9HrtAEQFPGza+VTASMkHRDbt8SG1B33gAW13eo9fnDlzgk26R7Jnz/P90yh2eezsvJmCA/Fzw4BikYEhrc3v9HrtDEQG/UjdNzk48hqP12A0FDsB4AL/brcAhTPpENzgf750PMI4O2OLwHGkUf4xwwCFxpFFisLr8HrtG4QGLFtf3n+EFZgf28RO+KY5pv6m+LV+xRweMUJ3LW0TEJR1gj6awn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bptauloS1N9LqM0q7iS2dQ9JDc6Yx3Z4QHXThiwEY9clkS31xrEX8wKKj33pHCKt94HRAIMiQ22H5dNkMESti918JdVUzk8TfO0EZbN1Rxmjm9/FX2oZHxiq/KJBBjiqszYtWQrrEioxbT6PXaTwgM+x1btje89f4i9lO+PtVEAY6Lrtx5Akg7xGA5zdKQ5RQFsd3vP3FKRkR721RyR8O4N7CqFBzyxZN3+Oi+mffL0YNqAEodwdMCQj8GAinSIxzI4anSkR4gCGFKZHDgkSAccLX9qlhqJp9m7ROEBIxQiWwEwco6i2xOpg/+8KkPSi+4xAUNYB8xhHTYlGS/DGhwOXOCnDajIRDo6YNyAQG0JWaNPpXERAsi/hewGhQcMYSJKRTqUvzG3MiLl8zmi93vmA9srHsCQw73ZMbPySt30wQtB731JQ4GLEgipXMj/7qIDpnV6QBmyehCbUXGFvLdIbEUEDGFOp/Qb2Gf/7pRjBsPaOx2yzEF1n8LkInYGAKPjW62zATvZp5yP8MQKx+blKSOqoJ+WT2KhIGtDeEbIPMyceOeKDEE37NuC1H4leRtlI0v+BkJqs/PotTnSDdY8vbyrsq1ogAOyubwoWsIa/XZhu7A4Vu3ugKGmijKtWBAYR7ZsF2osPJWZvWDGB6nRFmlwCBUaeRv0vwBChJ2K6oh0gyGI4Ov8HrtAcQFO6qOrJOAEVxJwgisJOMGVBJzgSgJOcCUBJ7iSgBNcScAJrTt3/gfzR65/IHLpiAAAAABJRU5ErkJggg==) }`
+ var uiNavbar =`.sopasjs-ui-navbar-wrapper { background-color: #737F85; }`
+ var navbarMenuLiActive = `.sopasjs-navbar-menu>li.active { background-color: #283c45; }`
+ var navbarMenuLiActiveA = `.sopasjs-navbar-menu>li.active>a { background-color: #283c45; }`
+ var navbarMeluLi = `.sopasjs-navbar-menu>li { color: #FFFFFF; }`
+ var navbarMeluLiA = `.sopasjs-navbar-menu>li>a { color: #FFFFFF; }`
+ var headerToolbarButtonHighlight = `.sopasjs-ui-header-toolbar-button.sopasjs-ui-navigation-navbutton>a.highlight { background-color: #737F85; }`
+ var toolbarButton = `.sopasjs-ui-header-toolbar-button>a { color: #283c45; }`
+
+ var customBackground = `.CSK_Module_MultiHTTPClient .myCustomBackground_CSK_Module_MultiHTTPClient { background-color: #737F8522; }` // font-family: "Open Sans"; }`
+
+ style.innerHTML = headerToolbar;
+ style.innerHTML += uiHeader;
+ style.innerHTML += appLogo;
+ style.innerHTML += uiNavbar;
+ style.innerHTML += navbarMenuLiActive;
+ style.innerHTML += navbarMenuLiActiveA;
+ style.innerHTML += navbarMeluLi;
+ style.innerHTML += navbarMeluLiA;
+ style.innerHTML += headerToolbarButtonHighlight;
+ style.innerHTML += toolbarButton;
+
+ style.innerHTML += customBackground;
+ }
+ else if (theme == 'None'){
+ var headerToolbar = `.sopasjs-ui-header-toolbar-wrapper { background-color: #007fc3; }`
+ var uiHeader = `.sopasjs-ui-header>.app-logo { margin-right:10px; }`
+ var appLogo = `.app-logo { background-color:#007fc3; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABICAYAAAAUNQy9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTZEaa/1AAAHBElEQVR4Xu3cachtUxgH8Evm+YOMIUQhQ5REpkI+yFzczCRzSDJkCpkl8xfzPM8zH8wyz5KIEGVWIuPr/5dTq9X/vPtZ61l7n7fb869fuY+79t73fZ9z9tl7rX1mTU1NhdCcLIbgJYsheMliCF6yGIKXLIbgJYsheMliCF6yGIKXLIbgJYsheMliCF6yGIKXLIbgJYsheMliCF6yGIKXLPZgJdgIti60JawN84ParrKjgRpXags4G+6C5+Aj+Bk+hhfhPjgBNgY13kIde06Nmw6Pe3vYFWbDXtNQ401ksZGt4Bb4Drz5Cx4CNpraV+ox6IoaZ7Eh3AY/Qkl+gfNgRVDbHedp6MoKoMYqi8GvYMmXoLZhIotOiwNfxX3l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hiyTug9teMLM4gXI7CucaupEuUaxrLMg3CdzWuVMjHlhhN6TwOfPBE/Z2UpbHyKZ3PwRLOhKTjmpLFGcbyyFL6C69pLI635EnIx5ZIJ6EZPqO4PKi/SzWNxStlazaDdGwzsjjDWBbLpQ+C1jQWWdZMMTeAGj8dzg+yicaFzxpyaU0+rqaxyPr84BeQj21CFmcQzg92hatT54LRmNrG2h2s4RQWT2tqOzkuCHwZLMlvxNY21sLwA1hyFeTj3WSxEFcqPgH8hfKy/EHg9xZwQRwnRnlHnks0bgK+2q+Fqw1eAkv4w0+Pp7axiOutSnIZjFtJyjv6nJcrCf/N6TZqG4u4lNsaLqNW26gmi4UuhUnmeEiPx9NYJZ9P+gi/ACU9Hk9j0R1gCR8CUeOryWIhrkKcZPLlLJ7GopNgEjkC8mPxNhavlv8AS/L7gS6yWIjn879hEjkT8uPxNhbxc8eQ4alfHYe3seggsKbZJLUsVuj7Ow5U+AFaHUuLxqKh5jz5kIXaP7VoLHoErFHji8liJeuH7Rb5FMb9QFs1FvX9qD2/Gkntd6RVY/FuvzW8EFPbKCKLlZYCPm/Xd14DrkhQx0AtG4v4UGzr8C7+kaD2l2rVWHQMWMMHg9U2zGTR6QLoK1zJuRCo/Y60bixiI18PLcIbpdYvNWvZWPQsWDM3qG2YyGID/MGdBfyHWL+aUIVfEcl3KH5Izy/Fx+mjsUa4KJD36XhTtjS8G176faStG2tdsMb1DKUs9oDfZcBpl5WNOH/GL6lI76hb8d2lixpXgtMvXIHBqRiujODSoG+A+Qn4GfBV4AJBfoms+h4vC3XsOTVuOvy8ZcFlT2q8iSyGaq7Tx5xEFkPwksUQvGQxBC9ZDMFLFkPwksUQvGQxBC9ZDMFLFkPwksUQvGQxBC9ZDMFLFkPwksUQvGQxBC9ZDMFnata/dLDegR+YrlcAAAAASUVORK5CYII=') }`
+ var uiNavbar =`.sopasjs-ui-navbar-wrapper { background-color: #f6f8f9; }`
+ var navbarMenuLiActive = `.sopasjs-navbar-menu>li.active { background-color: #007fc3; }`
+ var navbarMenuLiActiveA = `.sopasjs-navbar-menu>li.active>a { background-color: #007fc3; }`
+ var navbarMeluLi = `.sopasjs-navbar-menu>li { color: #697987; }`
+ var navbarMeluLiA = `.sopasjs-navbar-menu>li>a { color: #505f6b; }`
+ var headerToolbarButtonHighlight = `.sopasjs-ui-header-toolbar-button.sopasjs-ui-navigation-navbutton>a.highlight { background-color: #006093; }`
+ var toolbarButton = `.sopasjs-ui-header-toolbar-button>a { color: #cce5f3; }`
+
+ var customBackground = `.CSK_Module_MultiHTTPClient .myCustomBackground_CSK_Module_MultiHTTPClient { background-color: #fff; }` // font-family: "sans-serif"; }`
+
+ style.innerHTML = headerToolbar;
+ style.innerHTML += uiHeader;
+ style.innerHTML += appLogo;
+ style.innerHTML += uiNavbar;
+ style.innerHTML += navbarMenuLiActive;
+ style.innerHTML += navbarMenuLiActiveA;
+ style.innerHTML += navbarMeluLi;
+ style.innerHTML += navbarMeluLiA;
+ style.innerHTML += headerToolbarButtonHighlight;
+ style.innerHTML += toolbarButton;
+
+ style.innerHTML += customBackground;
+ }
+ document.head.append(style);
+ return theme
}
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/pages/src/index.ts b/CSK_Module_MultiHTTPClient/pages/src/index.ts
index e69de29..b01cd60 100644
--- a/CSK_Module_MultiHTTPClient/pages/src/index.ts
+++ b/CSK_Module_MultiHTTPClient/pages/src/index.ts
@@ -0,0 +1,17 @@
+document.addEventListener('sopasjs-ready', () => {
+ const page_1 = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(3) > a > i');
+ page_1.classList.remove('fa-file');
+ page_1.classList.add('fa-cloud');
+
+ const page_FirstLabel = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(2)');
+ const page_App = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(4)');
+ const page_Setup = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(5) > a');
+
+ page_FirstLabel.remove();
+ page_App.remove();
+ page_Setup.remove();
+
+ setTimeout(() => {
+ document.title = 'CSK_Module_MultiHTTPClient'
+ }, 500);
+})
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/project.mf.xml b/CSK_Module_MultiHTTPClient/project.mf.xml
index 074c9bb..bbcf2b2 100644
--- a/CSK_Module_MultiHTTPClient/project.mf.xml
+++ b/CSK_Module_MultiHTTPClient/project.mf.xml
@@ -36,6 +36,17 @@ It is possible to prepare and save multiple requests per instance. There are som
{empty} +
**4) Receive response** +
The module will dynamically create events to provide the incoming response of the executed requests. Please check the 'OnNewResponseNUM' / 'OnNewResponseNUM_NAME'-event documentation. +
+
+ Mode of HTTP request.
+ - GET
+ - POST
+ - HEAD
+ - PUT
+ - PATCH
+ - DELETE
+ - TRACE
+ - OPTIONS
+
Notify status if parameters should be loaded on app/device boot up.
@@ -243,15 +254,29 @@ INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific
Notify filename to use for cookie store.
+
+ Notify if FlowConfig should have priority for FlowConfig relevant configurations.
+
+
+
+ Notify UI style to use for CSK modules.
+
+
+
+ Notify version of module.
+
+
+
+ Notify if module can be used on device.
+
+
Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.
Send parameters to CSK_PersistentData module if possible to save them.
-
-
- Load parameters for this module from the CSK_PersistentData module if possible and use them.
+
Configure if this module should load its saved parameters at app / device boot up.
@@ -372,6 +397,13 @@ IMPORTANT: As instances start their own threads, the module needs to be restarte
Function to add new request based on preconfigured parameters.
+
+
+
+
+
+
+
Function to trigger preconfigured request via UI.
@@ -438,10 +470,60 @@ IMPORTANT: As instances start their own threads, the module needs to be restarte
Function to set filename for cookie storage.
+
+ Function to clear FlowConfig relevant configurations.
+
+
+ Function to configure if FlowConfig should have priority for FlowConfig relevant configuration.
+
+
+
+ Function to get status if module is active.
+
+
+
+ Load parameters for this module from the CSK_PersistentData module if possible and use them.
+
+
+
+ released
+ Function to get all parameters of the client in JSON format.
+
+
+
+
+ Function to reset main configuration of module.
+
+
+ released
+ Crown to provide CSK_FlowConfig relevant features.
+
+
+ Forward data via HTTP request.
+
+
+ Internally used CSK_FlowConfig create function.
+
+
+
+
+
+
+
+
+ data-flow
+ Set source of incoming data to forward via HTTP request.
+
+
+
+
+
+
+
SICK AG
- 1.0.0
+ 2.0.0
low
false
false
diff --git a/CSK_Module_MultiHTTPClient/scripts/CSK_Module_MultiHTTPClient.lua b/CSK_Module_MultiHTTPClient/scripts/CSK_Module_MultiHTTPClient.lua
index d715a0f..7c2a9c3 100644
--- a/CSK_Module_MultiHTTPClient/scripts/CSK_Module_MultiHTTPClient.lua
+++ b/CSK_Module_MultiHTTPClient/scripts/CSK_Module_MultiHTTPClient.lua
@@ -22,16 +22,13 @@
---@diagnostic disable: undefined-global, redundant-parameter, missing-parameter
---
--- CreationTemplateVersion: 3.6.0
--**************************************************************************
--**********************Start Global Scope *********************************
--**************************************************************************
-
-- If app property "LuaLoadAllEngineAPI" is FALSE, use this to load and check for required APIs
-- This can improve performance of garbage collection
-
_G.availableAPIs = require('Communication/MultiHTTPClient/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
+
-----------------------------------------------------------
-- Logger
_G.logger = Log.SharedLogger.create('ModuleLogger')
@@ -47,12 +44,19 @@ _G.logHandle:applyConfig()
local multiHTTPClient_Model = require('Communication/MultiHTTPClient/MultiHTTPClient_Model')
local multiHTTPClient_Instances = {} -- Handle all instances
-table.insert(multiHTTPClient_Instances, multiHTTPClient_Model.create(1)) -- Create at least 1 instance
-- Load script to communicate with the MultiHTTPClient_Model UI
-- Check / edit this script to see/edit functions which communicate with the UI
local multiHTTPClientController = require('Communication/MultiHTTPClient/MultiHTTPClient_Controller')
-multiHTTPClientController.setMultiHTTPClient_Instances_Handle(multiHTTPClient_Instances) -- share handle of instances
+
+if _G.availableAPIs.default and _G.availableAPIs.specific then
+ local setInstanceHandle = require('Communication/MultiHTTPClient/FlowConfig/MultiHTTPClient_FlowConfig')
+ table.insert(multiHTTPClient_Instances, multiHTTPClient_Model.create(1)) -- Create at least 1 instance
+ multiHTTPClientController.setMultiHTTPClient_Instances_Handle(multiHTTPClient_Instances) -- share handle of instances
+ setInstanceHandle(multiHTTPClient_Instances)
+else
+ _G.logger:warning("CSK_MultiHTTPClient: Relevant CROWN(s) not available on device. Module is not supported...")
+end
--**************************************************************************
--**********************End Global Scope ***********************************
@@ -97,7 +101,9 @@ local function main()
----------------------------------------------------------------------------------------
--setup() --> just for docu, see above
- CSK_MultiHTTPClient.setSelectedInstance(1)
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ CSK_MultiHTTPClient.setSelectedInstance(1)
+ end
CSK_MultiHTTPClient.pageCalled() -- Update UI
end
diff --git a/CSK_Module_MultiHTTPClient/scripts/CSK_MultiHTTPClient_Processing.lua b/CSK_Module_MultiHTTPClient/scripts/CSK_MultiHTTPClient_Processing.lua
index 7450fa7..5d7a78d 100644
--- a/CSK_Module_MultiHTTPClient/scripts/CSK_MultiHTTPClient_Processing.lua
+++ b/CSK_Module_MultiHTTPClient/scripts/CSK_MultiHTTPClient_Processing.lua
@@ -122,7 +122,7 @@ local function updateClient()
if processingParams.clientAuthentication then
if File.exists(processingParams.caBundleFileName) then
clientObject:setCABundle(processingParams.caBundleFileName)
- _G.logger:info(nameOfModule .. ": CA_Bundle active.")
+ _G.logger:fine(nameOfModule .. ": CA_Bundle active.")
else
_G.logger:warning(nameOfModule .. ": No CA_Bundle file available.")
end
@@ -133,7 +133,7 @@ local function updateClient()
else
clientObject:setClientCertificate(processingParams.clientCertificateFileName .. processingParams.clientCertificateType, processingParams.clientCertificateKeyFileName .. processingParams.clientCertificateKeyType)
end
- _G.logger:info(nameOfModule .. ": Client authentication active.")
+ _G.logger:fine(nameOfModule .. ": Client authentication active.")
else
_G.logger:warning(nameOfModule .. ": No client authentication files available.")
end
@@ -144,7 +144,9 @@ local function updateClient()
end
clientObject:setHostnameVerification(processingParams.hostnameVerification)
clientObject:setPeerVerification(processingParams.peerVerification)
- clientObject:setInterface(processingParams.interface)
+ if processingParams.interface ~= "Localhost" then
+ clientObject:setInterface(processingParams.interface)
+ end
if processingParams.proxyEnabled then
clientObject:setProxy(processingParams.proxyURL, processingParams.proxyPort)
clientObject:setProxyAuth(processingParams.proxyUsername, Cipher.AES.decrypt(processingParams.proxyPassword, processingParams.key))
diff --git a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/FlowConfig/MultiHTTPClient_FlowConfig.lua b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/FlowConfig/MultiHTTPClient_FlowConfig.lua
new file mode 100644
index 0000000..f3a0f71
--- /dev/null
+++ b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/FlowConfig/MultiHTTPClient_FlowConfig.lua
@@ -0,0 +1,30 @@
+--*****************************************************************
+-- Here you will find all the required content to provide specific
+-- features of this module via the 'CSK FlowConfig'.
+--*****************************************************************
+
+require('Communication.MultiHTTPClient.FlowConfig.MultiHTTPClient_SendRequest')
+
+-- Reference to the multiHTTPClient_Instances handle
+local multiHTTPClient_Instances
+
+--- Function to react if FlowConfig was updated
+local function handleOnClearOldFlow()
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ for i = 1, # multiHTTPClient_Instances do
+ if multiHTTPClient_Instances[i].parameters.flowConfigPriority then
+ CSK_MultiHTTPClient.clearFlowConfigRelevantConfiguration()
+ break
+ end
+ end
+ end
+end
+Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)
+
+--- Function to get access to the multiHTTPClient_Instances
+---@param handle handle Handle of multiHTTPClient_Instances object
+local function setMultiHTTPClient_Instances_Handle(handle)
+ multiHTTPClient_Instances = handle
+end
+
+return setMultiHTTPClient_Instances_Handle
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/FlowConfig/MultiHTTPClient_SendRequest.lua b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/FlowConfig/MultiHTTPClient_SendRequest.lua
new file mode 100644
index 0000000..349026d
--- /dev/null
+++ b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/FlowConfig/MultiHTTPClient_SendRequest.lua
@@ -0,0 +1,67 @@
+-- Block namespace
+local BLOCK_NAMESPACE = 'MultiHTTPClient_FC.SendRequest'
+local nameOfModule = 'CSK_MultiHTTPClient'
+
+--*************************************************************
+--*************************************************************
+
+-- Required to keep track of already allocated resource
+local instanceTable = {}
+
+local function sendRequest(handle, source)
+
+ local instance = Container.get(handle, 'Instance')
+ local requestName = Container.get(handle, 'RequestName')
+ local mode = Container.get(handle, 'Mode')
+ local endpoint = Container.get(handle, 'Endpoint')
+ local port = Container.get(handle, 'Port')
+
+ -- Check if amount of instances is valid
+ -- if not: add multiple additional instances
+ while true do
+ local amount = CSK_MultiHTTPClient.getInstancesAmount()
+ if amount < instance then
+ CSK_MultiHTTPClient.addInstance()
+ else
+ CSK_MultiHTTPClient.setSelectedInstance(instance)
+
+ CSK_MultiHTTPClient.addRequest(requestName, mode, endpoint, port, source, false)
+ break
+ end
+ end
+
+ return 'CSK_MultiHTTPClient.OnNewResponse' .. tostring(instance) .. '_' .. tostring(requestName)
+end
+Script.serveFunction(BLOCK_NAMESPACE .. '.sendRequest', sendRequest)
+
+--*************************************************************
+--*************************************************************
+
+local function create(instance, requestName, mode, endpoint, port)
+
+ local fullInstanceName = tostring(instance) .. tostring(requestName)
+
+ -- Check if same instance is already configured
+ if instance < 1 or nil ~= instanceTable[fullInstanceName] then
+ _G.logger:warning(nameOfModule .. ': Instance invalid or already in use, please choose another one')
+ return nil
+ else
+ -- Otherwise create handle and store the restriced resource
+ local handle = Container.create()
+ instanceTable[instance] = instance
+ Container.add(handle, 'Instance', instance)
+ Container.add(handle, 'RequestName', requestName)
+ Container.add(handle, 'Mode', mode)
+ Container.add(handle, 'Endpoint', endpoint)
+ Container.add(handle, 'Port', port)
+ return handle
+ end
+end
+Script.serveFunction(BLOCK_NAMESPACE .. '.create', create)
+
+--- Function to reset instances if FlowConfig was cleared
+local function handleOnClearOldFlow()
+ Script.releaseObject(instanceTable)
+ instanceTable = {}
+end
+Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)
\ No newline at end of file
diff --git a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Controller.lua b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Controller.lua
index 22cd1bb..7bf3057 100644
--- a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Controller.lua
+++ b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Controller.lua
@@ -38,6 +38,9 @@ Script.serveEvent("CSK_MultiHTTPClient.OnNewValueUpdateNUM", "MultiHTTPClient_On
-- Real events
--------------------------------------------------
+Script.serveEvent('CSK_MultiHTTPClient.OnNewStatusModuleVersion', 'MultiHTTPClient_OnNewStatusModuleVersion')
+Script.serveEvent('CSK_MultiHTTPClient.OnNewStatusCSKStyle', 'MultiHTTPClient_OnNewStatusCSKStyle')
+Script.serveEvent('CSK_MultiHTTPClient.OnNewStatusModuleIsActive', 'MultiHTTPClient_OnNewStatusModuleIsActive')
Script.serveEvent('CSK_MultiHTTPClient.OnNewStatusClientActivated', 'MultiHTTPClient_OnNewStatusClientActivated')
Script.serveEvent('CSK_MultiHTTPClient.OnNewStatusClientAuthentication', 'MultiHTTPClient_OnNewStatusClientAuthentication')
@@ -80,6 +83,7 @@ Script.serveEvent('CSK_MultiHTTPClient.OnNewStatusExtendedResponse', 'MultiHTTPC
Script.serveEvent("CSK_MultiHTTPClient.OnNewStatusLoadParameterOnReboot", "MultiHTTPClient_OnNewStatusLoadParameterOnReboot")
Script.serveEvent("CSK_MultiHTTPClient.OnPersistentDataModuleAvailable", "MultiHTTPClient_OnPersistentDataModuleAvailable")
Script.serveEvent("CSK_MultiHTTPClient.OnNewParameterName", "MultiHTTPClient_OnNewParameterName")
+Script.serveEvent('CSK_MultiHTTPClient.OnNewStatusFlowConfigPriority', 'MultiHTTPClient_OnNewStatusFlowConfigPriority')
Script.serveEvent("CSK_MultiHTTPClient.OnNewInstanceList", "MultiHTTPClient_OnNewInstanceList")
Script.serveEvent("CSK_MultiHTTPClient.OnNewProcessingParameter", "MultiHTTPClient_OnNewProcessingParameter")
@@ -131,6 +135,7 @@ local function createInterfaceList()
return helperFuncs.createStringListFromList({'ETH1'})
else
local interfaceList = Ethernet.Interface.getInterfaces()
+ table.insert(interfaceList, 'Localhost')
return helperFuncs.createStringListFromList(interfaceList)
end
end
@@ -268,79 +273,93 @@ end
--- Function to send all relevant values to UI on resume
local function handleOnExpiredTmrMultiHTTPClient()
- updateUserLevel()
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusModuleVersion", 'v' .. multiHTTPClient_Model.version)
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusCSKStyle", multiHTTPClient_Model.styleForUI)
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusModuleIsActive", _G.availableAPIs.default and _G.availableAPIs.specific)
- Script.notifyEvent("MultiHTTPClient_OnNewInstanceList", helperFuncs.createStringListBySize(#multiHTTPClient_Instances))
- Script.notifyEvent('MultiHTTPClient_OnNewSelectedInstance', selectedInstance)
- Script.notifyEvent('MultiHTTPClient_OnNewInterfaceDropdown', createInterfaceList())
- Script.notifyEvent('MultiHTTPClient_OnNewInterface', multiHTTPClient_Instances[selectedInstance].parameters.interface)
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
- Script.notifyEvent('MultiHTTPClient_OnNewStatusClientActivated', multiHTTPClient_Instances[selectedInstance].parameters.clientActivated)
- Script.notifyEvent('MultiHTTPClient_OnNewStatusClientAuthentication', multiHTTPClient_Instances[selectedInstance].parameters.clientAuthentication)
-
- Script.notifyEvent('MultiHTTPClient_OnNewClientCertificateType', multiHTTPClient_Instances[selectedInstance].parameters.clientCertificateType)
- Script.notifyEvent('MultiHTTPClient_OnNewClientCertificateKeyType', multiHTTPClient_Instances[selectedInstance].parameters.clientCertificateKeyType)
- Script.notifyEvent('MultiHTTPClient_OnNewCookieStore', multiHTTPClient_Instances[selectedInstance].parameters.cookieStore)
-
- Script.notifyEvent('MultiHTTPClient_OnNewProxyEnableStatus', multiHTTPClient_Instances[selectedInstance].parameters.proxyEnabled)
- Script.notifyEvent('MultiHTTPClient_OnNewProxyUsername', multiHTTPClient_Instances[selectedInstance].parameters.proxyUsername)
- Script.notifyEvent('MultiHTTPClient_OnNewProxyPassword', multiHTTPClient_Instances[selectedInstance].parameters.proxyPassword)
- Script.notifyEvent('MultiHTTPClient_OnNewProxyURL', multiHTTPClient_Instances[selectedInstance].parameters.proxyURL)
- Script.notifyEvent('MultiHTTPClient_OnNewProxyPort', multiHTTPClient_Instances[selectedInstance].parameters.proxyPort)
- Script.notifyEvent('MultiHTTPClient_OnNewVerboseMode', multiHTTPClient_Instances[selectedInstance].parameters.verboseMode)
- Script.notifyEvent('MultiHTTPClient_OnNewQueueSize', multiHTTPClient_Instances[selectedInstance].parameters.queueSize)
- Script.notifyEvent('MultiHTTPClient_OnNewHostnameVerification', multiHTTPClient_Instances[selectedInstance].parameters.hostnameVerification)
- Script.notifyEvent('MultiHTTPClient_OnNewPeerVerification', multiHTTPClient_Instances[selectedInstance].parameters.peerVerification)
-
- Script.notifyEvent('MultiHTTPClient_OnNewRequestEndpoint', multiHTTPClient_Instances[selectedInstance].requestEndpoint)
- Script.notifyEvent('MultiHTTPClient_OnNewRequestMode', multiHTTPClient_Instances[selectedInstance].requestMode)
- Script.notifyEvent('MultiHTTPClient_OnNewRequestPort', multiHTTPClient_Instances[selectedInstance].requestPort)
-
- Script.notifyEvent('MultiHTTPClient_OnNewHeaderList', helperFuncs.createJsonList(multiHTTPClient_Instances[selectedInstance].headers))
- Script.notifyEvent('MultiHTTPClient_OnNewSelectedHeader', multiHTTPClient_Instances[selectedInstance].selectedHeaderKey)
- if multiHTTPClient_Instances[selectedInstance].headers[multiHTTPClient_Instances[selectedInstance].selectedHeaderKey] then
- Script.notifyEvent('MultiHTTPClient_OnNewHeaderKey', multiHTTPClient_Instances[selectedInstance].headerKey)
- Script.notifyEvent('MultiHTTPClient_OnNewHeaderValue', multiHTTPClient_Instances[selectedInstance].headerValue)
- else
- Script.notifyEvent('MultiHTTPClient_OnNewHeaderKey', '')
- Script.notifyEvent('MultiHTTPClient_OnNewHeaderValue', '')
- end
+ updateUserLevel()
+
+ Script.notifyEvent("MultiHTTPClient_OnNewInstanceList", helperFuncs.createStringListBySize(#multiHTTPClient_Instances))
+ Script.notifyEvent('MultiHTTPClient_OnNewSelectedInstance', selectedInstance)
+ Script.notifyEvent('MultiHTTPClient_OnNewInterfaceDropdown', createInterfaceList())
+ Script.notifyEvent('MultiHTTPClient_OnNewInterface', multiHTTPClient_Instances[selectedInstance].parameters.interface)
- Script.notifyEvent('MultiHTTPClient_OnNewStatusRequestContentDisabled', multiHTTPClient_Instances[selectedInstance].requestMode == ('GET' or 'DELETE'))
- Script.notifyEvent('MultiHTTPClient_OnNewRequestContent', multiHTTPClient_Instances[selectedInstance].requestContent)
- Script.notifyEvent('MultiHTTPClient_OnNewRequestContentType', multiHTTPClient_Instances[selectedInstance].requestContentType)
+ Script.notifyEvent('MultiHTTPClient_OnNewStatusClientActivated', multiHTTPClient_Instances[selectedInstance].parameters.clientActivated)
+ Script.notifyEvent('MultiHTTPClient_OnNewStatusClientAuthentication', multiHTTPClient_Instances[selectedInstance].parameters.clientAuthentication)
- Script.notifyEvent('MultiHTTPClient_OnNewStatusExtendedResponse', multiHTTPClient_Instances[selectedInstance].parameters.extendedResponse)
- Script.notifyEvent('MultiHTTPClient_OnNewResponseMessage', '')
+ Script.notifyEvent('MultiHTTPClient_OnNewClientCertificateType', multiHTTPClient_Instances[selectedInstance].parameters.clientCertificateType)
+ Script.notifyEvent('MultiHTTPClient_OnNewClientCertificateKeyType', multiHTTPClient_Instances[selectedInstance].parameters.clientCertificateKeyType)
+ Script.notifyEvent('MultiHTTPClient_OnNewCookieStore', multiHTTPClient_Instances[selectedInstance].parameters.cookieStore)
+
+ Script.notifyEvent('MultiHTTPClient_OnNewProxyEnableStatus', multiHTTPClient_Instances[selectedInstance].parameters.proxyEnabled)
+ Script.notifyEvent('MultiHTTPClient_OnNewProxyUsername', multiHTTPClient_Instances[selectedInstance].parameters.proxyUsername)
+ Script.notifyEvent('MultiHTTPClient_OnNewProxyPassword', multiHTTPClient_Instances[selectedInstance].parameters.proxyPassword)
+ Script.notifyEvent('MultiHTTPClient_OnNewProxyURL', multiHTTPClient_Instances[selectedInstance].parameters.proxyURL)
+ Script.notifyEvent('MultiHTTPClient_OnNewProxyPort', multiHTTPClient_Instances[selectedInstance].parameters.proxyPort)
+ Script.notifyEvent('MultiHTTPClient_OnNewVerboseMode', multiHTTPClient_Instances[selectedInstance].parameters.verboseMode)
+ Script.notifyEvent('MultiHTTPClient_OnNewQueueSize', multiHTTPClient_Instances[selectedInstance].parameters.queueSize)
+ Script.notifyEvent('MultiHTTPClient_OnNewHostnameVerification', multiHTTPClient_Instances[selectedInstance].parameters.hostnameVerification)
+ Script.notifyEvent('MultiHTTPClient_OnNewPeerVerification', multiHTTPClient_Instances[selectedInstance].parameters.peerVerification)
+
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestEndpoint', multiHTTPClient_Instances[selectedInstance].requestEndpoint)
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestMode', multiHTTPClient_Instances[selectedInstance].requestMode)
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestPort', multiHTTPClient_Instances[selectedInstance].requestPort)
+
+ Script.notifyEvent('MultiHTTPClient_OnNewHeaderList', helperFuncs.createJsonList(multiHTTPClient_Instances[selectedInstance].headers))
+ Script.notifyEvent('MultiHTTPClient_OnNewSelectedHeader', multiHTTPClient_Instances[selectedInstance].selectedHeaderKey)
+ if multiHTTPClient_Instances[selectedInstance].headers[multiHTTPClient_Instances[selectedInstance].selectedHeaderKey] then
+ Script.notifyEvent('MultiHTTPClient_OnNewHeaderKey', multiHTTPClient_Instances[selectedInstance].headerKey)
+ Script.notifyEvent('MultiHTTPClient_OnNewHeaderValue', multiHTTPClient_Instances[selectedInstance].headerValue)
+ else
+ Script.notifyEvent('MultiHTTPClient_OnNewHeaderKey', '')
+ Script.notifyEvent('MultiHTTPClient_OnNewHeaderValue', '')
+ end
- Script.notifyEvent('MultiHTTPClient_OnNewRequestName', multiHTTPClient_Instances[selectedInstance].requestName)
- Script.notifyEvent("MultiHTTPClient_OnNewStatusRegisteredEvent", multiHTTPClient_Instances[selectedInstance].registeredEvent)
- Script.notifyEvent('MultiHTTPClient_OnNewRequestPeriodicStatus', multiHTTPClient_Instances[selectedInstance].requestPeriodic)
- Script.notifyEvent('MultiHTTPClient_OnNewRequestPeriod', multiHTTPClient_Instances[selectedInstance].requestPeriod)
- Script.notifyEvent('MultiHTTPClient_OnNewRequestsTable', getRequestsTableContent())
+ Script.notifyEvent('MultiHTTPClient_OnNewStatusRequestContentDisabled', multiHTTPClient_Instances[selectedInstance].requestMode == ('GET' or 'DELETE'))
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestContent', multiHTTPClient_Instances[selectedInstance].requestContent)
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestContentType', multiHTTPClient_Instances[selectedInstance].requestContentType)
- Script.notifyEvent("MultiHTTPClient_OnNewStatusLoadParameterOnReboot", multiHTTPClient_Instances[selectedInstance].parameterLoadOnReboot)
- Script.notifyEvent("MultiHTTPClient_OnPersistentDataModuleAvailable", multiHTTPClient_Instances[selectedInstance].persistentModuleAvailable)
- Script.notifyEvent("MultiHTTPClient_OnNewParameterName", multiHTTPClient_Instances[selectedInstance].parametersName)
+ Script.notifyEvent('MultiHTTPClient_OnNewStatusExtendedResponse', multiHTTPClient_Instances[selectedInstance].parameters.extendedResponse)
+ Script.notifyEvent('MultiHTTPClient_OnNewResponseMessage', '')
+
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestName', multiHTTPClient_Instances[selectedInstance].requestName)
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusRegisteredEvent", multiHTTPClient_Instances[selectedInstance].registeredEvent)
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestPeriodicStatus', multiHTTPClient_Instances[selectedInstance].requestPeriodic)
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestPeriod', multiHTTPClient_Instances[selectedInstance].requestPeriod)
+ Script.notifyEvent('MultiHTTPClient_OnNewRequestsTable', getRequestsTableContent())
+
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusLoadParameterOnReboot", multiHTTPClient_Instances[selectedInstance].parameterLoadOnReboot)
+ Script.notifyEvent("MultiHTTPClient_OnPersistentDataModuleAvailable", multiHTTPClient_Instances[selectedInstance].persistentModuleAvailable)
+ Script.notifyEvent("MultiHTTPClient_OnNewParameterName", multiHTTPClient_Instances[selectedInstance].parametersName)
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusFlowConfigPriority", multiHTTPClient_Instances[selectedInstance].parameters.flowConfigPriority)
+ end
end
Timer.register(tmrMultiHTTPClient, "OnExpired", handleOnExpiredTmrMultiHTTPClient)
-- ********************* UI Setting / Submit Functions Start ********************
local function pageCalled()
- updateUserLevel() -- try to hide user specific content asap
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ updateUserLevel() -- try to hide user specific content asap
+ end
tmrMultiHTTPClient:start()
return ''
end
Script.serveFunction("CSK_MultiHTTPClient.pageCalled", pageCalled)
local function setSelectedInstance(instance)
- selectedInstance = instance
- _G.logger:fine(nameOfModule .. ": New selected instance = " .. tostring(selectedInstance))
- multiHTTPClient_Instances[selectedInstance].activeInUI = true
- Script.notifyEvent('MultiHTTPClient_OnNewProcessingParameter', selectedInstance, 'activeInUI', true)
- multiHTTPClient_Instances[selectedInstance].selectedRequest = nil
- handleOnExpiredTmrMultiHTTPClient()
+ if #multiHTTPClient_Instances >= instance then
+ selectedInstance = instance
+ _G.logger:fine(nameOfModule .. ": New selected instance = " .. tostring(selectedInstance))
+ multiHTTPClient_Instances[selectedInstance].activeInUI = true
+ Script.notifyEvent('MultiHTTPClient_OnNewProcessingParameter', selectedInstance, 'activeInUI', true)
+ multiHTTPClient_Instances[selectedInstance].selectedRequest = nil
+ handleOnExpiredTmrMultiHTTPClient()
+ else
+ _G.logger:warning(nameOfModule .. ": Selected instance does not exist.")
+ end
end
Script.serveFunction("CSK_MultiHTTPClient.setSelectedInstance", setSelectedInstance)
@@ -720,12 +739,22 @@ local function createRequestParameters()
return requestParameters
end
-local function addRequest()
- if multiHTTPClient_Instances[selectedInstance].requestName ~= '' then
- if multiHTTPClient_Instances[selectedInstance].parameters.requests[multiHTTPClient_Instances[selectedInstance].requestName] then
+local function addRequest(name, mode, endpoint, port, event, periodic, period)
+
+ if name ~= '' then
+ if multiHTTPClient_Instances[selectedInstance].parameters.requests[name] then
_G.logger:fine(nameOfModule .. ": Request with this name already exists.")
else
_G.logger:fine(nameOfModule .. ": Add request to instance" .. tostring(selectedInstance))
+
+ multiHTTPClient_Instances[selectedInstance].requestName = name
+ multiHTTPClient_Instances[selectedInstance].requestMode = mode
+ multiHTTPClient_Instances[selectedInstance].requestEndpoint = 'http://' .. endpoint
+ multiHTTPClient_Instances[selectedInstance].requestPort = port
+ multiHTTPClient_Instances[selectedInstance].registeredEvent = event or ''
+ multiHTTPClient_Instances[selectedInstance].requestPeriodic = periodic
+ multiHTTPClient_Instances[selectedInstance].requestPeriod = period or 0
+
local requestToAdd = createRequestParameters()
multiHTTPClient_Instances[selectedInstance].parameters.requests[multiHTTPClient_Instances[selectedInstance].requestName] = requestToAdd
@@ -761,7 +790,7 @@ local function addEditRequestViaUI()
_G.logger:fine(nameOfModule .. ": Not possible to change request name. Delete request and create a new one.")
end
else
- addRequest()
+ addRequest(multiHTTPClient_Instances[selectedInstance].requestName, multiHTTPClient_Instances[selectedInstance].requestMode, multiHTTPClient_Instances[selectedInstance].requestEndpoint, multiHTTPClient_Instances[selectedInstance].requestPort, multiHTTPClient_Instances[selectedInstance].registeredEvent, multiHTTPClient_Instances[selectedInstance].requestPeriodic, multiHTTPClient_Instances[selectedInstance].requestPeriod)
end
handleOnExpiredTmrMultiHTTPClient()
end
@@ -829,7 +858,11 @@ end
Script.serveFunction('CSK_MultiHTTPClient.setExtendedResponse', setExtendedResponse)
local function getInstancesAmount ()
- return #multiHTTPClient_Instances
+ if multiHTTPClient_Instances then
+ return #multiHTTPClient_Instances
+ else
+ return 0
+ end
end
Script.serveFunction("CSK_MultiHTTPClient.getInstancesAmount", getInstancesAmount)
@@ -859,6 +892,30 @@ local function resetInstances()
end
Script.serveFunction('CSK_MultiHTTPClient.resetInstances', resetInstances)
+local function getStatusModuleActive()
+ return _G.availableAPIs.default and _G.availableAPIs.specific
+end
+Script.serveFunction('CSK_MultiHTTPClient.getStatusModuleActive', getStatusModuleActive)
+
+local function clearFlowConfigRelevantConfiguration()
+ for i = 1, #multiHTTPClient_Instances do
+ for key, value in pairs(multiHTTPClient_Instances[i].parameters.requests) do
+ setSelectedRequest(key)
+ removeRequest()
+ end
+ end
+end
+Script.serveFunction('CSK_MultiHTTPClient.clearFlowConfigRelevantConfiguration', clearFlowConfigRelevantConfiguration)
+
+local function getParameters(instanceNo)
+ if instanceNo <= #multiHTTPClient_Instances then
+ return helperFuncs.json.encode(multiHTTPClient_Instances[instanceNo].parameters)
+ else
+ return ''
+ end
+end
+Script.serveFunction('CSK_MultiHTTPClient.getParameters', getParameters)
+
-- *****************************************************************
-- Following function can be adapted for CSK_PersistentData module usage
-- *****************************************************************
@@ -869,7 +926,7 @@ local function setParameterName(name)
end
Script.serveFunction("CSK_MultiHTTPClient.setParameterName", setParameterName)
-local function sendParameters()
+local function sendParameters(noDataSave)
if multiHTTPClient_Instances[selectedInstance].persistentModuleAvailable then
CSK_PersistentData.addParameter(helperFuncs.convertTable2Container(multiHTTPClient_Instances[selectedInstance].parameters), multiHTTPClient_Instances[selectedInstance].parametersName)
@@ -880,7 +937,9 @@ local function sendParameters()
CSK_PersistentData.setModuleParameterName(nameOfModule, multiHTTPClient_Instances[selectedInstance].parametersName, multiHTTPClient_Instances[selectedInstance].parameterLoadOnReboot, tostring(selectedInstance))
end
_G.logger:fine(nameOfModule .. ": Send MultiHTTPClient parameters with name '" .. multiHTTPClient_Instances[selectedInstance].parametersName .. "' to CSK_PersistentData module.")
- CSK_PersistentData.saveData()
+ if not noDataSave then
+ CSK_PersistentData.saveData()
+ end
else
_G.logger:warning(nameOfModule .. ": CSK_PersistentData module not available.")
end
@@ -891,72 +950,108 @@ local function loadParameters()
if multiHTTPClient_Instances[selectedInstance].persistentModuleAvailable then
local data = CSK_PersistentData.getParameter(multiHTTPClient_Instances[selectedInstance].parametersName)
if data then
- _G.logger:fine(nameOfModule .. ": Loaded parameters for multiHTTPClientObject " .. tostring(selectedInstance) .. " from CSK_PersistentData module.")
+ _G.logger:info(nameOfModule .. ": Loaded parameters for multiHTTPClientObject " .. tostring(selectedInstance) .. " from CSK_PersistentData module.")
multiHTTPClient_Instances[selectedInstance].parameters = helperFuncs.convertContainer2Table(data)
-- If something needs to be configured/activated with new loaded data
Script.notifyEvent('MultiHTTPClient_OnNewProcessingParameter', selectedInstance, 'fullSetup', data)
--announceExternalEventsAndFunctions() -- future usage
CSK_MultiHTTPClient.pageCalled()
+ tmrMultiHTTPClient:start()
+ return true
else
_G.logger:warning(nameOfModule .. ": Loading parameters from CSK_PersistentData module did not work.")
+ tmrMultiHTTPClient:start()
+ return false
end
else
_G.logger:warning(nameOfModule .. ": CSK_PersistentData module not available.")
+ tmrMultiHTTPClient:start()
+ return false
end
- tmrMultiHTTPClient:start()
end
Script.serveFunction("CSK_MultiHTTPClient.loadParameters", loadParameters)
local function setLoadOnReboot(status)
multiHTTPClient_Instances[selectedInstance].parameterLoadOnReboot = status
_G.logger:fine(nameOfModule .. ": Set new status to load setting on reboot: " .. tostring(status))
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusLoadParameterOnReboot", status)
end
Script.serveFunction("CSK_MultiHTTPClient.setLoadOnReboot", setLoadOnReboot)
+local function setFlowConfigPriority(status)
+ multiHTTPClient_Instances[selectedInstance].parameters.flowConfigPriority = status
+ _G.logger:fine(nameOfModule .. ": Set new status of FlowConfig priority: " .. tostring(status))
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusFlowConfigPriority", multiHTTPClient_Instances[selectedInstance].parameters.flowConfigPriority)
+end
+Script.serveFunction('CSK_MultiHTTPClient.setFlowConfigPriority', setFlowConfigPriority)
+
--- Function to react on initial load of persistent parameters
local function handleOnInitialDataLoaded()
- _G.logger:fine(nameOfModule .. ': Try to initially load parameter from CSK_PersistentData module.')
- if string.sub(CSK_PersistentData.getVersion(), 1, 1) == '1' then
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
- _G.logger:warning(nameOfModule .. ': CSK_PersistentData module is too old and will not work. Please update CSK_PersistentData module.')
+ _G.logger:fine(nameOfModule .. ': Try to initially load parameter from CSK_PersistentData module.')
+ if string.sub(CSK_PersistentData.getVersion(), 1, 1) == '1' then
- for j = 1, #multiHTTPClient_Instances do
- multiHTTPClient_Instances[j].persistentModuleAvailable = false
- end
- else
- -- Check if CSK_PersistentData version is >= 3.0.0
- if tonumber(string.sub(CSK_PersistentData.getVersion(), 1, 1)) >= 3 then
- local parameterName, loadOnReboot, totalInstances = CSK_PersistentData.getModuleParameterName(nameOfModule, '1')
- -- Check for amount if instances to create
- if totalInstances then
- local c = 2
- while c <= totalInstances do
- addInstance()
- c = c+1
+ _G.logger:warning(nameOfModule .. ': CSK_PersistentData module is too old and will not work. Please update CSK_PersistentData module.')
+
+ for j = 1, #multiHTTPClient_Instances do
+ multiHTTPClient_Instances[j].persistentModuleAvailable = false
+ end
+ else
+ -- Check if CSK_PersistentData version is >= 3.0.0
+ if tonumber(string.sub(CSK_PersistentData.getVersion(), 1, 1)) >= 3 then
+ local parameterName, loadOnReboot, totalInstances = CSK_PersistentData.getModuleParameterName(nameOfModule, '1')
+ -- Check for amount if instances to create
+ if totalInstances then
+ local c = 2
+ while c <= totalInstances do
+ addInstance()
+ c = c+1
+ end
end
end
- end
-
- for i = 1, #multiHTTPClient_Instances do
- local parameterName, loadOnReboot = CSK_PersistentData.getModuleParameterName(nameOfModule, tostring(i))
- if parameterName then
- multiHTTPClient_Instances[i].parametersName = parameterName
- multiHTTPClient_Instances[i].parameterLoadOnReboot = loadOnReboot
+ if not multiHTTPClient_Instances then
+ return
end
- if multiHTTPClient_Instances[i].parameterLoadOnReboot then
- setSelectedInstance(i)
- loadParameters()
+ for i = 1, #multiHTTPClient_Instances do
+ local parameterName, loadOnReboot = CSK_PersistentData.getModuleParameterName(nameOfModule, tostring(i))
+
+ if parameterName then
+ multiHTTPClient_Instances[i].parametersName = parameterName
+ multiHTTPClient_Instances[i].parameterLoadOnReboot = loadOnReboot
+ end
+
+ if multiHTTPClient_Instances[i].parameterLoadOnReboot then
+ setSelectedInstance(i)
+ loadParameters()
+ end
end
+ Script.notifyEvent('MultiHTTPClient_OnDataLoadedOnReboot')
end
- Script.notifyEvent('MultiHTTPClient_OnDataLoadedOnReboot')
end
end
Script.register("CSK_PersistentData.OnInitialDataLoaded", handleOnInitialDataLoaded)
+local function resetModule()
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ clearFlowConfigRelevantConfiguration()
+ for i = 1, #multiHTTPClient_Instances do
+ setClientActivated(false)
+ end
+ pageCalled()
+ end
+end
+Script.serveFunction('CSK_MultiHTTPClient.resetModule', resetModule)
+Script.register("CSK_PersistentData.OnResetAllModules", resetModule)
+
+-- *************************************************
+-- END of functions for CSK_PersistentData module usage
+-- *************************************************
+
return funcs
--**************************************************************************
diff --git a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Model.lua b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Model.lua
index a505840..ff248e8 100644
--- a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Model.lua
+++ b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/MultiHTTPClient_Model.lua
@@ -13,12 +13,22 @@ local nameOfModule = 'CSK_MultiHTTPClient'
local multiHTTPClient = {}
multiHTTPClient.__index = multiHTTPClient
+multiHTTPClient.styleForUI = 'None' -- Optional parameter to set UI style
+multiHTTPClient.version = Engine.getCurrentAppVersion() -- Version of module
+
--**************************************************************************
--********************** End Global Scope **********************************
--**************************************************************************
--**********************Start Function Scope *******************************
--**************************************************************************
+--- Function to react on UI style change
+local function handleOnStyleChanged(theme)
+ multiHTTPClient.styleForUI = theme
+ Script.notifyEvent("MultiHTTPClient_OnNewStatusCSKStyle", multiHTTPClient.styleForUI)
+end
+Script.register('CSK_PersistentData.OnNewStatusCSKStyle', handleOnStyleChanged)
+
--- Function to create new instance
---@param multiHTTPClientInstanceNo int Number of instance
---@return table[] self Instance of multiHTTPClient
@@ -49,7 +59,7 @@ function multiHTTPClient.create(multiHTTPClientInstanceNo)
self.requestMode = 'POST' -- Request mode like 'PUT', 'POST', 'GET', ...
self.requestEndpoint = 'http://192.168.0.10/api/crown/DateTime/getDateTime' -- Endpoint of request
self.requestPort = 80 -- Port for request
- self.requestName = '' -- Name of request to use
+ self.requestName = 'NameOfRequest' -- Name of request to use
self.requestContent = '' -- Content payload of request
self.requestContentType = 'application/json' -- Type of payload content
self.requestPeriodic = false -- Status if request should be triggered periodically
@@ -67,6 +77,7 @@ function multiHTTPClient.create(multiHTTPClientInstanceNo)
-- Parameters to be saved permanently if wanted
self.parameters = {}
+ self.parameters.flowConfigPriority = CSK_FlowConfig ~= nil or false -- Status if FlowConfig should have priority for FlowConfig relevant configurations
self.parameters.processingFile = 'CSK_MultiHTTPClient_Processing' -- which file to use for processing (will be started in own thread)
self.parameters.clientActivated = false -- Set if HTTP client should be active
self.parameters.proxyEnabled = false -- Status if proxy is enabled
diff --git a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/helper/checkAPIs.lua b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/helper/checkAPIs.lua
index aae571b..58deb19 100644
--- a/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/helper/checkAPIs.lua
+++ b/CSK_Module_MultiHTTPClient/scripts/Communication/MultiHTTPClient/helper/checkAPIs.lua
@@ -5,18 +5,18 @@
local availableAPIs = {}
+-- Function to load all default APIs
local function loadAPIs()
CSK_MultiHTTPClient = require 'API.CSK_MultiHTTPClient'
- Cipher = {}
- Cipher.AES = require 'API.Cipher.AES'
+ Log = require 'API.Log'
+ Log.Handler = require 'API.Log.Handler'
+ Log.SharedLogger = require 'API.Log.SharedLogger'
+
Container = require 'API.Container'
DateTime = require 'API.DateTime'
Engine = require 'API.Engine'
File = require 'API.File'
- Log = require 'API.Log'
- Log.Handler = require 'API.Log.Handler'
- Log.SharedLogger = require 'API.Log.SharedLogger'
Object = require 'API.Object'
Timer = require 'API.Timer'
@@ -27,10 +27,13 @@ local function loadAPIs()
CSK_PersistentData = require 'API.CSK_PersistentData'
elseif appList[i] == 'CSK_Module_UserManagement' then
CSK_UserManagement = require 'API.CSK_UserManagement'
+ elseif appList[i] == 'CSK_Module_FlowConfig' then
+ CSK_FlowConfig = require 'API.CSK_FlowConfig'
end
end
end
+-- Function to load specific APIs
local function loadSpecificAPIs()
-- If you want to check for specific APIs/functions supported on the device the module is running, place relevant APIs here
@@ -40,6 +43,9 @@ local function loadSpecificAPIs()
Ethernet = require 'API.Ethernet'
Ethernet.Interface = require 'API.Ethernet.Interface'
+
+ Cipher = {}
+ Cipher.AES = require 'API.Cipher.AES'
end
availableAPIs.default = xpcall(loadAPIs, debug.traceback) -- TRUE if all default APIs were loaded correctly
diff --git a/README.md b/README.md
index 0ed0fcc..49cc547 100644
--- a/README.md
+++ b/README.md
@@ -13,10 +13,13 @@ If you want to make use of a domain name for an endpoint, please make sure that
## Information
-Tested on:
-|Device|Firmware|Module version
+Tested on
+
+|Device|Firmware|Module version|
|--|--|--|
-|SIM 1012|V2.3.0|V1.0.0|
+|SICK AppEngine|V1.7.0|V2.0.0|
+|SIM1012|V2.4.2|V2.0.0|
+|SIM1012|V2.3.0|V1.0.0|
This module is part of the SICK AppSpace Coding Starter Kit developing approach.
It is programmed in an object-oriented way. Some of the modules use kind of "classes" in Lua to make it possible to reuse code / classes in other projects.
diff --git a/docu/CSK_Module_MultiHTTPClient.html b/docu/CSK_Module_MultiHTTPClient.html
index 7c47751..17acfa6 100644
--- a/docu/CSK_Module_MultiHTTPClient.html
+++ b/docu/CSK_Module_MultiHTTPClient.html
@@ -6,7 +6,7 @@
-
Documentation - CSK_Module_MultiHTTPClient 1.0.0
+Documentation - CSK_Module_MultiHTTPClient 2.0.0