166f3657fSopenharmony_ci/*
266f3657fSopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
366f3657fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
466f3657fSopenharmony_ci * you may not use this file except in compliance with the License.
566f3657fSopenharmony_ci * You may obtain a copy of the License at
666f3657fSopenharmony_ci *
766f3657fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
866f3657fSopenharmony_ci *
966f3657fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1066f3657fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1166f3657fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1266f3657fSopenharmony_ci * See the License for the specific language governing permissions and
1366f3657fSopenharmony_ci * limitations under the License.
1466f3657fSopenharmony_ci */
1566f3657fSopenharmony_ci
1666f3657fSopenharmony_ci#include <iostream>
1766f3657fSopenharmony_ci
1866f3657fSopenharmony_ci#include "accesstoken_kit.h"
1966f3657fSopenharmony_ci#include "display.h"
2066f3657fSopenharmony_ci#include "display_manager.h"
2166f3657fSopenharmony_ci#include "dscreen_source_handler.h"
2266f3657fSopenharmony_ci#include "dscreen_sink_handler.h"
2366f3657fSopenharmony_ci#include "dscreen_util.h"
2466f3657fSopenharmony_ci#include "idistributed_hardware_sink.h"
2566f3657fSopenharmony_ci#include "idistributed_hardware_source.h"
2666f3657fSopenharmony_ci#include "screen.h"
2766f3657fSopenharmony_ci#include "screen_client.h"
2866f3657fSopenharmony_ci#include "screen_client_common.h"
2966f3657fSopenharmony_ci#include "screen_manager.h"
3066f3657fSopenharmony_ci#include "wm_common.h"
3166f3657fSopenharmony_ci#include "window.h"
3266f3657fSopenharmony_ci#include "window_scene.h"
3366f3657fSopenharmony_ci#include "window_option.h"
3466f3657fSopenharmony_ci#include "nativetoken_kit.h"
3566f3657fSopenharmony_ci#include "token_setproc.h"
3666f3657fSopenharmony_ci
3766f3657fSopenharmony_ci#include "decoder_demo.h"
3866f3657fSopenharmony_ci#include "softbus_bus_center.h"
3966f3657fSopenharmony_ci#include "softbus_common.h"
4066f3657fSopenharmony_ci
4166f3657fSopenharmony_ciusing namespace std;
4266f3657fSopenharmony_ciusing namespace OHOS;
4366f3657fSopenharmony_ciusing namespace OHOS::DistributedHardware;
4466f3657fSopenharmony_ciusing namespace OHOS::Rosen;
4566f3657fSopenharmony_ciusing namespace OHOS::MediaAVCodec;
4666f3657fSopenharmony_ciusing namespace OHOS::Security::AccessToken;
4766f3657fSopenharmony_ci
4866f3657fSopenharmony_cinamespace {
4966f3657fSopenharmony_ci    static char const *DSOFTBUS_TOOL_PKG_NAME = "ohos.dsoftbus.tool";
5066f3657fSopenharmony_ci    const uint32_t MAX_WINDOW_WIDTH = 2560;
5166f3657fSopenharmony_ci    const uint32_t MAX_WINDOW_HEIGHT = 2772;
5266f3657fSopenharmony_ci    const uint32_t DCODE_WIDTH = 1920;
5366f3657fSopenharmony_ci    const uint32_t DCODE_HEIGHT = 1080;
5466f3657fSopenharmony_ci}
5566f3657fSopenharmony_ci
5666f3657fSopenharmony_cistatic vector<sptr<Screen>> QueryRemoteScreenInfo()
5766f3657fSopenharmony_ci{
5866f3657fSopenharmony_ci    vector<sptr<Screen>> allScreens;
5966f3657fSopenharmony_ci    ScreenManager::GetInstance().GetAllScreens(allScreens);
6066f3657fSopenharmony_ci    sptr<Display> defaultDisplay = DisplayManager::GetInstance().GetDefaultDisplay();
6166f3657fSopenharmony_ci    vector<sptr<Screen>> remoteScreens;
6266f3657fSopenharmony_ci    for (const auto &screen : allScreens) {
6366f3657fSopenharmony_ci        if (screen == nullptr) {
6466f3657fSopenharmony_ci            continue;
6566f3657fSopenharmony_ci        }
6666f3657fSopenharmony_ci        if (!screen->IsReal() && screen->GetWidth() > 0) {
6766f3657fSopenharmony_ci            remoteScreens.push_back(screen);
6866f3657fSopenharmony_ci        }
6966f3657fSopenharmony_ci    }
7066f3657fSopenharmony_ci    cout << "-------------remote screen info---------------" << endl;
7166f3657fSopenharmony_ci    cout << "remote screen Num: " << remoteScreens.size() << endl;
7266f3657fSopenharmony_ci    for (const auto &screen : remoteScreens) {
7366f3657fSopenharmony_ci        if (screen == nullptr) {
7466f3657fSopenharmony_ci            continue;
7566f3657fSopenharmony_ci        }
7666f3657fSopenharmony_ci        cout << endl;
7766f3657fSopenharmony_ci        cout << "--------screen id " << screen->GetId() << "---------" << endl;
7866f3657fSopenharmony_ci        cout << "screen name: " << GetAnonyString(screen->GetName()).c_str() << endl;
7966f3657fSopenharmony_ci        cout << "width: " << screen->GetWidth() << endl;
8066f3657fSopenharmony_ci        cout << "height: " << screen->GetHeight() << endl;
8166f3657fSopenharmony_ci        cout << "-------------------------------------------" << endl;
8266f3657fSopenharmony_ci    }
8366f3657fSopenharmony_ci    return remoteScreens;
8466f3657fSopenharmony_ci}
8566f3657fSopenharmony_ci
8666f3657fSopenharmony_cistatic void StartMirror()
8766f3657fSopenharmony_ci{
8866f3657fSopenharmony_ci    vector<sptr<Screen>> remoteScreens = QueryRemoteScreenInfo();
8966f3657fSopenharmony_ci    if (remoteScreens.size() == 0) {
9066f3657fSopenharmony_ci        cout << "Error: no remote screens enabled" << endl;
9166f3657fSopenharmony_ci        return;
9266f3657fSopenharmony_ci    }
9366f3657fSopenharmony_ci
9466f3657fSopenharmony_ci    cout << "select remote screen id to mirror: " << endl;
9566f3657fSopenharmony_ci    uint64_t mirrorId;
9666f3657fSopenharmony_ci    cin >> mirrorId;
9766f3657fSopenharmony_ci
9866f3657fSopenharmony_ci    bool isMirrorIdValid = false;
9966f3657fSopenharmony_ci    for (const auto &screen : remoteScreens) {
10066f3657fSopenharmony_ci        if (screen == nullptr) {
10166f3657fSopenharmony_ci            continue;
10266f3657fSopenharmony_ci        }
10366f3657fSopenharmony_ci        if (screen->GetId() == mirrorId) {
10466f3657fSopenharmony_ci            isMirrorIdValid = true;
10566f3657fSopenharmony_ci            break;
10666f3657fSopenharmony_ci        }
10766f3657fSopenharmony_ci    }
10866f3657fSopenharmony_ci
10966f3657fSopenharmony_ci    if (!isMirrorIdValid) {
11066f3657fSopenharmony_ci        cout << "input mirrorId is not valid!" << endl;
11166f3657fSopenharmony_ci        return;
11266f3657fSopenharmony_ci    }
11366f3657fSopenharmony_ci
11466f3657fSopenharmony_ci    sptr<Display> defaultDisplay = DisplayManager::GetInstance().GetDefaultDisplay();
11566f3657fSopenharmony_ci    cout << "------------start mirror----------" << endl;
11666f3657fSopenharmony_ci    cout << "mirror screen Id is " << mirrorId << endl;
11766f3657fSopenharmony_ci    vector<uint64_t> mirrorIds;
11866f3657fSopenharmony_ci    mirrorIds.push_back(mirrorId);
11966f3657fSopenharmony_ci    ScreenId screenGroupId;
12066f3657fSopenharmony_ci    ScreenManager::GetInstance().MakeMirror(defaultDisplay->GetScreenId(), mirrorIds, screenGroupId);
12166f3657fSopenharmony_ci}
12266f3657fSopenharmony_ci
12366f3657fSopenharmony_cistatic void StopMirror()
12466f3657fSopenharmony_ci{
12566f3657fSopenharmony_ci    vector<sptr<Screen>> remoteScreens = QueryRemoteScreenInfo();
12666f3657fSopenharmony_ci    if (remoteScreens.size() == 0) {
12766f3657fSopenharmony_ci        cout << "no remote screens enabled, no need stop mirror" << endl;
12866f3657fSopenharmony_ci        return;
12966f3657fSopenharmony_ci    }
13066f3657fSopenharmony_ci
13166f3657fSopenharmony_ci    bool isStopMirrorIdValid = false;
13266f3657fSopenharmony_ci    cout << "select remote screen id to stop mirror: " << endl;
13366f3657fSopenharmony_ci    uint64_t stopMirrorId;
13466f3657fSopenharmony_ci    cin >> stopMirrorId;
13566f3657fSopenharmony_ci
13666f3657fSopenharmony_ci    for (const auto &screen : remoteScreens) {
13766f3657fSopenharmony_ci        if (screen == nullptr) {
13866f3657fSopenharmony_ci            continue;
13966f3657fSopenharmony_ci        }
14066f3657fSopenharmony_ci        if (screen->GetId() == stopMirrorId) {
14166f3657fSopenharmony_ci            isStopMirrorIdValid = true;
14266f3657fSopenharmony_ci            break;
14366f3657fSopenharmony_ci        }
14466f3657fSopenharmony_ci    }
14566f3657fSopenharmony_ci    if (!isStopMirrorIdValid) {
14666f3657fSopenharmony_ci        cout << "input screenId is not valid!" << endl;
14766f3657fSopenharmony_ci        return;
14866f3657fSopenharmony_ci    }
14966f3657fSopenharmony_ci
15066f3657fSopenharmony_ci    cout << "-------------- stop mirror ------------" << endl;
15166f3657fSopenharmony_ci    cout << "stop mirror screen id is " << stopMirrorId << endl;
15266f3657fSopenharmony_ci    vector<uint64_t> stopMirrorIds;
15366f3657fSopenharmony_ci    stopMirrorIds.push_back(stopMirrorId);
15466f3657fSopenharmony_ci    ScreenManager::GetInstance().RemoveVirtualScreenFromGroup(stopMirrorIds);
15566f3657fSopenharmony_ci}
15666f3657fSopenharmony_ci
15766f3657fSopenharmony_cistatic void StartExpand()
15866f3657fSopenharmony_ci{
15966f3657fSopenharmony_ci    vector<sptr<Screen>> remoteScreens = QueryRemoteScreenInfo();
16066f3657fSopenharmony_ci    if (remoteScreens.size() == 0) {
16166f3657fSopenharmony_ci        cout << "Error: no remote screens enabled" << endl;
16266f3657fSopenharmony_ci        return;
16366f3657fSopenharmony_ci    }
16466f3657fSopenharmony_ci
16566f3657fSopenharmony_ci    cout << "select remote screen id to expand: " << endl;
16666f3657fSopenharmony_ci    uint64_t expandId;
16766f3657fSopenharmony_ci    cin >> expandId;
16866f3657fSopenharmony_ci
16966f3657fSopenharmony_ci    bool isExpandIdValid = false;
17066f3657fSopenharmony_ci    for (const auto &screen : remoteScreens) {
17166f3657fSopenharmony_ci        if (screen == nullptr) {
17266f3657fSopenharmony_ci            continue;
17366f3657fSopenharmony_ci        }
17466f3657fSopenharmony_ci        if (screen->GetId() == expandId) {
17566f3657fSopenharmony_ci            isExpandIdValid = true;
17666f3657fSopenharmony_ci            break;
17766f3657fSopenharmony_ci        }
17866f3657fSopenharmony_ci    }
17966f3657fSopenharmony_ci
18066f3657fSopenharmony_ci    if (!isExpandIdValid) {
18166f3657fSopenharmony_ci        cout << "input expandId is not valid!" << endl;
18266f3657fSopenharmony_ci        return;
18366f3657fSopenharmony_ci    }
18466f3657fSopenharmony_ci
18566f3657fSopenharmony_ci    sptr<Display> defaultDisplay = DisplayManager::GetInstance().GetDefaultDisplay();
18666f3657fSopenharmony_ci    cout << endl << "------------start expand----------" << endl;
18766f3657fSopenharmony_ci    cout << "expand screen Id is " << expandId << endl;
18866f3657fSopenharmony_ci    vector<ExpandOption> options = {{defaultDisplay->GetScreenId(), 0, 0}, {expandId, defaultDisplay->GetWidth(), 0}};
18966f3657fSopenharmony_ci    ScreenId screenGroupId;
19066f3657fSopenharmony_ci    ScreenManager::GetInstance().MakeExpand(options, screenGroupId);
19166f3657fSopenharmony_ci}
19266f3657fSopenharmony_ci
19366f3657fSopenharmony_cistatic void StopExpand()
19466f3657fSopenharmony_ci{
19566f3657fSopenharmony_ci    vector<sptr<Screen>> remoteScreens = QueryRemoteScreenInfo();
19666f3657fSopenharmony_ci    if (remoteScreens.size() == 0) {
19766f3657fSopenharmony_ci        cout << "no remote screens enabled, no need stop expand" << endl;
19866f3657fSopenharmony_ci        return;
19966f3657fSopenharmony_ci    }
20066f3657fSopenharmony_ci
20166f3657fSopenharmony_ci    bool isStopExpandIdValid = false;
20266f3657fSopenharmony_ci    cout << "select remote screen id to stop expand: " << endl;
20366f3657fSopenharmony_ci    uint64_t stopExpandId;
20466f3657fSopenharmony_ci    cin >> stopExpandId;
20566f3657fSopenharmony_ci
20666f3657fSopenharmony_ci    for (const auto &screen : remoteScreens) {
20766f3657fSopenharmony_ci        if (screen == nullptr) {
20866f3657fSopenharmony_ci            continue;
20966f3657fSopenharmony_ci        }
21066f3657fSopenharmony_ci        if (screen->GetId() == stopExpandId) {
21166f3657fSopenharmony_ci            isStopExpandIdValid = true;
21266f3657fSopenharmony_ci            break;
21366f3657fSopenharmony_ci        }
21466f3657fSopenharmony_ci    }
21566f3657fSopenharmony_ci    if (!isStopExpandIdValid) {
21666f3657fSopenharmony_ci        cout << "input screenId is not valid!" << endl;
21766f3657fSopenharmony_ci        return;
21866f3657fSopenharmony_ci    }
21966f3657fSopenharmony_ci
22066f3657fSopenharmony_ci    cout << "-------------- stop expand ------------" << endl;
22166f3657fSopenharmony_ci    cout << "stop expand screen id is " << stopExpandId << endl;
22266f3657fSopenharmony_ci    vector<uint64_t> stopExpandIds;
22366f3657fSopenharmony_ci    stopExpandIds.push_back(stopExpandId);
22466f3657fSopenharmony_ci    ScreenManager::GetInstance().RemoveVirtualScreenFromGroup(stopExpandIds);
22566f3657fSopenharmony_ci}
22666f3657fSopenharmony_ci
22766f3657fSopenharmony_cistatic void PrintNodeProperty(NodeBasicInfo *nodeInfo)
22866f3657fSopenharmony_ci{
22966f3657fSopenharmony_ci    if (nodeInfo == nullptr) {
23066f3657fSopenharmony_ci        cout << "nodeInfo is nullptr" << endl;
23166f3657fSopenharmony_ci        return;
23266f3657fSopenharmony_ci    }
23366f3657fSopenharmony_ci
23466f3657fSopenharmony_ci    printf("DeviceName = %s\n", nodeInfo->deviceName);
23566f3657fSopenharmony_ci    printf("NetworkId = %s\n", GetAnonyString(nodeInfo->networkId).c_str());
23666f3657fSopenharmony_ci    NodeDeviceInfoKey key = NODE_KEY_UDID;
23766f3657fSopenharmony_ci    unsigned char udid[UDID_BUF_LEN] = {0};
23866f3657fSopenharmony_ci    if (GetNodeKeyInfo(DSOFTBUS_TOOL_PKG_NAME, nodeInfo->networkId, key, udid, UDID_BUF_LEN) != 0) {
23966f3657fSopenharmony_ci        printf("GetNodeKeyInfo Fail!\n");
24066f3657fSopenharmony_ci    } else {
24166f3657fSopenharmony_ci        printf("Udid = %s\n", GetAnonyString(reinterpret_cast<char *>(udid)).c_str());
24266f3657fSopenharmony_ci    }
24366f3657fSopenharmony_ci    key = NODE_KEY_UUID;
24466f3657fSopenharmony_ci    unsigned char uuid[UUID_BUF_LEN] = {0};
24566f3657fSopenharmony_ci    if (GetNodeKeyInfo(DSOFTBUS_TOOL_PKG_NAME, nodeInfo->networkId, key, uuid, UUID_BUF_LEN) != 0) {
24666f3657fSopenharmony_ci        printf("GetNodeKeyInfo Fail!\n");
24766f3657fSopenharmony_ci    } else {
24866f3657fSopenharmony_ci        printf("Uuid = %s\n", GetAnonyString(reinterpret_cast<char *>(udid)).c_str());
24966f3657fSopenharmony_ci    }
25066f3657fSopenharmony_ci}
25166f3657fSopenharmony_ci
25266f3657fSopenharmony_cistatic void QueryRemoteDeviceInfo()
25366f3657fSopenharmony_ci{
25466f3657fSopenharmony_ci    uint64_t tokenId;
25566f3657fSopenharmony_ci    const char *perms[2];
25666f3657fSopenharmony_ci    perms[0] = OHOS_PERMISSION_DISTRIBUTED_SOFTBUS_CENTER;
25766f3657fSopenharmony_ci    perms[1] = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
25866f3657fSopenharmony_ci    NativeTokenInfoParams infoInstance = {
25966f3657fSopenharmony_ci        .dcapsNum = 0,
26066f3657fSopenharmony_ci        .permsNum = 2,
26166f3657fSopenharmony_ci        .aclsNum = 0,
26266f3657fSopenharmony_ci        .dcaps = NULL,
26366f3657fSopenharmony_ci        .perms = perms,
26466f3657fSopenharmony_ci        .acls = NULL,
26566f3657fSopenharmony_ci        .processName = "dscreen_test_demo",
26666f3657fSopenharmony_ci        .aplStr = "system_core",
26766f3657fSopenharmony_ci    };
26866f3657fSopenharmony_ci    tokenId = GetAccessTokenId(&infoInstance);
26966f3657fSopenharmony_ci    SetSelfTokenID(tokenId);
27066f3657fSopenharmony_ci    OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
27166f3657fSopenharmony_ci
27266f3657fSopenharmony_ci    NodeBasicInfo localNodeinfo;
27366f3657fSopenharmony_ci    NodeBasicInfo *remoteNodeInfo = nullptr;
27466f3657fSopenharmony_ci    int32_t infoNum = 0;
27566f3657fSopenharmony_ci    printf("-----------Local Device Info------\n");
27666f3657fSopenharmony_ci    if (GetLocalNodeDeviceInfo(DSOFTBUS_TOOL_PKG_NAME, &localNodeinfo) != 0) {
27766f3657fSopenharmony_ci        printf("LnnGetLocalNodeInfo Fail!\n");
27866f3657fSopenharmony_ci        return;
27966f3657fSopenharmony_ci    }
28066f3657fSopenharmony_ci    PrintNodeProperty(&localNodeinfo);
28166f3657fSopenharmony_ci    printf("-------Remote Device info---------\n");
28266f3657fSopenharmony_ci    if (GetAllNodeDeviceInfo(DSOFTBUS_TOOL_PKG_NAME, &remoteNodeInfo, &infoNum) != 0) {
28366f3657fSopenharmony_ci        printf("GetAllNodeDeviceInfo Fail!\n");
28466f3657fSopenharmony_ci        return;
28566f3657fSopenharmony_ci    }
28666f3657fSopenharmony_ci    printf("Device Num = %" PRId32 "\n", infoNum);
28766f3657fSopenharmony_ci    for (int i = 0; i < infoNum; ++i) {
28866f3657fSopenharmony_ci        printf("\n[No.%" PRId32 "]", i + 1);
28966f3657fSopenharmony_ci        PrintNodeProperty(remoteNodeInfo + i);
29066f3657fSopenharmony_ci    }
29166f3657fSopenharmony_ci    FreeNodeInfo(remoteNodeInfo);
29266f3657fSopenharmony_ci    printf("SoftBusDumpDeviceInfo complete!\n");
29366f3657fSopenharmony_ci}
29466f3657fSopenharmony_ci
29566f3657fSopenharmony_cistatic void CreateWindow()
29666f3657fSopenharmony_ci{
29766f3657fSopenharmony_ci    cout << "create window, please input window size" << endl;
29866f3657fSopenharmony_ci    cout << "width: ";
29966f3657fSopenharmony_ci    uint32_t windowWidth;
30066f3657fSopenharmony_ci    cin >> windowWidth;
30166f3657fSopenharmony_ci    cout << "height: ";
30266f3657fSopenharmony_ci    uint32_t windowHeight;
30366f3657fSopenharmony_ci    cin >> windowHeight;
30466f3657fSopenharmony_ci
30566f3657fSopenharmony_ci    if (windowWidth == 0 || windowWidth >= MAX_WINDOW_WIDTH ||
30666f3657fSopenharmony_ci        windowHeight == 0 || windowHeight >= MAX_WINDOW_HEIGHT) {
30766f3657fSopenharmony_ci        cout << "Invalid window size." << endl;
30866f3657fSopenharmony_ci        return;
30966f3657fSopenharmony_ci    }
31066f3657fSopenharmony_ci
31166f3657fSopenharmony_ci    sptr<Display> defaultDisplay = DisplayManager::GetInstance().GetDefaultDisplay();
31266f3657fSopenharmony_ci    shared_ptr<WindowProperty> windowProperty = make_shared<WindowProperty>();
31366f3657fSopenharmony_ci    windowProperty->displayId = defaultDisplay->GetId();
31466f3657fSopenharmony_ci    windowProperty->startX = 0;
31566f3657fSopenharmony_ci    windowProperty->startY = 0;
31666f3657fSopenharmony_ci    windowProperty->width = windowWidth;
31766f3657fSopenharmony_ci    windowProperty->height = windowHeight;
31866f3657fSopenharmony_ci    int32_t windowId = ScreenClient::GetInstance().AddWindow(windowProperty);
31966f3657fSopenharmony_ci    ScreenClient::GetInstance().ShowWindow(windowId);
32066f3657fSopenharmony_ci    sptr<Surface> surface = ScreenClient::GetInstance().GetSurface(windowId);
32166f3657fSopenharmony_ci    cout << "create window success." << endl;
32266f3657fSopenharmony_ci
32366f3657fSopenharmony_ci    auto vdec = make_shared<VDecDemo>();
32466f3657fSopenharmony_ci
32566f3657fSopenharmony_ci    vdec->SetWindowSize(DCODE_WIDTH, DCODE_HEIGHT);
32666f3657fSopenharmony_ci    vdec->SetOutputSurface(surface);
32766f3657fSopenharmony_ci    cout << "start run decoder" << endl;
32866f3657fSopenharmony_ci    vdec->RunCase();
32966f3657fSopenharmony_ci    cout << "create window success, window id: " << windowId
33066f3657fSopenharmony_ci         << ", width: " << windowWidth
33166f3657fSopenharmony_ci         << ", height: " << windowHeight << endl;
33266f3657fSopenharmony_ci    ScreenClient::GetInstance().RemoveWindow(windowId);
33366f3657fSopenharmony_ci    _Exit(0);
33466f3657fSopenharmony_ci}
33566f3657fSopenharmony_ci
33666f3657fSopenharmony_ciint main()
33766f3657fSopenharmony_ci{
33866f3657fSopenharmony_ci    cout << "Please select a test scenario number(default StartMirror): " << endl;
33966f3657fSopenharmony_ci    cout << "0:StartMirror" << endl;
34066f3657fSopenharmony_ci    cout << "1:StopMirror" << endl;
34166f3657fSopenharmony_ci    cout << "2:StartExpand" << endl;
34266f3657fSopenharmony_ci    cout << "3:StopExpand" << endl;
34366f3657fSopenharmony_ci    cout << "4:CreateWindow" << endl;
34466f3657fSopenharmony_ci    cout << "5:QueryRemoteDeviceInfo" << endl;
34566f3657fSopenharmony_ci    cout << "6:QueryRemoteScreenInfo" << endl;
34666f3657fSopenharmony_ci    string mode;
34766f3657fSopenharmony_ci    (void)getline(cin, mode);
34866f3657fSopenharmony_ci    if (mode == "" || mode == "0") {
34966f3657fSopenharmony_ci        (void)StartMirror();
35066f3657fSopenharmony_ci    } else if (mode == "1") {
35166f3657fSopenharmony_ci        (void)StopMirror();
35266f3657fSopenharmony_ci    } else if (mode == "2") {
35366f3657fSopenharmony_ci        (void)StartExpand();
35466f3657fSopenharmony_ci    } else if (mode == "3") {
35566f3657fSopenharmony_ci        (void)StopExpand();
35666f3657fSopenharmony_ci    } else if (mode == "4") {
35766f3657fSopenharmony_ci        (void)CreateWindow();
35866f3657fSopenharmony_ci    } else if (mode == "5") {
35966f3657fSopenharmony_ci        (void)QueryRemoteDeviceInfo();
36066f3657fSopenharmony_ci    } else if (mode == "6") {
36166f3657fSopenharmony_ci        (void)QueryRemoteScreenInfo();
36266f3657fSopenharmony_ci    } else {
36366f3657fSopenharmony_ci        cout << "no that selection" << endl;
36466f3657fSopenharmony_ci    }
36566f3657fSopenharmony_ci    return 0;
36666f3657fSopenharmony_ci}
367