File Transfer

Description

Module: geocompy.geo.ftr

Definitions for the GeoCOM File transfer subsystem.

Types

  • GeoComPFTR

Definitions

class GeoComFTR(parent: GeoComType)[source]

File transfer subsystem of the GeoCOM protocol.

This subsystem provides access to the internal file system of the instrument, and provides methods to list or download files.

Added in version GeoCOM-TPS1200.

Parameters:
parent: GeoComType

The parent protocol instance of this subsystem.

abort_download() GeoComResponse[None][source]

RPC 23305, FTR_AbortDownload

Aborts current file download setup.

Return type:

GeoComResponse

abort_listing() GeoComResponse[None][source]

RPC 23308, FTR_AbortList

Aborts current file listing setup.

Return type:

GeoComResponse

See also

setup_listing, list

delete(filename: str, time: datetime | None = None, device: Device | str = Device.CFCARD, filetype: File | str = File.UNKNOWN) GeoComResponse[int][source]

RPC 23309, FTR_Delete

Deletes one or more files. Wildcards can be used to delete multiple items. If a date is given, only files older than that date are deleted.

Parameters:
filename: str

File name (or full path if type is unknown).

time: datetime | None = None

Deletion limit date, by default None

device: Device | str = Device.CFCARD

Memory device, by default CFCARD

filetype: File | str = File.UNKNOWN

File type, by default UNKNOWN

Returns:

Params:
  • int: Number of files deleted.

Error codes:
  • IVPARAM: Memory device unavailable, or cannot find file path.

Return type:

GeoComResponse

See also

list

delete_directory(dirname: str, time: datetime | None = None, device: Device | str = Device.INTERNAL) GeoComResponse[int][source]

RPC 23315, FTR_DeleteDir

Added in version GeoCOM-VivaTPS.

Deletes one or more directories. Wildcards can be used to delete multiple items. If a date is given, only directories older than that date are deleted.

Parameters:
dirname: str

Directory name.

time: datetime | None = None

Deletion limit date, by default None

device: Device | str = Device.INTERNAL

Memory device, by default PCPARD

Returns:

Params:
  • int: Number of directories deleted.

Error codes:
  • IVPARAM: Memory device unavailable, or cannot find file path.

Return type:

GeoComResponse

See also

list

download(block: int) GeoComResponse[bytes][source]

RPC 23304, FTR_Download

Downloads a single data block of a previously defined download sequence.

Parameters:
block: int

Index of data block to download.

Returns:

Params:
  • bytes: Data block.

Error codes:
  • FTR_MISSINGSETUP: No active download setup.

  • FTR_INVALIDINPUT: First block is missing.

  • FTR_FILEACCESS: File access error.

Return type:

GeoComResponse

download_large(block: int) GeoComResponse[bytes][source]

RPC 23314, FTR_DownloadXL

Added in version GeoCOM-VivaTPS.

Downloads a single data block of a previously defined large file download sequence.

Parameters:
block: int

Index of data block to download.

Returns:

Params:
  • bytes: Data block.

Error codes:
  • FTR_MISSINGSETUP: No active download setup.

  • FTR_INVALIDINPUT: First block is missing.

  • FTR_FILEACCESS: File access error.

Return type:

GeoComResponse

list(next: bool = False) GeoComResponse[tuple[bool, str, int, datetime | None]][source]

RPC 23307, FTR_List

Gets a single file entry according to the predefined listing setup.

Parameters:
next: bool = False

Get the next item, after a previous call (get first item otherwise), by default False

Returns:

Params:
  • bool: If file is last in listing.

  • str: Name of the file.

  • int: File size [byte].

  • datetime | None: Date and time of last modification.

Error codes:
  • FTR_MISSINGSETUP: No active listing setup.

  • FTR_INVALIDINPUT: First item is missing, or last call was already the last.

Return type:

GeoComResponse

setup_download(filename: str, blocksize: int, device: Device | str = Device.CFCARD, filetype: File | str = File.UNKNOWN) GeoComResponse[int][source]

RPC 23303, FTR_SetupDownload

Prepares download of the specified file of the specified type, on the selected memory device.

Parameters:
filename: str

File name (or full path if type is unknown).

blocksize: int

Download data block size.

device: Device | str = Device.CFCARD

Memory device, by default CFCARD

filetype: File | str = File.UNKNOWN

File type, by default UNKNOWN

Returns:

Params:
  • int: Number of download blocks needed.

Error codes:
  • IVPARAM: Memory device unavailable, or cannot find file path.

  • NOTOK: Setup already exists, previous setup was not aborted.

  • FTR_INVALIDINPUT: Block size too big.

  • FTR_FILEACCESS: File access error.

Return type:

GeoComResponse

setup_large_download(filename: str, blocksize: int, device: Device | str = Device.INTERNAL, filetype: File | str = File.UNKNOWN) GeoComResponse[int][source]

RPC 23313, FTR_SetupDownloadLarge

Added in version GeoCOM-VivaTPS.

Prepares download of the specified large file of the specified type, on the selected memory device.

Parameters:
filename: str

File name (or full path if type is unknown).

blocksize: int

Download data block size.

device: Device | str = Device.INTERNAL

Memory device, by default INTERNAL

filetype: File | str = File.UNKNOWN

File type, by default UNKNOWN

Returns:

Params:
  • int: Number of download blocks needed.

Error codes:
  • IVPARAM: Memory device unavailable, or cannot find file path.

  • NOTOK: Setup already exists, previous setup was not aborted.

  • FTR_INVALIDINPUT: Block size too big.

  • FTR_FILEACCESS: File access error.

Return type:

GeoComResponse

setup_listing(device: Device | str = Device.CFCARD, filetype: File | str = File.UNKNOWN, path: str = '') GeoComResponse[None][source]

RPC 23306, FTR_SetupList

Prepares file listing of the specified file type, on the selected memory device.

Parameters:
device: Device | str = Device.CFCARD

Memory device, by default CFCARD

filetype: File | str = File.UNKNOWN

File type, by default UNKNOWN

path: str = ''

Search path, by default “”

Returns:

Error codes:
  • IVPARAM: Memory device unavailable, or cannot find search path.

  • NOTOK: Setup already exists, previous setup was not aborted.

  • FTR_FILEACCESS: File access error.

Return type:

GeoComResponse

See also

list, abort_listing