Skip to content

Commit 734a8b3

Browse files
committed
Draft version
1 parent 01f3794 commit 734a8b3

File tree

20 files changed

+2766
-5
lines changed

20 files changed

+2766
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"showLoginButton": false
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Add project wide CSS settings here */
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "CSK_Module_RecipeManager",
3+
"version": "1.0.0",
4+
"description": "Generated",
5+
"components": [
6+
"@sick-davinci/basic-elements"
7+
],
8+
"dependencies": {
9+
"@sick-davinci/basic-elements": "^5.0.5"
10+
}
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.myCustomFrame_CSK_Module_RecipeManager {
2+
border-style: solid;
3+
border-width: 1px;
4+
border-color: grey;
5+
margin: 6px;
6+
}
7+
8+
.myCustomCssClass_CSK_Module_RecipeManager {
9+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<layout-row id="RowLayout1">
2+
<layout-column id="ColumnLayout1" style="align-items:stretch">
3+
<stacked-view id="SV_Login">
4+
<stacked-pane id="SP_LoginOK" value="true">
5+
<layout-column id="Column_PersistentData"
6+
class="myCustomFrame_CSK_Module_RecipeManager"
7+
style="align-items: stretch">
8+
<layout-row id="RowLayout4"
9+
style="justify-content: space-between; align-items: center">
10+
<layout-column id="ColumnLayout5" style="align-items: stretch">
11+
<davinci-value-display id="VD_ParameterName" value="Parameter name:"
12+
title="Name of the parameters within the CSK_PersistentData module to be uses for this module.">
13+
</davinci-value-display>
14+
</layout-column>
15+
<layout-column id="ColumnLayout6" style="align-items: stretch">
16+
<davinci-text-field id="TF_ParameterName" type="text"
17+
title="Name of the parameters within the CSK_PersistentData module to be uses for this module.">
18+
<crown-edpws-binding property="value"
19+
name="CSK_RecipeManager/OnNewParameterName" update-on-resume>
20+
</crown-edpws-binding>
21+
<crown-binding event="change" name="CSK_RecipeManager/setParameterName"
22+
path="param/args/name" auto-commit>
23+
</crown-binding>
24+
<crown-edpws-binding property="disabled"
25+
name="CSK_RecipeManager/OnPersistentDataModuleAvailable"
26+
update-on-resume converter="function(value) {return !value;}">
27+
</crown-edpws-binding>
28+
</davinci-text-field>
29+
</layout-column>
30+
</layout-row>
31+
<layout-row id="RowLayout2"
32+
style="justify-content: space-between; align-items: center">
33+
<davinci-value-display id="VD_LoadConfig"
34+
value="Load config on app start:"
35+
title="Load configured parameters from CSK_PersistentData on app start.">
36+
</davinci-value-display>
37+
<davinci-checkbox id="CB_LoadConfig"
38+
title="Load configured parameters from CSK_PersistentData on app start.">
39+
<span></span>
40+
<crown-edpws-binding property="checked"
41+
name="CSK_RecipeManager/OnNewStatusLoadParameterOnReboot"
42+
update-on-resume>
43+
</crown-edpws-binding>
44+
<crown-edpws-binding property="disabled"
45+
name="CSK_RecipeManager/OnPersistentDataModuleAvailable"
46+
update-on-resume converter="function(value) {return !value;}">
47+
</crown-edpws-binding>
48+
<crown-binding event="change" name="CSK_RecipeManager/setLoadOnReboot"
49+
path="param/args/status" auto-commit>
50+
</crown-binding>
51+
</davinci-checkbox>
52+
</layout-row>
53+
<layout-row id="RowLayout3">
54+
<layout-column id="ColumnLayout3" style="align-items: stretch">
55+
<davinci-button id="B_LoadConfig" type="primary"
56+
icon-position="append"
57+
title="Load configured parameters from CSK_PersistentData module.">
58+
<span>Load Config</span>
59+
<crown-binding event="submit" name="CSK_RecipeManager/loadParameters"
60+
auto-commit>
61+
</crown-binding>
62+
<crown-edpws-binding property="disabled"
63+
name="CSK_RecipeManager/OnPersistentDataModuleAvailable"
64+
update-on-resume converter="function(value) {return !value;}">
65+
</crown-edpws-binding>
66+
</davinci-button>
67+
</layout-column>
68+
<layout-column id="ColumnLayout4" style="align-items: stretch">
69+
<davinci-button id="B_SaveConfig" type="primary"
70+
icon-position="append"
71+
title="Save current configured parameters of this module within CSK_PersistentData module.">
72+
<span>Save Config</span>
73+
<crown-binding event="submit" name="CSK_RecipeManager/sendParameters"
74+
auto-commit>
75+
</crown-binding>
76+
<crown-edpws-binding property="disabled"
77+
name="CSK_RecipeManager/OnPersistentDataModuleAvailable"
78+
update-on-resume converter="function(value) {return !value;}">
79+
</crown-edpws-binding>
80+
</davinci-button>
81+
</layout-column>
82+
</layout-row>
83+
</layout-column>
84+
</stacked-pane>
85+
<stacked-pane id="SP_LoginNotOK" value="false">
86+
<davinci-callout id="Callout1" type="info">
87+
<span>
88+
Please log in via CSK_UserManagement module (at least via user level "Operator")
89+
</span>
90+
</davinci-callout>
91+
</stacked-pane>
92+
<crown-edpws-binding property="value"
93+
name="CSK_RecipeManager/OnUserLevelOperatorActive" update-on-resume
94+
converter="function(value) {return value.toString();}">
95+
</crown-edpws-binding>
96+
</stacked-view>
97+
<stacked-view id="SV_PageCalled">
98+
<crown-binding property="value" name="CSK_RecipeManager/pageCalled"
99+
path="result/data/empty" auto-update="0" update-on-resume>
100+
</crown-binding>
101+
</stacked-view>
102+
</layout-column>
103+
<layout-column id="ColumnLayout2" style="flex-grow:3">
104+
</layout-column>
105+
106+
</layout-row>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "1.0",
3+
"pages": []
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function convertToList(value) {
2+
return JSON.parse(value)
3+
}

CSK_Module_RecipeManager/pages/src/index.ts

Whitespace-only changes.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<manifest>
3+
<application name="CSK_Module_RecipeManager">
4+
<crown name="CSK_Module_RecipeManager">
5+
<desc>This is an automatically generated CROWN (description not necessary).</desc>
6+
</crown>
7+
<crown name="CSK_RecipeManager">
8+
<trait>released</trait>
9+
<desc>Please fill in information regarding: What is the idea of this module and its features? +
10+
How to use this module in general.... like: +
11+
{empty} +
12+
Typically the features of this module are used like this (check also main script of this module): +
13+
**1) Setup** +
14+
ToDo +
15+
{empty} +
16+
**2) Something else...** +
17+
</desc>
18+
<serves>
19+
<event name="OnNewStatusLoadParameterOnReboot">
20+
<desc>Notify status if parameters should be loaded on app/device boot up.</desc>
21+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
22+
</event>
23+
<event name="OnPersistentDataModuleAvailable">
24+
<desc>Notify status if features of CSK_PersistendData module are available.</desc>
25+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
26+
</event>
27+
<event name="OnDataLoadedOnReboot">
28+
<desc>Event to call if module tried to load parameters and should be ready.</desc>
29+
</event>
30+
<event name="OnNewParameterName">
31+
<desc>Notify name of persistent data parameter.</desc>
32+
<param desc="Parameter name" multiplicity="1" name="name" type="string"/>
33+
</event>
34+
<event name="OnUserLevelOperatorActive">
35+
<desc>Status of Operator userlevel. Used internally in combination with the CSK_UserManagement module if available.</desc>
36+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
37+
</event>
38+
<event name="OnUserLevelMaintenanceActive">
39+
<desc>Status of Maintenance userlevel. Used internally in combination with the CSK_UserManagement module if available.</desc>
40+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
41+
</event>
42+
<event name="OnUserLevelServiceActive">
43+
<desc>Status of Service userlevel. Used internally in combination with the CSK_UserManagement module if available.</desc>
44+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
45+
</event>
46+
<event name="OnUserLevelAdminActive">
47+
<desc>Status of Admin userlevel. Used internally in combination with the CSK_UserManagement module if available.</desc>
48+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
49+
</event>
50+
<function name="setParameterName">
51+
<desc>Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.</desc>
52+
<param desc="Name of the parameter." multiplicity="1" name="name" type="string"/>
53+
</function>
54+
<function name="sendParameters">
55+
<desc>Send parameters to CSK_PersistentData module if possible to save them.</desc>
56+
</function>
57+
<function name="loadParameters">
58+
<desc>Load parameters for this module from the CSK_PersistentData module if possible and use them.</desc>
59+
</function>
60+
<function name="setLoadOnReboot">
61+
<desc>Configure if this module should load its saved parameters at app/device boot up.</desc>
62+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
63+
</function>
64+
<function name="pageCalled">
65+
<desc>Function to register "OnResume" of the module UI (only as helper function).</desc>
66+
<return desc="Empty string (only needed to simplify binding)." multiplicity="1" name="empty" type="string"/>
67+
</function>
68+
</serves>
69+
</crown>
70+
<meta key="author">SICK AG</meta>
71+
<meta key="version">0.1.0</meta>
72+
<meta key="priority">low</meta>
73+
<meta key="copy-protected">false</meta>
74+
<meta key="read-protected">false</meta>
75+
<meta key="crown2-flow-engine">false</meta>
76+
<meta key="LuaLoadAllEngineAPI">true</meta>
77+
<entry default="CSK_Module_RecipeManager.lua" path="scripts"/>
78+
</application>
79+
</manifest>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
--MIT License
2+
--
3+
--Copyright (c) 2023 SICK AG
4+
--
5+
--Permission is hereby granted, free of charge, to any person obtaining a copy
6+
--of this software and associated documentation files (the "Software"), to deal
7+
--in the Software without restriction, including without limitation the rights
8+
--to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
--copies of the Software, and to permit persons to whom the Software is
10+
--furnished to do so, subject to the following conditions:
11+
--
12+
--The above copyright notice and this permission notice shall be included in all
13+
--copies or substantial portions of the Software.
14+
--
15+
--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
--IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
--FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
--AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
--LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
--OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
--SOFTWARE.
22+
23+
---@diagnostic disable: undefined-global, redundant-parameter, missing-parameter
24+
-- CreationTemplateVersion: 3.6.0
25+
--**************************************************************************
26+
--**********************Start Global Scope *********************************
27+
--**************************************************************************
28+
29+
-- If app property "LuaLoadAllEngineAPI" is FALSE, use this to load and check for required APIs
30+
-- This can improve performance of garbage collection
31+
32+
--_G.availableAPIs = require('Configuration/RecipeManager/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
33+
-----------------------------------------------------------
34+
-- Logger
35+
_G.logger = Log.SharedLogger.create('ModuleLogger')
36+
_G.logHandle = Log.Handler.create()
37+
_G.logHandle:attachToSharedLogger('ModuleLogger')
38+
_G.logHandle:setConsoleSinkEnabled(false) --> Set to TRUE if CSK_Logger module is not used
39+
_G.logHandle:setLevel("ALL")
40+
_G.logHandle:applyConfig()
41+
-----------------------------------------------------------
42+
43+
-- Loading script regarding RecipeManager_Model
44+
-- Check this script regarding RecipeManager_Model parameters and functions
45+
_G.recipeManager_Model = require('Configuration/RecipeManager/RecipeManager_Model')
46+
47+
--**************************************************************************
48+
--**********************End Global Scope ***********************************
49+
--**************************************************************************
50+
--**********************Start Function Scope *******************************
51+
--**************************************************************************
52+
53+
--- Function to react on startup event of the app
54+
local function main()
55+
56+
----------------------------------------------------------------------------------------
57+
-- INFO: Please check if module will eventually load inital configuration triggered via
58+
-- event CSK_PersistentData.OnInitialDataLoaded
59+
-- (see internal variable _G.recipeManager_Model.parameterLoadOnReboot)
60+
-- If so, the app will trigger the "OnDataLoadedOnReboot" event if ready after loading parameters
61+
--
62+
-- Can be used e.g. like this
63+
----------------------------------------------------------------------------------------
64+
65+
-- _G.recipeManager_Model.doSomething() -- if you want to start a function
66+
-- ...
67+
CSK_RecipeManager.pageCalled() -- Update UI
68+
69+
end
70+
Script.register("Engine.OnStarted", main)
71+
72+
--OR
73+
74+
-- Call function after persistent data was loaded
75+
--Script.register("CSK_RecipeManager.OnDataLoadedOnReboot", main)
76+
77+
--**************************************************************************
78+
--**********************End Function Scope *********************************
79+
--**************************************************************************

0 commit comments

Comments
 (0)