LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Memory

MemoryLibraryCodes

opFILE (CMD, ....)

  • Memory file entry
  • Dispatch status unchanged

    Parameters
    (DATA8)CMD - Specific command parameter


    • CMD = OPEN_APPEND
      Create file or open for append (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)NAME - First character in file name (character string)
      • Returns
        (HANDLER) HANDLE - Handle to file

    • CMD = OPEN_READ
      Open file for read (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)NAME - First character in file name (character string)
      • Returns
        (HANDLER) HANDLE - Handle to file
      • Returns
        (DATA32) SIZE - File size (0 = not found)

    • CMD = OPEN_WRITE
      Create file for write (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)NAME - First character in file name (character string)
      • Returns
        (HANDLER) HANDLE - Handle to file

    • CMD = CLOSE
      Close file
      • Parameters
        (HANDLER)HANDLE - Handle to file

    • CMD = REMOVE
      Delete file (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)NAME - First character in file name (character string)

    • CMD = MOVE
      Move file SOURCE to DEST (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)SOURCE - First character in source file name (character string)
      • Parameters
        (DATA8)DEST - First character in destination file name (character string)

    • CMD = WRITE_TEXT
      Write text to file
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA8)DEL - Delimiter code
      • Parameters
        (DATA8)TEXT - First character in text to write (character string)

    • CMD = READ_TEXT
      Read text from file
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA8)DEL - Delimiter code
      • Parameters
        (DATA8)LENGTH - Maximal string length
      • Returns
        (DATA8) TEXT - First character in text to read (character string)

    • CMD = WRITE_VALUE
      Write floating point value to file
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA8)DEL - Delimiter code
      • Parameters
        (DATAF)VALUE - Value to write
      • Parameters
        (DATA8)FIGURES - Total number of figures inclusive decimal point
      • Parameters
        (DATA8)DECIMALS - Number of decimals

    • CMD = READ_VALUE
      Read floating point value from file
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA8)DEL - Delimiter code
      • Returns
        (DATAF) VALUE - Value to write

    • CMD = WRITE_BYTES
      Write a number of bytes to file
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA16)BYTES - Number of bytes to write
      • Parameters
        (DATA8)SOURCE - First byte in byte stream to write

    • CMD = READ_BYTES
      Read a number of bytes from file
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA16)BYTES - Number of bytes to write
      • Returns
        (DATA8) DESTINATION - First byte in byte stream to write

    • CMD = OPEN_LOG
      Create file for data logging (if name starts with '~','/' or '.' it is not from current folder) (see Example)
      • Parameters
        (DATA8)NAME - First character in file name (character string)
      • Parameters
        (DATA32)syncedTime -
      • Parameters
        (DATA32)syncedTick -
      • Parameters
        (DATA32)nowTick -
      • Parameters
        (DATA32)sample_interval_in_ms -
      • Parameters
        (DATA32)duration_in_ms -
      • Parameters
        (DATA8)SDATA - First character in sensor type data (character string)
      • Returns
        (HANDLER) HANDLE - Handle to file

    • CMD = WRITE_LOG
      Write time slot samples to file (see Example)
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA32)TIME - Relative time in mS
      • Parameters
        (DATA8)ITEMS - Total number of values in this time slot
        .
        (DATAF)VALUES - DATAF array (handle) containing values

    • CMD = CLOSE_LOG
      Close data log file (see Example)
      • Parameters
        (HANDLER)HANDLE - Handle to file
      • Parameters
        (DATA8)NAME - First character in file name (character string)

    • CMD = GET_LOG_NAME
      Get the current open log filename
      • Parameters
        (DATA8)LENGTH - Max string length (don't care if NAME is a HND
      • Parameters
        (DATA8)NAME - First character in file name (character string or HND)

    • CMD = GET_HANDLE
      Get handle from filename (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)NAME - First character in file name (character string)
      • Returns
        (HANDLER) HANDLE - Handle to file
      • Returns
        (DATA8) WRITE - Open for write / append (0 = no, 1 = yes)

    • CMD = MAKE_FOLDER
      Make folder if not present
      • Parameters
        (DATA8)NAME - First character in folder name (character string)
      • Returns
        (DATA8) SUCCESS - Success (0 = no, 1 = yes)

    • CMD = LOAD_IMAGE
      • Parameters
        (DATA16)PRGID - Program id (see prgid)
      • Parameters
        (DATA8)NAME - First character in name (character string)
      • Returns
        (DATA32) SIZE - Size
      • Returns
        (DATA32) *IP - Address of image

    • CMD = GET_POOL
      • Parameters
        (DATA32)SIZE - Size of pool
      • Returns
        (HANDLER) HANDLE - Handle to pool
      • Returns
        (DATA32) *IP - Address of image

    • CMD = GET_FOLDERS
      • Parameters
        (DATA8)NAME - First character in folder name (ex "../prjs/")
      • Returns
        (DATA8) ITEMS - No of sub folders

    • CMD = GET_SUBFOLDER_NAME
      • Parameters
        (DATA8)NAME - First character in folder name (ex "../prjs/")
      • Parameters
        (DATA8)ITEM - Sub folder index [1..ITEMS]
      • Parameters
        (DATA8)LENGTH - Maximal string length
      • Returns
        (DATA8) STRING - First character in character string

    • CMD = DEL_SUBFOLDER
      • Parameters
        (DATA8)NAME - First character in folder name (ex "../prjs/")
      • Parameters
        (DATA8)ITEM - Sub folder index [1..ITEMS]

    • CMD = SET_LOG_SYNC_TIME
      • Parameters
        (DATA32)TIME - Sync time used in data log files
      • Parameters
        (DATA32)TICK - Sync tick used in data log files

    • CMD = GET_LOG_SYNC_TIME
      • Returns
        (DATA32) TIME - Sync time used in data log files
      • Returns
        (DATA32) TICK - Sync tick used in data log files

    • CMD = GET_IMAGE
      • Parameters
        (DATA8)NAME - First character in folder name (ex "../prjs/")
      • Parameters
        (DATA16)PRGID - Program id (see prgid)
      • Parameters
        (DATA8)ITEM - Sub folder index [1..ITEMS]
      • Returns
        (DATA32) *IP - Address of image

    • CMD = GET_ITEM
      • Parameters
        (DATA8)NAME - First character in folder name (ex "../prjs/")
      • Parameters
        (DATA8)STRING - First character in item name string
      • Returns
        (DATA8) ITEM - Sub folder index [1..ITEMS]

    • CMD = GET_CACHE_FILES
      • Returns
        (DATA8) ITEMS - No of files in cache

    • CMD = GET_CACHE_FILE
      • Parameters
        (DATA8)ITEM - Cache index [1..ITEMS]
      • Parameters
        (DATA8)LENGTH - Maximal string length
      • Returns
        (DATA8) STRING - First character in character string

    • CMD = PUT_CACHE_FILE
      • Parameters
        (DATA8)STRING - First character in character string

    • CMD = DEL_CACHE_FILE
      • Parameters
        (DATA8)ITEM - Cache index [1..ITEMS]
      • Parameters
        (DATA8)LENGTH - Maximal string length
      • Returns
        (DATA8) STRING - First character in character string


        opARRAY (CMD, ....)
  • Array entry
  • Dispatch status can change to BUSYBREAK or FAILBREAK

    Parameters
    (DATA8)CMD - Specific command parameter


    • CMD = CREATE8
      • Parameters
        (DATA32)ELEMENTS - Number of elements
      • Returns
        (HANDLER) HANDLE - Array handle

    • CMD = CREATE16
      • Parameters
        (DATA32)ELEMENTS - Number of elements
      • Returns
        (HANDLER) HANDLE - Array handle

    • CMD = CREATE32
      • Parameters
        (DATA32)ELEMENTS - Number of elements
      • Returns
        (HANDLER) HANDLE - Array handle

    • CMD = CREATEF
      • Parameters
        (DATA32)ELEMENTS - Number of elements
      • Returns
        (HANDLER) HANDLE - Array handle

    • CMD = SIZE
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Returns
        (DATA32) ELEMENTS - Total number of elements in array

    • CMD = RESIZE
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (DATA32)ELEMENTS - Total number of elements

    • CMD = DELETE
      • Parameters
        (HANDLER)HANDLE - Array handle

    • CMD = FILL
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (type)VALUE - Value to write - type depends on type of array

    • CMD = COPY
      • Parameters
        (HANDLER)HSOURCE - Source array handle
      • Parameters
        (HANDLER)HDEST - Destination array handle

    • CMD = INIT8
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (DATA32)INDEX - Index to element to write
      • Parameters
        (DATA32)ELEMENTS - Number of elements to write
        Below a number of VALUES equal to "ELEMENTS"
      • Parameters
        (DATA8)VALUE - First value to write - type must be equal to the array type

    • CMD = INIT16
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (DATA32)INDEX - Index to element to write
      • Parameters
        (DATA32)ELEMENTS - Number of elements to write
        Below a number of VALUES equal to "ELEMENTS"
      • Parameters
        (DATA16)VALUE - First value to write - type must be equal to the array type

    • CMD = INIT32
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (DATA32)INDEX - Index to element to write
      • Parameters
        (DATA32)ELEMENTS - Number of elements to write
        Below a number of VALUES equal to "ELEMENTS"
      • Parameters
        (DATA32)VALUE - First value to write - type must be equal to the array type

    • CMD = INITF
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (DATA32)INDEX - Index to element to write
      • Parameters
        (DATA32)ELEMENTS - Number of elements to write
        Below a number of VALUES equal to "ELEMENTS"
      • Parameters
        (DATAF)VALUE - First value to write - type must be equal to the array type

    • CMD = READ_CONTENT
      • Parameters
        (DATA16)PRGID - Program slot number (must be running) (see prgid)
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (DATA32)INDEX - Index to first byte to read
      • Parameters
        (DATA32)BYTES - Number of bytes to read
      • Returns
        (DATA8) ARRAY - First byte of array to receive data

    • CMD = WRITE_CONTENT
      • Parameters
        (DATA16)PRGID - Program slot number (must be running) (see prgid)
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Parameters
        (DATA32)INDEX - Index to first byte to write
      • Parameters
        (DATA32)BYTES - Number of bytes to write
      • Parameters
        (DATA8)ARRAY - First byte of array to deliver data

    • CMD = READ_SIZE
      • Parameters
        (DATA16)PRGID - Program slot number (must be running) (see prgid)
      • Parameters
        (HANDLER)HANDLE - Array handle
      • Returns
        (DATA32) BYTES - Number of bytes in array


        opARRAY_WRITE (HANDLE, INDEX, VALUE)
  • Array element write
  • Dispatch status can change to FAILBREAK

    Parameters
    (HANDLER)HANDLE - Array handle
    (DATA32)INDEX - Index to element to write
    (type)VALUE - Value to write - type depends on type of array


    opARRAY_READ (HANDLE, INDEX, VALUE)
  • Array element write
  • Dispatch status can change to FAILBREAK

    Parameters
    (HANDLER)HANDLE - Array handle
    (DATA32)INDEX - Index of element to read
    Returns
    (type) VALUE - Value to read - type depends on type of array



    opARRAY_APPEND (HANDLE, VALUE)

  • Array element append
  • Dispatch status can change to FAILBREAK

    Parameters
    (HANDLER)HANDLE - Array handle
    (type)VALUE - Value (new element) to append - type depends on type of array


    opMEMORY_USAGE (TOTAL, FREE)
  • Get memory usage
  • Dispatch status unchanged

    Returns
    (DATA32) TOTAL - Total memory [KB]
    (DATA32) FREE - Free memory [KB]



    opFILENAME (CMD, ....)

  • Memory filename entry
  • Dispatch status unchanged

    Parameters
    (DATA8)CMD - Specific command parameter


    • CMD = EXIST
      Test if file exists (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)NAME - First character in file name (character string)
      • Returns
        (DATA8) FLAG - Exist (0 = no, 1 = yes)

    • CMD = TOTALSIZE
      Calculate folder/file size (if name starts with '~','/' or '.' it is not from current folder)
      • Parameters
        (DATA8)NAME - First character in file name (character string)
      • Returns
        (DATA32) FILES - Total number of files
      • Returns
        (DATA32) SIZE - Total folder size [KB]

    • CMD = SPLIT
      Split filename into Folder, name, extension
      • Parameters
        (DATA8)FILENAME - First character in file name (character string) "../folder/subfolder/name.ext"
      • Parameters
        (DATA8)LENGTH - Maximal length for each of the below parameters
      • Returns
        (DATA8) FOLDER - First character in folder name (character string) "../folder/subfolder"
      • Returns
        (DATA8) NAME - First character in name (character string) "name"
      • Returns
        (DATA8) EXT - First character in extension (character string) ".ext"

    • CMD = MERGE
      Merge Folder, name, extension into filename
      • Parameters
        (DATA8)FOLDER - First character in folder name (character string) "../folder/subfolder"
      • Parameters
        (DATA8)NAME - First character in name (character string) "name"
      • Parameters
        (DATA8)EXT - First character in extension (character string) ".ext"
      • Parameters
        (DATA8)LENGTH - Maximal length for the below parameter
      • Returns
        (DATA8) FILENAME - First character in file name (character string) "../folder/subfolder/name.ext"

    • CMD = CHECK
      Check filename
      • Parameters
        (DATA8)FILENAME - First character in file name (character string) "../folder/subfolder/name.ext"
      • Returns
        (DATA8) OK - Filename ok (0 = FAIL, 1 = OK)

    • CMD = PACK
      Pack file or folder into "raf" container
      • Parameters
        (DATA8)FILENAME - First character in file name (character string) "../folder/subfolder/name.ext"

    • CMD = UNPACK
      Unpack "raf" container
      • Parameters
        (DATA8)FILENAME - First character in file name (character string) "../folder/subfolder/name"

    • CMD = GET_FOLDERNAME
      Get current folder name
      • Parameters
        (DATA8)LENGTH - Maximal length for the below parameter
      • Returns
        (DATA8) FOLDERNAME - First character in folder name (character string) "../folder/subfolder"