TSRSdk Class Reference

Inherits from NSObject
Declared in TSRSdk.h
TSRSdk.mm

Overview

TSRSdk is a class responsible for managing and verifying the license of the super-resolution SDK. The class provides methods for initializing the SDK with online license verification, and releasing the resources when the SDK is no longer needed. It also allows setting a custom logger for logging purposes.

Usage:

  1. Get an instance of TSRSdk using the getInstance method.
  2. Initialize the TSRSdk object with online license verification using the initWithAppId:sdkLicenseVerifyResultCallback:tsrLogger: methods.
  3. Perform super-resolution rendering using the TSRPass class.
  4. Release resources when the TSRSdk object is no longer needed by calling the reset method.

Example for online verification:


- (void)onTSRSdkLicenseVerifyResult:(TSRSdkLicenseStatus)status {
if (status == TSRSdkLicenseStatusAvailable) {
// Creating TSRPass for super-resolution rendering
} else {
// Do something when the verification of sdk's license failed.
}
}

// Init TSRSdk and verify the online license
[TSRSdk.getInstance initWithAppId:APPID sdkLicenseVerifyResultCallback:self tsrLogger:[[Logger alloc] init]];
// Release resources when the TSRSdk object is no longer needed.
[TSRSdk.getInstance reset];

– initWithAppId:authId:sdkLicenseVerifyResultCallback:tsrLogger:

Initializes the TSRSdk with online license verification. This method only can be executed once before the reset is executed.

- (void)initWithAppId:(long)appId authId:(int)authId sdkLicenseVerifyResultCallback:(id<TSRSdkLicenseVerifyResultCallback>)sdkLicenseVerifyResultCallback tsrLogger:(id<TSRLogger>)tsrLogger

Parameters

appId

Tencent Cloud account’s APPID, You can click on the link https://github.com/tencentyun/TSR/blob/main/%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97.md to learn how to find the APPID.

authId

The authentication ID of the TSRSDK. You can contact the Tencent Cloud MPS Team to get the authentication ID.

sdkLicenseVerifyResultCallback

SdkLicenseVerifyResultCallback is an interface for handling the result of SDK license verification.

tsrLogger

Set a TSRLogger for the TSRSdk. The TSRLogger must not be null.

Discussion

Initializes the TSRSdk with online license verification. This method only can be executed once before the reset is executed.

Declared In

TSRSdk.h

– initWithAppId:licenseUrl:tsrLogger:

Initializes the TSRSdk with offline license verification. This method only can be executed once before the reset() is executed.

- (TSRSdkLicenseStatus)initWithAppId:(long)appId licenseUrl:(NSURL *)licenseUrl tsrLogger:(id<TSRLogger>)tsrLogger

Parameters

appId

Tencent Cloud account’s APPID, You can click on the link https://github.com/tencentyun/TSR/blob/main/%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97.md to learn how to find the APPID.

licenseUrl

The url of the license

tsrLogger

Set a TSRLogger for the TSRSdk. The TSRLogger must not be null.

Return Value

The result of the verification of sdk’s license.

Discussion

Initializes the TSRSdk with offline license verification. This method only can be executed once before the reset() is executed.

Declared In

TSRSdk.h

– deInit

Releases the resources associated with the TSRSdk instance.

This method should be called when the TSRSdk instance is no longer needed, to free up memory and other resources.

After calling this method, you must re-initialize the TSRSdk instance using the initWithAppId methods before using it again.

- (void)deInit

Discussion

Releases the resources associated with the TSRSdk instance.

This method should be called when the TSRSdk instance is no longer needed, to free up memory and other resources.

After calling this method, you must re-initialize the TSRSdk instance using the initWithAppId methods before using it again.

Declared In

TSRSdk.h