Skip to content

Commit

Permalink
Intial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Stricker committed Oct 27, 2020
1 parent 9cd95e6 commit cfaba1e
Show file tree
Hide file tree
Showing 153 changed files with 13,842 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/Binaries
/Diagnosis
/Temp
/Docs
/*.set
/*.isopen

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

Empty file added Logical/Global.typ
Empty file.
Empty file added Logical/Global.var
Empty file.
307 changes: 307 additions & 0 deletions Logical/Libraries/ArEventLog/ArEventLog.fun
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogCreate (*creates an event log module; asynchronous execution *)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Name : STRING[256]; (*name of the event log module*)
Size : UDINT; (*size of the event log module*)
Persistence : USINT; (*persistence type of the log module*)
Info : UDINT; (*format of the additional data*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Busy : BOOL; (*execution running*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
Ident : ArEventLogIdentType; (*ident for the event log module*)
END_VAR

VAR
Internal : ArEventLogAsyncInternalType;(*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogDelete (*deletes an event log module; asynchronous execution *)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Busy : BOOL; (*execution running*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
END_VAR

VAR
Internal : ArEventLogAsyncInternalType;(*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogGetIdent (*gets identifier of an event log module*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Name : STRING[256]; (*name of the event log module*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
Ident : ArEventLogIdentType; (*identifier of the event log module*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogWrite (*writes a log entry to an event log module*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
EventID : DINT; (*event id of the log entry*)
OriginRecordID : ArEventLogRecordIDType; (*record id of basic cause of error/warning, or 0*)
ObjectID : STRING[36]; (*object id - string of maximum 35 characters, string length of 0 object id is generated internally*)
AddDataSize : UDINT; (*size of the additional data, or 0 (no additional data)*)
AddDataFormat : USINT; (*format of the additional data*)
AddData : UDINT; (*additional data of the entry given as pointer, or 0 (no additional data)*)
TimeStamp : UDINT; (*external timestamp given as pointer to ArEventLogTimeStampType, or 0 (timestamp is taken internally)*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
RecordID : ArEventLogRecordIDType; (*id of current record*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogGetLatestRecordID (*gets latest record id*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
RecordID : ArEventLogRecordIDType; (*latest record id to read*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogGetPreviousRecordID (*gets previous record id*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
RecordID : ArEventLogRecordIDType; (*current record id*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
PrevRecordID : ArEventLogRecordIDType; (*previous record id to read*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogRead (*reads a log entry from an event log module*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
RecordID : ArEventLogRecordIDType; (*record id to read*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
EventID : DINT; (*event id of the log entry*)
OriginRecordID : ArEventLogRecordIDType; (*record id of basic cause of error/warning, or 0*)
AddDataFormat : USINT; (*format of the additional data*)
AddDataSize : UDINT; (*size of the additional data*)
TimeStamp : ArEventLogTimeStampType; (*timestamp*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogReadDescription (*reads a description of an event id*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
RecordID : ArEventLogRecordIDType; (*record id to read*)
LanguageCode : ArEventLogLanguageCodeType;(*language id of description*)
Qualifier : STRING[250]; (*additional qualifier - reserved for future use*)
TextBuffer : UDINT; (*buffer for description*)
TextBufferSize : UDINT; (*maximum description size*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Busy : BOOL; (*execution running*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
TextSize : UDINT; (*size of description (including 0-termination)*)
END_VAR

VAR
Internal : ArEventLogAsyncInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogReadErrorNumber (*reads an error number log entry from an event log module*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
RecordID : ArEventLogRecordIDType; (*record id to read*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
ErrorNumber : UDINT; (*error number of the log entry*)
Severity : USINT; (*severity of the log entry*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogReadAddData (*reads the additional data from an event log module*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
RecordID : ArEventLogRecordIDType; (*record id to read*)
AddData : UDINT; (*buffer for additional data given as pointer*)
BytesToRead : UDINT; (*buffer size for additional data*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution status: see help*)
AddDataSize : UDINT; (*size of the additional data*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK ArEventLogReadObjectID (*reads the object id from an event log module*)
VAR_INPUT
Execute : BOOL; (*enables execution*)
Ident : ArEventLogIdentType; (*ident for the event log module to be written*)
RecordID : ArEventLogRecordIDType; (*record id to read*)
END_VAR

VAR_OUTPUT
Done : BOOL; (*execution done*)
Error : BOOL; (*execution failed*)
StatusID : DINT; (*execution error: see help*)
ObjectID : STRING[36]; (*object id - string of maximum 35 characters*)
END_VAR

VAR
Internal : ArEventLogInternalType; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

{REDUND_OK} FUNCTION ArEventLogMakeEventID : DINT (*makes an event id*)
VAR_INPUT
Severity : USINT; (*severity code of event id*)
Facility : UINT; (*facility of event id*)
ErrorCode : UINT; (*error code of event id*)
END_VAR
END_FUNCTION

{REDUND_OK} FUNCTION ArEventLogIsError : BOOL (*returns true if event id is an error entry*)
VAR_INPUT
EventID : DINT; (*event id*)
END_VAR
END_FUNCTION

{REDUND_OK} FUNCTION ArEventLogIsWarning : BOOL (*returns true if event id is a warning entry*)
VAR_INPUT
EventID : DINT; (*event id*)
END_VAR
END_FUNCTION

{REDUND_OK} FUNCTION ArEventLogIsInformation : BOOL (*returns true if event id is a information entry*)
VAR_INPUT
EventID : DINT; (*event id*)
END_VAR
END_FUNCTION

{REDUND_OK} FUNCTION ArEventLogIsSuccess : BOOL (*returns true if event id is a success entry*)
VAR_INPUT
EventID : DINT; (*event id*)
END_VAR
END_FUNCTION

{REDUND_OK} FUNCTION ArEventLogIsCustomerArea : BOOL (*returns true if the customer flag of the event id is set*)
VAR_INPUT
EventID : DINT; (*event id*)
END_VAR
END_FUNCTION

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ArEventLogAddDataInit : BOOL (*returns true on success, false on failure*)
VAR_INPUT
Buffer : UDINT; (*buffer for additional event log data*)
BufferSize : UDINT; (*buffer size*)
Format : USINT; (*format of the additional data*)
END_VAR
END_FUNCTION

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ArEventLogAddDataUdint : BOOL (*returns true on success, false on failure*)
VAR_INPUT
Buffer : UDINT; (*buffer for additional event data*)
BufferSize : UDINT; (*buffer size*)
Value : UDINT; (*UDINT value*)
END_VAR
END_FUNCTION

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ArEventLogAddDataDint : BOOL (*returns true on success, false on failure*)
VAR_INPUT
Buffer : UDINT; (*buffer for additional event data*)
BufferSize : UDINT; (*buffer size*)
Value : DINT; (*DINT value*)
END_VAR
END_FUNCTION

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ArEventLogAddDataString : BOOL (*returns true on success, false on failure*)
VAR_INPUT
Buffer : UDINT; (*buffer for additional event log data*)
BufferSize : UDINT; (*buffer size*)
Value : UDINT; (*STRING value, given as pointer to null terminated string*)
END_VAR
END_FUNCTION

{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ArEventLogAddDataQuantity : BOOL (*returns true on success, false on failure*)
VAR_INPUT
Buffer : UDINT; (*buffer for additional event log data*)
BufferSize : UDINT; (*buffer size*)
Value : LREAL; (*LREAL value*)
UnitID : DINT; (*unit ID, -1 no unit*)
NamespaceURI : UDINT; (*namespace URI given as pointer to null terminated string, null is default namespace (CEFACT)*)
END_VAR
END_FUNCTION
20 changes: 20 additions & 0 deletions Logical/Libraries/ArEventLog/ArEventLog.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

TYPE
ArEventLogIdentType : UDINT;
ArEventLogRecordIDType : UDINT;
ArEventLogLanguageCodeType : STRING[18]; (*String-type for language ID*)

ArEventLogTimeStampType : STRUCT
sec : UDINT; (*seconds*)
nsec : UDINT; (*nano seconds*)
END_STRUCT;

ArEventLogAsyncInternalType : STRUCT
FBStateCtx : ArFBStateInternalType;
AsyFuMaCtx : ArFBAsyFuMaInternalType;
END_STRUCT;

ArEventLogInternalType : STRUCT
FBStateCtx : ArFBStateInternalType;
END_STRUCT;
END_TYPE
42 changes: 42 additions & 0 deletions Logical/Libraries/ArEventLog/ArEventLog.var
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

VAR CONSTANT
arEVENTLOG_ERR_PARAMETER : DINT := -1070586096; (*obsolete - invalid parameters specified*)
arEVENTLOG_ERR_RECORDID_INVALID : DINT := -1070586096; (*no record with the given id exists in the logbook*)
arEVENTLOG_ERR_EXISTING : DINT := -1070586095; (*obsolete- log module already exists*)
arEVENTLOG_ERR_LOGBOOK_EXISTS : DINT := -1070586095; (*a logbook with the given name already exists*)
arEVENTLOG_ERR_INTERNAL : DINT := -1070586094; (*unexpected internal error*)
arEVENTLOG_ERR_NAME_INVALID : DINT := -1070586093; (*the given name is invalid (empty)*)
arEVENTLOG_ERR_SIZE_INVALID : DINT := -1070586092; (*the given size is smaller than the minimum size of a logbook*)
arEVENTLOG_ERR_PERSISTENCE_INVAL : DINT := -1070586091; (*the given persistence level is unknown*)
arEVENTLOG_ERR_IDENT_INVALID : DINT := -1070586090; (*the given ident is invalid (NULL)*)
arEVENTLOG_ERR_IDENT_SYSTEM : DINT := -1070586089; (*access denied, the given ident belongs to a system logbook*)
arEVENTLOG_ERR_EVENTID_INVALID : DINT := -1070586088; (*the given event id is no customer event id*)
arEVENTLOG_ERR_LOGBOOK_NOT_FOUND : DINT := -1070586087; (*a logbook with the given name does not exist*)
arEVENTLOG_ERR_ADDDATA_NULL : DINT := -1070586086; (*the given pointer to the additional data buffer is NULL*)
arEVENTLOG_ERR_NO_ERRORNUMBER : DINT := -1070586085; (*the given record is no error number record*)
arEVENTLOG_ERR_MODULE_EXISTS : DINT := -1070586084; (*another module with the given name already exists*)
arEVENTLOG_ERR_NO_DESCRIPTION : DINT := -1070586083; (*no description was found for the given record id*)
arEVENTLOG_ERR_DESCRIPTION_NULL : DINT := -1070586082; (*the given pointer to the description buffer is NULL*)
arEVENTLOG_ERR_FORMAT_INVALID : DINT := -1070586081; (*the given format for the additional data is unknown*)

arEVENTLOG_WRN_NO_EVENTID : DINT := -2144327920; (*the given record is no event id record*)
arEVENTLOG_WRN_FORMAT_INVALID : DINT := -2144327919; (*the given format for the additional data is unknown*)
arEVENTLOG_WRN_ADDDATA_NULL : DINT := -2144327918; (*the given pointer to the additional data is NULL*)

arEVENTLOG_INF_SIZE : DINT := 1076897555; (*specified data size too small*)

arEVENTLOG_SEVERITY_SUCCESS : USINT := 0; (*severity code success*)
arEVENTLOG_SEVERITY_INFO : USINT := 1; (*severity code informational*)
arEVENTLOG_SEVERITY_WARNING : USINT := 2; (*severity code warning*)
arEVENTLOG_SEVERITY_ERROR : USINT := 3; (*severity code error*)

arEVENTLOG_PERSISTENCE_VOLATILE : USINT := 0; (*persistence volatile*)
arEVENTLOG_PERSISTENCE_REMANENT : USINT := 1; (*persistence remanent*)
arEVENTLOG_PERSISTENCE_PERSIST : USINT := 2; (*persistence persistent*)

arEVENTLOG_ADDFORMAT_BINARY : USINT := 0; (*additional data format binary*)
arEVENTLOG_ADDFORMAT_TEXT : USINT := 1; (*additional data format series of null terminated strings*)
arEVENTLOG_ADDFORMAT_CODED : USINT := 2; (*additional data format binary coded data*)
arEVENTLOG_ADDFORMAT_CUST_BASE : USINT := 100; (*additional data format begin of customer area*)
arEVENTLOG_ADDFORMAT_CUST_MAX : USINT := 150; (*additional data format end of customer area*)
END_VAR
Loading

0 comments on commit cfaba1e

Please sign in to comment.