This function will make a backup of the voice messages on the device and store it to a file on the file system.
The voice messages can be restored from the file with the voiceRestore function.
This function is only supported when the project in the device is compiled in X32 compilation mode.
Important:
The voice backup file is not compatible between devices with X32 and NX32 execution architectures.
This means that a backup taken from a MX2 can be restored to other MX2 or DX4 devices (both X32 execution architecture), but not a MX2 turbo (NX32 execution architecture).
Input:
filename : STRING
The name of the file to store the voice backup in.
Returns:
0
|
- Backup was successful.
|
1
|
- No voice messages present.
|
2
|
- Could not create file.
|
3
|
- Drive is full.
|
4
|
- Cannot make a backup from a Project drive.
|
Declaration:
FUNCTION voiceBackup : INT;
VAR_INPUT
filename : STRING;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
upg : verCheckUpgrade;
END_VAR;
fsMediaOpen(media := 1);
fsDirChange(path := "B:\");
upg();
IF NOT upg.transfer AND NOT upg.firmware AND NOT upg.application THEN
IF NOT voicePresent() AND fsFileExists(name := "b:\voice.bak") THEN
DebugMsg(message := "Restoring voice...");
DebugFmt(message := "voiceRestore = \1", v1 := voiceRestore(filename := "voice.bak"));
END_IF;
IF voicePresent() AND NOT fsFileExists(name := "b:\voice.bak") THEN
DebugMsg(message := "Backing up voice...");
DebugFmt(message := "voiceBackup = \1", v1 := voiceBackup(filename := "voice.bak"));
END_IF;
END_IF;
BEGIN
...
END;
END_PROGRAM;
|