voiceRestore (Function)

Top  Previous  Next

Architecture:

X32 / NX32

Device support:

All with voice/DTMF capability

Firmware version:

4.34


This function will restore voice messages from a file created with the voiceBackup function.

This function is only supported when the project in the device is compiled in X32 compilation mode.

 

Important note for X32 execution architecture devices:

Calling this function will erase the flash area where the upgrade image is located overwriting any pending and uncommitted updates.

It is therefore advisable to check with verCheckUpgrade for any pending upgrades before calling this function.

 

Input:

filename : STRING

The name of the file to restore the voice backup from.

 

Returns:

0

- Restore was successful.

1

- Could not open file.

2

- Not a valid voice backup file.

4

- Cannot restore to a Project drive.

 

Declaration:

FUNCTION voiceRestore : INT;
VAR_INPUT
  filename : STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  upg : verCheckUpgrade;
END_VAR;
 
  // Initialize file system
  fsMediaOpen(media := 1);
  // Change media
  fsDirChange(path := "B:\");
 
  // Restore voice
  upg();
  IF NOT upg.transfer AND NOT upg.firmware AND NOT upg.application THEN
    //
    // Restore voice
    //
    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;
 
    //
    // Backup voice
    //
    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;