-
Notifications
You must be signed in to change notification settings - Fork 1
Home
The sample consists of two main components. The sample page is used to operate the recorder management. The task mappRecorder_01 drives the recorder management. The following functions are currently supported.
- Create new recordings
- Delete recordings
- View record data
- Download record data
Up to 3 web clients can connect at the same time. While the task itself can only execute one command at a time the commands are executed so fast that this should not be an issue. The init command may take longer but the response data is distributed to all sessions. The task uses a variable structure to communicate with the outside world that can also be used to interact with other tasks. The structure Recorder_01 looks as follows:
Level 1 | Level 2 | Level Description | ||
CMD | Used to trigger commands like Init, record, delete, ... A command is triggered by setting it to true, when the command is finished the task will reset the command. This indicates that the command is finished. Do not change any parameters or set another command until the previous command is finished. | |||
---|---|---|---|---|
Init | Initializes the record management and reads the names of previous recordings. | |||
Record | Starts a new recording session. This value must be true to all recording types. | |||
Trigger | Creates a trigger based entry. | |||
Delete | Deletes the selected record file | |||
View | View the selected recording file | |||
Download | Download the selected recording file | |||
ErrorReset | Resets pending errors | |||
PAR | Parameters like record variables, name, ... | |||
RecordNameNew | Record name or file pattern for command record | |||
RecordName | Record name for command delete and view | |||
RecordMode | Type of recording. Trigger, event, timer based or a combination of the three. | |||
RecordIntervall | Time for timer based record mode. | |||
IsRecording | Indicates that a recording is active | |||
SamplesNum | Samples in active recording | |||
Initialized | Shows that the record management was initialized. | |||
VisuSlotID | This is the session ID for the current command. This is used to identify where to send response messages. | |||
DAT | Recordings lists as well as status information | |||
RecordNames | List with all record names | |||
RecordNum | Number of recordings in the list | |||
Status | Shows the result for the last command | |||
VIS | Data specific for the visualization. The structure is an array, one for each client session | |||
RecordNames | List with all recordings formatted as data provider for the mappView list box | |||
RecordNum | Number of visible records in the list. Depending on the filter this number can be lower than the total number of records stored under DAT. | |||
RecordFilter | Only show records that fit the filter pattern. | |||
RecordSelected | Selected record used with the command delete and view. | |||
RecordDoubleClick | Helper variable to detect a double click on a record. When a double click is detected the record is opened. | |||
EnableButtons | Enable buttons delete and view if at least one record is available. | |||
ViewFilePath | File path used for the web widget that shows the file content. | |||
FileView | Trigger to open the fly out window and view the file content | |||
DownloadFileUrl | Url containing the file name that is downloaded | |||
ShowMessageBoxError | Show a message box when command was not successful | |||
ERR | Information about errors | |||
State | State where the error occurred | |||
Text | Error text | |||
StatusText | Shows the result for the last command. | |||
StatusNo | Shows the status as number |
The sample communicates with the outside world via the global structure 'Recorder_01'. If more than one recorder management is needed the complete package 'mappRecorder' should be duplicated. It is important that the new task name and new global structure use the same name.
After importing the sample go to the package 'mappRecorder' and edit the file 'DatVariables.var'. The variable array 'DAT_VAR_LIST' contains the name of the variables that contain the record data. The default variable has a few sample values. After importing the task these can be replaced with "real" variables that should be saved. The variables can be standard type but also arrays or structures.
The following constants located in the package mappRecorder under Variables.var can be adjusted if necessary.
Constant | Default | Text |
---|---|---|
DAT_MAX_NUM | 100 | Maximum number of records. |
DAT_NAME_LENGTH | 40 | Maximum length for a record name. |
DAT_VIS_LENGTH | 120 | Make this REC_NAME_LENGTH x 3. |
DAT_MAX_CLIENTS_ID | 2 | Maximum number of concurrent web client connections. Do not change this number. |
DAT_VIEW_FILTER | csv, xml | Files extensions than can be used with the view command. Filter is case sensitive. |
DAT_DOWNLOAD_SIZE | 500000 | Maximum size of memory allocated for uploading and downloading files |
DAT_VAR_NUM | 10 | Maximum number of variables that can be registered. |
DAT_DEVICE | RECORDER_DEVICE | Device name for the recording data defined under File Devices in the CPU configuration. |
DAT_THIS_TASK | Recorder_1 | Name of this task and the global variables structure. |
DAT_MPLINK | gDataRecorder_1 | mappRecoreer link name from configuration view |
DAT_VAR_LIST | List of variables to be inlcuded in a record |
The sample generates the following list of error messages. All other error numbers are generated from included libraries that can be found in the Automation Studio help.
No | Constant | Text |
---|---|---|
50010 | ERR_REC_TOO_MANY_CLIENTS | More than 3 clients try to connect to user management |
50100 | ERR_REC_NAME_EMPTY | Record name is empty |
50101 | ERR_REC_NAME_EXISTS | Record name already exists |
50102 | ERR_REC_NAME_LOST | Record name was not found |
50103 | ERR_REC_NAME_LENGTH | One or more record names exceeds maximum length |
50110 | ERR_REC_DEV_NAME_EMPTY | Device name is empty |
50120 | ERR_REC_VAR_NAME_EMPTY | Variable name is empty |
50130 | ERR_REC_NOT_INITIALIZED | Record management is not initialized |
50200 | ERR_REC_MAX_NUM | Record management is not initialized |
50300 | ERR_REC_TASK_NAME | Task name is incorrect. Make sure task name and global variable structure share the same name and that the string "this" is correct in the init task. |
50400 | ERR_MEM_ALLOC | Memory allocation for file upload and download failed |
50410 | ERR_MEM_DOWNLOAD | Size of download file exceeds maximum |
50420 | ERR_TIMEOUT_DOWNLOAD | Download response timed out |
- Fixed memory violation when file exceeds download buffer size
- Only start recording when FUB is active
- Changed some parameters to constants
- Simplified configuration
- Added more error messages
- Added the possibility to define multiple variables
- Moved status text to main structure
- Moved error no up to main structure and renamed it to StatusNo
- Rercord name can now be defined at RecordNameNew
- Fixed oversized item flag is not reset
- Fixed ReplaceString function call
- Update mapp to version 5.8.1
- Fixed download not working when downloading the same file again
First public release