Files
distributed_screen/common/include/dscreen_constants.h
T
2022-03-09 19:33:26 +08:00

126 lines
4.0 KiB
C++

/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_DSCREEN_CONSTANTS_H
#define OHOS_DSCREEN_CONSTANTS_H
#include <cstdint>
#include <string>
#include <unistd.h>
namespace OHOS {
namespace DistributedHardware {
enum RpcEventType {
NOTIFY_SINK_SETUP = 1,
NOTIFY_SOURCE_SETUP_RESULT = 2,
};
enum DScreenState {
DISABLED,
ENABLED,
DISABLING,
ENABLING,
CONNECTING,
CONNECTED,
DISCONNECTING,
};
enum TaskType {
TASK_ENABLE,
TASK_DISABLE,
TASK_CONNECT,
TASK_DISCONNECT,
};
enum CodecType : uint8_t {
VIDEO_CODEC_TYPE_VIDEO_H264 = 0,
VIDEO_CODEC_TYPE_VIDEO_H265 = 1,
};
enum VideoFormat : uint8_t {
VIDEO_DATA_FORMAT_YUVI420 = 0,
VIDEO_DATA_FORMAT_NV12 = 1,
VIDEO_DATA_FORMAT_NV21 = 2,
};
/* Screen package name */
const std::string PKG_NAME = "DBinderBus_" + std::to_string(getpid());
/* Screen data session name */
const std::string DATA_SESSION_NAME = "DBinder.ohos.dhardware.dscreen.data";
/* Screen session name max len */
constexpr uint32_t DSCREEN_MAX_SESSION_NAME_LEN = 50;
constexpr uint32_t DSCREEN_MAX_DEVICE_ID_LEN = 100;
/* Screen data received max length */
constexpr uint32_t DSCREEN_MAX_RECV_DATA_LEN = 104857600;
/* Screen max video data width */
constexpr uint32_t DSCREEN_MAX_VIDEO_DATA_WIDTH = 2560;
/* Screen max video data height */
constexpr uint32_t DSCREEN_MAX_VIDEO_DATA_HEIGHT = 1600;
/* Screen max screen data width */
constexpr uint32_t DSCREEN_MAX_SCREEN_DATA_WIDTH = 2560;
/* Screen max screen data height */
constexpr uint32_t DSCREEN_MAX_SCREEN_DATA_HEIGHT = 1600;
/* YUV420 buffer size max size */
constexpr int64_t MAX_YUV420_BUFFER_SIZE = 2560 * 1600 * (3 / 2) * 2;
constexpr int32_t LOG_MAX_LEN = 4096;
constexpr int32_t INVALID_WINDOW_ID = -1;
const std::string DSCREEN_LOG_TITLE_TAG = "DSCREEN";
const std::string DSCREEN_PREFIX = "DISTRIBUTED_SCREEN";
const std::string SCREEN_PREFIX = "SCREEN";
const std::string DSCREEN_VERSION = "1.0";
const std::string SEPERATOR = "#";
const std::string KEY_VERSION = "screenVersion";
const std::string KEY_DISPLAY_ID = "displayId";
const std::string KEY_SCREEN_ID = "screenId";
const std::string KEY_DISPLAY_RECT = "displayRect";
const std::string KEY_SCREEN_RECT = "screenRect";
const std::string KEY_POINT_START_X = "startX";
const std::string KEY_POINT_START_Y = "startY";
const std::string KEY_WIDTH = "width";
const std::string KEY_HEIGHT = "height";
const std::string KEY_SCREEN_WIDTH = "screenWidth";
const std::string KEY_SCREEN_HEIGHT = "screenHeight";
const std::string KEY_VIDEO_WIDTH = "videoWidth";
const std::string KEY_VIDEO_HEIGHT = "videoHeight";
const std::string KEY_FPS = "fps";
const std::string KEY_CODECTYPE = "codecType";
const std::string SCREEN_CLIENT_WINDOW = "screenClientWindow";
const std::string KEY_DH_ID = "dhId";
const std::string KEY_ERR_CODE = "errCode";
const std::string KEY_ERR_CONTENT = "errContent";
const std::string KEY_VIDEO_PARAM = "videoParam";
const std::string KEY_MAPRELATION = "mapRelation";
constexpr float DEFAULT_DENSITY = 2.0;
constexpr int32_t DEFAULT_SCREEN_FLAGS = 0;
constexpr uint32_t DEFAULT_FPS = 30;
constexpr uint8_t DEFAULT_CODECTYPE = VIDEO_CODEC_TYPE_VIDEO_H264;
constexpr uint8_t DEFAULT_VIDEO_FORMAT = VIDEO_DATA_FORMAT_NV21;
constexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID = 4807;
constexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID = 4808;
constexpr uint64_t SCREEN_ID_INVALID = -1ULL;
constexpr uint64_t SCREEN_ID_DEFAULT = 0;
} // namespace DistributedHardware
} // namespace OHOS
#endif