Skip to content

Commit 7ce455c

Browse files
v1.0.0
Initial version --------- Co-authored-by: Roy Gollub <roy.gollub@sick.de>
1 parent d786a4f commit 7ce455c

19 files changed

Lines changed: 10965 additions & 870 deletions

CHANGELOG.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4-
## Release 0.1.0
4+
## Release 1.0.0
55
- Initial commit
6-
7-
### New features
8-
- ...
9-
10-
### Improvements
11-
- ...
12-
13-
### Bugfix
14-
- ...

CSK_Module_MultiIOLinkSMI/pages/pages/CSK_Module_MultiIOLinkSMI/CSK_Module_MultiIOLinkSMI.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
border-color: grey;
55
margin: 6px;
66
}
7-
7+
.marginTop {
8+
margin-top: 1.5rem
9+
}
810
.myCustomCssClass_CSK_Module_MultiIOLinkSMI {
911
}

CSK_Module_MultiIOLinkSMI/pages/pages/CSK_Module_MultiIOLinkSMI/CSK_Module_MultiIOLinkSMI.html

Lines changed: 952 additions & 175 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
export function convertToList(value) {
22
return JSON.parse(value)
3-
}
3+
}
4+
5+
export function extractFilenames(files: FileList): Array<string> {
6+
if(files === null || files == undefined) {
7+
return []
8+
}
9+
const fileNames = [];
10+
for (const file of files) {
11+
fileNames.push(file.name);
12+
}
13+
return fileNames;
14+
}
15+
16+
export function bool2str(newbool){
17+
var myString: string = String(newbool);
18+
return myString
19+
}
20+
21+
export function num2str(newnum){
22+
return String(newnum)
23+
}
24+
25+
export function str2num(newstr){
26+
return Number(newstr)
27+
}

CSK_Module_MultiIOLinkSMI/project.mf.xml

Lines changed: 789 additions & 36 deletions
Large diffs are not rendered by default.

CSK_Module_MultiIOLinkSMI/scripts/CSK_Module_MultiIOLinkSMI.lua

Lines changed: 57 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,21 @@
2020
--OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
--SOFTWARE.
2222

23-
---@diagnostic disable: undefined-global, redundant-parameter, missing-parameter
23+
-- luacheck: no max line length
2424

25-
--
26-
-- CreationTemplateVersion: 3.6.0
2725
--**************************************************************************
2826
--**********************Start Global Scope *********************************
2927
--**************************************************************************
30-
31-
-- If app property "LuaLoadAllEngineAPI" is FALSE, use this to load and check for required APIs
28+
-- If App property "LuaLoadAllEngineAPI" is FALSE, use this to load and check for required APIs
3229
-- This can improve performance of garbage collection
30+
_G.availableAPIs = require('Communication/MultiIOLinkSMI/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
3331

34-
-- _G.availableAPIs = require('Communication/MultiIOLinkSMI/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
3532
-----------------------------------------------------------
3633
-- Logger
3734
_G.logger = Log.SharedLogger.create('ModuleLogger')
3835
_G.logHandle = Log.Handler.create()
3936
_G.logHandle:attachToSharedLogger('ModuleLogger')
40-
_G.logHandle:setConsoleSinkEnabled(false) --> Set to TRUE if CSK_Logger is not used
37+
_G.logHandle:setConsoleSinkEnabled(false) --> Set to TRUE if LoggingModule is not used
4138
_G.logHandle:setLevel("ALL")
4239
_G.logHandle:applyConfig()
4340
-----------------------------------------------------------
@@ -47,64 +44,81 @@ _G.logHandle:applyConfig()
4744
local multiIOLinkSMI_Model = require('Communication/MultiIOLinkSMI/MultiIOLinkSMI_Model')
4845

4946
local multiIOLinkSMI_Instances = {} -- Handle all instances
50-
table.insert(multiIOLinkSMI_Instances, multiIOLinkSMI_Model.create(1)) -- Create at least 1 instance
5147

5248
-- Load script to communicate with the MultiIOLinkSMI_Model UI
5349
-- Check / edit this script to see/edit functions which communicate with the UI
5450
local multiIOLinkSMIController = require('Communication/MultiIOLinkSMI/MultiIOLinkSMI_Controller')
55-
multiIOLinkSMIController.setMultiIOLinkSMI_Instances_Handle(multiIOLinkSMI_Instances) -- share handle of instances
51+
52+
if _G.availableAPIs.ioLinkSmi and Engine.getEnumValues('IOLinkMasterPorts') ~= nil then
53+
_G.logger:info("IOLinkSMI API Support = true")
54+
table.insert(multiIOLinkSMI_Instances, multiIOLinkSMI_Model.create(1))
55+
multiIOLinkSMIController.setMultiIOLinkSMI_Instances_Handle(multiIOLinkSMI_Instances) -- share handle of instances
56+
else
57+
_G.logger:warning("CSK_MultiIOLinkSMI: Features of this module are not supported on this device. Missing APIs.")
58+
end
5659

5760
--**************************************************************************
5861
--**********************End Global Scope ***********************************
5962
--**************************************************************************
6063
--**********************Start Function Scope *******************************
6164
--**************************************************************************
6265

63-
--[[
64-
--- Function to show how this module could be used
65-
local function startProcessing()
66-
67-
CSK_MultiIOLinkSMI.setSelectedInstance(1) --> select instance of module
68-
CSK_MultiIOLinkSMI.doSomething() --> preparation
69-
70-
-- Option A --> prepare an event to trigger processing via this one
71-
--Script.serveEvent("CSK_MultiIOLinkSMI.OnNewTestEvent", "MultiIOLinkSMI_OnNewTestEvent") --> Create event to listen to and process forwarded object
72-
--CSK_MultiIOLinkSMI.setRegisterEvent('CSK_MultiIOLinkSMI.OnNewTestEvent') --> Register processing to the event
73-
74-
--Script.notifyEvent('OnNewTestEvent', data)
75-
76-
-- Option B --> trigger processing via function call
77-
local result = CSK_MultiIOLinkSMI.processSomething(data)
78-
79-
end
80-
end
81-
82-
-- Call processing function after persistent data was loaded
83-
--Script.register("CSK_MultiIOLinkSMI.OnDataLoadedOnReboot", startProcessing)
84-
]]
85-
86-
--OR
87-
88-
--- Function to react on startup event of the app
8966
local function main()
9067

91-
multiIOLinkSMIController.setMultiIOLinkSMI_Model_Handle(multiIOLinkSMI_Model) -- share handle of Model
92-
93-
----------------------------------------------------------------------------------------
68+
if _G.availableAPIs.ioLinkSmi then
69+
multiIOLinkSMIController.setMultiIOLinkSMI_Model_Handle(multiIOLinkSMI_Model) -- share handle of model
70+
CSK_MultiIOLinkSMI.setSelectedInstance(1)
71+
CSK_MultiIOLinkSMI.pageCalled()
72+
end
73+
----------------------------------------------------------------------------------------
9474
-- INFO: Please check if module will eventually load inital configuration triggered via
9575
-- event CSK_PersistentData.OnInitialDataLoaded
96-
-- (see internal variable _G.multiIOLinkSMI_Model.parameterLoadOnReboot)
76+
-- (see internal variable _G.deepLearningObjects.parameterLoadOnReboot)
9777
-- If so, the app will trigger the "OnDataLoadedOnReboot" event if ready after loading parameters
9878
--
9979
-- Can be used e.g. like this
80+
--
81+
--[[
82+
CSK_MultiIOLinkSMI.setSelectedInstance(1)
83+
CSK_MultiIOLinkSMI.setPort('S1')
84+
CSK_MultiIOLinkSMI.activateInstance(true)
85+
-- Optionally register to 'OnNewPortEvent'-event
86+
87+
local deviceIdentification = CSK_MultiIOLinkSMI.getDeviceIdentification('S1')
88+
CSK_MultiIOLinkSMI.applyNewDeviceIdentification(deviceIdentification)
89+
-- Optionally register to 'CSK_MultiIOLinkSMI.OnNewDeviceIdentificationApplied'-event
90+
91+
-- Read message handling
92+
CSK_MultiIOLinkSMI.createIODDReadMessage()
93+
CSK_MultiIOLinkSMI.setIODDReadMessageName('readMessageTitle')
94+
CSK_MultiIOLinkSMI.setSelectedIODDReadMessage('readMessageTitle')
95+
-- Register to "CSK_MultiIOLinkSMI.readMessage[port][readMessageTitle]"-event
96+
97+
-- Write message handling
98+
CSK_MultiIOLinkSMI.createIODDWriteMessage()
99+
CSK_MultiIOLinkSMI.setIODDWriteMessageName('writeMessageTitle')
100+
CSK_MultiIOLinkSMI.setSelectedIODDWriteMessage('writeMessageTitle')
101+
-- Register to "CSK_MultiIOLinkSMI.writeMessage[port][writeMessageName]"-event
102+
103+
-- Direct data reading
104+
local readProcessDataSuccess, readProcessDataResult = CSK_MultiIOLinkSMI.readProcessData()
105+
local readParameterSuccess, readParameterResult = CSK_MultiIOLinkSMI.readParameter(index, subindex)
106+
local resultProcessByteArray = CSK_MultiIOLinkSMI.readProcessDataByteArray()
107+
local resultParameterByteArray = CSK_MultiIOLinkSMI.readParameterByteArray(index, subindex)
108+
local success1, jsonReceivedData = CSK_MultiIOLinkSMI.readIODDMessage('messageName') -- after defining a read message in UI or IODD module
109+
110+
-- Direct data writing
111+
local writeSuccess = CSK_MultiIOLinkSMI.writeProcessData(jsonDataToWrite)
112+
local success2, errorDescription1 = CSK_MultiIOLinkSMI.writeParameter(index, subindex, byteArrayToWrite)
113+
local success3, errorDescription2 = CSK_MultiIOLinkSMI.writeProcessDataByteArray(byteArrayToWrite)
114+
local success4, errorDescription3 = CSK_MultiIOLinkSMI.writeParameterByteArray(index, subindey, byteArrayToWrite)
115+
local success5 = CSK_MultiIOLinkSMI.writeIODDMessage(messageName, jsonDataToWrite) -- after defining a write message in UI or IODD module
116+
]]
100117
----------------------------------------------------------------------------------------
101118

102-
--startProcessing() --> see above
103-
CSK_MultiIOLinkSMI.pageCalled() -- Update UI
104-
105119
end
106120
Script.register("Engine.OnStarted", main)
107121

108122
--**************************************************************************
109123
--**********************End Function Scope *********************************
110-
--**************************************************************************
124+
--**************************************************************************

0 commit comments

Comments
 (0)