Updated on 2024-09-13 GMT+08:00

Starting Projection

startProjectionWithParam

API Description

This API is used to start projection.

Precautions

  1. Call this API after login.
  2. The actual service processing result is returned in the callback.

Method Definition

1
- (void)startProjectionWithParam:(HWMUISDKStartProjectionParamModel *)param callback:(HWMSDKStartProjectionCompleteHandler)callback;

Parameter Description

Table 1 HWMUISDKStartProjectionParamModel description

Parameter

Mandatory

Type

Description

pairCode

Yes

NSString *

Pairing code.

randomNumber

No

NSString *

Random number, which needs to be carried for cross-enterprise projection. To obtain the value, call this API with pairCode carried. The call fails and error code 222020012 is returned. You can obtain the randomNumber value in callback and use the value to call this API again for secondary projection.

verifyCode

No

NSString *

Verification code, which needs to be carried for cross-enterprise projection. To obtain the value, call this API with pairCode carried. The call fails and error code 222020012 is returned. You can obtain the verification code in the returned result and use the code to call this API again for secondary projection.

Return Values

Table 2 HWMSDKStartProjectionCompleteHandler description

Type

Description

NSError *

Error message.

HWMUISDKStartProjectionResultModel

Projection result.

Table 3 HWMUISDKStartProjectionResultModel description

Parameter

Type

Description

randomNumber

NSString *

Random number. It is returned in the cross-enterprise projection scenario and used for secondary projection.

Sample Code
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
/// Start projection.
- (void)startProjection {
    HWMUISDKStartProjectionParamModel *param = [[HWMUISDKStartProjectionParamModel alloc] init];
    param.pairCode = getPairCode();
    param.randomNumber = getRandomNumber();
    param.verifyCode = getVerifyCode();
    [[HWMSdk getOpenApi] startProjectionWithParam:param
                            callback:^(NSError *_Nullable error, HWMUISDKStartProjectionResultModel *_Nullable startProjectionResult) {
        if (error) {
            NSLog(@"Start projection failed.:%@", error.localizedDescription);
        } else {
            NSLog(@"Projection started.");
        }
    }];
}