SDL Scripting Language

vroomhuhSoftware and s/w Development

Nov 4, 2013 (3 years and 5 months ago)

98 views

SDL Scripting Language
COLORSPACE UDMA supports user programmable scripts which can add new specialized
features or customize existing functions. Write your SDL script in text format, and save it as
a.SDL into a hyperdrive C/SYSTEM/SDL.
Here is the sample for separating the JPG and RAW files
SDL Separate JPG/NEF demo.
PRINT Searching memory card  CALL SCAN_CARD ANY IFEQU $CARD_PATH
NOCARD CALL BEEP 3000 1000
PRINT Memory card not found! SDL_END ENDIF
ASSIGN $SRC_PATH =CONNECT $CARD_PATH /DCIM
PRINT Searching following path : PRINT $SRC_PATH CALL SEARCH_FOLDER
$SRC_PATH IFEQU $FILE_COUNT 0
SDL_END ENDIF
CALL READ_ENV ROOT_PATH ASSIGN $TAG_PATH =CONNECT $ENV /
ASSIGN $TAG_PATH =CONNECT $TAG_PATH $LAST_TIME
CALL READ_ENV FOLDER_SERIAL
ASSIGN $TAG_PATH =CONNECT $TAG_PATH $ENV
PRINT Create target folder : PRINT $TAG_PATH
CALL CREATE_FOLDER $TAG_PATH
IFEQU $FOLDER_PATH ERROR
SDL_END
ENDIF
ASSIGN $JPG_PATH =CONNECT $TAG_PATH /JPG
PRINT $JPG_PATH
CALL CREATE_FOLDER $JPG_PATH
IFEQU $FOLDER_PATH ERROR
SDL_END
ENDIF
ASSIGN $NEF_PATH =CONNECT $TAG_PATH /NEF
PRINT $NEF_PATH
CALL CREATE_FOLDER $NEF_PATH
IFEQU $FOLDER_PATH ERROR
SDL_END
ENDIF
CALL CLEAR_FILTER
CALL SET_FILTER_EXT JPG
PRINT Transfer JPG files 
CALL BACKUP_PART $SRC_PATH $JPG_PATH SOURCE TILE REALTIME UDMA66
IFEQU $BACKUP_RESULT ERROR
CALL BEEP 3000 1000 PRINT Transfer JPG ERROR!
CALL WAIT_KEY 90
SDL_END
ENDIF
CALL CLEAR_FILTER
CALL SET_FILTER_EXT NEF
PRINT Transfer NEF files 
CALL BACKUP_PART $SRC_PATH $NEF_PATH SOURCE TILE REALTIME UDMA66
IFEQU $BACKUP_RESULT ERROR
CALL BEEP 3000 1000
CALL WAIT_KEY 90
SDL_END
ENDIF
CALL BEEP 1000 1000
PRINT Transfer JPG and NEF OK!
CALL WAIT_KEY 90 IFEQU $KEY KEY_BACK
CALL POWER_OFF
SDL_END
ENDIF
SDL_END
LCD Screen Commands
A) BACKLIGHT
Feature: Adjust backlight brightness
Format: BACKLIGHT <backlight brightness>
Parameters:
<backlight brightness>
0 turn off backlight
29 minimal brightness
69 medium brightness
99 maximum brightness
Return Value: None
Example: BACKLIGHT 69
B) CLEAR_SCREEN
Feature: Clear the contents of the LCD screen
Format: CLEAR_SCREEN
Parameters: None
Return Value: None
Example: CLEAR_SCREEN
C) PRINT
Feature: Display a line of text and/or variables.
Format: PRINT <display content>
Parameters:
<display content >
e.g. Hello World string/text
e.g. variables
Return Value: None
Example: PRINT Hello World
Folder Commands
A) CREATE_FOLDER
Feature: Create a new folder
Format: CREATE_FOLDER <path name>
Parameters: <path name> must start with /C/ or /G/ which are the absolute path names of
the first hard drive partition and first memory card respectively.
Return Value: If creation of new folder is successful, $FOLDER_PATH will return the
absolute path name of the new folder.
If unsuccessful, $FOLDER_PATH will return ERROR
Example: CREATE_FOLDER /C/PHOTOS
B) SELECT_FOLDER
Feature: Select a folder
Format: SELECT_FOLDER <folder name> <source path name>
Parameters:
<folder name> name of the folder
<source path name>
path where the folder can be
found
Return Value: If successful, $SELECTED_PATH will return the absolute path name of the
selected folder.
If unsuccessful, $SELECTED_PATH will return ERROR
Example: SELECT_FOLDER PHOTOS /C/
C) BROWSE_FOLDER
Feature: Browse the images in a folder
Format: BROWSE_FOLDER <folder name>
Parameters: <folder name> name of the folder where the images are stored
Return Value: None
Example: BROWSE_FOLDER PHOTOS
D) FILE_MANAGER
Feature: Run File Manager
Format: FILE_MANAGER
Parameters: None
Return Value: None
Example: FILE_MANAGER
Device Control Commands
A) BEEP
Feature: Create a beep tone
Format: BEEP <frequency> <duration>
Parameters:
<frequency>
tone frequency in Hz (e.g.
100~10000)
<duration>
tone duration in milliseconds (e.g.
100~10000)
Return Value: None
Example: BEEP 100 10000
B) POWER_OFF
Feature: Turns off the device
Format: POWER_OFF
Parameters: None
Return Value: None
Example: POWER_OFF
C) READ_ENV
Feature: Obtain the environment variable values
Format: READ_ENV <environment variable name>
Parameters:
<environment variable name> Description
LAST_PATH
the last hard drive backup folder
path name
FOLDER_SERIAL backup folder serial number
ROOT_PATH
designated backup path on the
hard drive
Return Value: Environment variable value stored in the variable $ENV
Example: READ_ENV LAST_PATH
D) SCAN_CARD
Feature: Scans a memory card
Format: SCAN_CARD <memory card name>
Parameters:
<memory card name> Description
CF
Access CF memory card
information.
SD
Access SD memory card
information.
ANY
Test all memory card slots, access
information of the first memory
card detected.
Testing priority is as follows: CF
> SD > MS > xD
Return Value:
If the specified memory card exists, the variable $CARD_PATH will store the path name of
the memory card. The variable $CARD_CAPACITY will store the remaining capacity of the
memory card in Mbytes.
If the specified the memory card does not exists, the variable $CARD_PATH will return
NOCARD
Example: SCAN_CARD ANY
E) WAIT_KEY
Feature: Waits for user keystrokes
Format: WAIT_KEY <waiting time>
Parameters: <waiting time> e.g. 1~240 seconds
Return Value:
If a button is pressed during the waiting time, the keystroke value will be stored in the
variable $KEY, otherwise $KEY will return NOKEY. Below is the full list of keystroke
values for all the buttons found on COLORSPACE UDMA.
[KEY_MENU][KEY_UP][KEY_ZOOMIN]
[KEY_LEFT][KEY_RIGHT]
[KEY_BACK][KEY_DOWN][KEY_ZOOMOUT]
Example: WAIT_KEY 240
F) SET_USB_HOST
Feature: Activates USB OTG
Format: SET_USB_HOST <switch>
Parameters:
<switch> Description
On
Activates USB OTG, port
becomes USB Host
Off
Deactivates USB OTG, port
becomes USB Device
Return Value: None
Note: Command will not change the USB port status immediately. Instead, the port status will
only change the next time the file directory is accessed. Consider using SELECT_FOLDER
command right after SET_USB_HOST command if you wish to change the USB port status
immediately.
Example: SET_USB_HOST On
Script Control Commands
A) SDL
Feature: Indicates the beginning of the SDL script. This must be the first command of the
SDL script.
Format: SDL <script name >
Parameters: <script name > will be displayed on the LCD screen title bar.
Return Value: None
Example: SDL Hello World
B) SDL_END
Feature: Indicates the end of the SDL script. This command can occur anywhere in the SDL
script and will terminate the script immediately.
Format: SDL_END
Parameters: None
Return Value: None
Example: SDL_END
C) IFEQU / ENDIF / ELSE
Feature:
IFEQU (if equal) compares if two parameters are equal.
If equal, the script will continue until a ELSE or ENDIF command. Any script between the
ELSE and ENDIF command is skipped.
If not equal, the script will skip to next ELSE command and continue until a ELSE or
ENDIF command.
Format:
IFEQU <parameter 1> <parameter 2>
<script 1>
ELSE
<script 2 >
ENDIF
Parameters: None
Return Value: None
Backup Control Commands
Full Backup Command
A) BACKUP_ALL
Feature: Customize full backup from a specific memory card folder to a specific hard drive
folder.
Format: BACKUP_ALL <memory card path name> <hard drive path name> <backup
preview source> <preview mode> <verification mode> <backup speed>
Parameters:
Parameters Description
<memory card path name>
a memory card folders absolute
path name. It can be the root
folder of the memory card
<hard drive path name>
the hard drive folders absolute
path name. It cannot be the root
folder of the hard drive

<backup preview source>
SOURCE
preview files from the memory
card
TARGET previews files from the hard drive

NONE
no previews

<preview mode>
SINGLE display single image previews
TILE
display 60 x 60 pixels image tile
previews
NONE
no previews

<verification mode>
REALTIME
perform real time CRC data
verification
HDD
compares checksum with hard
drive data
CARD
compares checksum with memory
card data
BOTH
compares checksum with both
hard drive and memory card data

<backup speed>
UDMA66 high speed backup at 40MB/s
HYPER low speed backup at 16MB/s
Return Value:
Return Value Description
$BACKUP_RESULT
if backup is successful, will return
 OK
if not successful, it will return
 ERROR
$TRANSFER_SIZE
the total memory size of files
successfully transferred in bytes
$TRANSFER_NUMBER
the total number of files
successfully transferred
$TRANSFER_TIME
the total time taken to for the
transfer in seconds
Partial Backup Command
B) CLEAR_FILTER
Feature: Remove the backup filter
Format: CLEAR_FILTER
Parameters: None
Return Value: None
C) SET_FILTER_EXT
Feature: Set a file extension filter. Device will not backup files with unspecified extensions.
Format: SET_FILTER_EXT <extension>
Parameters: <extension> must contain only three characters
Return Value: None
Example: SET_FILTER_EXT CR2
D) SET_FILTER_SIZE
Feature: Set a file size filter. Device will not backup files with file sizes outside the set range.
Format: SET_FILTER_SIZE <file minimum size> <file maximum size>
Parameters: <file minimum size> and <file maximum size> must be in bytes
Return Value: None
Example: SET_FILTER_SIZE1000 5000
E) SET_FILTER_DATE
Feature: Set a file date (year/month/day) filter. Device will not backup files dated outside the
set range.
Format: SET_FILTER_DATE <year><start date><end date>
Parameters:
Parameters Description
<year> YYYY format e.g. 1980~2079
<start date > MMDD format
<end date > MMDD format
Return Value: None
Example: SET_FILTER_DATE 2009 0101 1231
F) SET_FILTER_TIME
Feature: Set a file time (hour/minute) filter. Device will not backup files timed outside the set
range.
Format: SET_FILTER_TIME <start time> <end time>
Parameters: <start time> and <end time> must be in HHMM format
Return Value: None
Example: SET_FILTER_TIME 0000 2359
G) BACKUP_PART
Feature: Perform partial backup based on abovementioned filter settings, from a specific
memory card folder to a specific hard drive folder
Format: BACKUP_PART <memory card path name> <hard drive path name> <backup
preview source> <preview mode> <verification mode> <backup speed>
Parameters:
Parameters Description
<memory card path name>
a memory card folders absolute
path name. It can be the root
folder of the memory card
<hard drive path name>
the hard drive folders absolute
path name. It cannot be the root
folder of the hard drive

<backup preview source>
SOURCE
preview files from the memory
card
TARGET
previews files from the hard drive

NONE no previews

<preview mode>
SINGLE display single image previews
TILE
display 60 x 60 pixels image tile
previews
NONE no previews

<verification mode>
REALTIME
perform real time CRC data
verification
HDD
compares checksum with hard
drive data
CARD
compares checksum with memory
card data
BOTH
compares checksum with both
hard drive and memory card data

<backup speed>
UDMA66
high speed backup at 40MB/s
HYPER low speed backup at 16MB/s
Return Value:
Return Value Description
$BACKUP_RESULT
if backup is successful, will return
 OK
if not successful, it will return
 ERROR
$TRANSFER_SIZE
the total memory size of files
successfully transferred in bytes
$TRANSFER_NUMBER
the total number of files
successfully transferred
$TRANSFER_TIME
the total time taken to for the
transfer in seconds
Incremental Backup Command
A) BACKUP_INC
Feature: Run Incremental Backup Command.
First, system will compare the folders in memory card and external hard disk drive.
Then, it will backup any file or folder that has changed in memory card to the selected folder
in external hard disk drive.
Format: BACKUP_INC <memory card path name> <hard drive path name> <backup
preview source> <preview mode> <verification mode> <backup speed>
Parameters:
Parameters Description
<memory card path name>
a memory card folders absolute
path name. It can be the root
folder of the memory card
<hard drive path name>
the hard drive folders absolute
path name. It cannot be the root
folder of the hard drive

<backup preview source>
SOURCE
preview files from the memory
card
TARGET previews files from the hard drive

NONE
no previews

<preview mode>
SINGLE display single image previews
TILE
display 60 x 60 pixels image tile
previews
NONE
no previews

<verification mode>
REALTIME
perform real time CRC data
verification
HDD
compares checksum with hard
drive data
CARD
compares checksum with memory
card data
BOTH
compares checksum with both
hard drive and memory card data

<backup speed>
UDMA66
high speed backup at 40MB/s
HYPER low speed backup at 16MB/s
Return Value:
Return Value Description
$BACKUP_RESULT
if backup is successful, will return
 OK
if not successful, it will return
 ERROR
$TRANSFER_SIZE
the total memory size of files
successfully transferred in bytes
$TRANSFER_NUMBER
the total number of files
successfully transferred
$TRANSFER_TIME
the total time taken to for the
transfer in seconds
Feature Restriction:
If single folder contains more than 8192 of items, it will stop function.
If needed backup folder is more than 8192, it wil stop function.
Synchronized Command
A) SYNC_ANALYZE
Feature: Run comparison between two folders.
Format: SYNC_ANALYZE <initial folder path name> <appointed folder path name>
Parameters:
Parameters Description
<initial folder path name> Specific folder path name on
internal hard disk drive
<appointed folder path name>
Specific folder path name on
memory card or external hard disk
drive
Return Value:
Return Value Description
$SYNC_INT2EXT_FILES
the amount of files in initial folder
is more than in appointed folder
$SYNC_INT2EXT_SIZE
the memory size in initial folder is
larger than in appointed folder
$SYNC_INT2EXT_SECTORS
the number of sectors in initial
folder is more than in appointed
folder
$SYNC_EXT2INT_FILES
the number of files in appointed
folder is more than in initial folder

$SYNC_EXT2INT_SIZE
the memory size in appointed
folder is larger than in initial
folder
$SYNC_EXT2INT_SECTORS
the number of sectors in appointed
folder is more than in initial folder

B) SYNC_COPY
Feature: Perform Synchronized Copy.
First, system will run comparison between the folders in memory card and external hard disk
drive.
Any changes of file or folder in memory card will be copied to the selected folder in external
hard disk drive.
Format: SYNC_COPY<initial folder path name> <appointed folder path name> < the total
number of sectors in synchronized copy> <copy speed>
Parameters
Parameters Description
<initial folder path name>
source of synchronized folder
path name
<appointed folder path name>
appointed synchronized folder
path name
<the total number of sectors in
synchronized copy>
running the total number of
sectors in synchronized copy soon

<copy speed> HYPER: low speed synchronized
copy at 16MB/s
UDMA66: high speed
synchronized copy at 40MB/s
Return Value:
Parameters Description
$SYNC_RESULT
if copy is successful, will return
 OK
if not successful, it will return
 ERROR
$TRANSFER_SIZE
the total memory size of file
successfully synchronized in bytes

$TRANSFER_NUMBER
the total number of files
successfully synchronized
$TRANSFER_TIME
the total time taken to for the
synchronized in seconds
Note:
Please perform SYNC_ANALYZE before running any SYNC_COPYcommand.
Every single command of SYNC_COPY will run one way synchronized copy from source
to appointed folder.
Please check on the references from SYNC BiD LS.SDL for detail information.
If total needed synchronized folders is more than 16384, the feature will stop function.
Variable Assignment Commands
A) ASSIGN
Feature: Run variable assignment.
Format: ASSIGN <variable name> <variable value>
Parameters:
Parameters Description
<variable name> the name of assigned variable
<variable value> number
another variable:
variable control :=SELECT or =CONNECT
Return Value: None
B) =SELECT
Feature: Run variable assignment
Format: ASSIGN <variable name> <variable value>
Parameters:
Parameters Description
<variable name> the name of assigned variable
<variable value> number
another variable:
variable control :=SELECT or =CONNECT
Return Value: None
C) =CONNECT
Feature: Run variable assignment
Format: ASSIGN <variable name> <variable value>
Parameters:
Parameters Description
<variable name> the name of assigned variable
<variable value> number
another variable:
variable control :=SELECT or =CONNECT
Return Value: None