diff --git a/Logical/mappLogbook/LogTypes.typ b/Logical/mappLogbook/LogTypes.typ
index 54dd576..6c4ae21 100644
--- a/Logical/mappLogbook/LogTypes.typ
+++ b/Logical/mappLogbook/LogTypes.typ
@@ -1,19 +1,19 @@
TYPE
- enumLogbook :
+ enumLogbookState :
( (*State machine*)
- enumWait,
- enumOpen,
- enumLatest,
- enumNext,
- enumDetails1,
- enumDetails2,
- enumDetails3,
- enumDetails4,
- enumFilter,
- enumPrep,
- enumError,
- enumNone
+ stateWait,
+ stateOpen,
+ stateLatest,
+ stateNext,
+ stateDetails1,
+ stateDetails2,
+ stateDetails3,
+ stateDetails4,
+ stateFilter,
+ statePrep,
+ stateError,
+ stateNone
);
enumSeverity :
(
@@ -22,21 +22,21 @@ TYPE
severityWarning,
severityError
);
- enumFacility :
+ enumLogbookType :
(
- facilityAccessSecurity,
- facilityCommisioning,
- facilityConnectivity,
- facilityFieldbus,
- facilityFirewall,
- facilityMapp,
- facilityMotion,
- facilitySafety,
- facilitySystem,
- facilityTextSystem,
- facilityUnitSystem,
- facilityUser,
- facilityVisualization
+ logAccessSecurity,
+ logCommisioning,
+ logConnectivity,
+ logFieldbus,
+ logFirewall,
+ logMapp,
+ logMotion,
+ logSafety,
+ logSystem,
+ logTextSystem,
+ logUnitSystem,
+ logUser,
+ logVisualization
);
enumSorting :
(
@@ -46,6 +46,7 @@ TYPE
logbookCMD : STRUCT (*Command structure*)
Refresh : BOOL; (*Read all entries*)
Update : BOOL; (*Update entries*)
+ Write : BOOL; (*Write a new entry*)
ResetError : BOOL; (*Reset error*)
END_STRUCT;
logbookPAR : STRUCT (*Parameter structure*)
@@ -53,24 +54,28 @@ TYPE
TableConfig : STRING[100]; (*Hide unused rows*)
EntriesMax : UINT; (*Maximum number of entries, shadow of LOGBOOK_ENTRIES_MAX*)
FilterErrorNo : UDINT; (*Filter by error number*)
- FilterErrorText : STRING[100]; (*Filter by error text*)
+ FilterErrorText : STRING[LOGBOOK_TEXT_LEN]; (*Filter by error text*)
FilterSeverity : ARRAY[0..3]OF BOOL := [4(TRUE)]; (*Filter by severity*)
- FilterFacility : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF BOOL := [14(TRUE)]; (*Filter by facility*)
+ FilterLogbook : ARRAY[0..LOGBOOK_BOOKS_MAX]OF BOOL := [14(TRUE)]; (*Filter by logbook*)
FilterDateStart : DATE; (*Filter by date*)
FilterDateEnd : DATE;
Sorting : enumSorting := sortingDESC; (*Sort date asc or desc*)
AbortOnEntriesLimit : BOOL; (*Stop looking for additional entries when limit is reached*)
AutoUpdate : BOOL; (*Automatically update data*)
- AutoUpdateInterval : UINT := 10; (*Interval for auto update in s*)
+ AutoUpdateInterval : UINT := 60; (*Interval for auto update in s*)
+ WriteErrorNo : UDINT; (*Error no for new entry*)
+ WriteErrorText : STRING[LOGBOOK_TEXT_LEN]; (*Error text for new entry*)
+ WriteSeverity : USINT := 0; (*Error severiry for new entry*)
+ WriteLogbook : UINT := 0; (*Error logbook for new entry*)
END_STRUCT;
logbookERR : STRUCT (*Error structure*)
- State : enumLogbook; (*State where the error occured*)
+ State : enumLogbookState; (*State where the error occured*)
END_STRUCT;
logbookDAT : STRUCT (*Data structure*)
Entries : logbookENTRIES;
EntriesTotal : UINT; (*Total number of entries*)
CntSeverity : ARRAY[0..3]OF UINT; (*Counts by severity*)
- CntFacility : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF UINT; (*Counts by facility*)
+ CntLogbook : ARRAY[0..LOGBOOK_BOOKS_MAX]OF UINT; (*Counts by logbook*)
LastUpdate : STRING[25]; (*Last refresh run*)
END_STRUCT;
logbookENTRIES : STRUCT (*Entries structure*)
@@ -81,7 +86,7 @@ TYPE
Severity : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF USINT; (*Severity*)
Code : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF UINT; (*Code*)
FacilityCode : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF UINT; (*Facility code*)
- FacilityText : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF STRING[30]; (*Facility text*)
+ LogbookName : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF STRING[30]; (*Logbook text*)
ErrorNo : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF DINT; (*Error number*)
ErrorText : ARRAY[1..LOGBOOK_ENTRIES_MAX]OF STRING[LOGBOOK_TEXT_LEN]; (*Error text*)
END_STRUCT;
diff --git a/Logical/mappLogbook/LogVariables.var b/Logical/mappLogbook/LogVariables.var
index ab7b2d3..86e2708 100644
--- a/Logical/mappLogbook/LogVariables.var
+++ b/Logical/mappLogbook/LogVariables.var
@@ -4,6 +4,6 @@ END_VAR
VAR CONSTANT
LOGBOOK_EXECUTIONS : USINT := 10; (*Executions per cycle*)
LOGBOOK_ENTRIES_MAX : UINT := 100; (*Total number of entries*)
- LOGBOOK_FACILITIES_MAX : USINT := 13; (*Total number of facilities*)
+ LOGBOOK_BOOKS_MAX : USINT := 13; (*Total number of facilities*)
LOGBOOK_TEXT_LEN : UINT := 200; (*Error text length*)
END_VAR
diff --git a/Logical/mappLogbook/Logbook/LocalFunctions.st b/Logical/mappLogbook/Logbook/LocalFunctions.st
index 2c25709..818b229 100644
--- a/Logical/mappLogbook/Logbook/LocalFunctions.st
+++ b/Logical/mappLogbook/Logbook/LocalFunctions.st
@@ -66,12 +66,12 @@ FUNCTION InsertEntry
// If buffer is full check where entry fits
ELSE
// Entry is beyond scope of buffer
- IF idx >= LOGBOOK_ENTRIES_MAX THEN
+ IF idx > LOGBOOK_ENTRIES_MAX THEN
InsertEntry := NO_SPACE;
RETURN;
ELSE
IF DAT.EntriesTotal - idx > 0 THEN
- idy := DAT.EntriesTotal - idx - 1;
+ idy := DAT.EntriesTotal - idx;
END_IF
END_IF
END_IF
@@ -86,7 +86,7 @@ FUNCTION InsertEntry
brsmemmove(ADR(DAT.Entries.ErrorText[idx+1]),ADR(DAT.Entries.ErrorText[idx]), idy * SIZEOF(DAT.Entries.ErrorText[1]));
brsmemmove(ADR(DAT.Entries.EventID[idx+1]),ADR(DAT.Entries.EventID[idx]), idy * SIZEOF(DAT.Entries.EventID[1]));
brsmemmove(ADR(DAT.Entries.FacilityCode[idx+1]),ADR(DAT.Entries.FacilityCode[idx]), idy * SIZEOF(DAT.Entries.FacilityCode[1]));
- brsmemmove(ADR(DAT.Entries.FacilityText[idx+1]),ADR(DAT.Entries.FacilityText[idx]), idy * SIZEOF(DAT.Entries.FacilityText[1]));
+ brsmemmove(ADR(DAT.Entries.LogbookName[idx+1]),ADR(DAT.Entries.LogbookName[idx]), idy * SIZEOF(DAT.Entries.LogbookName[1]));
brsmemmove(ADR(DAT.Entries.Severity[idx+1]),ADR(DAT.Entries.Severity[idx]), idy * SIZEOF(DAT.Entries.Severity[1]));
END_IF
InsertEntry := idx;
diff --git a/Logical/mappLogbook/Logbook/Main.st b/Logical/mappLogbook/Logbook/Main.st
index c97ff53..2447ffc 100644
--- a/Logical/mappLogbook/Logbook/Main.st
+++ b/Logical/mappLogbook/Logbook/Main.st
@@ -16,9 +16,9 @@ END_PROGRAM
PROGRAM _CYCLIC
// Abort current update run
IF EDGENEG(gLogbook.CMD.Refresh) THEN
- IF state <> enumError THEN
+ IF state <> stateError THEN
gLogbook.Status := ERR_OK;
- state := enumWait;
+ state := stateWait;
END_IF
END_IF
// Run task multiple times to speed up process
@@ -30,7 +30,7 @@ PROGRAM _CYCLIC
// --------------------------------------------------------------------------------------------------------------------
// Wait for new command
// --------------------------------------------------------------------------------------------------------------------
- enumWait:
+ stateWait:
// --------------------------------------------------------------------------------------------------------------------
// Get current date
DTGetTime_0.enable := TRUE;
@@ -42,10 +42,10 @@ PROGRAM _CYCLIC
// Refresh all logbook data
IF gLogbook.CMD.Refresh THEN
// Erase old data, set busy state
- brsmemset(ADR(Facility), 0, SIZEOF(Facility));
+ brsmemset(ADR(Logbook), 0, SIZEOF(Logbook));
brsmemset(ADR(gLogbook.DAT), 0, SIZEOF(gLogbook.DAT));
gLogbook.Status := ERR_FUB_BUSY;
- state := enumOpen;
+ state := stateOpen;
END_IF
// --------------------------------------------------------------------------------------------------------------------
@@ -57,7 +57,7 @@ PROGRAM _CYCLIC
IF AutoRefresh.Q THEN
AutoRefresh(IN:= FALSE);
gLogbook.CMD.Update := TRUE;
- state := enumNext;
+ state := stateNext;
END_IF
ELSE
AutoRefresh(IN:= FALSE);
@@ -66,12 +66,12 @@ PROGRAM _CYCLIC
// --------------------------------------------------------------------------------------------------------------------
// Update only latest logbook data
IF gLogbook.CMD.Update THEN
- brsmemset(ADR(Facility.RecordIDIsLast), 0, SIZEOF(Facility.RecordIDIsLast));
- brsmemset(ADR(Facility.RecordID), 0, SIZEOF(Facility.RecordID));
+ brsmemset(ADR(Logbook.RecordIDIsLast), 0, SIZEOF(Logbook.RecordIDIsLast));
+ brsmemset(ADR(Logbook.RecordID), 0, SIZEOF(Logbook.RecordID));
// Start at the beginning set busy state
- Facility.CntFacility := 0;
+ Logbook.CntLogbook := 0;
gLogbook.Status := ERR_FUB_BUSY;
- state := enumLatest;
+ state := stateLatest;
END_IF
// --------------------------------------------------------------------------------------------------------------------
@@ -91,162 +91,162 @@ PROGRAM _CYCLIC
brsstrcat(ADR(gLogbook.StatusText), ADR(gLogbook.DAT.LastUpdate));
EXIT;
// --------------------------------------------------------------------------------------------------------------------
- // Open logbook facility
+ // Open logbook
// --------------------------------------------------------------------------------------------------------------------
- enumOpen:
- // Last facility reached
- IF Facility.CntFacility > LOGBOOK_FACILITIES_MAX THEN
- Facility.CntFacility := 0;
- state := enumLatest;
+ stateOpen:
+ // Last logbook reached
+ IF Logbook.CntLogbook > LOGBOOK_BOOKS_MAX THEN
+ Logbook.CntLogbook := 0;
+ state := stateLatest;
EXIT;
END_IF
ArEventLogGetIdent_0.Execute := gLogbook.CMD.Refresh;
- ArEventLogGetIdent_0.Name := FACILITY_NAMES[Facility.CntFacility];
+ ArEventLogGetIdent_0.Name := LOGBOOK_NAMES[Logbook.CntLogbook];
ArEventLogGetIdent_0();
// Success
IF (ArEventLogGetIdent_0.Done AND ArEventLogGetIdent_0.StatusID = ERR_OK) OR ArEventLogGetIdent_0.StatusID = arEVENTLOG_ERR_LOGBOOK_NOT_FOUND THEN
- Facility.Ident[Facility.CntFacility] := ArEventLogGetIdent_0.Ident;
- Facility.CntFacility := Facility.CntFacility + 1;
+ Logbook.Ident[Logbook.CntLogbook] := ArEventLogGetIdent_0.Ident;
+ Logbook.CntLogbook := Logbook.CntLogbook + 1;
ArEventLogGetIdent_0(Execute := FALSE);
// Error
ELSIF ArEventLogGetIdent_0.Error THEN
gLogbook.ERR.State := state;
gLogbook.Status := ArEventLogGetIdent_0.StatusID;
- state := enumError;
+ state := stateError;
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Read latest entry
// --------------------------------------------------------------------------------------------------------------------
- enumLatest:
+ stateLatest:
ArEventLogGetLatestRecordID_0.Execute := TRUE;
- ArEventLogGetLatestRecordID_0.Ident := Facility.Ident[Facility.CntFacility];
+ ArEventLogGetLatestRecordID_0.Ident := Logbook.Ident[Logbook.CntLogbook];
ArEventLogGetLatestRecordID_0();
// Success
IF ArEventLogGetLatestRecordID_0.Done AND ArEventLogGetLatestRecordID_0.StatusID = ERR_OK THEN
// Store this record ID for next step
- Facility.RecordID[Facility.CntFacility] := ArEventLogGetLatestRecordID_0.RecordID;
+ Logbook.RecordID[Logbook.CntLogbook] := ArEventLogGetLatestRecordID_0.RecordID;
// If there is a new entry
- IF ArEventLogGetLatestRecordID_0.RecordID > Facility.RecordIDOld[Facility.CntFacility] THEN
+ IF ArEventLogGetLatestRecordID_0.RecordID > Logbook.RecordIDOld[Logbook.CntLogbook] THEN
// Store latest ID for next update command, reset is last flag
- Facility.RecordIDLatest[Facility.CntFacility] := ArEventLogGetLatestRecordID_0.RecordID;
- state := enumDetails1;
+ Logbook.RecordIDLatest[Logbook.CntLogbook] := ArEventLogGetLatestRecordID_0.RecordID;
+ state := stateDetails1;
// No new entry
ELSE
- Facility.RecordIDIsLast[Facility.CntFacility] := TRUE;
- state := enumPrep;
+ Logbook.RecordIDIsLast[Logbook.CntLogbook] := TRUE;
+ state := statePrep;
END_IF
// Error
ELSIF ArEventLogGetLatestRecordID_0.Error THEN
gLogbook.ERR.State := state;
gLogbook.Status := ArEventLogGetLatestRecordID_0.StatusID;
- state := enumError;
+ state := stateError;
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Read next entry
// --------------------------------------------------------------------------------------------------------------------
- enumNext:
+ stateNext:
animation := WorkingStatus(ADR(gLogbook.StatusText), ADR('reading entries...'), animation);
ArEventLogGetPreviousRecordID_0.Execute := TRUE;
- ArEventLogGetPreviousRecordID_0.Ident := Facility.Ident[Facility.CntFacility];
- ArEventLogGetPreviousRecordID_0.RecordID := Facility.RecordID[Facility.CntFacility];
+ ArEventLogGetPreviousRecordID_0.Ident := Logbook.Ident[Logbook.CntLogbook];
+ ArEventLogGetPreviousRecordID_0.RecordID := Logbook.RecordID[Logbook.CntLogbook];
ArEventLogGetPreviousRecordID_0();
// Success
IF ArEventLogGetPreviousRecordID_0.Done AND ArEventLogGetPreviousRecordID_0.StatusID = ERR_OK THEN
// Store this record ID for next step
- Facility.RecordID[Facility.CntFacility] := ArEventLogGetPreviousRecordID_0.PrevRecordID;
+ Logbook.RecordID[Logbook.CntLogbook] := ArEventLogGetPreviousRecordID_0.PrevRecordID;
// Stop update when previous record ID is reached
- IF Facility.RecordID[Facility.CntFacility] = Facility.RecordIDOld[Facility.CntFacility] AND gLogbook.CMD.Update THEN
+ IF Logbook.RecordID[Logbook.CntLogbook] = Logbook.RecordIDOld[Logbook.CntLogbook] AND gLogbook.CMD.Update THEN
// Remember latest entry, set is last flag
- Facility.RecordIDOld[Facility.CntFacility] := Facility.RecordIDLatest[Facility.CntFacility];
- Facility.RecordIDIsLast[Facility.CntFacility] := TRUE;
- state := enumPrep;
+ Logbook.RecordIDOld[Logbook.CntLogbook] := Logbook.RecordIDLatest[Logbook.CntLogbook];
+ Logbook.RecordIDIsLast[Logbook.CntLogbook] := TRUE;
+ state := statePrep;
ELSE
- state := enumDetails1;
+ state := stateDetails1;
END_IF
// Error
ELSIF ArEventLogGetPreviousRecordID_0.Error THEN
// Last entry reached is not an error
IF ArEventLogGetPreviousRecordID_0.StatusID = arEVENTLOG_ERR_RECORDID_INVALID THEN
// Remember latest entry, set is last flag
- Facility.RecordIDOld[Facility.CntFacility] := Facility.RecordIDLatest[Facility.CntFacility];
- Facility.RecordIDIsLast[Facility.CntFacility] := TRUE;
- state := enumPrep;
+ Logbook.RecordIDOld[Logbook.CntLogbook] := Logbook.RecordIDLatest[Logbook.CntLogbook];
+ Logbook.RecordIDIsLast[Logbook.CntLogbook] := TRUE;
+ state := statePrep;
// Everything else is an error
ELSE
gLogbook.ERR.State := state;
gLogbook.Status := ArEventLogGetPreviousRecordID_0.StatusID;
- state := enumError;
+ state := stateError;
END_IF
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Read event id and time stamp
// --------------------------------------------------------------------------------------------------------------------
- enumDetails1:
+ stateDetails1:
ArEventLogRead_0.Execute := TRUE;
- ArEventLogRead_0.Ident := Facility.Ident[Facility.CntFacility];
- ArEventLogRead_0.RecordID := Facility.RecordID[Facility.CntFacility];
+ ArEventLogRead_0.Ident := Logbook.Ident[Logbook.CntLogbook];
+ ArEventLogRead_0.RecordID := Logbook.RecordID[Logbook.CntLogbook];
ArEventLogRead_0();
// Success
IF ArEventLogRead_0.Done AND (ArEventLogRead_0.StatusID = ERR_OK OR ArEventLogRead_0.StatusID = arEVENTLOG_WRN_NO_EVENTID) THEN
- state := enumDetails2;
+ state := stateDetails2;
// Error
ELSIF ArEventLogRead_0.Error THEN
gLogbook.ERR.State := state;
gLogbook.Status := ArEventLogRead_0.StatusID;
- state := enumError;
+ state := stateError;
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Read error no
// --------------------------------------------------------------------------------------------------------------------
- enumDetails2:
+ stateDetails2:
ArEventLogReadErrorNumber_0.Execute := TRUE;
- ArEventLogReadErrorNumber_0.Ident := Facility.Ident[Facility.CntFacility];
- ArEventLogReadErrorNumber_0.RecordID := Facility.RecordID[Facility.CntFacility];
+ ArEventLogReadErrorNumber_0.Ident := Logbook.Ident[Logbook.CntLogbook];
+ ArEventLogReadErrorNumber_0.RecordID := Logbook.RecordID[Logbook.CntLogbook];
ArEventLogReadErrorNumber_0();
// Success
IF (ArEventLogReadErrorNumber_0.Done AND ArEventLogReadErrorNumber_0.StatusID = ERR_OK) OR ArEventLogReadErrorNumber_0.StatusID = arEVENTLOG_ERR_NO_ERRORNUMBER THEN
- state := enumDetails3;
+ state := stateDetails3;
// Error
ELSIF ArEventLogReadErrorNumber_0.Error THEN
gLogbook.ERR.State := state;
gLogbook.Status := ArEventLogReadErrorNumber_0.StatusID;
- state := enumError;
+ state := stateError;
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Read error description
// --------------------------------------------------------------------------------------------------------------------
- enumDetails3:
+ stateDetails3:
ArEventLogReadDescription_0.Execute := TRUE;
- ArEventLogReadDescription_0.Ident := Facility.Ident[Facility.CntFacility];
- ArEventLogReadDescription_0.RecordID := Facility.RecordID[Facility.CntFacility];
+ ArEventLogReadDescription_0.Ident := Logbook.Ident[Logbook.CntLogbook];
+ ArEventLogReadDescription_0.RecordID := Logbook.RecordID[Logbook.CntLogbook];
ArEventLogReadDescription_0.TextBuffer := ADR(ErrorText);
ArEventLogReadDescription_0.TextBufferSize := SIZEOF(ErrorText);
ArEventLogReadDescription_0();
// Success
IF (ArEventLogReadDescription_0.Done AND (ArEventLogReadDescription_0.StatusID = ERR_OK OR ArEventLogReadDescription_0.StatusID = arEVENTLOG_WRN_NO_EVENTID)) OR ArEventLogReadDescription_0.StatusID = arEVENTLOG_ERR_NO_DESCRIPTION THEN
- state := enumDetails4;
+ state := stateDetails4;
// Error
ELSIF ArEventLogReadDescription_0.Error THEN
gLogbook.ERR.State := state;
gLogbook.Status := ArEventLogReadDescription_0.StatusID;
- state := enumError;
+ state := stateError;
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Read additional information
// --------------------------------------------------------------------------------------------------------------------
- enumDetails4:
+ stateDetails4:
// Skip if no additional data is available
IF ArEventLogRead_0.AddDataSize > 0 THEN
// Read additional data
ArEventLogReadAddData_0.Execute := TRUE;
- ArEventLogReadAddData_0.Ident := Facility.Ident[Facility.CntFacility];
- ArEventLogReadAddData_0.RecordID := Facility.RecordID[Facility.CntFacility];
+ ArEventLogReadAddData_0.Ident := Logbook.Ident[Logbook.CntLogbook];
+ ArEventLogReadAddData_0.RecordID := Logbook.RecordID[Logbook.CntLogbook];
ArEventLogReadAddData_0.AddData := ADR(AddData);
// Limit buffer to max size
IF ArEventLogRead_0.AddDataSize < SIZEOF(AddData) THEN
@@ -274,31 +274,31 @@ PROGRAM _CYCLIC
END_IF
END_IF
END_IF
- state := enumFilter;
+ state := stateFilter;
// Error
ELSIF ArEventLogReadDescription_0.Error THEN
gLogbook.ERR.State := state;
gLogbook.Status := ArEventLogReadAddData_0.StatusID;
- state := enumError;
+ state := stateError;
END_IF
ELSE
- state := enumFilter;
+ state := stateFilter;
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Apply filter settings
// --------------------------------------------------------------------------------------------------------------------
- enumFilter:
+ stateFilter:
// --------------------------------------------------------------------------------------------------------------------
// Filters
cntFilterNo := 0;
cntFilterText := 0;
- cntFilterFacility := 0;
+ cntFilterLogbook := 0;
cntFilterSeverity := 0;
cntFilterDate := 0;
// --------------------------------------------------------------------------------------------------------------------
- // Check if facility should be read
- IF gLogbook.PAR.FilterFacility[Facility.CntFacility] THEN
- cntFilterFacility := cntFilterFacility + 1;
+ // Check if logbook should be read
+ IF gLogbook.PAR.FilterLogbook[Logbook.CntLogbook] THEN
+ cntFilterLogbook := cntFilterLogbook + 1;
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Check if error text matches search string
@@ -335,12 +335,12 @@ PROGRAM _CYCLIC
cntFilterDate := cntFilterDate + 1;
END_IF
// --------------------------------------------------------------------------------------------------------------------
- // Count facility entries
- gLogbook.DAT.CntFacility[Facility.CntFacility] := gLogbook.DAT.CntFacility[Facility.CntFacility] + 1;
+ // Count logbook entries
+ gLogbook.DAT.CntLogbook[Logbook.CntLogbook] := gLogbook.DAT.CntLogbook[Logbook.CntLogbook] + 1;
// --------------------------------------------------------------------------------------------------------------------
// Transfer data
- IF cntFilterNo > 0 AND cntFilterText > 0 AND cntFilterFacility > 0 AND cntFilterSeverity > 0 AND cntFilterDate > 0 THEN
+ IF cntFilterNo > 0 AND cntFilterText > 0 AND cntFilterLogbook > 0 AND cntFilterSeverity > 0 AND cntFilterDate > 0 THEN
// --------------------------------------------------------------------------------------------------------------------
// Find new place for entry
idx := InsertEntry(ADR(gLogbook.DAT), ArEventLogRead_0.TimeStamp.sec, UDINT_TO_UINT(ArEventLogRead_0.TimeStamp.nsec/1000000), gLogbook.PAR.Sorting);
@@ -359,7 +359,7 @@ PROGRAM _CYCLIC
NormalizeDateTime(ADR(gLogbook.DAT.Entries.Timestamp[idx]), tmpDTstruct.minute, ':');
NormalizeDateTime(ADR(gLogbook.DAT.Entries.Timestamp[idx]), tmpDTstruct.second, ':');
NormalizeDateTime(ADR(gLogbook.DAT.Entries.Timestamp[idx]), gLogbook.DAT.Entries.DTmsec[idx], '.');
- // Add event ID, code, facility, severity
+ // Add event ID, code, logbook, severity
gLogbook.DAT.Entries.EventID[gLogbook.DAT.EntriesTotal] := ArEventLogRead_0.EventID;
IF ArEventLogRead_0.EventID <> 0 THEN
gLogbook.DAT.Entries.Severity[idx] := GetSeverity(EventID := ArEventLogRead_0.EventID);
@@ -368,7 +368,7 @@ PROGRAM _CYCLIC
END_IF
gLogbook.DAT.Entries.Code[idx] := GetCode(EventID := ArEventLogRead_0.EventID);
gLogbook.DAT.Entries.FacilityCode[idx] := GetFacility(EventID := ArEventLogRead_0.EventID);
- gLogbook.DAT.Entries.FacilityText[idx] := FACILITY_TEXT[Facility.CntFacility];
+ gLogbook.DAT.Entries.LogbookName[idx] := LOGBOOK_TEXT[Logbook.CntLogbook];
// Add error number and text, use event ID if error no is 0
IF ArEventLogReadErrorNumber_0.ErrorNumber <> 0 THEN
gLogbook.DAT.Entries.ErrorNo[idx] := ArEventLogReadErrorNumber_0.ErrorNumber;
@@ -389,12 +389,12 @@ PROGRAM _CYCLIC
brsstrcat(ADR(gLogbook.PAR.TableConfig), ADR(tmpSTR));
brsstrcat(ADR(gLogbook.PAR.TableConfig), ADR(', "visible":false}]}'));
- state := enumPrep;
+ state := statePrep;
// --------------------------------------------------------------------------------------------------------------------
// Perpare for next entry
// --------------------------------------------------------------------------------------------------------------------
- enumPrep:
+ statePrep:
// --------------------------------------------------------------------------------------------------------------------
// Reset buffer and function blocks
brsmemset(ADR(AddData), 0, SIZEOF(AddData));
@@ -406,34 +406,34 @@ PROGRAM _CYCLIC
ArEventLogReadAddData_0(Execute := FALSE);
// --------------------------------------------------------------------------------------------------------------------
- // Find next facility from here to the end
+ // Find next logbook from here to the end
REPEAT
- Facility.CntFacility := Facility.CntFacility + 1;
- IF Facility.CntFacility <= LOGBOOK_FACILITIES_MAX THEN
- IF (Facility.Ident[Facility.CntFacility] <> 0 AND NOT Facility.RecordIDIsLast[Facility.CntFacility]) OR (Facility.Ident[Facility.CntFacility] <> 0 AND Facility.RecordID[Facility.CntFacility] = 0) THEN
+ Logbook.CntLogbook := Logbook.CntLogbook + 1;
+ IF Logbook.CntLogbook <= LOGBOOK_BOOKS_MAX THEN
+ IF (Logbook.Ident[Logbook.CntLogbook] <> 0 AND NOT Logbook.RecordIDIsLast[Logbook.CntLogbook]) OR (Logbook.Ident[Logbook.CntLogbook] <> 0 AND Logbook.RecordID[Logbook.CntLogbook] = 0) THEN
EXIT;
END_IF
END_IF
- UNTIL Facility.CntFacility > LOGBOOK_FACILITIES_MAX
+ UNTIL Logbook.CntLogbook > LOGBOOK_BOOKS_MAX
END_REPEAT;
// --------------------------------------------------------------------------------------------------------------------
- // No facility found, start at the beginning
- IF Facility.CntFacility > LOGBOOK_FACILITIES_MAX THEN
- Facility.CntFacility := 0;
- // Find next facility from start to the end
+ // No logbook found, start at the beginning
+ IF Logbook.CntLogbook > LOGBOOK_BOOKS_MAX THEN
+ Logbook.CntLogbook := 0;
+ // Find next logbook from start to the end
REPEAT
- IF (Facility.Ident[Facility.CntFacility] <> 0 AND NOT Facility.RecordIDIsLast[Facility.CntFacility]) OR (Facility.Ident[Facility.CntFacility] <> 0 AND Facility.RecordID[Facility.CntFacility] = 0) THEN
+ IF (Logbook.Ident[Logbook.CntLogbook] <> 0 AND NOT Logbook.RecordIDIsLast[Logbook.CntLogbook]) OR (Logbook.Ident[Logbook.CntLogbook] <> 0 AND Logbook.RecordID[Logbook.CntLogbook] = 0) THEN
EXIT;
END_IF
- Facility.CntFacility := Facility.CntFacility + 1;
- UNTIL Facility.CntFacility > LOGBOOK_FACILITIES_MAX
+ Logbook.CntLogbook := Logbook.CntLogbook + 1;
+ UNTIL Logbook.CntLogbook > LOGBOOK_BOOKS_MAX
END_REPEAT;
END_IF
// --------------------------------------------------------------------------------------------------------------------
- // Finish when no facility found or max entries is reached
- IF Facility.CntFacility > LOGBOOK_FACILITIES_MAX OR (gLogbook.PAR.AbortOnEntriesLimit AND gLogbook.DAT.EntriesTotal = LOGBOOK_ENTRIES_MAX) THEN
+ // Finish when no logbook found or max entries is reached
+ IF Logbook.CntLogbook > LOGBOOK_BOOKS_MAX OR (gLogbook.PAR.AbortOnEntriesLimit AND gLogbook.DAT.EntriesTotal = LOGBOOK_ENTRIES_MAX) THEN
// Add last update
DT_TO_DTStructure(gLogbook.PAR.DateNow, ADR(tmpDTstruct));
brsmemset(ADR(gLogbook.DAT.LastUpdate), 0, SIZEOF(gLogbook.DAT.LastUpdate));
@@ -447,29 +447,29 @@ PROGRAM _CYCLIC
gLogbook.Status := ERR_OK;
gLogbook.CMD.Refresh := FALSE;
gLogbook.CMD.Update := FALSE;
- state := enumWait;
+ state := stateWait;
ELSE
// Read latest entry
- IF Facility.RecordID[Facility.CntFacility] = 0 THEN
- state := enumLatest;
+ IF Logbook.RecordID[Logbook.CntLogbook] = 0 THEN
+ state := stateLatest;
// Read next entry
ELSE
- state := enumNext;
+ state := stateNext;
END_IF
END_IF
// --------------------------------------------------------------------------------------------------------------------
// Error state
// --------------------------------------------------------------------------------------------------------------------
- enumError:
+ stateError:
gLogbook.StatusText := 'Error...';
brsmemset(ADR(gLogbook.CMD), 0, SIZEOF(gLogbook.CMD)-1);
// Reset error
IF gLogbook.CMD.ResetError THEN
- gLogbook.ERR.State := enumNone;
+ gLogbook.ERR.State := stateNone;
gLogbook.Status := 0;
gLogbook.CMD.ResetError := FALSE;
- state := enumWait;
+ state := stateWait;
END_IF
EXIT;
END_CASE;
diff --git a/Logical/mappLogbook/Logbook/Types.typ b/Logical/mappLogbook/Logbook/Types.typ
index fa41905..279bfae 100644
--- a/Logical/mappLogbook/Logbook/Types.typ
+++ b/Logical/mappLogbook/Logbook/Types.typ
@@ -1,11 +1,11 @@
TYPE
- typFacility : STRUCT
- Ident : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF UDINT;
- RecordIDLatest : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF UDINT;
- RecordIDOld : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF UDINT;
- RecordIDIsLast : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF BOOL;
- RecordID : ARRAY[0..LOGBOOK_FACILITIES_MAX]OF UDINT;
- CntFacility : USINT;
+ typLogbook : STRUCT
+ Ident : ARRAY[0..LOGBOOK_BOOKS_MAX]OF UDINT;
+ RecordIDLatest : ARRAY[0..LOGBOOK_BOOKS_MAX]OF UDINT;
+ RecordIDOld : ARRAY[0..LOGBOOK_BOOKS_MAX]OF UDINT;
+ RecordIDIsLast : ARRAY[0..LOGBOOK_BOOKS_MAX]OF BOOL;
+ RecordID : ARRAY[0..LOGBOOK_BOOKS_MAX]OF UDINT;
+ CntLogbook : USINT;
END_STRUCT;
END_TYPE
diff --git a/Logical/mappLogbook/Logbook/Variables.var b/Logical/mappLogbook/Logbook/Variables.var
index f446b9b..3b78868 100644
--- a/Logical/mappLogbook/Logbook/Variables.var
+++ b/Logical/mappLogbook/Logbook/Variables.var
@@ -3,7 +3,7 @@ VAR
ErrorText : STRING[LOGBOOK_TEXT_LEN];
cntFilterNo : UINT;
cntFilterText : UINT;
- cntFilterFacility : UINT;
+ cntFilterLogbook : UINT;
cntFilterSeverity : UINT;
cntFilterDate : UINT;
tmpSTR : STRING[100];
@@ -12,7 +12,7 @@ VAR
TimeStart : DATE_AND_TIME;
TimeEnd : DATE_AND_TIME;
AddData : ARRAY[0..500] OF USINT;
- Facility : typFacility;
+ Logbook : typLogbook;
idx : UINT;
animation : USINT;
END_VAR
@@ -31,14 +31,14 @@ VAR
END_VAR
(*Local variables*)
VAR
- state : enumLogbook;
+ state : enumLogbookState;
ArEventLogGetIdent_0 : ArEventLogGetIdent;
executions : USINT;
END_VAR
(*---------------------------------------------------------------------------------------------------------------------------------*)
(*Local constants*)
VAR CONSTANT
- FACILITY_NAMES : ARRAY[0..LOGBOOK_FACILITIES_MAX] OF STRING[50] := ['$$accsec','$$diag','$$arlogconn','$$fieldbus','$$firewall','$$mapp','$$motion','$$safety','$$arlogsys','$$textsys','$$unitsys','$$arlogusr','$$vision','$$visu'];
- FACILITY_TEXT : ARRAY[0..LOGBOOK_FACILITIES_MAX] OF STRING[50] := ['Access','Commissioning','Connectivity','Fieldbus','Firewall','Mapp','Motion','Safety','System','Text System','Unit System','User','Vision','Visualization'];
+ LOGBOOK_NAMES : ARRAY[0..LOGBOOK_BOOKS_MAX] OF STRING[50] := ['$$accsec','$$diag','$$arlogconn','$$fieldbus','$$firewall','$$mapp','$$motion','$$safety','$$arlogsys','$$textsys','$$unitsys','$$arlogusr','$$vision','$$visu'];
+ LOGBOOK_TEXT : ARRAY[0..LOGBOOK_BOOKS_MAX] OF STRING[50] := ['Access','Commissioning','Connectivity','Fieldbus','Firewall','Mapp','Motion','Safety','System','Text System','Unit System','User','Vision','Visualization'];
NO_SPACE : UINT := 0;
END_VAR
diff --git a/Logical/mappView/Resources/Media/Logbook/screenshot.png b/Logical/mappView/Resources/Media/Logbook/screenshot.png
index 2fd4bdb..8f3e5be 100644
Binary files a/Logical/mappView/Resources/Media/Logbook/screenshot.png and b/Logical/mappView/Resources/Media/Logbook/screenshot.png differ
diff --git a/Logical/mappView/Visualization/Pages/LogbookPage/Content.content b/Logical/mappView/Visualization/Pages/LogbookPage/Content.content
index 6b2296d..10fd876 100644
--- a/Logical/mappView/Visualization/Pages/LogbookPage/Content.content
+++ b/Logical/mappView/Visualization/Pages/LogbookPage/Content.content
@@ -1,13 +1,13 @@
-
+
-
+
@@ -102,7 +102,7 @@
-
+
@@ -121,4 +121,4 @@
-
\ No newline at end of file
+
diff --git a/Physical/PC/X20CP1583/Connectivity/OpcUA/OpcUaMap.uad b/Physical/PC/X20CP1583/Connectivity/OpcUA/OpcUaMap.uad
index 7e1025b..e3098bc 100644
--- a/Physical/PC/X20CP1583/Connectivity/OpcUA/OpcUaMap.uad
+++ b/Physical/PC/X20CP1583/Connectivity/OpcUA/OpcUaMap.uad
@@ -19,7 +19,6 @@
-
@@ -28,14 +27,13 @@
-
+
-
diff --git a/Physical/PC/X20CP1583/mappView/Logbook.binding b/Physical/PC/X20CP1583/mappView/Logbook.binding
index c75c00e..ae85aab 100644
--- a/Physical/PC/X20CP1583/mappView/Logbook.binding
+++ b/Physical/PC/X20CP1583/mappView/Logbook.binding
@@ -1,4 +1,4 @@
-
+
@@ -13,6 +13,14 @@
+
+
+
+
+
+
+
+
@@ -21,10 +29,6 @@
-
-
-
-
@@ -45,7 +49,6 @@
-
@@ -53,10 +56,6 @@
-
-
-
-
@@ -71,59 +70,59 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -139,59 +138,59 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/Physical/PC/X20CP1583/mappView/Logbook.eventbinding b/Physical/PC/X20CP1583/mappView/Logbook.eventbinding
index 9cb7f8f..8a0ccf4 100644
--- a/Physical/PC/X20CP1583/mappView/Logbook.eventbinding
+++ b/Physical/PC/X20CP1583/mappView/Logbook.eventbinding
@@ -174,7 +174,7 @@
-
+
@@ -315,8 +315,8 @@
-
-
+
+