1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef OHOS_SCREEN_CLIENT_H
17#define OHOS_SCREEN_CLIENT_H
18
19#include <atomic>
20#include <cstdint>
21#include <list>
22#include <map>
23#include <memory>
24#include <mutex>
25#include <string>
26
27#include "single_instance.h"
28#include "surface.h"
29
30#include "dscreen_constants.h"
31#include "screen_client_common.h"
32
33namespace OHOS {
34namespace DistributedHardware {
35class ScreenClient {
36DECLARE_SINGLE_INSTANCE_BASE(ScreenClient);
37public:
38    int32_t AddWindow(std::shared_ptr<WindowProperty> &windowProperty);
39    sptr<Surface> GetSurface(int32_t windowId);
40    int32_t ShowWindow(int32_t windowId);
41    int32_t MoveWindow(int32_t windowId, int32_t startX, int32_t startY);
42    int32_t RemoveWindow(int32_t windowId);
43    int32_t HideWindow(int32_t windowId);
44    int32_t DestroyAllWindow();
45private:
46    ScreenClient() = default;
47    ~ScreenClient() = default;
48    std::map<int32_t, sptr<Surface>> surfaceMap_;
49    std::atomic<int32_t> windowId_ = INVALID_WINDOW_ID;
50    std::mutex surfaceMapMutex_;
51};
52} // namespace DistributedHardware
53} // namespace OHOS
54#endif