NTPackageManager


@interface NTPackageManager : NSObject {
  void *swigCPtr;
  BOOL swigCMemOwn;
}

Base class for offline map package manager. Package manager supports downloading/removing packages. It can be queried about available packages and status of the packages. It works asynchronously in the background and can inform app when packages have been updated. It works persistently. If a package download is started and app is closed, the download will resume when the package manager is started next time.

  • Checks if this object is equal to the specified object.

    Declaration

    Objective-C

    - (BOOL)isEqual:(id)object;

    Parameters

    object

    The reference object.

    Return Value

    True when objects are equal, false otherwise.

  • Returns the hash value of this object.

    Declaration

    Objective-C

    - (NSUInteger)hash;

    Return Value

    The hash value of this object.

  • Constructs a new package manager, given URL for package list and data folder. The data folder must exist before creating a new package manager and it is assumed to be persistent. Note: the package manager must be explicitly started using start() method!

    Warning

    Throws NSException If package manager fails to open or create package database.

    Declaration

    Objective-C

    - (id)initWithPackageListURL:(NSString *)packageListURL
                      dataFolder:(NSString *)dataFolder
                    serverEncKey:(NSString *)serverEncKey
                     localEncKey:(NSString *)localEncKey;

    Parameters

    packageListURL

    The URL that defines all packages.

    dataFolder

    The folder where downloaded packages are kept. It must exist and must be writable.

    serverEncKey

    Encryption key for server packages

    localEncKey

    Encryption key for local packages

  • Returns the current listener for package manager events.

    Declaration

    Objective-C

    - (NTPackageManagerListener *)getPackageManagerListener;

    Return Value

    The current listener or null if none is set.

  • Sets the package manager listener.

    Declaration

    Objective-C

    - (void)setPackageManagerListener:(NTPackageManagerListener *)listener;

    Parameters

    listener

    The new package manager listener to use.

  • Starts the package manager. All previous tasks will be resumed after this.

    Declaration

    Objective-C

    - (BOOL)start;

    Return Value

    True if package manager was successfully started. False otherwise (can not create/access database).

  • Stops the package manager. The stopping can be asynchronous or synchronous.

    Declaration

    Objective-C

    - (void)stop:(BOOL)wait;

    Parameters

    wait

    If set to true, then synchronous stopping is performed and the operation may take a while.

  • Returns the list of available server packages. Note that the list must be retrieved from the server first, using startPackageListDownload.

    Declaration

    Objective-C

    - (NTPackageInfoVector *)getServerPackages;

    Return Value

    The list of available server packages.

  • Returns the list of available local downloaded packages.

    Declaration

    Objective-C

    - (NTPackageInfoVector *)getLocalPackages;

    Return Value

    The list of available local downloaded packages.

  • Returns the metainfo of server packages.

    Declaration

    Objective-C

    - (NTPackageMetaInfo *)getServerPackageListMetaInfo;

    Return Value

    The metainfo data about server packages, or null if no metainfo is available.

  • Returns the age of server package list. This method can be used to measure the time of the download and check whether the list should be updated.

    Declaration

    Objective-C

    - (int)getServerPackageListAge;

    Return Value

    The age of server package list in seconds.

  • Returns the specified server package. Note that the list must be retrieved from the server first, using startPackageListDownload.

    Declaration

    Objective-C

    - (NTPackageInfo *)getServerPackage:(NSString *)packageId;

    Parameters

    packageId

    The id of the package.

    Return Value

    The specified server package or null if it is not in the server package list.

  • Returns the specified local package.

    Declaration

    Objective-C

    - (NTPackageInfo *)getLocalPackage:(NSString *)packageId;

    Parameters

    packageId

    The id of the package.

    Return Value

    The specified local package or null if it can not be found in the local package list. Note that if the package is being downloaded, null is returned.

  • Returns the status of the specified package.

    Declaration

    Objective-C

    - (NTPackageStatus *)getLocalPackageStatus:(NSString *)packageId
                                       version:(int)version;

    Parameters

    packageId

    The id of the package.

    version

    The version of the package. Use -1 for the latest version.

    Return Value

    The status of the package or null if it is not yet downloaded. If the package is currently being downloaded, its status is returned.

  • Suggests packages for given map position. Note that in order this to work, local package list must be available first.

    Declaration

    Objective-C

    - (NTPackageInfoVector *)suggestPackages:(NTMapPos *)mapPos
                                  projection:(NTProjection *)projection;

    Parameters

    mapPos

    The map position.

    projection

    The projection for the map position.

    Return Value

    The sorted list of suggested packages (from the best to the worst). The list may contain downloaded packages.

  • Tests if the specified map area at specified zoom level is downloaded.

    Declaration

    Objective-C

    - (BOOL)isAreaDownloaded:(NTMapBounds *)mapBounds
                        zoom:(int)zoom
                  projection:(NTProjection *)projection;

    Parameters

    mapBounds

    The area bounding box.

    zoom

    The zoom level to check.

    projection

    The projection for the bounding box.

    Return Value

    True if all required tiles are downloaded and available. False otherwise.

  • Starts downloading package list asynchronously. When this task finishes, listener is called and server package list is updated.

    Declaration

    Objective-C

    - (BOOL)startPackageListDownload;

    Return Value

    True if the package list will be downloaded and listener will be notified (if set). False if it can not be downloaded.

  • Starts importing the specified package asynchronously. When this task finishes, listener is called and local package list is updated. Note 1: In general, package manager may need temporary storage equal to the size of the package during import. It is the responsibility of the app to perform such checks. Note 2: the package may not be deleted after this call, as the import is asynchronous operation. It is safe to delete the original file once import is complete (this is notified via manager listener).

    Declaration

    Objective-C

    - (BOOL)startPackageImport:(NSString *)packageId
                       version:(int)version
               packageFileName:(NSString *)packageFileName;

    Parameters

    packageId

    The id of the package to download.

    version

    The version of the package.

    packageFileName

    The fully qualified path of the package. The file name may also refer to URL or asset (using ‘asset://’ prefix).

    Return Value

    True is the package will be imported.

  • Starts downloading specified package asynchronously. When this task finishes, listener is called and local package list is updated. Note: In general, package manager may need temporary storage equal to the size of the package during download. It is the responsibility of the app to perform such checks.

    Declaration

    Objective-C

    - (BOOL)startPackageDownload:(NSString *)packageId;

    Parameters

    packageId

    The id of the package to download.

    Return Value

    True is the package is available and will be downloaded. False if the package was not found.

  • Starts the removal of specified package asynchronously. When this task finishes, listener is called and local package list is updated.

    Declaration

    Objective-C

    - (BOOL)startPackageRemove:(NSString *)packageId;

    Parameters

    packageId

    The id of the package to remove.

    Return Value

    True is the package was found and will be removed. False if the package was not found.

  • Cancels the current/pending tasks involving of the specified package.

    Declaration

    Objective-C

    - (void)cancelPackageTasks:(NSString *)packageId;

    Parameters

    packageId

    The id of the package to cancel.

  • Sets the priority of the specific package. If the given priority is higher than priority of any other package, other operations will be paused and this package is processed immediately. If the given priority is set to negative value, package download will be paused until priority is reset to non-negative value.

    Declaration

    Objective-C

    - (void)setPackagePriority:(NSString *)packageId priority:(int)priority;

    Parameters

    packageId

    The id of the download package.

    priority

    The priority of the download package. If it is less than zero, package download is paused.

  • Undocumented

    Declaration

    Objective-C

    -(void)dealloc;