diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml new file mode 100644 index 00000000..cff24b88 --- /dev/null +++ b/.github/workflows/native_full_build.yml @@ -0,0 +1,29 @@ +name: Build Control Manager in Native Environment + +on: + push: + branches: [ main, 'sprint/**', 'release/**', develop ] + pull_request: + branches: [ main, 'sprint/**', 'release/**', topic/RDK*, develop ] + +permissions: + contents: read + +jobs: + build-control-on-pr: + name: Build Control Manager in github rdkcentral + runs-on: ubuntu-latest + container: + image: ghcr.io/rdkcentral/docker-rdk-ci:latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: build dependencies + run: | + sh -x ci/build_dependencies.sh + + - name: cov build + run: | + sh -x ci/cov_build.sh diff --git a/ci/build_dependencies.sh b/ci/build_dependencies.sh new file mode 100644 index 00000000..d46c2575 --- /dev/null +++ b/ci/build_dependencies.sh @@ -0,0 +1,357 @@ +#!/bin/bash +set -x +set -e +############################## +GITHUB_WORKSPACE="${PWD}" +ls -la ${GITHUB_WORKSPACE} +cd ${GITHUB_WORKSPACE} + +git config --global --add safe.directory "${GITHUB_WORKSPACE}" + +# ############################# +# 1. Install Dependencies and packages + +apt update +apt install -y \ + libsqlite3-dev \ + libcurl4-openssl-dev \ + libsystemd-dev \ + libboost-all-dev \ + libglib2.0-dev \ + libgio2.0-cil-dev \ + libjansson-dev \ + libarchive-dev \ + libssl-dev \ + zlib1g-dev \ + libdbus-1-dev \ + uuid-dev \ + libevdev-dev \ + libdrm-dev \ + gperf \ + meson \ + valgrind \ + lcov \ + clang +pip install jsonref + +########################################### +# 2. Clone the required repositories + +git clone --depth 1 --branch R4.4.3 https://github.com/rdkcentral/ThunderTools.git + +git clone --depth 1 --branch R4.4.1 https://github.com/rdkcentral/Thunder.git + +git clone --depth 1 --branch develop https://github.com/rdkcentral/entservices-apis.git + +git clone --depth 1 https://github.com/rdkcentral/xr-voice-sdk.git + +############################ +# 3. Build Thunder-Tools +echo "======================================================================================" +echo "building thunderTools" +cd ThunderTools +patch -p1 < $GITHUB_WORKSPACE/ci/patches/00010-R4.4-Add-support-for-project-dir.patch +cd - + +cmake -G Ninja -S ThunderTools -B build/ThunderTools \ + -DEXCEPTIONS_ENABLE=ON \ + -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install/usr" \ + -DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + -DGENERIC_CMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" + +cmake --build build/ThunderTools --target install + +############################ +# 4. Build Thunder +echo "======================================================================================" +echo "building thunder" + +cd Thunder +patch -p1 < $GITHUB_WORKSPACE/ci/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch +patch -p1 < $GITHUB_WORKSPACE/ci/patches/error_code_R4_4.patch +patch -p1 < $GITHUB_WORKSPACE/ci/patches/1004-Add-support-for-project-dir.patch +patch -p1 < $GITHUB_WORKSPACE/ci/patches/RDKEMW-733-Add-ENTOS-IDS.patch +cd - + +cmake -G Ninja -S Thunder -B build/Thunder \ + -DMESSAGING=ON \ + -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install/usr" \ + -DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + -DGENERIC_CMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + -DBUILD_TYPE=Debug \ + -DBINDING=127.0.0.1 \ + -DPORT=55555 \ + -DEXCEPTIONS_ENABLE=ON + +cmake --build build/Thunder --target install + +############################ +# 5. Build entservices-apis +echo "======================================================================================" +echo "building entservices-apis" +cd entservices-apis +rm -rf jsonrpc/DTV.json +cd .. + +cmake -G Ninja -S entservices-apis -B build/entservices-apis \ + -DEXCEPTIONS_ENABLE=ON \ + -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install/usr" \ + -DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" + +cmake --build build/entservices-apis --target install + +############################ +# 6. Create stub/empty headers for external dependencies +echo "======================================================================================" +echo "Creating stub headers" + +HEADERS_DIR="$GITHUB_WORKSPACE/ci/headers" +mkdir -p "${HEADERS_DIR}" +mkdir -p "${HEADERS_DIR}/rdk/iarmbus" +mkdir -p "${HEADERS_DIR}/rdk/ds" +mkdir -p "${HEADERS_DIR}/rdk/ds-rpc" +mkdir -p "${HEADERS_DIR}/rdk/ds-hal" +mkdir -p "${HEADERS_DIR}/rdk/halif/ds-hal" +mkdir -p "${HEADERS_DIR}/rdk/iarmmgrs-hal" +mkdir -p "${HEADERS_DIR}/websocket" +mkdir -p "${HEADERS_DIR}/proc" +mkdir -p "${HEADERS_DIR}/audiocapturemgr" +mkdir -p "${HEADERS_DIR}/ccec/drivers" +mkdir -p "${HEADERS_DIR}/network" +mkdir -p "${HEADERS_DIR}/nopoll" + +cd "${HEADERS_DIR}" + +# IARM headers (types provided via -include Iarm.h) +touch rdk/iarmbus/libIARM.h +touch rdk/iarmbus/libIBus.h +touch rdk/iarmbus/libIBusDaemon.h + +# IARM managers (types provided via -include Iarm.h for sysMgr, or in control stubs) +touch rdk/iarmmgrs-hal/sysMgr.h +touch rdk/iarmmgrs-hal/irMgr.h +touch rdk/iarmmgrs-hal/deepSleepMgr.h +touch rdk/iarmmgrs-hal/mfrMgr.h +touch rdk/iarmmgrs-hal/pwrMgr.h +touch rdk/iarmmgrs-hal/plat_ir.h + +# Device settings headers (types provided via -include devicesettings.h) +touch rdk/ds/audioOutputPort.hpp +touch rdk/ds/compositeIn.hpp +touch rdk/ds/dsDisplay.h +touch rdk/ds/dsError.h +touch rdk/ds/dsMgr.h +touch rdk/ds/dsRpc.h +touch rdk/ds/dsTypes.h +touch rdk/ds/dsUtl.h +touch rdk/ds/exception.hpp +touch rdk/ds/hdmiIn.hpp +touch rdk/ds/host.hpp +touch rdk/ds/list.hpp +# manager.hpp is empty — device::Manager is provided by the force-included devicesettings.h +touch rdk/ds/manager.hpp +touch rdk/ds/sleepMode.hpp +touch rdk/ds/videoDevice.hpp +touch rdk/ds/videoOutputPort.hpp +touch rdk/ds/videoOutputPortConfig.hpp +touch rdk/ds/videoOutputPortType.hpp +touch rdk/ds/videoResolution.hpp +touch rdk/ds/frontPanelIndicator.hpp +touch rdk/ds/frontPanelConfig.hpp +touch rdk/ds/frontPanelTextDisplay.hpp + +# Other stubs +touch audiocapturemgr/audiocapturemgr_iarm.h +touch rdk_logger_milestone.h +touch btmgr.h +touch proc/readproc.h +touch nopoll/nopoll.h + +# rfcapi.h (types provided via -include Rfc.h) +touch rfcapi.h + +# telemetry (types provided via -include Telemetry.h) +touch telemetry_busmessage_sender.h +touch telemetry2_0.h + +# secure_wrapper (types provided via -include secure_wrappermock.h) +touch secure_wrapper.h + +# edid / drm +touch edid-parser.hpp +touch dsFPD.h + +# safec - needs actual dummy API content +cat > safec_lib.h << 'SAFEC_EOF' +#ifndef _SAFEC_LIB_H_ +#define _SAFEC_LIB_H_ +#include +#include +#include +#ifdef SAFEC_DUMMY_API +typedef int errno_t; +#define EOK 0 + +static inline errno_t strcpy_s(char *dest, size_t dmax, const char *src) { + (void)dmax; + if(dest == NULL || src == NULL) { + return -1; + } + strcpy(dest, src); + return EOK; +} + +static inline errno_t strncpy_s(char *dest, size_t dmax, const char *src, size_t count) { + (void)dmax; + if(dest == NULL || src == NULL) { + return -1; + } + strncpy(dest, src, count); + return EOK; +} + +static inline errno_t strcat_s(char *dest, size_t dmax, const char *src) { + (void)dmax; + if(dest == NULL || src == NULL) { + return -1; + } + strcat(dest, src); + return EOK; +} + +static inline errno_t strncat_s(char *dest, size_t dmax, const char *src, size_t count) { + (void)dmax; + if(dest == NULL || src == NULL) { + return -1; + } + strncat(dest, src, count); + return EOK; +} + +static inline errno_t sprintf_s(char *dest, size_t dmax, const char *format, ...) { + va_list args; + int ret; + if(dest == NULL || format == NULL) { + return -1; + } + va_start(args, format); + ret = vsnprintf(dest, dmax, format, args); + va_end(args); + return (ret < 0) ? -1 : EOK; +} + +static inline errno_t snprintf_s(char *dest, size_t dmax, size_t count, const char *format, ...) { + va_list args; + int ret; + size_t max_len = count < dmax ? count : dmax; + if(dest == NULL || format == NULL) { + return -1; + } + va_start(args, format); + ret = vsnprintf(dest, max_len, format, args); + va_end(args); + return (ret < 0) ? -1 : EOK; +} + +static inline errno_t strcmp_s(const char *dest, size_t dmax, const char *src, int *indicator) { + (void)dmax; + if(dest == NULL || src == NULL || indicator == NULL) { + return -1; + } + *indicator = strcmp(dest, src); + return EOK; +} + +static inline errno_t strncmp_s(const char *dest, size_t dmax, const char *src, size_t count, int *indicator) { + (void)dmax; + if(dest == NULL || src == NULL || indicator == NULL) { + return -1; + } + *indicator = strncmp(dest, src, count); + return EOK; +} + +static inline char *strtok_s(char *str, size_t *strmax, const char *delim, char **context) { + char *token; + (void)strmax; + if(delim == NULL || context == NULL) { + return NULL; + } + token = strtok_r(str, delim, context); + return token; +} + +static inline errno_t memcpy_s(void *dest, size_t dmax, const void *src, size_t count) { + (void)dmax; + if(dest == NULL || src == NULL) { + return -1; + } + memcpy(dest, src, count); + return EOK; +} + +static inline errno_t memset_s(void *dest, size_t dmax, int value, size_t count) { + (void)dmax; + if(dest == NULL) { + return -1; + } + memset(dest, value, count); + return EOK; +} + +static inline errno_t memmove_s(void *dest, size_t dmax, const void *src, size_t count) { + (void)dmax; + if(dest == NULL || src == NULL) { + return -1; + } + memmove(dest, src, count); + return EOK; +} + +static inline errno_t memcmp_s(const void *dest, size_t dmax, const void *src, size_t count, int *indicator) { + (void)dmax; + if(dest == NULL || src == NULL || indicator == NULL) { + return -1; + } + *indicator = memcmp(dest, src, count); + return EOK; +} + +#define ERR_CHK(rc) do { (void)(rc); } while(0) +#endif +#endif +SAFEC_EOF + +echo "Stub headers created successfully" + +cd ${GITHUB_WORKSPACE} + +mkdir -p "${GITHUB_WORKSPACE}/install/usr/include" +printf '{}\n' > "${GITHUB_WORKSPACE}/install/usr/include/ctrlm_config_empty.json" + +# Copy system headers for compatibility +cp -r /usr/include/glib-2.0/* /usr/lib/x86_64-linux-gnu/glib-2.0/include/* "${HEADERS_DIR}/" 2>/dev/null || true + +############################ +# 7. Create stub shared libraries for linking +echo "======================================================================================" +echo "Creating stub libraries" + +STUB_LIB_DIR="$GITHUB_WORKSPACE/install/usr/lib" +mkdir -p "${STUB_LIB_DIR}" + +# Create a minimal C stub source +cat > /tmp/stub.c << 'STUB_EOF' +void __stub_placeholder(void) {} +STUB_EOF + +# Build stub .so for each missing library +for lib in xr-voice-sdk rdkversion IARMBus ds dshalcli nopoll rfcapi secure_wrapper evdev; do + gcc -shared -fPIC -o "${STUB_LIB_DIR}/lib${lib}.so" /tmp/stub.c +done + +rm /tmp/stub.c + +echo "Stub libraries created in ${STUB_LIB_DIR}" +echo "======================================================================================" +echo "build_dependencies.sh complete" diff --git a/ci/cov_build.sh b/ci/cov_build.sh new file mode 100644 index 00000000..e8348b96 --- /dev/null +++ b/ci/cov_build.sh @@ -0,0 +1,101 @@ +#!/bin/bash +set -x +set -e +############################## +GITHUB_WORKSPACE="${PWD}" +ls -la ${GITHUB_WORKSPACE} +############################ + +# Build control (ctrlm-main) +echo "building control (ctrlm-main)" + +CTRL_STUBS="$GITHUB_WORKSPACE/ci/mocks/control" +MOCK_DIR="$GITHUB_WORKSPACE/ci/mocks" +HEADERS_DIR="$GITHUB_WORKSPACE/ci/headers" +EMPTY_JSON="$GITHUB_WORKSPACE/install/usr/include/ctrlm_config_empty.json" + +cmake -G Ninja -S "$GITHUB_WORKSPACE" -B build/control \ +-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/install/usr" \ +-DCMAKE_INSTALL_SYSCONFDIR="${GITHUB_WORKSPACE}/install/etc" \ +-DCMAKE_MODULE_PATH="${GITHUB_WORKSPACE}/install/tools/cmake" \ +-DCMAKE_VERBOSE_MAKEFILE=ON \ +-DCMAKE_PROJECT_VERSION="1.0.0" \ +-DUSE_THUNDER_R4=ON \ +-DTHUNDER=ON \ +-DTHUNDER_SECURITY=OFF \ +-DBLE_ENABLED=OFF \ +-DRF4CE_ENABLED=ON \ +-DIP_ENABLED=OFF \ +-DTELEMETRY_SUPPORT=OFF \ +-DAUTH_ENABLED=OFF \ +-DXRSR_HTTP=OFF \ +-DXRSR_SDT=OFF \ +-DBUILD_CTRLM_FACTORY=OFF \ +-DBUILD_FACTORY_TEST=OFF \ +-DUSE_SAFEC=OFF \ +-DUSE_IARM_POWER_MANAGER=OFF \ +-DBREAKPAD=OFF \ +-DFDC_ENABLED=OFF \ +-DENABLE_ASYNC_SRVR_MSG=OFF \ +-DHIDE_NON_EXTERNAL_SYMBOLS=OFF \ +-DBUILD_SYSTEM=NONE \ +-DCTRLM_UTILS_JSON_COMBINE="${GITHUB_WORKSPACE}/xr-voice-sdk/scripts/vsdk_json_combine.py" \ +-DCTRLM_UTILS_JSON_TO_HEADER="${GITHUB_WORKSPACE}/xr-voice-sdk/scripts/vsdk_json_to_header.py" \ +-DCTRLM_CONFIG_JSON_CPC="${EMPTY_JSON}" \ +-DCTRLM_CONFIG_JSON_CPC_SUB="${EMPTY_JSON}" \ +-DCTRLM_CONFIG_JSON_CPC_ADD="${EMPTY_JSON}" \ +-DCTRLM_CONFIG_JSON_MAIN_SUB="${EMPTY_JSON}" \ +-DCTRLM_CONFIG_JSON_MAIN_ADD="${EMPTY_JSON}" \ +-DCMAKE_CXX_FLAGS=" \ +-I ${CTRL_STUBS} \ +-I ${MOCK_DIR} \ +-I ${MOCK_DIR}/thunder \ +-I ${MOCK_DIR}/devicesettings \ +-I ${HEADERS_DIR} \ +-I ${HEADERS_DIR}/rdk/iarmbus \ +-I ${HEADERS_DIR}/rdk/ds \ +-I ${HEADERS_DIR}/rdk/ds-rpc \ +-I ${HEADERS_DIR}/rdk/ds-hal \ +-I ${HEADERS_DIR}/rdk/halif/ds-hal \ +-I ${HEADERS_DIR}/rdk/iarmmgrs-hal \ +-I ${HEADERS_DIR}/audiocapturemgr \ +-I ${HEADERS_DIR}/ccec/drivers \ +-I ${HEADERS_DIR}/network \ +-I ${HEADERS_DIR}/nopoll \ +-I ${GITHUB_WORKSPACE}/install/usr/include \ +-I ${GITHUB_WORKSPACE}/install/usr/include/WPEFramework \ +-I /usr/include/glib-2.0 \ +-I /usr/lib/x86_64-linux-gnu/glib-2.0/include \ +-I /usr/include/libdrm \ +-include ${MOCK_DIR}/Iarm.h \ +-include ${MOCK_DIR}/devicesettings.h \ +-include ${MOCK_DIR}/Rfc.h \ +-include ${MOCK_DIR}/Telemetry.h \ +-include ${MOCK_DIR}/secure_wrappermock.h \ +-Wall -Wno-error \ +-DSAFEC_DUMMY_API \ +-DDISABLE_SECURITY_TOKEN \ +-DUSE_THUNDER_R4=ON -DTHUNDER_VERSION=4 -DTHUNDER_VERSION_MAJOR=4 -DTHUNDER_VERSION_MINOR=4" \ +-DCMAKE_C_FLAGS=" \ +-I ${CTRL_STUBS} \ +-I ${MOCK_DIR} \ +-I ${HEADERS_DIR} \ +-I ${HEADERS_DIR}/rdk/iarmbus \ +-I ${HEADERS_DIR}/rdk/ds \ +-I ${HEADERS_DIR}/rdk/iarmmgrs-hal \ +-I ${GITHUB_WORKSPACE}/install/usr/include \ +-I ${GITHUB_WORKSPACE}/install/usr/include/WPEFramework \ +-Wall -Wno-error \ +-DSAFEC_DUMMY_API \ +-DDISABLE_SECURITY_TOKEN" \ +-DCMAKE_EXE_LINKER_FLAGS="-L${GITHUB_WORKSPACE}/install/usr/lib -Wl,--unresolved-symbols=ignore-all" + + +# control's CMakeLists.txt adds -Werror via target_compile_options, which appends +# after CMAKE_CXX_FLAGS and overrides our -Wno-error. Strip it from generated build files. +find "${GITHUB_WORKSPACE}/build/control" \( -name "*.ninja" -o -name "flags.make" \) -exec sed -i 's/\(^\|[[:space:]]\)-Werror\([[:space:]]\|$\)/\1\2/g' {} \; + +cmake --build build/control -j$(nproc) 2>&1 +echo "======================================================================================" +echo "control build complete" +exit 0 diff --git a/ci/mocks/Iarm.h b/ci/mocks/Iarm.h new file mode 100644 index 00000000..03cd08d4 --- /dev/null +++ b/ci/mocks/Iarm.h @@ -0,0 +1,923 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include +#include + +#include "mfrTypes.h" + +typedef int IARM_EventId_t; + +typedef enum _IARM_Result_t { + IARM_RESULT_SUCCESS, + IARM_RESULT_INVALID_PARAM, + IARM_RESULT_INVALID_STATE, + IARM_RESULT_IPCCORE_FAIL, + IARM_RESULT_OOM, +} IARM_Result_t; + +#define IARM_BUS_DAEMON_NAME "Daemon" + +typedef IARM_Result_t (*IARM_BusCall_t)(void* arg); +typedef void (*IARM_EventHandler_t)(const char* owner, IARM_EventId_t eventId, void* data, size_t len); + +class IarmBusImpl { +public: + virtual ~IarmBusImpl() = default; + + virtual IARM_Result_t IARM_Bus_Init(const char* name) = 0; + virtual IARM_Result_t IARM_Bus_Connect() = 0; + virtual IARM_Result_t IARM_Bus_Disconnect() = 0; + virtual IARM_Result_t IARM_Bus_Term() = 0; + virtual IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered) = 0; + virtual IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) = 0; + virtual IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId) = 0; + virtual IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) = 0; + virtual IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen) = 0; + virtual IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) = 0; + virtual IARM_Result_t IARM_Bus_RegisterCall(const char* methodName, IARM_BusCall_t handler) = 0; + virtual IARM_Result_t IARM_Bus_Call_with_IPCTimeout(const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout) = 0; +}; + +class IarmBus { +protected: + static IarmBusImpl* impl; +public: + IarmBus(); + IarmBus(const IarmBus &obj) = delete; // deleted copy constructor so that copy of the instance cannot be created. + static void setImpl(IarmBusImpl* newImpl); + static IARM_Result_t IARM_Bus_Init(const char* name); + static IARM_Result_t IARM_Bus_Connect(); + static IARM_Result_t IARM_Bus_Disconnect(); + static IARM_Result_t IARM_Bus_Term(); + static IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered); + static IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler); + static IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId); + static IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler); + static IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen); + static IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) ; + static IARM_Result_t IARM_Bus_RegisterCall(const char* methodName, IARM_BusCall_t handler); + static IARM_Result_t IARM_Bus_Call_with_IPCTimeout(const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout); +}; + +extern IARM_Result_t (*IARM_Bus_Init)(const char*); +extern IARM_Result_t (*IARM_Bus_Connect)(); +extern IARM_Result_t (*IARM_Bus_Disconnect)(); +extern IARM_Result_t (*IARM_Bus_Term)(); +extern IARM_Result_t (*IARM_Bus_IsConnected)(const char*,int*); +extern IARM_Result_t (*IARM_Bus_RegisterEventHandler)(const char*,IARM_EventId_t,IARM_EventHandler_t); +extern IARM_Result_t (*IARM_Bus_UnRegisterEventHandler)(const char*,IARM_EventId_t); +extern IARM_Result_t (*IARM_Bus_RemoveEventHandler)(const char*,IARM_EventId_t,IARM_EventHandler_t); +extern IARM_Result_t (*IARM_Bus_Call)(const char*,const char*,void*,size_t); +extern IARM_Result_t (*IARM_Bus_BroadcastEvent)(const char *,IARM_EventId_t,void *,size_t); +extern IARM_Result_t (*IARM_Bus_RegisterCall)(const char*,IARM_BusCall_t); +extern IARM_Result_t (*IARM_Bus_Call_with_IPCTimeout)(const char*,const char*,void*,size_t,int); +/* ctrlm-main uses IARM_Bus_RegisterEvent as a plain function (defined in stubs_iarm.cpp) */ +extern IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId); + +#define IARM_BUS_COMMON_API_SysModeChange "SysModeChange" + +typedef enum _IARM_Bus_Daemon_PowerState_t { + IARM_BUS_PWRMGR_POWERSTATE_OFF, + IARM_BUS_PWRMGR_POWERSTATE_STANDBY, + IARM_BUS_PWRMGR_POWERSTATE_ON, + IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP, + IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP +} IARM_Bus_PowerState_t; + +typedef IARM_Bus_PowerState_t IARM_Bus_PWRMgr_PowerState_t; + +typedef enum _IARM_Bus_Daemon_SysMode_t { + IARM_BUS_SYS_MODE_NORMAL, + IARM_BUS_SYS_MODE_EAS, + IARM_BUS_SYS_MODE_WAREHOUSE +} IARM_Bus_Daemon_SysMode_t; + +#define IARMBUS_AUDIOCAPTUREMGR_NAME "audiocapturemgr" +#define IARMBUS_AUDIOCAPTUREMGR_REQUEST_SAMPLE "requestSample" + +#define IARMBUS_AUDIOCAPTUREMGR_OPEN "open" +#define IARMBUS_AUDIOCAPTUREMGR_CLOSE "close" +#define IARMBUS_AUDIOCAPTUREMGR_START "start" +#define IARMBUS_AUDIOCAPTUREMGR_STOP "stop" +#define IARMBUS_AUDIOCAPTUREMGR_GET_DEFAULT_AUDIO_PROPS "getDefaultAudioProperties" +#define IARMBUS_AUDIOCAPTUREMGR_GET_AUDIO_PROPS "getAudioProperties" +#define IARMBUS_AUDIOCAPTUREMGR_GET_OUTPUT_PROPS "getOutputProperties" +#define IARMBUS_AUDIOCAPTUREMGR_SET_AUDIO_PROPERTIES "setAudioProperties" +#define IARMBUS_AUDIOCAPTUREMGR_SET_OUTPUT_PROPERTIES "setOutputProperties" + +#define AUDIOCAPTUREMGR_FILENAME_PREFIX "audio_sample" +#define AUDIOCAPTUREMGR_FILE_PATH "/opt/" + +#define DATA_CAPTURE_IARM_EVENT_AUDIO_CLIP_READY 100 + +#define ACM_RESULT_GENERAL_FAILURE 0 +#define ACM_RESULT_PRECAPTURE_NOT_SUPPORTED 1 +#define ACM_RESULT_STREAM_UNAVAILABLE 2 +#define ACM_RESULT_DURATION_OUT_OF_BOUNDS 3 +#define BUFFERED_FILE_OUTPUT "" + +enum Format { + acmFormate16BitStereo, + acmFormate16BitMonoLeft, + acmFormate16BitMonoRight, + acmFormate16BitMono, + acmFormate24BitStereo, + acmFormate24Bit5_1 +}; + +enum Sampling_frequency { + acmFreqe48000, + acmFreqe44100, + acmFreqe32000, + acmFreqe24000, + acmFreqe16000 +}; + +namespace audiocapturemgr { +using session_id_t = int; + +struct audio_properties_ifce_t { + Format format; + Sampling_frequency sampling_frequency; +}; +} + +struct iarmbus_notification_payload_t { + char dataLocator[64]; +}; + +struct iarmbus_acm_arg_t { + struct iarmbus_open_args { + int source; + std::string output_type; + }; + + struct iarmbus_request_payload_t { + float duration; + bool is_precapture; + }; + + struct output_t { + unsigned int buffer_duration; + unsigned int max_buffer_duration; + }; + + struct arg_output_props_t { + output_t output; + }; + + struct Details { + iarmbus_open_args arg_open; + audiocapturemgr::audio_properties_ifce_t arg_audio_properties; + iarmbus_request_payload_t arg_sample_request; + arg_output_props_t arg_output_props; + }; + + int session_id; + int result; + Details details; +}; + +#define IARM_BUS_CECMGR_NAME "CECMgr" +#define IARM_BUS_CECMGR_MAX_DATA_LENGTH 62 +#define IARM_BUS_CECMGR_API_Send "Send" + +typedef struct _IARM_Bus_CECMgr_Send_Param_t { + uint8_t length; + uint8_t data[IARM_BUS_CECMGR_MAX_DATA_LENGTH + 1]; + uint8_t retVal; +} IARM_Bus_CECMgr_Send_Param_t; + +#define IARM_BUS_DEEPSLEEPMGR_NAME "DEEPSLEEPMgr" + +#define IARM_BUS_DEEPSLEEPMGR_API_GetLastWakeupReason "GetLastWakeupReason" +#define IARM_BUS_DEEPSLEEPMGR_API_GetLastWakeupKeyCode "GetLastWakeupKeycode" + +typedef enum _DeepSleep_WakeupReason_t { + DEEPSLEEP_WAKEUPREASON_IR = 0, + DEEPSLEEP_WAKEUPREASON_RCU_BT, + DEEPSLEEP_WAKEUPREASON_RCU_RF4CE, + DEEPSLEEP_WAKEUPREASON_GPIO, + DEEPSLEEP_WAKEUPREASON_LAN, + DEEPSLEEP_WAKEUPREASON_WLAN, + DEEPSLEEP_WAKEUPREASON_TIMER, + DEEPSLEEP_WAKEUPREASON_FRONT_PANEL, + DEEPSLEEP_WAKEUPREASON_WATCHDOG, + DEEPSLEEP_WAKEUPREASON_SOFTWARE_RESET, + DEEPSLEEP_WAKEUPREASON_THERMAL_RESET, + DEEPSLEEP_WAKEUPREASON_WARM_RESET, + DEEPSLEEP_WAKEUPREASON_COLDBOOT, + DEEPSLEEP_WAKEUPREASON_STR_AUTH_FAILURE, + DEEPSLEEP_WAKEUPREASON_CEC, + DEEPSLEEP_WAKEUPREASON_PRESENCE, + DEEPSLEEP_WAKEUPREASON_VOICE, + DEEPSLEEP_WAKEUPREASON_UNKNOWN +} DeepSleep_WakeupReason_t; + +typedef struct _DeepSleepMgr_WakeupKeyCode_Param_t { + unsigned int keyCode; +} DeepSleepMgr_WakeupKeyCode_Param_t; + +#define IARM_BUS_MFRLIB_NAME "MFRLib" +#define IARM_BUS_MFRLIB_API_SetBootLoaderPattern "mfrSetBootloaderPattern" +#define IARM_BUS_MFRLIB_API_SetBlSplashScreen "mfrSetBlSplashScreen" +#define IARM_BUS_MFRLIB_API_GetSerializedData "mfrGetManufacturerData" +#define IARM_BUS_MFRLIB_API_SetFsrFlag "mfrSetFSRflag" +#define IARM_BUS_MFRLIB_API_GetFsrFlag "mfrGetFSRflag" +#define IARM_BUS_MFRLIB_API_GetTemperature "mfrGetTemperature" /*!< Gets the thermal temperature for the device*/ +#define IARM_BUS_MFRLIB_API_SetTemperatureThresholds "mfrSetTempThresholds" /*!< Sets the thermal threshold for the device*/ +#define IARM_BUS_MFRLIB_API_GetTemperatureThresholds "mfrGetTempThresholds" /*!< Gets the thermal threshold for the device*/ + +typedef struct _IARM_Bus_MFRLib_SetBLPattern_Param_t { + mfrBlPattern_t pattern; +} IARM_Bus_MFRLib_SetBLPattern_Param_t; + +typedef struct _IARM_Bus_MFRLib_GetSerializedData_Param_t { + mfrSerializedType_t type; + char buffer[1280]; + int bufLen; +} IARM_Bus_MFRLib_GetSerializedData_Param_t; + +#define PWRMGR_MAX_REBOOT_REASON_LENGTH 100 + +#define MAX_PWR_STATE_BEF_REBOOR_STR_LEN (32) +#define IARM_BUS_PWRMGR_API_GetPowerStateBeforeReboot "GetPowerStateBeforeReboot" +#define IARM_BUS_PWRMGR_API_SetStandbyVideoState "SetStandbyVideoState" +#define IARM_BUS_PWRMGR_API_GetStandbyVideoState "GetStandbyVideoState" +#define IARM_BUS_PWRMGR_API_SetNetworkStandbyMode "SetNetworkStandbyMode" +#define IARM_BUS_PWRMGR_API_GetNetworkStandbyMode "GetNetworkStandbyMode" +#define IARM_BUS_PWRMGR_API_Reboot "performReboot" +#define IARM_BUS_PWRMGR_API_WareHouseClear "WarehouseClear" /*!< */ +#define IARM_BUS_PWRMGR_API_ColdFactoryReset "ColdFactoryReset" /*!< Reset the box to cold factory state*/ +#define IARM_BUS_PWRMGR_API_FactoryReset "FactoryReset" /*!< Reset the box to factory state*/ +#define IARM_BUS_PWRMGR_API_UserFactoryReset "UserFactoryReset" /*!< Reset the box to user factory state*/ +#define IARM_BUS_PWRMGR_API_WareHouseReset "WareHouseReset" /*!< Reset the box to warehouse state*/ + +typedef struct _IARM_Bus_PWRMgr_NetworkStandbyMode_Param_t { + bool bStandbyMode; +} IARM_Bus_PWRMgr_NetworkStandbyMode_Param_t; + +typedef struct _IARM_Bus_PWRMgr_GetPowerStateBeforeReboot_Param_t { + char powerStateBeforeReboot[MAX_PWR_STATE_BEF_REBOOR_STR_LEN]; +} IARM_Bus_PWRMgr_GetPowerStateBeforeReboot_Param_t; + +typedef struct _IARM_Bus_PWRMgr_SetDeepSleepTimeOut_Param_t { + unsigned int timeout; +} IARM_Bus_PWRMgr_SetDeepSleepTimeOut_Param_t; + +typedef enum _IARM_Bus_PWRMgr_ThermalState_t { + IARM_BUS_PWRMGR_TEMPERATURE_NORMAL = 0, + IARM_BUS_PWRMGR_TEMPERATURE_HIGH, + IARM_BUS_PWRMGR_TEMPERATURE_CRITICAL +} IARM_Bus_PWRMgr_ThermalState_t; + +typedef enum _WakeupSrcType_t { + WAKEUPSRC_VOICE = 0, + WAKEUPSRC_PRESENCE_DETECTION, + WAKEUPSRC_BLUETOOTH, + WAKEUPSRC_WIFI, + WAKEUPSRC_IR, + WAKEUPSRC_POWER_KEY, + WAKEUPSRC_TIMER, + WAKEUPSRC_CEC, + WAKEUPSRC_LAN, + WAKEUPSRC_MAX +} WakeupSrcType_t; + +typedef struct _PWRMgr_EventData_t { + union { + struct _MODE_DATA { + IARM_Bus_PWRMgr_PowerState_t curState; + IARM_Bus_PWRMgr_PowerState_t newState; + uint32_t deep_sleep_timeout; + bool nwStandbyMode; + } state; + struct _THERM_DATA { + IARM_Bus_PWRMgr_ThermalState_t curLevel; + IARM_Bus_PWRMgr_ThermalState_t newLevel; + float curTemperature; + } therm; + bool bNetworkStandbyMode; + int32_t reset_sequence_progress; + } data; +} IARM_Bus_PWRMgr_EventData_t; + +typedef struct _IARM_Bus_PWRMgr_GetThermalState_Param_t { + IARM_Bus_PWRMgr_ThermalState_t curLevel; + float curTemperature; +} IARM_Bus_PWRMgr_GetThermalState_Param_t; + +typedef struct _IARM_Bus_PWRMgr_GetTempThresholds_Param_t { + float tempHigh; + float tempCritical; +} IARM_Bus_PWRMgr_GetTempThresholds_Param_t; + +typedef struct _IARM_Bus_PWRMgr_SetTempThresholds_Param_t { + float tempHigh; + float tempCritical; +} IARM_Bus_PWRMgr_SetTempThresholds_Param_t; + +typedef struct _IARM_Bus_PWRMgr_GetOvertempGraceInterval_Param_t { + int graceInterval; +} IARM_Bus_PWRMgr_GetOvertempGraceInterval_Param_t; + +typedef struct _IARM_Bus_PWRMgr_SetOvertempGraceInterval_Param_t { + int graceInterval; +} IARM_Bus_PWRMgr_SetOvertempGraceInterval_Param_t; + +typedef struct _IARM_Bus_CommonAPI_SysModeChange_Param_t { + IARM_Bus_Daemon_SysMode_t oldMode; + IARM_Bus_Daemon_SysMode_t newMode; +} IARM_Bus_CommonAPI_SysModeChange_Param_t; + +typedef enum _PWRMgr_EventId_t { + IARM_BUS_PWRMGR_EVENT_MODECHANGED = 0, + IARM_BUS_PWRMGR_EVENT_DEEPSLEEP_TIMEOUT, + IARM_BUS_PWRMGR_EVENT_RESET_SEQUENCE, + IARM_BUS_PWRMGR_EVENT_REBOOTING, + IARM_BUS_PWRMGR_EVENT_THERMAL_MODECHANGED, + IARM_BUS_PWRMGR_EVENT_WAREHOUSEOPS_STATUSCHANGED, + IARM_BUS_PWRMGR_EVENT_NETWORK_STANDBYMODECHANGED, + IARM_BUS_PWRMGR_EVENT_MAX, + IARM_BUS_DSMGR_EVENT_ATMOS_CAPS_CHANGED, +} IARM_Bus_PWRMgr_EventId_t; + +typedef struct _IARM_Bus_PWRMgr_RebootParam_t { + char reboot_reason_custom[PWRMGR_MAX_REBOOT_REASON_LENGTH]; + char reboot_reason_other[PWRMGR_MAX_REBOOT_REASON_LENGTH]; + char requestor[PWRMGR_MAX_REBOOT_REASON_LENGTH]; +} IARM_Bus_PWRMgr_RebootParam_t; + +#define IARM_BUS_PWRMGR_NAME "PWRMgr" +#define IARM_BUS_PWRMGR_API_SetPowerState "SetPowerState" +#define IARM_BUS_PWRMGR_API_GetPowerState "GetPowerState" + +typedef struct _IARM_Bus_PWRMgr_SetPowerState_Param_t { + IARM_Bus_PWRMgr_PowerState_t newState; + int keyCode; +} IARM_Bus_PWRMgr_SetPowerState_Param_t; + +typedef struct _IARM_Bus_PWRMgr_GetPowerState_Param_t { + IARM_Bus_PWRMgr_PowerState_t curState; + IARM_Bus_PowerState_t prevState; +} IARM_Bus_PWRMgr_GetPowerState_Param_t; + +typedef struct _IARM_BUS_PWRMgr_DeepSleepTimeout_EventData_t { + unsigned int timeout; /*!< Timeout for deep sleep in seconds*/ +} IARM_BUS_PWRMgr_DeepSleepTimeout_EventData_t; + +#define IARM_BUS_PWRMGR_API_GetThermalState "GetThermalState" +#define IARM_BUS_PWRMGR_API_GetTemperatureThresholds "GetTemperatureThresholds" +#define IARM_BUS_PWRMGR_API_SetTemperatureThresholds "SetTemperatureThresholds" +#define IARM_BUS_PWRMGR_API_GetOvertempGraceInterval "GetOvertempGraceInterval" +#define IARM_BUS_PWRMGR_API_SetOvertempGraceInterval "SetOvertempGraceInterval" +#define IARM_BUS_PWRMGR_API_GetLastWakeupReason "GetLastWakeupReason" +#define IARM_BUS_PWRMGR_API_GetLastWakeupKeyCode "GetLastWakeupKeyCode" + +/** + * @brief Structure which holds the wakeup source type and the value to be set and the power state. + */ +typedef struct _IARM_Bus_PWRMgr_WakeupSrcConfig_Param_t{ + uint32_t pwrMode; + uint32_t srcType; + uint32_t config; +} IARM_Bus_PWRMgr_WakeupSrcConfig_Param_t; +/** + * @brief Structure which holds the ware house reset time. + */ +typedef struct _IARM_Bus_PWRMgr_WareHouseReset_Param_t { + bool suppressReboot; /*!< STB should not be rebooted */ +} IARM_Bus_PWRMgr_WareHouseReset_Param_t; + +/** + * @brief Enumerator which represents the possible warehouse ops + */ +typedef enum _IARM_Bus_PWRMgr_WareHouseOpsStatus_t{ + IARM_BUS_PWRMGR_WAREHOUSE_COMPLETED = 0, /* warehouse operation completed sucessfully */ + IARM_BUS_PWRMGR_WAREHOUSE_INPROGRESS, /* warehouse operation in progress*/ + IARM_BUS_PWRMGR_WAREHOUSE_FAILED, /* warehouse operation failed.*/ +} IARM_Bus_PWRMgr_WareHouseOpsStatus_t; + +/** + * @brief Enumerator which represents the possible warehouse ops + */ +typedef enum _IARM_Bus_PWRMgr_WareHouseOps_t{ + IARM_BUS_PWRMGR_WAREHOUSE_RESET = 0, /* warehouse reset */ + IARM_BUS_PWRMGR_WAREHOUSE_CLEAR, /* warehouse clear*/ +} IARM_Bus_PWRMgr_WareHouseOps_t; + +/** + * @brief Structure which holds warehouse opn status value. + */ +typedef struct _IARM_BUS_PWRMgr_WareHouseOpn_EventData_t { + IARM_Bus_PWRMgr_WareHouseOps_t wareHouseOpn; /*!< WareHouse operation*/ + IARM_Bus_PWRMgr_WareHouseOpsStatus_t status; /*!< WareHouse operation status*/ +} IARM_BUS_PWRMgr_WareHouseOpn_EventData_t; + +#define IARM_BUS_PWRMGR_API_SetWakeupSrcConfig "setWakeupSrcConfig" +#define IARM_BUS_PWRMGR_API_GetWakeupSrcConfig "getWakeupSrcConfig" /*!< gets wakup configuration*/ + +#define IARM_BUS_SYSMGR_NAME "SYSMgr" +#define IARM_BUS_SYSMGR_API_GetSystemStates "GetSystemStates" + +/** + * @brief Structure which holds RFC device management update information. + */ +typedef struct _IARM_BUS_SYSMGR_DeviceMgtUpdateInfo_Param_t +{ + char source[10]; /*!< Device Management Update source. Ex: rfc */ + char type[10]; /*!< Device Management Update type. Ex: initial */ + bool status; /*!< Device Management Update status. true/false */ +} IARM_BUS_SYSMGR_DeviceMgtUpdateInfo_Param_t; + +typedef enum _SYSMgr_EventId_t { + IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE, + IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_REQUEST, /*!< Xupnp data request frm Receiver to UPNP*/ + IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_UPDATE, /*!< Xupnp data frm UPNP to Receiver*/ + IARM_BUS_SYSMGR_EVENT_IMAGE_DNLD, /*Image download status to Receiver */ + IARM_BUS_SYSMGR_EVENT_CARD_FWDNLD, /*!< CARD FW download event to Receiver - Valid on some product's CA*/ + IARM_BUS_SYSMGR_EVENT_HDCP_PROFILE_UPDATE, /*!< HDCP Profile Update */ + IARM_BUS_SYSMGR_EVENT_INTRUSION, /*!< Intrusion Detection */ + IARM_BUS_SYSMGR_EVENT_EISS_FILTER_STATUS, /*!< EISS Filter status event */ + IARM_BUS_SYSMGR_EVENT_EISS_APP_ID_UPDATE, /*!< EISS App ID update */ + IARM_BUS_SYSMGR_EVENT_KEYCODE_LOGGING_CHANGED, /*!< Key Code logging status update */ + IARM_BUS_SYSMGR_EVENT_USB_MOUNT_CHANGED, /*!< Fires when USB mounts change */ + IARM_BUS_SYSMGR_EVENT_APP_RELEASE_FOCUS, /*!< Application fires event to release focus*/ + IARM_BUS_SYSMGR_EVENT_DEVICE_UPDATE_RECEIVED, /*!< Received Device Management update information */ + IARM_BUS_SYSMGR_EVENT_MAX /*!< Max Event Id */ +} IARM_Bus_SYSMgr_EventId_t; + +typedef struct _IARM_BUS_SYSMGR_KEYCodeLoggingInfo_Param_t { + int logStatus; /*!< HDCP Profile Data */ +} IARM_BUS_SYSMGR_KEYCodeLoggingInfo_Param_t; + +#define IARM_BUS_SYSMGR_API_GetKeyCodeLoggingPref "GetKeyCodeLoggingPref" +#define IARM_BUS_SYSMGR_API_SetKeyCodeLoggingPref "SetKeyCodeLoggingPref" + +typedef enum _SYSMgr_SystemState_t { + IARM_BUS_SYSMGR_SYSSTATE_CHANNELMAP, //0 + IARM_BUS_SYSMGR_SYSSTATE_DISCONNECTMGR, //1 + IARM_BUS_SYSMGR_SYSSTATE_TUNEREADY, //2 + IARM_BUS_SYSMGR_SYSSTATE_EXIT_OK, //3 + IARM_BUS_SYSMGR_SYSSTATE_CMAC, //4 + IARM_BUS_SYSMGR_SYSSTATE_MOTO_ENTITLEMENT, //5 + IARM_BUS_SYSMGR_SYSSTATE_MOTO_HRV_RX, //6 + IARM_BUS_SYSMGR_SYSSTATE_CARD_CISCO_STATUS, //7 + IARM_BUS_SYSMGR_SYSSTATE_VIDEO_PRESENTING, //8 + IARM_BUS_SYSMGR_SYSSTATE_HDMI_OUT, //9 + IARM_BUS_SYSMGR_SYSSTATE_HDCP_ENABLED, //10 + IARM_BUS_SYSMGR_SYSSTATE_HDMI_EDID_READ, //11 + IARM_BUS_SYSMGR_SYSSTATE_FIRMWARE_DWNLD, //12 + IARM_BUS_SYSMGR_SYSSTATE_TIME_SOURCE, //13 + IARM_BUS_SYSMGR_SYSSTATE_TIME_ZONE, //14 + IARM_BUS_SYSMGR_SYSSTATE_CA_SYSTEM, //15 + IARM_BUS_SYSMGR_SYSSTATE_ESTB_IP, //16 + IARM_BUS_SYSMGR_SYSSTATE_ECM_IP, //17 + IARM_BUS_SYSMGR_SYSSTATE_LAN_IP, //18 + IARM_BUS_SYSMGR_SYSSTATE_MOCA, //19 + IARM_BUS_SYSMGR_SYSSTATE_DOCSIS, //20 + IARM_BUS_SYSMGR_SYSSTATE_DSG_BROADCAST_CHANNEL, //21 + IARM_BUS_SYSMGR_SYSSTATE_DSG_CA_TUNNEL, //22 + IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD, //23 + IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD_DWNLD, //24 + IARM_BUS_SYSMGR_SYSSTATE_CVR_SUBSYSTEM, //25 + IARM_BUS_SYSMGR_SYSSTATE_DOWNLOAD, //26 + IARM_BUS_SYSMGR_SYSSTATE_VOD_AD, //27 + IARM_BUS_SYSMGR_SYSSTATE_DAC_INIT_TIMESTAMP, //28 + IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD_SERIAL_NO, //29 + IARM_BUS_SYSMGR_SYSSTATE_ECM_MAC, //30 + IARM_BUS_SYSMGR_SYSSTATE_DAC_ID, //31 + IARM_BUS_SYSMGR_SYSSTATE_PLANT_ID, //32 + IARM_BUS_SYSMGR_SYSSTATE_STB_SERIAL_NO, //33 + IARM_BUS_SYSMGR_SYSSTATE_BOOTUP, //34 + IARM_BUS_SYSMGR_SYSSTATE_GATEWAY_CONNECTION, //35 + IARM_BUS_SYSMGR_SYSSTATE_DST_OFFSET, //36 + IARM_BUS_SYSMGR_SYSSTATE_RF_CONNECTED, //37 + IARM_BUS_SYSMGR_SYSSTATE_PARTNERID_CHANGE, //38 + IARM_BUS_SYSMGR_SYSSTATE_IP_MODE, //39 + IARM_BUS_SYSMGR_SYSSTATE_LP_CONNECTION_RESET, //40 + IARM_BUS_SYSMGR_SYSSTATE_RWS_CONNECTION_RESET, //41 + IARM_BUS_SYSMGR_SYSSTATE_QAM_READY, //42 + IARM_BUS_SYSMGR_SYSSTATE_FIRMWARE_UPDATE_STATE, //43, Added as part of RDK-19978, As the IARM + IARM_BUS_SYSMGR_SYSSTATE_USB_DETECTED, //44 + IARM_BUS_SYSMGR_SYSSTATE_LOG_UPLOAD, //45 +} IARM_Bus_SYSMgr_SystemState_t; + +typedef enum _SYSMgr_FirmwareUpdateState_t { + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_UNINITIALIZED = 0, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_REQUESTING = 1, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_DOWNLOADING = 2, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_FAILED = 3, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_DOWNLOAD_COMPLETE = 4, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_VALIDATION_COMPLETE = 5, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_PREPARING_TO_REBOOT = 6, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_ONHOLD_FOR_OPTOUT = 7, /* On Hold for opt-out */ + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_CRITICAL_REBOOT = 8, + IARM_BUS_SYSMGR_FIRMWARE_UPDATE_STATE_NO_UPGRADE_REQUIRED = 9 +} IARM_Bus_SYSMGR_FirmwareUpdateState_t; + +typedef enum _SYSMgr_LogUpload_t +{ + IARM_BUS_SYSMGR_LOG_UPLOAD_SUCCESS = 0, + IARM_BUS_SYSMGR_LOG_UPLOAD_FAILED = 1, + IARM_BUS_SYSMGR_LOG_UPLOAD_ABORTED = 2, +} IARM_Bus_SYSMGR_SYSMgr_LogUpload_t; + +typedef struct _IARM_BUS_SYSMgr_EventData_t { + union { + struct _CARD_FWDNLD_DATA { + char eventType; + char status; + } cardFWDNLD; + struct _IMAGE_FWDNLD_DATA { + char status; + } imageFWDNLD; + struct _XUPNP_DATA { + unsigned long deviceInfoLength; + } xupnpData; + struct _HDCP_PROFILE { + unsigned int hdcpProfile; + } hdcpProfileData; + struct _SystemStates { + IARM_Bus_SYSMgr_SystemState_t stateId; + int state; + int error; + char payload[128]; + } systemStates; + struct _EISS_STATUS { + int filterStatus; + } eissEventData; + struct _EISS_APP_ID { + unsigned char idList[4][6]; + int count; + } eissAppIDList; + struct _KEY_CODE_LOG { + int logStatus; + } keyCodeLogData; + struct _USB_MOUNT { + int mounted; + char device[128]; + char dir[256]; + } usbMountData; + + } data; +} IARM_Bus_SYSMgr_EventData_t; + +typedef struct _propertyValue { + int state; + int error; + char payload[128]; +} state_property; + +typedef struct _IARM_Bus_SYSMgr_GetSystemStates_Param_t { + state_property channel_map; + state_property disconnect_mgr_state; + state_property TuneReadyStatus; + state_property exit_ok_key_sequence; + state_property cmac; + state_property card_moto_entitlements; + state_property card_moto_hrv_rx; + state_property dac_init_timestamp; + state_property card_cisco_status; + state_property video_presenting; + state_property hdmi_out; + state_property hdcp_enabled; + state_property hdmi_edid_read; + state_property firmware_download; + state_property time_source; + state_property time_zone_available; + state_property ca_system; + state_property estb_ip; + state_property ecm_ip; + state_property lan_ip; + state_property moca; + state_property docsis; + state_property dsg_broadcast_tunnel; + state_property dsg_ca_tunnel; + state_property cable_card; + state_property cable_card_download; + state_property cvr_subsystem; + state_property download; + state_property vod_ad; + state_property card_serial_no; + state_property ecm_mac; + state_property dac_id; + state_property plant_id; + state_property stb_serial_no; + state_property bootup; + state_property dst_offset; + state_property rf_connected; + state_property ip_mode; + state_property qam_ready_status; + state_property firmware_update_state; +} IARM_Bus_SYSMgr_GetSystemStates_Param_t; + +#define IARM_BUS_DSMGR_NAME "DSMgr" + +/*! Events published from DS Mananger */ +typedef enum _DSMgr_EventId_t { + IARM_BUS_DSMGR_EVENT_RES_PRECHANGE = 0, /*!< Resolution Pre Change Event */ + IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE, /*!< Resolution Post Change Event */ + IARM_BUS_DSMGR_EVENT_ZOOM_SETTINGS, /*!< Zoom Settings Events */ + IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, /*!< HDMI HPD DETECT Change Event */ + IARM_BUS_DSMGR_EVENT_AUDIO_MODE, /*!< HDMI HPD DETECT Change Event */ + IARM_BUS_DSMGR_EVENT_HDCP_STATUS, /*!< HDMI HDCP status */ + IARM_BUS_DSMGR_EVENT_RX_SENSE, /*!< HDMI Rx Sense status */ + IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG, /*!< HDMI IN HPD change event */ + IARM_BUS_DSMGR_EVENT_HDMI_IN_SIGNAL_STATUS, /*!< HDMI IN signal status change event */ + IARM_BUS_DSMGR_EVENT_HDMI_IN_STATUS, /*!< HDMI IN status change event */ + IARM_BUS_DSMGR_EVENT_HDMI_IN_AV_LATENCY, /*!< HDMI IN AV Latency Event */ + IARM_BUS_DSMGR_EVENT_HDMI_IN_VIDEO_MODE_UPDATE, /*!< HDMI IN video mode update event */ + IARM_BUS_DSMGR_EVENT_HDMI_IN_ALLM_STATUS, /*!< HDMI IN ALLM mode update event */ + IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS, /*!< HDMI IN VRR mode update event */ + IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_HOTPLUG, /*!< COMPOSITE IN HPD change event */ + IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_SIGNAL_STATUS, /*!< COMPOSITE IN signal status change event */ + IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, /*!< COMPOSITE IN status change event */ + IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE, /*!< COMPOSITE IN Video Mode change event */ + IARM_BUS_DSMGR_EVENT_TIME_FORMAT_CHANGE, /*!< Clock Time Format Change Event*/ + IARM_BUS_DSMGR_EVENT_AUDIO_LEVEL_CHANGED, /*!< Audio Level Change Event*/ + IARM_BUS_DSMGR_EVENT_AUDIO_OUT_HOTPLUG, /*!< AUDIO OUT HPD change event */ + IARM_BUS_DSMGR_EVENT_AUDIO_FORMAT_UPDATE, /*!< Audio Format change event */ + IARM_BUS_DSMGR_EVENT_AUDIO_PRIMARY_LANGUAGE_CHANGED, /*!< Audio Primary Language change event */ + IARM_BUS_DSMGR_EVENT_AUDIO_SECONDARY_LANGUAGE_CHANGED, /*!< Audio Secondary Language change event */ + IARM_BUS_DSMGR_EVENT_AUDIO_FADER_CONTROL_CHANGED, /*!< Audio Fader Control change event */ + IARM_BUS_DSMGR_EVENT_AUDIO_ASSOCIATED_AUDIO_MIXING_CHANGED, /*!< Audio Associated Audio Mixing change event */ + IARM_BUS_DSMGR_EVENT_VIDEO_FORMAT_UPDATE, /*!< Video Format change event */ + IARM_BUS_DSMGR_EVENT_DISPLAY_FRAMRATE_PRECHANGE, /*!< Frame rate pre change */ + IARM_BUS_DSMGR_EVENT_DISPLAY_FRAMRATE_POSTCHANGE, /*!< Frame rate post change */ + IARM_BUS_DSMGR_EVENT_AUDIO_PORT_STATE, /*!< Audio Port Init State */ + IARM_BUS_DSMGR_EVENT_SLEEP_MODE_CHANGED, /*!< Sleep Mode Change Event*/ + IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE, /*Register(__VA_ARGS__) +#endif + +/* Netsrvmgr Based Macros & Structures */ +typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t { + union { + char activeIface[INTERFACE_SIZE]; + char allNetworkInterfaces[INTERFACE_LIST]; + char setInterface[INTERFACE_SIZE]; + char activeIfaceIpaddr[MAX_IP_ADDRESS_LEN]; + }; + char interfaceCount; + bool isInterfaceEnabled; + bool persist; + char ipfamily[MAX_IP_FAMILY_SIZE]; +} IARM_BUS_NetSrvMgr_Iface_EventData_t; + +#define IARM_BUS_SYSMGR_API_RunScript "RunScript" +/*! Parameter for RunScript call*/ +typedef struct _IARM_Bus_SYSMgr_RunScript_t{ + char script_path [256]; //[in] Null terminated path name of the script. + int return_value; //[out] Returns the ret value of system. +} IARM_Bus_SYSMgr_RunScript_t; + +typedef enum _CECMgr_EventId_t { + IARM_BUS_CECMGR_EVENT_SEND, + IARM_BUS_CECMGR_EVENT_RECV, + IARM_BUS_CECMGR_EVENT_ENABLE, + IARM_BUS_CECMGR_EVENT_DAEMON_INITIALIZED, + IARM_BUS_CECMGR_EVENT_MAX, + IARM_BUS_CECMGR_EVENT_STATUS_UPDATED +} IARM_Bus_CECMgr_EventId_t; + +typedef enum _IARM_Bus_MFRLib_ThermalState_t{ + IARM_BUS_TEMPERATURE_NORMAL = 0, /* Temp is within normal operating range */ + IARM_BUS_TEMPERATURE_HIGH, /* Temp is high, but just a warning as device can still operate */ + IARM_BUS_TEMPERATURE_CRITICAL /* Temp is critical, should trigger a thermal reset */ +} IARM_Bus_MFRLib_CurThermalState_t; + +typedef struct _IARM_Bus_CECMgr_Status_Updated_Param_t +{ + int logicalAddress; +}IARM_Bus_CECMgr_Status_Updated_Param_t; + +typedef struct _IARM_Bus_MFRLib_SetBLSplashScreen_Param{ + char path[255]; +} IARM_Bus_MFRLib_SetBLSplashScreen_Param_t; + +typedef struct _IARM_Bus_MFRLib_ThermalSoCTemp_Param_t{ + IARM_Bus_MFRLib_CurThermalState_t curState; /* !< Current Thermal level */ + int curSoCTemperature; /* !< Current SoC temperature value */ + int curWiFiTemperature; /* !< Current WiFi temperature value */ + int highTemp; /* !< New threshold at which TEMPERATURE_HIGH will be reported */ + int criticalTemp; /* !< New threshold at which TEMPERATURE_CRITICAL will be reported */ +} IARM_Bus_MFRLib_ThermalSoCTemp_Param_t; + +typedef bool IARM_Bus_MFRLib_FsrFlag_Param_t; // true or false + +#define IARM_BUS_CECMGR_API_isAvailable "isAvailable" +#define IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs "dsHdmiInGetNumberOfInputs" +#define IARM_BUS_DSMGR_API_dsHdmiInGetStatus "dsHdmiInGetStatus" +#define IARM_BUS_DSMGR_API_dsGetHDMIARCPortId "dsGetHDMIARCPortId" +#define IARM_BUS_DSMGR_API_SetStandbyVideoState "dsSetStandbyVideoState" +#define IARM_BUS_DSMGR_API_GetStandbyVideoState "dsGetStandbyVideoState" diff --git a/ci/mocks/Rfc.h b/ci/mocks/Rfc.h new file mode 100644 index 00000000..e7f001df --- /dev/null +++ b/ci/mocks/Rfc.h @@ -0,0 +1,114 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +typedef enum { + WDMP_SUCCESS = 0, /**< Success. */ + WDMP_FAILURE, /**< General Failure */ + WDMP_ERR_TIMEOUT, + WDMP_ERR_NOT_EXIST, + WDMP_ERR_INVALID_PARAMETER_NAME, + WDMP_ERR_INVALID_PARAMETER_TYPE, + WDMP_ERR_INVALID_PARAMETER_VALUE, + WDMP_ERR_NOT_WRITABLE, + WDMP_ERR_SETATTRIBUTE_REJECTED, + WDMP_ERR_REQUEST_REJECTED, + WDMP_ERR_NAMESPACE_OVERLAP, + WDMP_ERR_UNKNOWN_COMPONENT, + WDMP_ERR_NAMESPACE_MISMATCH, + WDMP_ERR_UNSUPPORTED_NAMESPACE, + WDMP_ERR_DP_COMPONENT_VERSION_MISMATCH, + WDMP_ERR_INVALID_PARAM, + WDMP_ERR_UNSUPPORTED_DATATYPE, + WDMP_STATUS_RESOURCES, + WDMP_ERR_WIFI_BUSY, + WDMP_ERR_INVALID_ATTRIBUTES, + WDMP_ERR_WILDCARD_NOT_SUPPORTED, + WDMP_ERR_SET_OF_CMC_OR_CID_NOT_SUPPORTED, + WDMP_ERR_VALUE_IS_EMPTY, + WDMP_ERR_VALUE_IS_NULL, + WDMP_ERR_DATATYPE_IS_NULL, + WDMP_ERR_CMC_TEST_FAILED, + WDMP_ERR_NEW_CID_IS_MISSING, + WDMP_ERR_CID_TEST_FAILED, + WDMP_ERR_SETTING_CMC_OR_CID, + WDMP_ERR_INVALID_INPUT_PARAMETER, + WDMP_ERR_ATTRIBUTES_IS_NULL, + WDMP_ERR_NOTIFY_IS_NULL, + WDMP_ERR_INVALID_WIFI_INDEX, + WDMP_ERR_INVALID_RADIO_INDEX, + WDMP_ERR_ATOMIC_GET_SET_FAILED, + WDMP_ERR_METHOD_NOT_SUPPORTED, + WDMP_ERR_SESSION_IN_PROGRESS, + WDMP_ERR_INTERNAL_ERROR, + WDMP_ERR_DEFAULT_VALUE +} WDMP_STATUS; + +typedef enum { + WDMP_STRING = 0, + WDMP_INT, + WDMP_UINT, + WDMP_BOOLEAN, + WDMP_DATETIME, + WDMP_BASE64, + WDMP_LONG, + WDMP_ULONG, + WDMP_FLOAT, + WDMP_DOUBLE, + WDMP_BYTE, + WDMP_NONE, + WDMP_BLOB +} DATA_TYPE; + +#define MAX_PARAM_LEN (2 * 1024) + +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATA_TYPE type; +} RFC_ParamData_t; + +class RfcApiImpl { +public: + virtual ~RfcApiImpl() = default; + + virtual WDMP_STATUS getRFCParameter(char* pcCallerID, const char* pcParameterName, RFC_ParamData_t* pstParamData) = 0; + virtual WDMP_STATUS setRFCParameter(char* pcCallerID, const char* pcParameterName, const char* pcParameterValue, DATA_TYPE eDataType) = 0; + virtual const char* getRFCErrorString(WDMP_STATUS code) = 0; +}; + +class RfcApi { + +protected: + static RfcApiImpl* impl; + +public: + RfcApi(); + RfcApi(const RfcApi &obj) = delete; // deleted copy constructor so that copy of the instance cannot be created. + static void setImpl(RfcApiImpl* newImpl); + static WDMP_STATUS getRFCParameter(char* pcCallerID, const char* pcParameterName, RFC_ParamData_t* pstParamData); + static WDMP_STATUS setRFCParameter(char* pcCallerID, const char* pcParameterName, const char* pcParameterValue, DATA_TYPE eDataType); + static const char* getRFCErrorString(WDMP_STATUS code); +}; + +extern WDMP_STATUS (*getRFCParameter)(char*,const char*,RFC_ParamData_t*); +extern WDMP_STATUS (*setRFCParameter)(char*,const char*,const char*,DATA_TYPE); +extern const char* (*getRFCErrorString)(WDMP_STATUS); + diff --git a/ci/mocks/Telemetry.h b/ci/mocks/Telemetry.h new file mode 100644 index 00000000..4ae4133c --- /dev/null +++ b/ci/mocks/Telemetry.h @@ -0,0 +1,61 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +typedef enum { + T2ERROR_SUCCESS, + T2ERROR_FAILURE, + T2ERROR_INVALID_PROFILE, + T2ERROR_PROFILE_NOT_FOUND, + T2ERROR_PROFILE_NOT_SET, + T2ERROR_MAX_PROFILES_REACHED, + T2ERROR_MEMALLOC_FAILED, + T2ERROR_INVALID_ARGS, + T2ERROR_INTERNAL_ERROR +} T2ERROR; + +class TelemetryApiImpl { +public: + virtual ~TelemetryApiImpl() = default; + + virtual void t2_init(char* component) = 0; + virtual void t2_uninit(void) = 0; + virtual T2ERROR t2_event_s(const char* marker, const char* value) = 0; + virtual T2ERROR t2_event_d(const char* marker, int value) = 0; +}; + +class TelemetryApi { +protected: + static TelemetryApiImpl* impl; +public: + TelemetryApi(); + TelemetryApi(const TelemetryApi &obj) = delete; + static void setImpl(TelemetryApiImpl* newImpl); + static void t2_init(char* component); + static void t2_uninit(void); + static T2ERROR t2_event_s(const char* marker, const char* value); + static T2ERROR t2_event_d(const char* marker, int value); +}; + +extern void (*t2_init)(char*); +extern void (*t2_uninit)(void); +extern T2ERROR (*t2_event_s)(const char*,const char*); +extern T2ERROR (*t2_event_d)(const char*,int); + diff --git a/ci/mocks/control/comcastIrKeyCodes.h b/ci/mocks/control/comcastIrKeyCodes.h new file mode 100644 index 00000000..123661fa --- /dev/null +++ b/ci/mocks/control/comcastIrKeyCodes.h @@ -0,0 +1,49 @@ +/* + * Stub for comcastIrKeyCodes.h + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _COMCAST_IR_KEY_CODES_H_ +#define _COMCAST_IR_KEY_CODES_H_ + +/* Key event types */ +#define KET_KEYDOWN 0x00000008 +#define KET_KEYUP 0x00000100 +#define KET_KEYREPEAT 0x00000200 + +/* Key codes */ +#define KED_POWER 0x00000001 +#define KED_TVPOWER 0x00000002 +#define KED_RF_POWER 0x00000003 +#define KED_DISCRETE_POWER_ON 0x00000004 +#define KED_DISCRETE_POWER_STANDBY 0x00000005 +#define KED_VOLUMEUP 0x00000010 +#define KED_VOLUMEDOWN 0x00000011 +#define KED_MUTE 0x00000012 +#define KED_INPUTKEY 0x00000013 +#define KED_SETUP 0x00000020 +#define KED_PUSH_TO_TALK 0x00000030 +#define KED_RF_PAIR_GHOST 0x00000040 +#define KED_SCREEN_BIND_NOTIFY 0x00000050 +#define KED_XR2V3 0x00000060 +#define KED_XR5V2 0x00000061 +#define KED_XR11V1 0x00000062 +#define KED_XR11V2 0x00000063 +#define KED_XR11_NOTIFY 0x00000064 +#define KED_XR15V1_NOTIFY 0x00000065 +#define KED_XR16V1_NOTIFY 0x00000066 +#define KED_UNDEFINEDKEY 0x000000FF + +/* XMP tags */ +#define XMP_TAG_COMCAST 0x0001 +#define XMP_TAG_PLATCO 0x0002 +#define XMP_TAG_XR11V2 0x0003 +#define XMP_TAG_XR15V1 0x0004 +#define XMP_TAG_XR15V2 0x0005 +#define XMP_TAG_XR16V1 0x0006 +#define XMP_TAG_XRAV1 0x0007 +#define XMP_TAG_XR20V1 0x0008 +#define XMP_TAG_UNDEFINED 0x00FF + +#endif /* _COMCAST_IR_KEY_CODES_H_ */ diff --git a/ci/mocks/control/irMgr.h b/ci/mocks/control/irMgr.h new file mode 100644 index 00000000..f1fe0313 --- /dev/null +++ b/ci/mocks/control/irMgr.h @@ -0,0 +1,42 @@ +/* + * Stub for irMgr.h - IR Manager types + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _IR_MGR_H_ +#define _IR_MGR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define IARM_BUS_IRMGR_NAME "IRMgr" + +typedef enum { + IARM_BUS_IRMGR_EVENT_IRKEY = 0, + IARM_BUS_IRMGR_EVENT_CONTROL = 1, + IARM_BUS_IRMGR_EVENT_MAX = 2 +} IARM_Bus_IRMgr_EventId_t; + +#define IARM_BUS_IRMGR_KEYSRC_IR 0 +#define IARM_BUS_IRMGR_KEYSRC_FP 1 +#define IARM_BUS_IRMGR_KEYSRC_RF 2 + +typedef struct { + union { + struct { + int keyType; + int keyCode; + int keySrc; + int keyTag; + int keySourceId; + } irkey; + } data; +} IARM_Bus_IRMgr_EventData_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _IR_MGR_H_ */ diff --git a/ci/mocks/control/rdkversion.h b/ci/mocks/control/rdkversion.h new file mode 100644 index 00000000..3527916c --- /dev/null +++ b/ci/mocks/control/rdkversion.h @@ -0,0 +1,33 @@ +/* + * Stub for rdkversion.h + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _RDKVERSION_H_ +#define _RDKVERSION_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + char *image_name; + char *stb_name; + char *branch_name; + char *version_name; + char *image_build_time; + bool production_build; + char *parse_error; +} rdk_version_info_t; + +int rdk_version_parse_version(rdk_version_info_t *info); +void rdk_version_object_free(rdk_version_info_t *info); + +#ifdef __cplusplus +} +#endif + +#endif /* _RDKVERSION_H_ */ diff --git a/ci/mocks/control/rdkx_logger.h b/ci/mocks/control/rdkx_logger.h new file mode 100644 index 00000000..984f663b --- /dev/null +++ b/ci/mocks/control/rdkx_logger.h @@ -0,0 +1,204 @@ +/* + * If not stated otherwise in this file or this component's license file the + * following copyright and licenses apply: + * + * Copyright 2024 RDK Management + * + * 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 _RDKX_LOGGER_H_ +#define _RDKX_LOGGER_H_ + +#ifdef __cplusplus +#include +#include +#include +/* The real rdkx_logger.h pulls in std:: namespace indirectly; replicate only the needed names here */ +// ctrlm expects these to be in the global namespace, so we need to pull them in here +using std::get; +using std::map; +using std::string; +using std::tuple; +#endif + +/* Log option flags */ +#define XLOG_OPTS_DATE (1 << 0) +#define XLOG_OPTS_TIME (1 << 1) +#define XLOG_OPTS_LF (1 << 2) +#define XLOG_OPTS_MOD_NAME (1 << 3) +#define XLOG_OPTS_LEVEL (1 << 4) +#define XLOG_OPTS_COLOR (1 << 5) + +/* Module IDs */ +#define XLOG_MODULE_ID_CTRLM 0 +#define XLOG_MODULE_ID_VSDK 1 +#define XLOG_MODULE_ID_XRAUDIO 2 + +#ifndef XLOG_MODULE_ID +#define XLOG_MODULE_ID XLOG_MODULE_ID_CTRLM +#endif + +/* Stub types and functions used by xlog_fprintf */ +#ifndef XLOG_OPTS_DEFAULT +#define XLOG_OPTS_DEFAULT 0 +#endif + +#ifndef XLOG_COLOR_NONE +#define XLOG_COLOR_NONE 0 +#endif + +#ifndef XLOG_COLOR_BLU +#define XLOG_COLOR_BLU 0 +#endif + +#ifndef XLOG_COLOR_GRN +#define XLOG_COLOR_GRN 0 +#endif + +#ifndef XLOG_LINE_NONE +#define XLOG_LINE_NONE 0 +#endif + +typedef int xlog_level_t; + +#ifndef XLOG_LEVEL_DEBUG +#define XLOG_LEVEL_DEBUG 0 +#endif + +#ifndef XLOG_LEVEL_INFO +#define XLOG_LEVEL_INFO 1 +#endif + +#ifndef XLOG_LEVEL_WARN +#define XLOG_LEVEL_WARN 2 +#endif + +#ifndef XLOG_LEVEL_ERROR +#define XLOG_LEVEL_ERROR 3 +#endif + +#ifndef XLOG_LEVEL_FATAL +#define XLOG_LEVEL_FATAL 4 +#endif + +#ifndef XLOG_LEVEL_TELEMETRY +#define XLOG_LEVEL_TELEMETRY 5 +#endif + +#ifndef XLOG_BUF_SIZE_DEFAULT +#define XLOG_BUF_SIZE_DEFAULT 0 +#endif + +typedef struct { + int options; + int color; + const char *function; + int line; + int level; + int id; + int size_max; +} xlog_args_t; + +#ifndef xlog_fprintf +#define xlog_fprintf(args, output, fmt, ...) do { (void)(args); (void)(output); (void)sizeof(fmt); } while(0) +#endif + +#ifndef xlog_printf +#define xlog_printf(args, fmt, ...) do { (void)(args); (void)sizeof(fmt); } while(0) +#endif + +#ifndef xlog_init +#define xlog_init(id, path, options, console, syslog) (0) +#endif + +#ifndef xlog_level_set_all +#define xlog_level_set_all(level) do { (void)(level); } while(0) +#endif + +#ifndef xlog_level_get +#define xlog_level_get(id) (XLOG_LEVEL_INFO) +#endif + +#ifndef xlog_term +#define xlog_term() do { } while(0) +#endif + +/* Logging macros - silently discard in stub builds (avoids -Werror=format-zero-length) */ +#ifndef XLOGD +#define XLOGD(level, opts, color, size, fmt, ...) do { (void)(level); (void)(opts); (void)(color); (void)(size); (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_INFO +#define XLOGD_INFO(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_DEBUG +#define XLOGD_DEBUG(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_ERROR +#define XLOGD_ERROR(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_WARN +#define XLOGD_WARN(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_FATAL +#define XLOGD_FATAL(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_TELEMETRY +#define XLOGD_TELEMETRY(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_INFO_OPTS +#define XLOGD_INFO_OPTS(opts, fmt, ...) do { (void)(opts); (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_NO_LF +#define XLOGD_NO_LF(level, fmt, ...) do { (void)(level); (void)sizeof(fmt); } while(0) +#endif +/* XLOGD_OUTPUT is used as an output-handle VALUE (second arg to xlog_fprintf), not a logging macro */ +#ifndef XLOGD_OUTPUT +#define XLOGD_OUTPUT NULL +#endif + +#ifndef XLOGD_AUTOMATION_INFO +#define XLOGD_AUTOMATION_INFO(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_AUTOMATION_DEBUG +#define XLOGD_AUTOMATION_DEBUG(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_AUTOMATION_ERROR +#define XLOGD_AUTOMATION_ERROR(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_AUTOMATION_WARN +#define XLOGD_AUTOMATION_WARN(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOGD_AUTOMATION_TELEMETRY +#define XLOGD_AUTOMATION_TELEMETRY(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif + +#ifndef XLOG_INFO +#define XLOG_INFO(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOG_DEBUG +#define XLOG_DEBUG(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOG_ERROR +#define XLOG_ERROR(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOG_WARN +#define XLOG_WARN(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOG_RAW +#define XLOG_RAW(fmt, ...) do { (void)sizeof(fmt); } while(0) +#endif +#ifndef XLOG_FLUSH +#define XLOG_FLUSH() do { } while(0) +#endif + +#endif /* _RDKX_LOGGER_H_ */ diff --git a/ci/mocks/control/xr_fdc.h b/ci/mocks/control/xr_fdc.h new file mode 100644 index 00000000..7af85a31 --- /dev/null +++ b/ci/mocks/control/xr_fdc.h @@ -0,0 +1,23 @@ +/* + * Stub for xr_fdc.h - File Descriptor Check + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _XR_FDC_H_ +#define _XR_FDC_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t xr_fdc_check(uint32_t limit_soft, uint32_t limit_hard, bool log_fds); + +#ifdef __cplusplus +} +#endif + +#endif /* _XR_FDC_H_ */ diff --git a/ci/mocks/control/xr_mq.h b/ci/mocks/control/xr_mq.h new file mode 100644 index 00000000..ece5597c --- /dev/null +++ b/ci/mocks/control/xr_mq.h @@ -0,0 +1,50 @@ +/* + * If not stated otherwise in this file or this component's license file the + * following copyright and licenses apply: + * + * Copyright 2024 RDK Management + * + * 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 _XR_MQ_H_ +#define _XR_MQ_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* xr_mq_t is an integer (OS queue descriptor), not a pointer */ +typedef int xr_mq_t; + +#define XR_MQ_INVALID ((xr_mq_t)-1) + +typedef struct { + uint32_t max_msg; /* field name used by ctrlm source (must be first — matches designated init order) */ + size_t max_msg_size; +} xr_mq_attr_t; + +xr_mq_t xr_mq_create(const xr_mq_attr_t *attr); +void xr_mq_destroy(xr_mq_t mq); +bool xr_mq_push(xr_mq_t mq, const void *msg, size_t msg_size); +bool xr_mq_pop(xr_mq_t mq, void *msg, size_t msg_size); +bool xr_mq_pop_timeout(xr_mq_t mq, void *msg, size_t msg_size, int32_t timeout_ms); + +#ifdef __cplusplus +} +#endif + +#endif /* _XR_MQ_H_ */ diff --git a/ci/mocks/control/xr_timestamp.h b/ci/mocks/control/xr_timestamp.h new file mode 100644 index 00000000..0a185e47 --- /dev/null +++ b/ci/mocks/control/xr_timestamp.h @@ -0,0 +1,44 @@ +/* + * If not stated otherwise in this file or this component's license file the + * following copyright and licenses apply: + * + * Copyright 2024 RDK Management + * + * 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 _XR_TIMESTAMP_H_ +#define _XR_TIMESTAMP_H_ + +#include +#include + +/* Use timespec-compatible layout so ctrlm can assign directly between types. */ +typedef struct timespec rdkx_timestamp_t; + +#ifdef __cplusplus +extern "C" { +#endif + +void rdkx_timestamp_get(rdkx_timestamp_t *timestamp); +void rdkx_timestamp_get_realtime(rdkx_timestamp_t *timestamp); +double rdkx_timestamp_subtract(const rdkx_timestamp_t *a, const rdkx_timestamp_t *b); +signed long long rdkx_timestamp_subtract_us(rdkx_timestamp_t a, rdkx_timestamp_t b); +signed long long rdkx_timestamp_subtract_ms(rdkx_timestamp_t a, rdkx_timestamp_t b); +void rdkx_timestamp_add_ms(rdkx_timestamp_t *timestamp, unsigned long milliseconds); +int rdkx_timestamp_cmp(const rdkx_timestamp_t *a, const rdkx_timestamp_t *b); + +#ifdef __cplusplus +} +#endif + +#endif /* _XR_TIMESTAMP_H_ */ diff --git a/ci/mocks/control/xr_voice_sdk.h b/ci/mocks/control/xr_voice_sdk.h new file mode 100644 index 00000000..f4a385e5 --- /dev/null +++ b/ci/mocks/control/xr_voice_sdk.h @@ -0,0 +1,42 @@ +/* + * Stub for xr_voice_sdk.h + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _XR_VOICE_SDK_H_ +#define _XR_VOICE_SDK_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* xr_voice_sdk API */ +int xr_voice_sdk_init(void); +int xr_voice_sdk_term(void); + +/* vsdk API used by ctrlm-main */ +#define VSDK_VERSION_QTY_MAX (16) + +typedef struct { + const char *name; + const char *version; + const char *branch; + const char *commit_id; +} vsdk_version_info_t; + +typedef void (*vsdk_thread_poll_response_t)(void *data); + +void vsdk_version(vsdk_version_info_t *info, uint32_t *qty); +bool vsdk_init(bool console, const char *filename, uint32_t file_size_max); +void vsdk_term(void); +void vsdk_thread_poll(vsdk_thread_poll_response_t response, void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* _XR_VOICE_SDK_H_ */ diff --git a/ci/mocks/control/xraudio.h b/ci/mocks/control/xraudio.h new file mode 100644 index 00000000..f28f5c25 --- /dev/null +++ b/ci/mocks/control/xraudio.h @@ -0,0 +1,47 @@ +/* + * Stub for xraudio.h - Audio types + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _XRAUDIO_H_ +#define _XRAUDIO_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XRAUDIO_ENCODING_PCM = 0, + XRAUDIO_ENCODING_ADPCM = 1, + XRAUDIO_ENCODING_OPUS = 2, + XRAUDIO_ENCODING_INVALID = 3 +} xraudio_encoding_t; + +typedef struct { + xraudio_encoding_t type; +} xraudio_encoding_info_t; + +typedef struct { + xraudio_encoding_info_t encoding; + uint16_t sample_rate; + uint8_t sample_size; + uint8_t channel_qty; +} xraudio_output_format_t; + +typedef enum { + XRAUDIO_RESULT_OK = 0, + XRAUDIO_RESULT_ERROR = 1 +} xraudio_result_t; + +int32_t xraudio_container_header_parse_wave(int audio_fd, const uint8_t *header, size_t size, xraudio_output_format_t *format, uint32_t *data_length); + +#ifdef __cplusplus +} +#endif + +#endif /* _XRAUDIO_H_ */ diff --git a/ci/mocks/control/xrsr.h b/ci/mocks/control/xrsr.h new file mode 100644 index 00000000..5fa7a34a --- /dev/null +++ b/ci/mocks/control/xrsr.h @@ -0,0 +1,357 @@ +/* + * If not stated otherwise in this file or this component's license file the + * following copyright and licenses apply: + * + * Copyright 2024 RDK Management + * + * 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 _XRSR_H_ +#define _XRSR_H_ + +#include +#include +#include +#include +#include "xr_timestamp.h" + +/* Minimal opaque placeholders to avoid requiring OpenSSL dev headers in mocks. */ +#if defined(__has_include) +#if __has_include() +#include +#endif +#endif + +#ifndef OPENSSL_TYPES_H +typedef struct xrsr_x509_stub X509; +typedef struct xrsr_evp_pkey_stub EVP_PKEY; +typedef struct stack_st_X509 X509_STACK; +#endif +#ifndef STACK_OF +#define STACK_OF(type) struct stack_st_##type +#endif +#ifdef __cplusplus +extern "C" { +#endif + +#define XRSR_SAT_TOKEN_LEN_MAX (2048) +#define XRSR_QUERY_STRING_QTY_MAX (16) +#define XRSR_SESSION_BY_TEXT_MAX (256) +#define XRSR_DST_PARAM_LEN_MAX (256) +#define XRSR_USER_AGENT_LEN_MAX (512) +#define XRSR_DST_QTY_MAX (4) + +/* Source types */ +typedef enum { + XRSR_SRC_RCU_PTT = 0, + XRSR_SRC_RCU_FF = 1, + XRSR_SRC_MICROPHONE = 2, + XRSR_SRC_MICROPHONE_TAP = 3, + XRSR_SRC_INVALID = 4 +} xrsr_src_t; + +/* Audio format values used in ctrlm. */ +enum { + XRSR_AUDIO_FORMAT_NONE = 0, + XRSR_AUDIO_FORMAT_PCM = (1 << 0), + XRSR_AUDIO_FORMAT_PCM_32_BIT = (1 << 1), + XRSR_AUDIO_FORMAT_PCM_32_BIT_MULTI = (1 << 2), + XRSR_AUDIO_FORMAT_PCM_RAW = (1 << 3), + XRSR_AUDIO_FORMAT_ADPCM = (1 << 4), + XRSR_AUDIO_FORMAT_ADPCM_FRAME = (1 << 5), + XRSR_AUDIO_FORMAT_OPUS = (1 << 6), + XRSR_AUDIO_FORMAT_OPUS_XVP = (1 << 7), + XRSR_AUDIO_FORMAT_MAX = (1 << 8) +}; + +typedef struct { + uint32_t size_packet; + uint32_t size_header; + uint32_t offset_step_size_index; + uint32_t offset_predicted_sample_lsb; + uint32_t offset_predicted_sample_msb; + uint32_t offset_sequence_value; + uint32_t shift_sequence_value; + uint32_t sequence_value_min; + uint32_t sequence_value_max; +} xrsr_audio_format_adpcm_frame_t; + +typedef struct { + int type; + union { + xrsr_audio_format_adpcm_frame_t adpcm_frame; + } value; +} xrsr_audio_format_t; + +typedef enum { + XRSR_SESSION_END_REASON_EOS = 0, + XRSR_SESSION_END_REASON_TERMINATE = 1, + XRSR_SESSION_END_REASON_EOT = 2, + XRSR_SESSION_END_REASON_DISCONNECT_REMOTE = 3, + XRSR_SESSION_END_REASON_ERROR_AUDIO_BEGIN = 4, + XRSR_SESSION_END_REASON_ERROR_AUDIO_DURATION = 5, + XRSR_SESSION_END_REASON_INVALID = 6 +} xrsr_session_end_reason_t; + +typedef enum { + XRSR_STREAM_FROM_BEGINNING = 0, + XRSR_STREAM_FROM_KEYWORD = 1, + XRSR_STREAM_FROM_KEYWORD_BEGIN = 2, + XRSR_STREAM_FROM_LIVE = 3, + XRSR_STREAM_FROM_INVALID = 4 +} xrsr_stream_from_t; + +typedef enum { + XRSR_STREAM_UNTIL_END_OF_STREAM = 0, + XRSR_STREAM_UNTIL_END_OF_SPEECH = 1, + XRSR_STREAM_UNTIL_END_OF_KEYWORD = 2, + XRSR_STREAM_UNTIL_INVALID = 3 +} xrsr_stream_until_t; + +typedef enum { + XRSR_POWER_MODE_FULL = 0, + XRSR_POWER_MODE_LOW = 1, + XRSR_POWER_MODE_SLEEP = 2, + XRSR_POWER_MODE_QTY = 3 +} xrsr_power_mode_t; + +typedef enum { + XRSR_KWD_RESULT_DETECTED = 0, + XRSR_KWD_RESULT_NOT_DETECTED = 1, + XRSR_KWD_RESULT_INVALID = 2 +} xrsr_keyword_detector_result_t; + +typedef enum { + XRSR_CERT_TYPE_P12 = 0, + XRSR_CERT_TYPE_X509 = 1, + XRSR_CERT_TYPE_PEM = 2 +} xrsr_cert_type_t; + +typedef struct { + xrsr_cert_type_t type; + union { + struct { + const char *filename; + const char *passphrase; + } p12; + struct { + X509 *x509; + EVP_PKEY *pkey; + STACK_OF(X509) *chain; + } x509; + struct { + const char *filename_cert; + const char *filename_pkey; + const char *filename_chain; + const char *passphrase; + } pem; + } cert; +} xrsr_cert_t; + +typedef struct { + uint32_t connect_check_interval; + uint32_t timeout_connect; + uint32_t timeout_inactivity; + uint32_t timeout_session; + bool ipv4_fallback; + uint32_t backoff_delay; +} xrsr_dst_params_t; + +typedef struct xrsr_session_config_in_t xrsr_session_config_in_t; +typedef struct xrsr_session_config_out_t xrsr_session_config_out_t; +typedef struct xrsr_session_config_update_t xrsr_session_config_update_t; + +typedef void (*xrsr_session_config_cb_t)(const uuid_t uuid, xrsr_session_config_in_t *config_in); +typedef xrsr_session_config_cb_t xrsr_callback_session_config_t; +typedef bool (*xrsr_handler_send_t)(const void *data, size_t size, void *user_data); +typedef void (*xrsr_session_audio_cb_t)(int bytes_sent, void *user_data); + +typedef struct { + bool valid; + uint32_t packets_processed; + uint32_t packets_lost; + uint32_t samples_processed; + uint32_t samples_lost; + uint32_t decoder_failures; + uint32_t samples_buffered_max; + double snr_peak; + double snr_mean; +} xrsr_audio_stats_t; + +typedef struct { + bool result; + int stream_end_reason; + xrsr_audio_stats_t audio_stats; +} xrsr_stream_stats_t; + +typedef struct { + xrsr_session_end_reason_t session_end_reason; + int ret_code_protocol; + int ret_code_library; + int ret_code_internal; + const char *server_ip; + int time_dns; + int time_connect; + int stream_end_reason; + xrsr_stream_stats_t stream_stats; +} xrsr_session_stats_t; + +typedef struct xrsr_handlers_t { + void (*session_begin)(void *data, const uuid_t uuid, xrsr_src_t src, uint32_t dst_index, xrsr_keyword_detector_result_t *detector_result, xrsr_session_config_out_t *config_out, xrsr_session_config_in_t *config_in, rdkx_timestamp_t *timestamp, const char *transcription_in); + void (*session_config)(void *data, const uuid_t uuid, xrsr_session_config_update_t *session_config_update, rdkx_timestamp_t *timestamp); + void (*session_end)(void *data, const uuid_t uuid, xrsr_session_stats_t *stats, rdkx_timestamp_t *timestamp); + void (*stream_begin)(void *data, const uuid_t uuid, xrsr_src_t src, rdkx_timestamp_t *timestamp); + void (*stream_kwd)(void *data, const uuid_t uuid, rdkx_timestamp_t *timestamp); + void (*stream_audio)(void *data, const uuid_t uuid, const uint8_t *buffer, size_t size, rdkx_timestamp_t *timestamp); + void (*stream_end)(void *data, const uuid_t uuid, xrsr_stream_stats_t *stats, rdkx_timestamp_t *timestamp); + bool (*connected)(void *data, const uuid_t uuid, xrsr_handler_send_t send, void *param, rdkx_timestamp_t *timestamp, xrsr_session_config_update_t *session_config_update); + void (*disconnected)(void *data, const uuid_t uuid, xrsr_session_end_reason_t reason, bool retry, bool *detect_resume, rdkx_timestamp_t *timestamp); + void (*recv_msg)(void *data, const char *msg, size_t msg_len); + void (*source_error)(void *data, xrsr_src_t src); + void *data; +} xrsr_handlers_t; + +typedef struct { + const char *url; + xrsr_handlers_t handlers; + int formats; + uint32_t stream_time_min; + xrsr_stream_from_t stream_from; + int32_t stream_offset; + xrsr_stream_until_t stream_until; + const xrsr_dst_params_t *params[XRSR_POWER_MODE_QTY]; +} xrsr_dst_t; + +typedef struct { + xrsr_src_t src; + uint32_t dst_qty; + xrsr_dst_t dsts[XRSR_DST_QTY_MAX]; +} xrsr_route_t; + +struct xrsr_session_config_out_t { + bool detect_keyword; + bool has_stream; + bool push_to_talk; + xrsr_stream_from_t stream_from; + xrsr_audio_format_t format; + bool user_initiated; + xrsr_session_config_cb_t cb_session_config; +}; + +struct xrsr_session_config_in_t { + xrsr_src_t src; + struct { + xrsr_cert_t client_cert; + bool host_verify; + bool ocsp_verify_stapling; + bool ocsp_verify_ca; + const char *sat_token; + const char *user_agent; + const char *query_strs[XRSR_QUERY_STRING_QTY_MAX + 1]; + } http; + struct { + xrsr_cert_t client_cert; + const char *sat_token; + bool host_verify; + bool ocsp_verify_stapling; + bool ocsp_verify_ca; + bool cert_expired_allow; + bool cert_revoked_allow; + bool ocsp_expired_allow; + uint32_t keyword_begin; + uint32_t keyword_duration; + void *app_config; + } ws; +}; + +struct xrsr_session_config_update_t { + int dummy; +}; + +typedef struct { + bool delete_files; + bool enable; + bool use_curtail; + uint32_t file_qty_max; + uint32_t file_size_max; + const char *dir_path; +} xrsr_capture_config_t; + +typedef enum { + XRSR_AUDIO_CONTAINER_NONE = 0, + XRSR_AUDIO_CONTAINER_WAV = 1 +} xrsr_audio_container_t; + +typedef enum { + XRSR_SESSION_REQUEST_TYPE_INVALID = 0, + XRSR_SESSION_REQUEST_TYPE_TEXT = 1, + XRSR_SESSION_REQUEST_TYPE_AUDIO_FILE = 2, + XRSR_SESSION_REQUEST_TYPE_AUDIO_MIC = 3, + XRSR_SESSION_REQUEST_TYPE_AUDIO_FD = 4 +} xrsr_session_request_type_t; + +typedef struct { + xrsr_session_request_type_t type; + union { + struct { + const char *text; + } text; + struct { + const char *path; + } audio_file; + struct { + bool stream_params_required; + } audio_mic; + struct { + int audio_fd; + xrsr_audio_format_t audio_format; + xrsr_session_audio_cb_t callback; + void *user_data; + } audio_fd; + } value; +} xrsr_session_request_t; + +typedef struct { + const char *vsdk_config; + const char *host_name; + bool networked_standby; + bool local_mic; + bool local_mic_tap; + int dummy; +} xrsr_config_t; + +bool xrsr_open(const char *host_name, xrsr_route_t *routes, const xrsr_handlers_t *handlers, const xrsr_capture_config_t *capture_config, xrsr_power_mode_t power_mode, bool privacy, bool mask_pii, void *json_obj_vsdk); +void xrsr_close(void); +bool xrsr_route(xrsr_route_t *routes); +void xrsr_session_terminate(xrsr_src_t src); +bool xrsr_config_get(xrsr_config_t *config); +bool xrsr_power_mode_set(xrsr_power_mode_t power_mode); +bool xrsr_privacy_mode_set(bool enable); +bool xrsr_privacy_mode_get(bool *enable); +void xrsr_mask_pii_set(bool enable); +bool xrsr_session_request(xrsr_src_t src, xrsr_audio_format_t format, xrsr_session_request_t request, const uuid_t *uuid, bool low_latency, bool low_cpu_util); +bool xrsr_session_audio_fd_set(xrsr_src_t src, int audio_fd, xrsr_audio_format_t format, xrsr_session_audio_cb_t callback, void *user_data); +void xrsr_session_audio_stream_start(xrsr_src_t src); +void xrsr_session_keyword_info_set(xrsr_src_t src, uint32_t pre_keyword_sample_qty, uint32_t keyword_sample_qty); +bool xrsr_session_capture_start(xrsr_audio_container_t container, const char *file_path, bool raw_mic_enable); +bool xrsr_session_capture_stop(void); +bool xrsr_capture_config_set(const xrsr_capture_config_t *capture_config); +const char *xrsr_audio_container_str(xrsr_audio_container_t container); +const char *xrsr_src_str(xrsr_src_t src); +const char *xrsr_session_end_reason_str(xrsr_session_end_reason_t reason); + +#ifdef __cplusplus +} +#endif + +#endif /* _XRSR_H_ */ diff --git a/ci/mocks/control/xrsv_http.h b/ci/mocks/control/xrsv_http.h new file mode 100644 index 00000000..3a4fbee8 --- /dev/null +++ b/ci/mocks/control/xrsv_http.h @@ -0,0 +1,57 @@ +/* + * Stub for xrsv_http.h - Voice HTTP endpoint types + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _XRSV_HTTP_H_ +#define _XRSV_HTTP_H_ + +#include "xrsr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *xrsv_http_object_t; + +typedef struct { + const char *device_id; + const char *partner_id; + const char *experience; + const char *app_id; + const char *language; + bool test_flag; + bool mask_pii; + void *user_data; +} xrsv_http_params_t; + +typedef struct { + const char *transcription; + long return_code; +} xrsv_http_recv_msg_t; + +typedef struct { + void (*session_begin)(const uuid_t uuid, xrsr_src_t src, uint32_t dst_index, xrsr_session_config_out_t *configuration, rdkx_timestamp_t *timestamp, void *user_data); + void (*session_end)(const uuid_t uuid, xrsr_session_stats_t *stats, rdkx_timestamp_t *timestamp, void *user_data); + void (*stream_begin)(const uuid_t uuid, xrsr_src_t src, rdkx_timestamp_t *timestamp, void *user_data); + void (*stream_end)(const uuid_t uuid, xrsr_stream_stats_t *stats, rdkx_timestamp_t *timestamp, void *user_data); + void (*connected)(const uuid_t uuid, rdkx_timestamp_t *timestamp, void *user_data); + void (*disconnected)(const uuid_t uuid, rdkx_timestamp_t *timestamp, void *user_data); + void (*recv_msg)(xrsv_http_recv_msg_t *msg, void *user_data); +} xrsv_http_handlers_t; + +xrsv_http_object_t xrsv_http_create(const xrsv_http_params_t *params); +void xrsv_http_destroy(xrsv_http_object_t obj); +bool xrsv_http_handlers(xrsv_http_object_t obj, const xrsv_http_handlers_t *handlers, xrsr_handlers_t *handlers_out); +void xrsv_http_update_device_id(xrsv_http_object_t obj, const char *device_id); +void xrsv_http_update_partner_id(xrsv_http_object_t obj, const char *partner_id); +void xrsv_http_update_experience(xrsv_http_object_t obj, const char *experience); +void xrsv_http_update_language(xrsv_http_object_t obj, const char *language); +void xrsv_http_update_mask_pii(xrsv_http_object_t obj, bool enable); + +#ifdef __cplusplus +} +#endif + +#endif /* _XRSV_HTTP_H_ */ diff --git a/ci/mocks/control/xrsv_ws_nextgen.h b/ci/mocks/control/xrsv_ws_nextgen.h new file mode 100644 index 00000000..9861e9cd --- /dev/null +++ b/ci/mocks/control/xrsv_ws_nextgen.h @@ -0,0 +1,98 @@ +/* + * Stub for xrsv_ws_nextgen.h - Voice WebSocket NextGen endpoint types + * + * Copyright 2024 RDK Management + * Licensed under the Apache License, Version 2.0 + */ +#ifndef _XRSV_WS_NEXTGEN_H_ +#define _XRSV_WS_NEXTGEN_H_ + +#include "xrsr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *xrsv_ws_nextgen_object_t; + +typedef enum { + XRSV_WS_NEXTGEN_DEVICE_TYPE_STB = 0, + XRSV_WS_NEXTGEN_DEVICE_TYPE_TV = 1 +} xrsv_ws_nextgen_device_type_t; + +typedef struct { + const char *device_id; + const char *account_id; + const char *partner_id; + const char *experience; + const char *audio_profile; + const char *audio_model; + const char *language; + const char *device_mac; + const char *rf_protocol; + bool test_flag; + bool bypass_wuw_verify_success; + bool bypass_wuw_verify_failure; + bool mask_pii; + void *user_data; +} xrsv_ws_nextgen_params_t; + +typedef struct { + uint32_t keyword_sample_begin; + uint32_t keyword_sample_end; + uint32_t keyword_doa; + float keyword_sensitivity; + bool keyword_sensitivity_triggered; + float keyword_sensitivity_high; + bool keyword_sensitivity_high_support; + bool keyword_sensitivity_high_triggered; + float dynamic_gain; + float linear_confidence; + float nonlinear_confidence; + float signal_noise_ratio; + bool push_to_talk; + uint32_t par_eos_timeout; +} xrsv_ws_nextgen_stream_params_t; + +typedef struct { + void (*session_begin)(const uuid_t uuid, xrsr_src_t src, uint32_t dst_index, xrsr_session_config_out_t *configuration, xrsv_ws_nextgen_stream_params_t *stream_params, rdkx_timestamp_t *timestamp, void *user_data); + void (*session_end)(const uuid_t uuid, xrsr_session_stats_t *stats, rdkx_timestamp_t *timestamp, void *user_data); + void (*stream_begin)(const uuid_t uuid, xrsr_src_t src, rdkx_timestamp_t *timestamp, void *user_data); + void (*stream_kwd)(const uuid_t uuid, rdkx_timestamp_t *timestamp, void *user_data); + void (*stream_end)(const uuid_t uuid, xrsr_stream_stats_t *stats, rdkx_timestamp_t *timestamp, void *user_data); + void (*connected)(const uuid_t uuid, rdkx_timestamp_t *timestamp, void *user_data); + void (*disconnected)(const uuid_t uuid, bool retry, rdkx_timestamp_t *timestamp, void *user_data); + void (*sent_init)(const uuid_t uuid, rdkx_timestamp_t *timestamp, void *user_data); + void (*listening)(void *user_data); + void (*asr)(const char *str_transcription, bool final, void *user_data); + void (*conn_close)(const char *reason, long ret_code, void *user_data); + void (*response_vrex)(long ret_code, void *user_data); + void (*wuw_verification)(const uuid_t uuid, bool passed, long confidence, void *user_data); + void (*source_error)(xrsr_src_t src, void *user_data); + void (*tv_mute)(bool mute, void *user_data); + void (*tv_power)(bool power, bool toggle, void *user_data); + void (*tv_volume)(bool up, uint32_t repeat_count, void *user_data); + void (*msg)(const char *msg, unsigned long length, void *user_data); +} xrsv_ws_nextgen_handlers_t; + +xrsv_ws_nextgen_object_t xrsv_ws_nextgen_create(const xrsv_ws_nextgen_params_t *params); +void xrsv_ws_nextgen_destroy(xrsv_ws_nextgen_object_t obj); +bool xrsv_ws_nextgen_handlers(xrsv_ws_nextgen_object_t obj, const xrsv_ws_nextgen_handlers_t *handlers, xrsr_handlers_t *handlers_out); +bool xrsv_ws_nextgen_update_init_app(xrsv_ws_nextgen_object_t obj, const char *init_app); +bool xrsv_ws_nextgen_send_msg(xrsv_ws_nextgen_object_t obj, const char *msg); +void xrsv_ws_nextgen_update_account_id(xrsv_ws_nextgen_object_t obj, const char *account_id); +void xrsv_ws_nextgen_update_device_id(xrsv_ws_nextgen_object_t obj, const char *device_id); +void xrsv_ws_nextgen_update_device_type(xrsv_ws_nextgen_object_t obj, xrsv_ws_nextgen_device_type_t type); +void xrsv_ws_nextgen_update_partner_id(xrsv_ws_nextgen_object_t obj, const char *partner_id); +void xrsv_ws_nextgen_update_experience(xrsv_ws_nextgen_object_t obj, const char *experience); +void xrsv_ws_nextgen_update_language(xrsv_ws_nextgen_object_t obj, const char *language); +void xrsv_ws_nextgen_update_mask_pii(xrsv_ws_nextgen_object_t obj, bool enable); +void xrsv_ws_nextgen_update_audio_profile(xrsv_ws_nextgen_object_t obj, const char *profile); +void xrsv_ws_nextgen_update_audio_model(xrsv_ws_nextgen_object_t obj, const char *model); +void xrsv_ws_nextgen_update_audio_rf_protocol(xrsv_ws_nextgen_object_t obj, const char *rf_protocol); + +#ifdef __cplusplus +} +#endif + +#endif /* _XRSV_WS_NEXTGEN_H_ */ diff --git a/ci/mocks/devicesettings.h b/ci/mocks/devicesettings.h new file mode 100644 index 00000000..28927b64 --- /dev/null +++ b/ci/mocks/devicesettings.h @@ -0,0 +1,2297 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +* +**/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +/* +* Copyright (c) 2007 Dave Airlie +* Copyright (c) 2007 Jakob Bornecrantz +* Copyright (c) 2008 Red Hat Inc. +* Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA +* Copyright (c) 2007-2008 Intel Corporation +* Licensed under the MIT License +*/ +#define DRM_DISPLAY_MODE_LEN 32 +#define DRM_PROP_NAME_LEN 32 + +#define DRM_MODE_PROP_RANGE (1<<1) +#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ +#define DRM_MODE_PROP_BLOB (1<<4) +#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ + +#define DRM_MODE_PROP_LEGACY_TYPE ( \ + DRM_MODE_PROP_RANGE | \ + DRM_MODE_PROP_ENUM | \ + DRM_MODE_PROP_BLOB | \ + DRM_MODE_PROP_BITMASK) + +#define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0 + +typedef unsigned int drm_context_t; +typedef unsigned int drm_magic_t; +typedef unsigned int drm_handle_t; +typedef unsigned int drm_drawable_t; + + +#include +#include +#include +#include + +typedef enum _dsAudioPortType_t { + dsAUDIOPORT_TYPE_ID_LR, /**< RCA audio output. */ + dsAUDIOPORT_TYPE_HDMI, /**< HDMI audio output. */ + dsAUDIOPORT_TYPE_SPDIF, /**< S/PDIF audio output. */ + dsAUDIOPORT_TYPE_SPEAKER, /**< SPEAKER audio output. */ + dsAUDIOPORT_TYPE_HDMI_ARC, /** < HDMI ARC/EARC audio output. */ + dsAUDIOPORT_TYPE_HEADPHONE, /**< 3.5mm headphone jack. */ + dsAUDIOPORT_TYPE_MAX /**< Maximum index for audio port type. */ +} dsAudioPortType_t; + +typedef enum _dsAudioDuckingAction_t { + dsAUDIO_DUCKINGACTION_START = 0, + dsAUDIO_DUCKINGACTION_STOP = 1 +} dsAudioDuckingAction_t; + +typedef enum _dsAudioDuckingType_t { + dsAUDIO_DUCKINGTYPE_ABSOLUTE = 0, + dsAUDIO_DUCKINGTYPE_RELATIVE = 1 +} dsAudioDuckingType_t; + +typedef enum _dsVideoPortType_t { + dsVIDEOPORT_TYPE_RF = 0, ///< RF modulator (channel 3/4) video output + dsVIDEOPORT_TYPE_BB, ///< Baseband (composite, RCA) video output + dsVIDEOPORT_TYPE_SVIDEO, ///< S-Video video output + dsVIDEOPORT_TYPE_1394, ///< IEEE 1394 (Firewire) video output + dsVIDEOPORT_TYPE_DVI, ///< DVI (Panel-Link, HDCP) video output + dsVIDEOPORT_TYPE_COMPONENT, ///< Component video output + dsVIDEOPORT_TYPE_HDMI, ///< HDMI video output + dsVIDEOPORT_TYPE_HDMI_INPUT, ///< HDMI video input + dsVIDEOPORT_TYPE_INTERNAL, ///< Internal (integrated/internal display) video output + dsVIDEOPORT_TYPE_MAX ///< Out of range +} dsVideoPortType_t; + +typedef enum _dsAudioFormat_t { + dsAUDIO_FORMAT_NONE, + dsAUDIO_FORMAT_PCM, + dsAUDIO_FORMAT_DOLBY_AC3, + dsAUDIO_FORMAT_DOLBY_EAC3, + dsAUDIO_FORMAT_DOLBY_AC4, + dsAUDIO_FORMAT_DOLBY_MAT, + dsAUDIO_FORMAT_DOLBY_TRUEHD, + dsAUDIO_FORMAT_DOLBY_EAC3_ATMOS, + dsAUDIO_FORMAT_DOLBY_TRUEHD_ATMOS, + dsAUDIO_FORMAT_DOLBY_MAT_ATMOS, + dsAUDIO_FORMAT_DOLBY_AC4_ATMOS, + dsAUDIO_FORMAT_AAC, + dsAUDIO_FORMAT_VORBIS, + dsAUDIO_FORMAT_WMA, + dsAUDIO_FORMAT_UNKNOWN, + dsAUDIO_FORMAT_MAX /**< Maximum . */ +} dsAudioFormat_t; + +typedef enum _dsAudioCapabilities_t { + dsAUDIOSUPPORT_NONE = 0x0, + dsAUDIOSUPPORT_ATMOS = 0x01, + dsAUDIOSUPPORT_DD = 0x02, + dsAUDIOSUPPORT_DDPLUS = 0x04, + dsAUDIOSUPPORT_DAD = 0x08, + dsAUDIOSUPPORT_DAPv2 = 0x10, + dsAUDIOSUPPORT_MS12 = 0x20, + dsAUDIOSUPPORT_MS12V2 = 0x40, + dsAUDIOSUPPORT_Invalid = 0x80, +} dsAudioCapabilities_t; + +typedef enum _dsAudioARCTypes_t { + dsAUDIOARCSUPPORT_NONE = 0x0, + dsAUDIOARCSUPPORT_ARC = 0x01, + dsAUDIOARCSUPPORT_eARC = 0x02, +} dsAudioARCTypes_t; + +typedef enum _dsMS12Capabilities_t { + dsMS12SUPPORT_NONE = 0x0, + dsMS12SUPPORT_DolbyVolume = 0x01, + dsMS12SUPPORT_InteligentEqualizer = 0x02, + dsMS12SUPPORT_DialogueEnhancer = 0x04, + dsMS12SUPPORT_Invalid = 0x80, +} dsMS12Capabilities_t; + +typedef struct _dsVolumeLeveller_t { + int mode; // 0 = off, 1= on, 2= auto + int level; +} dsVolumeLeveller_t; + +typedef struct _dsSurroundVirtualizer_t { + int mode; // 0 = off, 1= on, 2= auto + int boost; +} dsSurroundVirtualizer_t; + +typedef enum StereoMode { + dsAUDIO_STEREO_UNKNOWN, /**< Unknown mode. */ + dsAUDIO_STEREO_MONO = 1, /**< Mono mode. */ + dsAUDIO_STEREO_STEREO, /**< Normal stereo mode (L+R). */ + dsAUDIO_STEREO_SURROUND, /**< Surround mode. */ + dsAUDIO_STEREO_PASSTHRU, /**< Passthrough mode. */ + dsAUDIO_STEREO_DD, /**< Dolby Digital. */ + dsAUDIO_STEREO_DDPLUS, /**< Dolby Digital Plus. */ + dsAUDIO_STEREO_MAX /**< Maximum index for audio stereo types. */ +} dsAudioStereoMode_t; + +typedef enum _dsATMOSCapability_t { + dsAUDIO_ATMOS_NOTSUPPORTED = 0, /**< ATMOS audio not supported */ + dsAUDIO_ATMOS_DDPLUSSTREAM, /**< can handle dd plus stream which is only way to pass ATMOS metadata */ + dsAUDIO_ATMOS_ATMOSMETADATA, /**< capable of parsing ATMOS metadata */ +} dsATMOSCapability_t; + +typedef enum _dsAudioInput_t +{ + dsAUDIO_INPUT_PRIMARY = 0, /**< Primary Audio Input is main audio input provided to audio mixer */ + dsAUDIO_INPUT_SYSTEM, /**< System Audio Input to audio mixer , e.g Beep Sounds */ + dsAUDIO_INPUT_MAX /**< Out of range */ +} dsAudioInput_t; + +typedef enum _dsHdcpProtocolVersion_t { + dsHDCP_VERSION_1X = 0, /**< HDCP Protocol version 1.x */ + dsHDCP_VERSION_2X, /**< HDCP Protocol version 2.x */ + dsHDCP_VERSION_MAX /**< Maximum index for HDCP protocol. */ +} dsHdcpProtocolVersion_t; + +typedef enum _dsHdcpStatus_t { + dsHDCP_STATUS_UNPOWERED = 0, /**< Connected Sink Device does not support HDCP */ + dsHDCP_STATUS_UNAUTHENTICATED, /**< HDCP Authentication Process is not initiated */ + dsHDCP_STATUS_AUTHENTICATED, /**< HDCP Authentication Process is initiated and Passed */ + dsHDCP_STATUS_AUTHENTICATIONFAILURE, /**< HDCP Authentication Failure or Link Integroty Failure */ + dsHDCP_STATUS_INPROGRESS, /**< HDCP Authentication in Progress */ + dsHDCP_STATUS_PORTDISABLED, /**< HDMI output port disabled */ + dsHDCP_STATUS_MAX /**< Maximum index for HDCP status. */ +} dsHdcpStatus_t; + +typedef enum _dsVideoResolution_t { + dsVIDEO_PIXELRES_720x480, /**< 720x480 Resolution. */ + dsVIDEO_PIXELRES_720x576, /**< 720x576 Resolution. */ + dsVIDEO_PIXELRES_1280x720, /**< 1280x720 Resolution. */ + dsVIDEO_PIXELRES_1920x1080, /**< 1920x1080 Resolution. */ + dsVIDEO_PIXELRES_3840x2160, /**< 3840x2160 Resolution. */ + dsVIDEO_PIXELRES_4096x2160, /**< 3840x2160 Resolution. */ + dsVIDEO_PIXELRES_MAX /**< Maximum index for Video ouptut resolutions. */ +} dsVideoResolution_t; + +// typedef enum _dsTVResolution_t { +// dsTV_RESOLUTION_480i = 0x0001, /**< 480i Resolution. */ +// dsTV_RESOLUTION_480p = 0x0002, /**< 480p Resolution. */ +// dsTV_RESOLUTION_576i = 0x0004, /**< 576p Resolution. */ +// dsTV_RESOLUTION_576p = 0x0008, /**< 576p Resolution. */ +// dsTV_RESOLUTION_720p = 0x0010, /**< 720p Resolution. */ +// dsTV_RESOLUTION_1080i = 0x0020, /**< 1080i Resolution. */ +// dsTV_RESOLUTION_1080p = 0x0040, /**< 1080p Resolution. */ +// dsTV_RESOLUTION_2160p30 = 0x0080, /**< 2160p30 Resolution. */ +// dsTV_RESOLUTION_2160p60 = 0x0100, /**< 2160p60 Resolution. */ +// } dsTVResolution_t; + +typedef enum _dsTVResolution_t { + dsTV_RESOLUTION_480i = 0x0001, + dsTV_RESOLUTION_480p = 0x0002, + dsTV_RESOLUTION_576i = 0x0004, + dsTV_RESOLUTION_576p = 0x0008, + dsTV_RESOLUTION_576p50 = 0x0010, + dsTV_RESOLUTION_720p = 0x0020, + dsTV_RESOLUTION_720p50 = 0x0040, + dsTV_RESOLUTION_1080i = 0x0080, + dsTV_RESOLUTION_1080p = 0x0100, + dsTV_RESOLUTION_1080p24 = 0x0200, + dsTV_RESOLUTION_1080p25 = 0x0400, + dsTV_RESOLUTION_1080i25 = 0x0800, + dsTV_RESOLUTION_1080p30 = 0x1000, + dsTV_RESOLUTION_1080i50 = 0x2000, + dsTV_RESOLUTION_1080p50 = 0x4000, + dsTV_RESOLUTION_1080p60 = 0x8000, + dsTV_RESOLUTION_2160p24 = 0x10000, + dsTV_RESOLUTION_2160p25 = 0x20000, + dsTV_RESOLUTION_2160p30 = 0x40000, + dsTV_RESOLUTION_2160p50 = 0x80000, + dsTV_RESOLUTION_2160p60 = 0x100000, +} dsTVResolution_t; + +typedef enum _dsVideoFrameRate_t { + dsVIDEO_FRAMERATE_UNKNOWN, /**< Unknown frame rate. */ + dsVIDEO_FRAMERATE_24, /**< Played at 24 frames per second. */ + dsVIDEO_FRAMERATE_25, /**< Played at 25 frames per second. */ + dsVIDEO_FRAMERATE_30, /**< Played at 30 frames per second. */ + dsVIDEO_FRAMERATE_60, /**< Played at 60 frames per second. */ + dsVIDEO_FRAMERATE_23dot98, /**< Played at 23.98 frames per second. */ + dsVIDEO_FRAMERATE_29dot97, /**< Played at 29.97 frames per second. */ + dsVIDEO_FRAMERATE_50, /**< Played at 50 frames per second. */ + dsVIDEO_FRAMERATE_59dot94, /**< Played at 59.94 frames per second. */ + dsVIDEO_FRAMERATE_100, /**< Played at 100 frames per second. */ + dsVIDEO_FRAMERATE_119dot88, /**< Played at 119.88 frames per second. */ + dsVIDEO_FRAMERATE_120, /**< Played at 120 frames per second. */ + dsVIDEO_FRAMERATE_200, /**< Played at 200 frames per second. */ + dsVIDEO_FRAMERATE_239dot76, /**< Played at 23.76 frames per second. */ + dsVIDEO_FRAMERATE_240, /**< Played at 240 frames per second. */ + dsVIDEO_FRAMERATE_MAX /**< Maximum index for video frame rates. */ +} dsVideoFrameRate_t; + +typedef enum _dsVideoZoom_t { + dsVIDEO_ZOOM_UNKNOWN = -1, /**< Unknown mode. */ + dsVIDEO_ZOOM_NONE = 0, /**< Decoder format conversion is inactive. */ + dsVIDEO_ZOOM_FULL, /**< Full screen (16:9 video is streched to fit 4:3 frame). */ + dsVIDEO_ZOOM_LB_16_9, /**< 16:9 Letterbox (16:9 video is placed in a 4:3 frame with a full letterbox effect). */ + dsVIDEO_ZOOM_LB_14_9, /**< 14:9 Letterbox (16:9 video is transferred into a 4:3 frame with 14:9 letterbox effect). */ + dsVIDEO_ZOOM_CCO, /**< Center Cut-out (16:9 video is cut to fill 4:3 frame with its center part). */ + dsVIDEO_ZOOM_PAN_SCAN, /**< Pan & Scan (16:9 is cut and panned to fille 4:3 frame, following MPEG pan & scan vectors). */ + dsVIDEO_ZOOM_LB_2_21_1_ON_4_3, /**< 2.21:1 Letterbox on 4:3 (video is transferred into 4:3 frame with a 2.21:1 letterbox effect). */ + dsVIDEO_ZOOM_LB_2_21_1_ON_16_9, /**< 2.21:1 Letterbox on 16:9 (video is transferred into 16:9 frame with a 2.21:1 letterbox effect). */ + dsVIDEO_ZOOM_PLATFORM, /**< Control over the decoder format conversions is managed by the platform. */ + dsVIDEO_ZOOM_16_9_ZOOM, /**< 16:9 Zoom (4:3 video is zoomed to fill 16:9 frame). */ + dsVIDEO_ZOOM_PILLARBOX_4_3, /**< Pillarbox 4:3 (4:3 video is placed in a 16:9 frame with a pillarbox effect) */ + dsVIDEO_ZOOM_WIDE_4_3, /**< Wide 4:3 (4:3 video is stretched to fill 16:9 frame). */ + dsVIDEO_ZOOM_MAX /**< Maximum index for screen zoom modes. */ +} dsVideoZoom_t; + +typedef enum _dsVideoAspectRatio_t { + dsVIDEO_ASPECT_RATIO_4x3, /**< 4:3 aspect ratio. */ + dsVIDEO_ASPECT_RATIO_16x9, /**< 16:9 aspect ratio. */ + dsVIDEO_ASPECT_RATIO_MAX /**< Maximum index for video aspect ratios. */ +} dsVideoAspectRatio_t; + +typedef enum _dsVideoStereoScopicMode_t { + dsVIDEO_SSMODE_UNKNOWN = 0, /**< Unknown mode. */ + dsVIDEO_SSMODE_2D, /**< 2D mode. */ + dsVIDEO_SSMODE_3D_SIDE_BY_SIDE, /**< 3D side by side (L/R) stereo mode. */ + dsVIDEO_SSMODE_3D_TOP_AND_BOTTOM, /**< 3D top & bottom stereo mode. */ + dsVIDEO_SSMODE_MAX /**< Maximum index for video stereoscopic modes. */ +} dsVideoStereoScopicMode_t; + +typedef struct _dsVideoPortResolution_t { + char name[32]; /**< Name the resolution (e.g. 480i, 480p, 1080p24). */ + dsVideoResolution_t pixelResolution; /**< The resolution associated with the name. */ + dsVideoAspectRatio_t aspectRatio; /**< The associated aspect ratio. */ + dsVideoStereoScopicMode_t stereoScopicMode; /**< The associated stereoscopic mode. */ + dsVideoFrameRate_t frameRate; /**< The associated frame rate. */ + bool interlaced; /**< The associated scan mode(@a true if interlaced, @a false if progressive). */ +} dsVideoPortResolution_t; + +typedef enum _dsHDRStandard_t { + dsHDRSTANDARD_NONE = 0x0, + dsHDRSTANDARD_HDR10 = 0x01, + dsHDRSTANDARD_HLG = 0x02, + dsHDRSTANDARD_DolbyVision = 0x04, + dsHDRSTANDARD_TechnicolorPrime = 0x08, + dsHDRSTANDARD_HDR10PLUS = 0x10, + dsHDRSTANDARD_SDR = 0x20, + dsHDRSTANDARD_Invalid = 0x80, +} dsHDRStandard_t; + +typedef enum _dsSURROUNDMode_t { + dsSURROUNDMODE_NONE = 0x0, + dsSURROUNDMODE_DD = 0x1, + dsSURROUNDMODE_DDPLUS = 0x2, +} dsSURROUNDMode_t; + +typedef enum _dsDisplayColorDepth_t { + dsDISPLAY_COLORDEPTH_UNKNOWN = 0x0, /* Unknown color depth */ + dsDISPLAY_COLORDEPTH_8BIT = 0x01, /* 8 bit color depth */ + dsDISPLAY_COLORDEPTH_10BIT = 0x02, /* 10 bit color depth */ + dsDISPLAY_COLORDEPTH_12BIT = 0x04, /* 12 bit color depth */ + dsDISPLAY_COLORDEPTH_AUTO = 0x08 /* Automatic color depth */ +} dsDisplayColorDepth_t; + +typedef enum _dsHdmiInPort_t { + dsHDMI_IN_PORT_NONE = -1, + dsHDMI_IN_PORT_0, + dsHDMI_IN_PORT_1, + dsHDMI_IN_PORT_2, + dsHDMI_IN_PORT_MAX +} dsHdmiInPort_t; + +typedef enum _dsHdmiInSignalStatus_t { + dsHDMI_IN_SIGNAL_STATUS_NONE = -1, + dsHDMI_IN_SIGNAL_STATUS_NOSIGNAL, + dsHDMI_IN_SIGNAL_STATUS_UNSTABLE, + dsHDMI_IN_SIGNAL_STATUS_NOTSUPPORTED, + dsHDMI_IN_SIGNAL_STATUS_STABLE, + dsHDMI_IN_SIGNAL_STATUS_MAX +} dsHdmiInSignalStatus_t; + +typedef enum dsAviContentType { + dsAVICONTENT_TYPE_GRAPHICS, /*!< Content type Graphics. - ITC=1, CN1=0, CN0=0 */ + dsAVICONTENT_TYPE_PHOTO, /*!< Content type Photo - ITC=1, CN1=0, CN0=1 */ + dsAVICONTENT_TYPE_CINEMA, /*!< Content type Cinema - ITC=1, CN1=1, CN0=0 */ + dsAVICONTENT_TYPE_GAME, /*!< Content type Game - ITC=1, CN1=1, CN0=1 */ + dsAVICONTENT_TYPE_NOT_SIGNALLED,/*!< Content type no data - ITC=0, CN1=0, CN0=0 */ + dsAVICONTENT_TYPE_MAX, /*!< Out of range */ +}dsAviContentType_t; + +struct dsSpd_infoframe_st { + uint8_t pkttype; + uint8_t version; + uint8_t length; /*length=25*/ + uint8_t rsd; + uint8_t checksum; + /*Vendor Name Character*/ + uint8_t vendor_name[8]; + /*Product Description Character*/ + uint8_t product_des[16]; + /*byte 25*/ + uint8_t source_info; +}; + +typedef enum tv_hdmi_edid_version_e { + HDMI_EDID_VER_14 = 0, + HDMI_EDID_VER_20, + HDMI_EDID_VER_MAX, +} tv_hdmi_edid_version_t; + +typedef enum _dsAudioPortState { + dsAUDIOPORT_STATE_UNINITIALIZED, + dsAUDIOPORT_STATE_INITIALIZED, + dsAUDIOPORT_STATE_MAX +} dsAudioPortState_t; + +typedef enum { + dsERR_NONE = 0, ///< Input output operation is successful + dsERR_GENERAL = 1, ///< Operation general error. + dsERR_INVALID_PARAM, ///< Invalid parameter is passed to the module + dsERR_INVALID_STATE, ///< Module is in an invalid state + dsERR_ALREADY_INITIALIZED, ///< Module is already initialised + dsERR_NOT_INITIALIZED, ///< Module is not initialised + dsERR_OPERATION_NOT_SUPPORTED, ///< Operation not supported + dsERR_RESOURCE_NOT_AVAILABLE, ///< Resources have failed to allocate + dsERR_OPERATION_FAILED, ///< The attempted operation has failed. Used when a SoC call has a failure + dsErr_MAX +} dsError_t; + +#define MAX_LANGUAGE_LEN 10 +#define DSMGR_MAX_VIDEO_PORT_NAME_LENGTH 128 + +typedef struct { + bool isEnabled; + bool result; + char port[DSMGR_MAX_VIDEO_PORT_NAME_LENGTH]; + } dsMgrStandbyVideoStateParam_t; + +typedef struct { + bool result; + bool isEnabled; + char port[DSMGR_MAX_VIDEO_PORT_NAME_LENGTH]; + } IARM_Bus_PWRMgr_StandbyVideoState_Param_t; + +typedef enum _dsSleepMode_t { + dsHOST_SLEEP_MODE_LIGHT, /**< Light sleep mode. */ + dsHOST_SLEEP_MODE_DEEP, /**< Deep sleep mode. */ + dsHOST_SLEEP_MODE_MAX, /**< Maximum index for sleep modes */ +} dsSleepMode_t; + +typedef enum __dsFPDTimeFormat_t { + dsFPD_TIME_12_HOUR, /**< 12 hour time format. */ + dsFPD_TIME_24_HOUR, /**< 24 hour time format. */ + dsFPD_TIME_STRING /**< Text string. */ +} dsFPDTimeFormat_t; + +typedef enum _dsCompInSignalStatus_t { + dsCOMP_IN_SIGNAL_STATUS_NONE = -1, + dsCOMP_IN_SIGNAL_STATUS_NOSIGNAL, + dsCOMP_IN_SIGNAL_STATUS_UNSTABLE, + dsCOMP_IN_SIGNAL_STATUS_NOTSUPPORTED, + dsCOMP_IN_SIGNAL_STATUS_STABLE, + dsCOMP_IN_SIGNAL_STATUS_MAX +} dsCompInSignalStatus_t; + +typedef enum _dsCompositeInPort_t { + dsCOMPOSITE_IN_PORT_NONE = -1, + dsCOMPOSITE_IN_PORT_0, + dsCOMPOSITE_IN_PORT_1, + dsCOMPOSITE_IN_PORT_MAX +} dsCompositeInPort_t; + +typedef enum dsHdmiMaxCapabilityVersion{ + HDMI_COMPATIBILITY_VERSION_14 = 0, /*!< Hdmi Compatibility Version 1.4 */ + HDMI_COMPATIBILITY_VERSION_20, /*!< Hdmi Compatibility Version 2.0 */ + HDMI_COMPATIBILITY_VERSION_21, /*!< Hdmi Compatibility Version 2.1 */ + HDMI_COMPATIBILITY_VERSION_MAX /*!< Out of bounds */ + }dsHdmiMaxCapabilityVersion_t; + +typedef enum dsVRRType { + dsVRR_NONE, + dsVRR_HDMI_VRR, + dsVRR_AMD_FREESYNC, + dsVRR_AMD_FREESYNC_PREMIUM, + dsVRR_AMD_FREESYNC_PREMIUM_PRO +} dsVRRType_t; + +typedef enum _dsAVIScanInformation_t { + dsAVI_SCAN_TYPE_NO_DATA = 0, ///< No data signalling - S1=0, S0=0 + dsAVI_SCAN_TYPE_OVERSCAN = 1, ///< Overscan signalling - S1=0, S0=1 + dsAVI_SCAN_TYPE_UNDERSCAN = 2, ///< Underscan signalling - S1=1, S0=0 + dsAVI_SCAN_TYPE_MAX ///< Out of range +} dsAVIScanInformation_t; + +typedef struct _dsHdmiInVrrStatus_t +{ + dsVRRType_t vrrType; /*! Type of VRR */ + double vrrAmdfreesyncFramerate_Hz; /*! Display VRR FrameRate in Hz */ +} dsHdmiInVrrStatus_t; + +/*! DS Manager Event Data */ +typedef struct _DSMgr_EventData_t { + union { + struct _RESOLUTION_DATA { + /* Declare Event Data structure for Video resolution Event */ + int width; /*!< Resolution Width */ + int height; /*!< Key code */ + } resn; /*Reolution data*/ + struct _DFC_DATA { + /* Declare Event Data structure for Zoom settings Event */ + int zoomsettings; + } dfc; /*zoom data*/ + + struct _AUDIOMODE_DATA { + /* Declare Event Data structure for Video resolution Event */ + int type; /*!< device type */ + int mode; /*!< device mode */ + } Audioport; /*Audio mode data*/ + + struct _ATMOS_CAPS_CHANGE { + dsATMOSCapability_t caps; + bool status; + } AtmosCapsChange; + + struct _HDMI_HPD_DATA { + /* Declare HDMI HPD Data */ + int event; + } hdmi_hpd; /*HDMI Hot Plug detect*/ + + struct _HDMI_HDCP_DATA { + /* Declare HDMI DCP Data */ + int hdcpStatus; + } hdmi_hdcp; /*HDMI HDCP Hot Plug detect*/ + + struct _HDMI_RXSENSE_DATA { + /* Declare HDMI Rx Sense status */ + int status; + } hdmi_rxsense; /*HDMI Rx Sense Data*/ + + struct _HDMI_IN_CONNECT_DATA { + dsHdmiInPort_t port; + bool isPortConnected; + } hdmi_in_connect; + + struct _HDMI_IN_STATUS_DATA { + /* Declare HDMI Input status*/ + dsHdmiInPort_t port; + bool isPresented; + } hdmi_in_status; /*HDMI in status change detect*/ + + struct _HDMI_IN_SIG_STATUS_DATA { + /* Declare HDMI In signal status*/ + dsHdmiInPort_t port; + dsHdmiInSignalStatus_t status; + } hdmi_in_sig_status; /*HDMI in signal change detect*/ + + struct _HDMI_IN_VIDEO_MODE_DATA { + /* Declare HDMI In signal status*/ + dsHdmiInPort_t port; + dsVideoPortResolution_t resolution; + } hdmi_in_video_mode; /*HDMI in video mode update*/ + + struct _COMPOSITE_IN_CONNECT_DATA { + dsCompositeInPort_t port; + bool isPortConnected; + } composite_in_connect; + + struct _COMPOSITE_IN_STATUS_DATA { + /* Declare Composite Input status*/ + dsCompositeInPort_t port; + bool isPresented; + } composite_in_status; /*Composite in status change detect*/ + + struct _COMPOSITE_IN_SIG_STATUS_DATA { + /* Declare Composite In signal status*/ + dsCompositeInPort_t port; + dsCompInSignalStatus_t status; + } composite_in_sig_status; /*Composite in signal change detect*/ + + struct _COMPOSITE_IN_VIDEO_MODE_DATA{ + /* Declare COMPOSITE In Video Mode*/ + dsCompositeInPort_t port; + dsVideoPortResolution_t resolution; + }composite_in_video_mode; /*Composite in video mode update*/ + + struct _FPD_TIME_FORMAT { + dsFPDTimeFormat_t eTimeFormat; + } FPDTimeFormat; + + struct _HDCP_PROTOCOL_DATA { + dsHdcpProtocolVersion_t protocolVersion; + } HDCPProtocolVersion; + struct _SLEEP_MODE_DATA { + dsSleepMode_t sleepMode; + } sleepModeInfo; + + struct _AUDIO_LEVEL_DATA { + int level; + } AudioLevelInfo; + + struct _AUDIO_OUT_CONNECT_DATA { + dsAudioPortType_t portType; + unsigned int uiPortNo; + bool isPortConnected; + } audio_out_connect; + + struct _AUDIO_FORMAT_DATA { + dsAudioFormat_t audioFormat; + } AudioFormatInfo; + + struct _LANGUAGE_DATA { + char audioLanguage[MAX_LANGUAGE_LEN]; + } AudioLanguageInfo; + + struct _FADER_CONTROL_DATA { + int mixerbalance; + } FaderControlInfo; + + struct _ASSOCIATED_AUDIO_MIXING_DATA { + bool mixing; + } AssociatedAudioMixingInfo; + + struct _VIDEO_FORMAT_DATA { + dsHDRStandard_t videoFormat; + } VideoFormatInfo; + + struct _AUDIO_PORTSTATE_DATA { + dsAudioPortState_t audioPortState; + } AudioPortStateInfo; + + struct _HDMI_IN_ALLM_MODE_DATA { + /* Declare HDMI In ALLM Mode*/ + dsHdmiInPort_t port; + bool allm_mode; + } hdmi_in_allm_mode; /*HDMI in ALLM Mode change*/ + + struct _HDMI_IN_VRR_MODE_DATA{ + /* Declare HDMI In VRR Mode*/ + dsHdmiInPort_t port; + dsVRRType_t vrr_type; + }hdmi_in_vrr_mode; /*HDMI in VRR Mode change*/ + + struct _HDMI_IN_CONTENT_TYPE_DATA{ + dsHdmiInPort_t port; + dsAviContentType_t aviContentType; + }hdmi_in_content_type; + struct _HDMI_IN_AV_LATENCY{ + int audio_output_delay; + int video_latency; + }hdmi_in_av_latency; /*HDMI in AVLatency change*/ + struct _DISPLAY_FRAMERATE_CHANGE { + char framerate[20]; + }DisplayFrameRateChange; + } data; +} IARM_Bus_DSMgr_EventData_t; + +typedef enum _dsDisplayEvent_t { + dsDISPLAY_EVENT_CONNECTED = 0, //!< Display connected event. + dsDISPLAY_EVENT_DISCONNECTED, //!< Display disconnected event. + dsDISPLAY_RXSENSE_ON, //!< Rx Sense ON event + dsDISPLAY_RXSENSE_OFF, //!< Rx Sense OFF event + dsDISPLAY_HDCPPROTOCOL_CHANGE, //!< HDCP Protocol Version Change event + dsDISPLAY_EVENT_MAX +} dsDisplayEvent_t; + +typedef enum _dsDisplayColorSpace_t +{ + dsDISPLAY_COLORSPACE_UNKNOWN = 0, ///< Unknown color space + dsDISPLAY_COLORSPACE_RGB = 1, ///< RGB color space + dsDISPLAY_COLORSPACE_YCbCr422 = 2, ///< YCbCr4.2.2 color space + dsDISPLAY_COLORSPACE_YCbCr444 = 3, ///< YCbCr4.4.4 color space + dsDISPLAY_COLORSPACE_YCbCr420 = 4, ///< YCbCr4.2.0 color space + dsDISPLAY_COLORSPACE_AUTO = 5, ///< Automatic color space + dsDISPLAY_COLORSPACE_MAX ///< Out of range +} dsDisplayColorSpace_t; + +typedef enum _dsDisplayQuantizationRange_t +{ + dsDISPLAY_QUANTIZATIONRANGE_UNKNOWN = 0, ///< Unknown quantization range + dsDISPLAY_QUANTIZATIONRANGE_LIMITED = 1, ///< Limited quantization range + dsDISPLAY_QUANTIZATIONRANGE_FULL = 2, ///< Full quantization range + dsDISPLAY_QUANTIZATIONRANGE_MAX ///< Out of range +} dsDisplayQuantizationRange_t; + +typedef uint32_t dsFPDColor_t; +#define dsFPDColor_Make(R8,G8,B8) (((R8)<< 8)|((G8)<<8)|((B8) )) +#define dsFPD_COLOR_WHITE dsFPDColor_Make(0xFF, 0xFF, 0xFF) + +typedef struct _dsFPDColorConfig_t{ + int id; + dsFPDColor_t color; +}dsFPDColorConfig_t; + +namespace device { + +template +using List = std::vector; + +} + +namespace device { + +class Exception : public std::exception { + int _err; + std::string _msg; + +public: + Exception(const char* msg = "No Message for this exception") throw() + : _msg(msg) + { + } + + Exception(int err, const char* msg = "No Message for this Exception") throw() + : _err(err) + , _msg(msg){}; + + virtual const std::string& getMessage() const + { + return _msg; + } + + virtual int getCode() const + { + return _err; + } + + virtual const char* what() const throw() + { + return _msg.c_str(); + } + + virtual ~Exception() throw(){}; +}; + +} + +namespace device { +class AudioStereoModeImpl { +public: + virtual ~AudioStereoModeImpl() = default; + virtual const std::string& getName() const = 0; + + virtual std::string toString() = 0; + +}; + +class AudioStereoMode { +protected: + static AudioStereoModeImpl* impl; + int audioMode; + +public: + AudioStereoMode(); + static void setImpl(AudioStereoModeImpl* newImpl); + const std::string& getName() const; + + static const int kMono; //!< Indicates audio mode of type mono. + static const int kStereo; //!< Indicates audio mode of type stereo. + static const int kSurround; //!< Indicates audio mode of type surround. + static const int kPassThru; //!< Indicates audio mode of type pass through. + static const int kDD; //!< Indicates audio mode of type dolby digital. + static const int kDDPlus; //!< Indicates audio mode of type dolby digital plus. + static const int kMax; //!< Indicates maximum number of audio modes supported. + + bool operator==(const AudioStereoMode& other) const { + return audioMode == other.audioMode; + } + AudioStereoMode& operator=(int mode) { + audioMode = mode; + return *this; +} + + std::string toString(); + AudioStereoMode(int id); +}; + +} + +namespace device { + +class AudioOutputPortTypeImpl { +public: + virtual ~AudioOutputPortTypeImpl() = default; + + virtual int getId() const = 0; +}; + +class AudioOutputPortType { +protected: + static AudioOutputPortTypeImpl* impl; + +public: + AudioOutputPortType(); + static void setImpl(AudioOutputPortTypeImpl* newImpl); + + static const int kHDMI; + static const int kARC; + static const int kSPDIF; + static const int kSPEAKER; + static const int kHEADPHONE; + int getId() const; + + +}; + +} +namespace device { + +class AudioOutputPortImpl { +public: + virtual ~AudioOutputPortImpl() = default; + + virtual const AudioOutputPortType& getType() const = 0; + + virtual const std::string& getName() const = 0; + virtual std::vector getMS12AudioProfileList() const = 0; + virtual void getAudioCapabilities(int* capabilities) = 0; + virtual void getMS12Capabilities(int* capabilities) = 0; + virtual bool isAudioMSDecode() const = 0; + + virtual bool getEnablePersist() = 0; + virtual void getHdmiArcPortId(int *portId) = 0; + virtual bool isConnected() = 0; + virtual void setDRCMode(int DRCMode) = 0; + virtual void setCompression (int compresionLevel) = 0; + virtual int getCompression() = 0; + virtual void setDolbyVolumeMode(bool dolbyVolumeMode) = 0; + virtual void setDialogEnhancement(int enhancerlevel) = 0; + virtual int getDialogEnhancement() = 0; + virtual void resetDialogEnhancement() = 0; + virtual void setIntelligentEqualizerMode (int intelligentEqualizerMode) = 0; + virtual int getIntelligentEqualizerMode() = 0; + virtual void setGraphicEqualizerMode (int graphicEqualizerMode) = 0; + virtual int getGraphicEqualizerMode() = 0; + virtual void setMS12AudioProfile(std::string audioProfileName) = 0; + virtual void resetVolumeLeveller() = 0; + virtual void resetSurroundVirtualizer() = 0; + virtual void resetBassEnhancer() = 0; + virtual void getSupportedARCTypes(int *types) = 0; + virtual void setEnablePersist(bool pEnable) = 0; + virtual dsError_t setEnablePort(bool pEnable) = 0; + virtual bool isMuted() = 0; + virtual void setAudioAtmosOutputMode (int enable) = 0; + virtual bool getSinkDeviceAtmosCapability(dsATMOSCapability_t& atmosCapability) = 0; + virtual void setAudioDelayOffset(int audioDelayOffsetMs) = 0; + virtual void setAudioDelay(int audioDelayMs) = 0; + virtual void getAudioDelay(uint32_t audioDelayMs) = 0; + virtual void getSecondaryLanguage(std::string secondaryLanguage) = 0; + virtual void setSecondaryLanguage(std::string secondaryLanguage) = 0; + virtual void setPrimaryLanguage(std::string primaryLanguage) = 0; + virtual void getPrimaryLanguage(std::string primaryLanguage) = 0; + virtual void getFaderControl(int *mixerBalance) = 0; + virtual void setFaderControl(int mixerBalance) = 0; + virtual void setAssociatedAudioMixing(bool mixing) = 0; + virtual void setGain(float newGain) = 0; + virtual void setMISteering(bool MISteering) = 0; + virtual void setSurroundVirtualizer(dsSurroundVirtualizer_t surroundVirtualizer) = 0; + virtual void setBassEnhancer(int bassBoost) = 0; + virtual void enableSurroundDecoder(bool enableSurroundDecoder) = 0; + virtual void setVolumeLeveller(dsVolumeLeveller_t volumeLeveller) = 0; + virtual bool getMISteering() = 0; + virtual dsSurroundVirtualizer_t getSurroundVirtualizer() = 0; + virtual int getDRCMode() = 0; + virtual float getLevel() = 0; + virtual float getGain() = 0; + virtual bool isSurroundDecoderEnabled() = 0; + virtual int getBassEnhancer() = 0; + virtual dsVolumeLeveller_t getVolumeLeveller() = 0; + virtual bool getStereoAuto() = 0; + virtual void setStereoAuto(bool stereoAuto, bool persist) = 0; + virtual std::string getMS12AudioProfile() = 0; + virtual void setMS12AudioProfileSetttingsOverride(std::string audioProfileState,std::string audioProfileName,std::string audioProfileSettingsName, std::string audioProfileSettingValue) = 0; + virtual void setLevel(float level) = 0; + virtual void setMuted(bool muted) = 0; + virtual void getAssociatedAudioMixing(bool *mixing) = 0; + virtual bool isEnabled() = 0; + virtual void setSAD(std::vector sad_list) = 0; + virtual void reInitializeAudioOutputPort() = 0; + virtual void getAudioDelayOffset (uint32_t audioDelayOffsetMs) = 0; + // virtual const List getSupportedStereoModes() const = 0; + virtual std::vector getSupportedStereoModes() const = 0; + + + + + virtual AudioStereoMode getStereoMode(const bool toPersist) const= 0; + + virtual AudioStereoMode getStereoMode() const= 0; + + + virtual void enableARC(dsAudioARCTypes_t type, bool enable) = 0; + + virtual uint32_t getDolbyVolumeMode() const = 0; + + virtual void setStereoMode(const std::string &mode, bool persist) = 0; + + +}; + +class AudioOutputPort { +protected: + static AudioOutputPortImpl* impl; + +public: + AudioOutputPort(); + static void setImpl(AudioOutputPortImpl* newImpl); + static AudioOutputPort& getInstance(); + + const AudioOutputPortType& getType() const; + + // dsATMOSCapability_t atmosCapability=dsATMOSCapability_t::dsAUDIO_ATMOS_ATMOSMETADATA; + const std::string& getName() const; + std::vector getMS12AudioProfileList() const; + void getAudioCapabilities(int* capabilities); + void getMS12Capabilities(int* capabilities); + bool isAudioMSDecode(); + void reInitializeAudioOutputPort(); + bool getEnablePersist(); + void getHdmiArcPortId(int *portId); + bool isConnected(); + + int getDRCMode(); + void setDRCMode(int DRCMode); + void setCompression (int compresionLevel); + int getCompression(); + void setDolbyVolumeMode(bool dolbyVolumeMode); + + void setDialogEnhancement(int enhancerlevel); + int getDialogEnhancement(); + void setIntelligentEqualizerMode (int intelligentEqualizerMode); + int getIntelligentEqualizerMode(); + void setGraphicEqualizerMode (int graphicEqualizerMode); + int getGraphicEqualizerMode(); + void setMS12AudioProfile(std::string audioProfileName); + void resetVolumeLeveller(); + void resetSurroundVirtualizer(); + void resetBassEnhancer(); + void resetDialogEnhancement(); + void getSupportedARCTypes(int *types); + void setEnablePersist(bool pEnable); + dsError_t setEnablePort(bool pEnable); + bool isMuted(); + void setAudioAtmosOutputMode (int enable); + bool getSinkDeviceAtmosCapability(dsATMOSCapability_t& atmosCapability); + void setAudioDelayOffset(int audioDelayOffsetMs); + void setAudioDelay(int audioDelayMs); + void getAudioDelay(uint32_t audioDelayMs); + void getSecondaryLanguage(std::string secondaryLanguage); + void setSecondaryLanguage(std::string secondaryLanguage); + void setPrimaryLanguage(std::string primaryLanguage); + void getPrimaryLanguage(std::string primaryLanguage); + void getFaderControl(int *mixerBalance); + void setFaderControl(int mixerBalance); + void setAssociatedAudioMixing(bool mixing); + void setGain(float newGain); + void setMISteering(bool MISteering); + void setSurroundVirtualizer(dsSurroundVirtualizer_t surroundVirtualizer); + void setBassEnhancer(int bassBoost); + void enableSurroundDecoder(bool enableSurroundDecoder); + void setVolumeLeveller(dsVolumeLeveller_t volumeLeveller); + bool getMISteering(); + dsSurroundVirtualizer_t getSurroundVirtualizer(); + float getLevel(); + float getGain(); + bool isSurroundDecoderEnabled(); + int getBassEnhancer(); + dsVolumeLeveller_t getVolumeLeveller(); + bool getStereoAuto(); + void setStereoAuto(bool stereoAuto, bool persist); + std::string getMS12AudioProfile(); + void setMS12AudioProfileSetttingsOverride(std::string audioProfileState,std::string audioProfileName,std::string audioProfileSettingsName, std::string audioProfileSettingValue); + void setLevel(float level); + void setMuted(bool muted); + void getAssociatedAudioMixing(bool *mixing); + bool isEnabled(); + void setSAD(std::vector sad_list); + void getAudioDelayOffset (uint32_t audioDelayOffsetMs); + + // const List getSupportedStereoModes() const; + const std::vector getSupportedStereoModes() const; + + AudioStereoMode getStereoMode(const bool toPersist) const; + + AudioStereoMode getStereoMode() const; + + void enableARC(dsAudioARCTypes_t type, bool enable); + uint32_t getDolbyVolumeMode() const; + void setStereoMode(const std::string &mode, bool persist); + void setAudioDucking(dsAudioDuckingAction_t action, dsAudioDuckingType_t type, float level) { + (void)action; + (void)type; + (void)level; + } + + + + +}; + +} + +namespace device { +class CompositeInputImpl { +public: + virtual ~CompositeInputImpl() = default; + virtual uint8_t getNumberOfInputs() const = 0; + virtual bool isPortConnected(int8_t Port) const = 0; + virtual void selectPort(int8_t Port) const = 0; + virtual void scaleVideo(int32_t x, int32_t y, int32_t width, int32_t height) const = 0; +}; + +class CompositeInput { +protected: + static CompositeInputImpl* impl; + +public: + CompositeInput(); + static void setImpl(CompositeInputImpl* newImpl); + static CompositeInput& getInstance(); + + uint8_t getNumberOfInputs() const; + bool isPortConnected(int8_t port) const; + void selectPort(int8_t port) const; + void scaleVideo(int32_t x, int32_t y, int32_t width, int32_t height) const; +}; + +} + +namespace device { + +class HdmiInputImpl { +public: + virtual ~HdmiInputImpl() = default; + + virtual uint8_t getNumberOfInputs() const = 0; + virtual bool isPortConnected(int8_t Port) const = 0; + virtual std::string getCurrentVideoMode() const = 0; + virtual void selectPort(int8_t Port,bool audioMix = false, int videoPlane = 0,bool topMost = false) const = 0; + virtual void scaleVideo(int32_t x, int32_t y, int32_t width, int32_t height) const = 0; + // virtual void setAudioMixerLevels(dsAudioInput_t gain, int volume) const = 0; + virtual void getEDIDBytesInfo(int iHdmiPort, std::vector& edid) const = 0; + virtual void getHDMISPDInfo(int iHdmiPort, std::vector& data) const = 0; + virtual void setEdidVersion(int iHdmiPort, int iEdidVersion) const = 0; + virtual void getEdidVersion(int iHdmiPort, int* iEdidVersion) const = 0; + virtual void getHdmiALLMStatus(int iHdmiPort, bool* allmStatus) const = 0; + virtual void getVRRStatus(int iHdmiPort, dsHdmiInVrrStatus_t *vrrStatus) const = 0; + virtual void getSupportedGameFeatures(std::vector& featureList) const = 0; + virtual void getAVLatency(int *audio_output_delay, int *video_latency) const = 0; + virtual void setEdid2AllmSupport(int iHdmiPort, bool allmsupport) const = 0; + virtual void getEdid2AllmSupport(int iHdmiPort, bool *allmsupport) const = 0; + virtual void setVRRSupport(int iHdmiPort, bool vrrsupport) const = 0; + virtual void getVRRSupport(int iHdmiPort, bool *vrrsupport) const = 0; + virtual void getCurrentVideoModeObj (dsVideoPortResolution_t &resolution) const = 0; + virtual void getHdmiVersion (int iHdmiPort, dsHdmiMaxCapabilityVersion_t *capversion) const = 0; + virtual dsError_t getHDMIARCPortId(int &portId) const = 0; +}; + +class HdmiInput { +protected: + static HdmiInputImpl* impl; + +public: + HdmiInput(); + static void setImpl(HdmiInputImpl* newImpl); + static HdmiInput& getInstance(); // Changed return type + + uint8_t getNumberOfInputs() const; + bool isPortConnected(int8_t port) const; + std::string getCurrentVideoMode() const; + void selectPort(int8_t Port,bool audioMix = false, int videoPlane = 0,bool topMost = false) const; + void scaleVideo(int32_t x, int32_t y, int32_t width, int32_t height) const; + void getEDIDBytesInfo(int iHdmiPort, std::vector& edid) const; + void getHDMISPDInfo(int iHdmiPort, std::vector& data) const; + void setEdidVersion(int iHdmiPort, int iEdidVersion) const; + void getEdidVersion(int iHdmiPort, int* iEdidVersion) const; + + void getHdmiALLMStatus(int iHdmiPort, bool* allmStatus) const; + void getVRRStatus(int iHdmiPort, dsHdmiInVrrStatus_t *vrrStatus) const; + void getSupportedGameFeatures(std::vector& featureList) const; + void getAVLatency(int *audio_output_delay, int *video_latency)const; + void setEdid2AllmSupport(int iport, bool allmSupport) const; + void getEdid2AllmSupport(int iport, bool *allmSupport) const; + void setVRRSupport(int iHdmiPort, bool vrrsupport) const; + void getVRRSupport(int iHdmiPort, bool *vrrsupport) const; + void getCurrentVideoModeObj (dsVideoPortResolution_t &resolution) const; + void getHdmiVersion (int iHdmiPort, dsHdmiMaxCapabilityVersion_t *capversion) const; + dsError_t getHDMIARCPortId(int &portId) const; +}; + +} + +namespace device { +class SleepMode; +class SleepModeImpl { +public: + virtual ~SleepModeImpl() = default; + virtual SleepMode & getInstanceById(int id) = 0; + virtual SleepMode & getInstanceByName(const std::string &name) = 0; + virtual List getSleepModes() = 0; + virtual const std::string& toString() const = 0; +}; + +class SleepMode { +protected: + static SleepModeImpl* impl; + +public: + SleepMode(); + static void setImpl(SleepModeImpl* newImpl); + + static SleepMode& getInstance(); + static SleepMode& getInstance(int id); + static SleepMode& getInstance(const std::string &name); + + List getSleepModes(); + const std::string& toString() const; +}; +} + + +namespace device { + +class VideoDFCImpl { +public: + virtual ~VideoDFCImpl() = default; + virtual const std::string& getName() const = 0; + +}; + +class VideoDFC { +protected: + static VideoDFCImpl* impl; + +public: + VideoDFC(); + static void setImpl(VideoDFCImpl* newImpl); + const std::string& getName() const; + +}; + +} + +namespace device { + +class VideoDeviceImpl { +public: + virtual ~VideoDeviceImpl() = default; + + virtual int getFRFMode(int* frfmode) const = 0; + virtual int setFRFMode(int frfmode) const = 0; + virtual int getCurrentDisframerate(char* framerate) const = 0; + virtual int setDisplayframerate(const char* framerate) const = 0; + virtual void setDFC(std::string zoomSetting) = 0; + virtual const VideoDFC& getDFC() = 0; + virtual void getHDRCapabilities(int* capabilities) = 0; + virtual void getSettopSupportedResolutions(std::list& resolutions) = 0; +}; + +class VideoDevice { +protected: + static VideoDeviceImpl* impl; + +public: + VideoDevice(); + + static void setImpl(VideoDeviceImpl* newImpl); + static VideoDevice& getInstance(); + + int getFRFMode(int* frfmode) const; + int setFRFMode(int frfmode) const; + int getCurrentDisframerate(char* framerate) const; + int setDisplayframerate(const char* framerate) const; + + const VideoDFC& getDFC(); + void setDFC(std::string zoomSetting); + void getHDRCapabilities(int* capabilities); + void getSettopSupportedResolutions(std::list& resolutions); + +}; + +} + +namespace device { + +class DSConstant { +private: + bool enabled; + +protected: + int _id; + std::string _name; + + +public: + + DSConstant() : enabled(false), _id(0), _name("_UNASSIGNED NAME_"){}; + + DSConstant(const int id, const std::string &name) : enabled(false), _id(id), _name(name){}; + + virtual ~DSConstant() {}; + + virtual bool operator==(int id) const { + return id == _id; + } + +}; + +} + +namespace device { + class PixelResolution : public DSConstant{ + public: + static const int k720x480; //!< Indicates 720x480 video resolution. + static const int k720x576; //!< Indicates 720x576 video resolution. + static const int k1280x720; //!< Indicates 1280x720 video resolution. + static const int k1366x768; //!< Indicates 1366x768 video resolution. + static const int k1920x1080; //!< Indicates 1920x1080 video resolution. + + static const int k3840x2160; //!< Indicates 3840x2160 video resolution. + static const int k4096x2160; //!< Indicates 4096x2160 video resolution. + + static const int kMax; //!< Indicates the maximum number of video resolutions supported. + + PixelResolution(int id); + PixelResolution() = default; + virtual ~PixelResolution() = default; + }; +} + +namespace device { + + class FrameRate : public DSConstant { + float _value; //!< Indicates the supported frame rate value in fps. + public: + static const int kUnknown; //!< Indicates video frame rate of unknown type. + static const int k24; //!< Indicates video frame rate of 24 fps. + static const int k25; //!< Indicates video frame rate of 25 fps. + static const int k30; //!< Indicates video frame rate of 30 fps. + static const int k60; //!< Indicates video frame rate of 60 fps. + static const int k23dot98; //!< Indicates video frame rate of 23.98 fps. + static const int k29dot97; //!< Indicates video frame rate of 29.97 fps. + static const int k50; //!< Indicates video frame rate of 50 fps. + static const int k59dot94; //!< Indicates video frame rate of 59.94 fps. + static const int kMax; //!< Indicates maximum number of frame rates supported. + + virtual ~FrameRate() = default; + + FrameRate(int id); + FrameRate(float value); + }; + +} + +namespace device { + +class VideoResolutionImpl { +public: + virtual ~VideoResolutionImpl() = default; + + virtual const std::string& getName() const = 0; + virtual const PixelResolution& getPixelResolution() const = 0; + virtual const FrameRate& getFrameRate() const = 0; +}; + +class VideoResolution { +protected: + static VideoResolutionImpl* impl; + +public: + static void setImpl(VideoResolutionImpl* newImpl); + const std::string& getName() const; + const PixelResolution & getPixelResolution() const; + const FrameRate & getFrameRate() const; +}; + +} + +namespace device { + +class VideoOutputPortTypeImpl { +public: + virtual ~VideoOutputPortTypeImpl() = default; + + virtual int getId() const = 0; + virtual const List getSupportedResolutions() const = 0; +}; + +class VideoOutputPortType : public DSConstant{ +protected: + static VideoOutputPortTypeImpl* impl; + +public: + VideoOutputPortType(); + VideoOutputPortType(int type){ + _id = type; + } + + static void setImpl(VideoOutputPortTypeImpl* newImpl); + + int getId() const; + const List getSupportedResolutions() const; + + static const int kRF; + static const int kBaseband; + static const int kSVideo; + static const int k1394; + static const int kDVI; + static const int kComponent; + static const int kHDMI; + static const int kInternal; + static const int kScart; + static const int kMax; +}; + +} + +namespace device{ + class DisplayImpl{ + public: + virtual ~DisplayImpl() = default; + + virtual void getEDIDBytes(std::vector &edid) const = 0; + virtual bool isConnectedDeviceRepeater() = 0; + virtual int getSurroundMode() = 0; + virtual void setAllmEnabled(bool enable) = 0; + virtual void setAVIContentType(int contentType) = 0; + virtual void setAVIScanInformation(int scanInfo) = 0; + }; + class Display { + protected: + static DisplayImpl* impl; + + public: + static void setImpl(DisplayImpl* newImpl); + static Display& getInstance(); + + void getEDIDBytes(std::vector& edid); + int getSurroundMode(); + bool isConnectedDeviceRepeater(); + void setAllmEnabled(bool enable); + void setAVIContentType(int contentType); + void setAVIScanInformation(int scanInfo); + +}; + +} + +namespace device { + +class VideoOutputPortImpl { +public: + virtual ~VideoOutputPortImpl() = default; + + virtual const VideoOutputPortType& getType() const = 0; + virtual const std::string& getName() const = 0; + virtual const VideoResolution& getDefaultResolution() const = 0; + virtual int getHDCPProtocol() = 0; + virtual int getHDCPReceiverProtocol() = 0; + virtual int getHDCPCurrentProtocol() = 0; + virtual int getHDCPStatus() = 0; + virtual AudioOutputPort& getAudioOutputPort() const = 0; + virtual bool isDisplayConnected() = 0; + virtual bool isContentProtected() = 0; + virtual Display& getDisplay() = 0; + virtual bool setScartParameter(std::string sScartParameter, std::string sScartParameterData) = 0; + + virtual void getTVHDRCapabilities(int* capabilities) = 0; + virtual bool setForceHDRMode (dsHDRStandard_t mode) = 0; + virtual int getPreferredColorDepth(bool persist) = 0; + virtual void getColorDepthCapabilities(unsigned int *capabilities) = 0; + virtual void setPreferredColorDepth(dsDisplayColorDepth_t colorDepth, bool persist) = 0; + virtual bool getCurrentOutputSettings(int& videoEOTF, int& matrixCoefficients, int& colorSpace, int& colorDepth, int& quantizationRange) = 0; + virtual bool isConnected() const = 0; + virtual void setResolution(std::string resolution, bool persist, bool isIgnoreEdid) = 0; + + virtual const VideoResolution& getResolution() const =0; + + virtual void getSupportedTvResolutions(int *tvResolutions) = 0; + virtual int getVideoEOTF() = 0; + virtual bool isActive() = 0; + virtual void setAllmEnabled(bool enable) = 0; + + virtual int GetHdmiPreference() = 0; + virtual bool SetHdmiPreference(dsHdcpProtocolVersion_t hdcpProtocol) = 0; + virtual int getColorSpace() const = 0; + virtual int getColorDepth() const = 0; + virtual int getQuantizationRange() const = 0; + virtual bool IsOutputHDR() = 0; + + +}; + +class VideoOutputPort { +protected: + static VideoOutputPortImpl* impl; + +public: + VideoOutputPort(); + + static void setImpl(VideoOutputPortImpl* newImpl); + static VideoOutputPort& getInstance(); + + const VideoOutputPortType& getType() const; + const std::string& getName() const; + const VideoResolution& getDefaultResolution() const; + int getHDCPProtocol(); + int getHDCPReceiverProtocol(); + int getHDCPCurrentProtocol(); + int getHDCPStatus(); + AudioOutputPort& getAudioOutputPort(); + bool isDisplayConnected(); + bool isContentProtected(); + Display& getDisplay(); + void getSupportedTvResolutions(int *tvResolutions); + const VideoResolution& getResolution() const; + + void setResolution(std::string resolution, bool persist, bool isIgnoreEdid); + bool getCurrentOutputSettings(int& videoEOTF, int& matrixCoefficients, int& colorSpace, int& colorDepth, int& quantizationRange); + + void setPreferredColorDepth(dsDisplayColorDepth_t colorDepth, bool persist); + void getColorDepthCapabilities(unsigned int *capabilities); + int getPreferredColorDepth(bool persist); + bool setForceHDRMode (dsHDRStandard_t mode); + void getTVHDRCapabilities(int* capabilities); + bool setScartParameter(std::string sScartParameter, std::string sScartParameterData); + int getVideoEOTF(); + bool isActive(); + void setAllmEnabled(bool enable); + int GetHdmiPreference(); + bool SetHdmiPreference(dsHdcpProtocolVersion_t hdcpProtocol); + int getColorSpace() const; + int getColorDepth() const; + int getQuantizationRange() const; + bool IsOutputHDR(); + +}; + +} + +namespace device { + +class VideoOutputPortConfigImpl { +public: + virtual ~VideoOutputPortConfigImpl() = default; + + virtual VideoOutputPortType& getPortType(int id) = 0; + virtual VideoOutputPort& getPort(const std::string& name) = 0; +}; + +class VideoOutputPortConfig { +protected: + static VideoOutputPortConfigImpl* impl; + +public: + VideoOutputPortConfig(); + + static void setImpl(VideoOutputPortConfigImpl* newImpl); + static VideoOutputPortConfig& getInstance(); + + VideoOutputPortType& getPortType(int id); + VideoOutputPort& getPort(const std::string& name); +}; + +} + +class ManagerImpl { +public: + virtual ~ManagerImpl() = default; + + virtual void Initialize() = 0; + virtual void DeInitialize() = 0; +}; + +namespace device { +class Manager { +protected: + static ManagerImpl* impl; + +public: + Manager(); + + static void setImpl(ManagerImpl* newImpl); + static Manager& getInstance(); + + inline static bool IsInitialized = false; + static void Initialize(); + static void DeInitialize(); +}; +} + +namespace device { + +class HostImpl; +class IDisplayEventsImpl; +class IAudioOutputPortEventsImpl; +class IDisplayDeviceEventsImpl; +class IHdmiInEventsImpl; +class IVideoDeviceEventsImpl; +class IVideoOutputPortEventsImpl; +class ICompositeInEventsImpl; + +class Host { +protected: + static HostImpl* impl; + +public: + static void setImpl(HostImpl* newImpl); + static Host& getInstance(); + + SleepMode getPreferredSleepMode(); + int setPreferredSleepMode(const SleepMode mode); + List getAvailableSleepModes(); + List getVideoOutputPorts(); + List getAudioOutputPorts(); + List getVideoDevices(); + VideoOutputPort& getVideoOutputPort(const std::string& name); + AudioOutputPort& getAudioOutputPort(const std::string& name); + void getHostEDID(std::vector& edid) const; + std::string getDefaultVideoPortName(); + std::string getDefaultAudioPortName(); + + void getMS12ConfigDetails(std::string type); + bool isHDMIOutPortPresent(); + void getSecondaryLanguage(std::string secondaryLanguage); + void setSecondaryLanguage(std::string secondaryLanguage); + void getSinkDeviceAtmosCapability(dsATMOSCapability_t atmosCapability); + void getFaderControl(int *mixerBalance); + void setFaderControl(int mixerBalance); + void setPrimaryLanguage(std::string primaryLanguage); + void getPrimaryLanguage(std::string primaryLanguage); + void setAudioAtmosOutputMode (int enable); + void setAssociatedAudioMixing(bool mixing); + void getCurrentAudioFormat(dsAudioFormat_t audioFormat); + void getAssociatedAudioMixing(bool *mixing); + void setAudioMixerLevels(dsAudioInput_t gain, int volume) ; + +class IDisplayEvents { + protected: + static IDisplayEventsImpl* impl; + + public: + static void setImpl(IDisplayEventsImpl* newImpl); + static IDisplayEvents& getInstance(); + virtual void OnDisplayRxSense(dsDisplayEvent_t displayEvent); +}; + +class IAudioOutputPortEvents { + protected: + static IAudioOutputPortEventsImpl* impl; + + public: + static void setImpl(IAudioOutputPortEventsImpl* newImpl); + static IAudioOutputPortEvents& getInstance(); + virtual void OnAudioOutHotPlug(dsAudioPortType_t portType, uint32_t uiPortNumber, bool isPortConnected); + virtual void OnAudioFormatUpdate(dsAudioFormat_t audioFormat); + virtual void OnDolbyAtmosCapabilitiesChanged(dsATMOSCapability_t atmosCapability, bool status); + virtual void OnAudioPortStateChanged(dsAudioPortState_t audioPortState); + virtual void OnAssociatedAudioMixingChanged(bool mixing); + virtual void OnAudioFaderControlChanged(int mixerBalance); + virtual void OnAudioPrimaryLanguageChanged(const std::string& primaryLanguage); + virtual void OnAudioSecondaryLanguageChanged(const std::string& secondaryLanguage); + virtual void OnAudioModeEvent(dsAudioPortType_t audioPortType, dsAudioStereoMode_t audioStereoMode); + virtual void OnAudioLevelChangedEvent(int audioLevel); +}; + +class IDisplayDeviceEvents { + protected: + static IDisplayDeviceEventsImpl* impl; + public: + static void setImpl(IDisplayDeviceEventsImpl* newImpl); + static IDisplayDeviceEvents& getInstance(); + + virtual void OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent); +}; + +class IHdmiInEvents { + protected: + static IHdmiInEventsImpl* impl; + + public: + static void setImpl(IHdmiInEventsImpl* newImpl); + static IHdmiInEvents& getInstance(); + + virtual void OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected); + virtual void OnHdmiInEventSignalStatus(dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus); + virtual void OnHdmiInEventStatus(dsHdmiInPort_t activePort, bool isPresented); + virtual void OnHdmiInVideoModeUpdate(dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution); + virtual void OnHdmiInAllmStatus(dsHdmiInPort_t port, bool allmStatus); + virtual void OnHdmiInAVIContentType(dsHdmiInPort_t port, dsAviContentType_t aviContentType); + virtual void OnHdmiInVRRStatus(dsHdmiInPort_t port, dsVRRType_t vrrType); + virtual void OnHdmiInAVLatency(int audioDelay, int videoDelay); +}; + +class ICompositeInEvents { + protected: + static ICompositeInEventsImpl* impl; + + public: + static void setImpl(ICompositeInEventsImpl* newImpl); + static ICompositeInEvents& getInstance(); + + virtual void OnCompositeInHotPlug(dsCompositeInPort_t port, bool isConnected); + virtual void OnCompositeInSignalStatus(dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus); + virtual void OnCompositeInStatus(dsCompositeInPort_t activePort, bool isPresented); + virtual void OnCompositeInVideoModeUpdate(dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution); + }; + +class IVideoDeviceEvents { + protected: + static IVideoDeviceEventsImpl* impl; + + public: + static void setImpl(IVideoDeviceEventsImpl* newImpl); + static IVideoDeviceEvents& getInstance(); + + virtual void OnZoomSettingsChanged(dsVideoZoom_t zoomSetting); + virtual void OnDisplayFrameratePreChange(const std::string& frameRate); + virtual void OnDisplayFrameratePostChange(const std::string& frameRate); +}; + +class IVideoOutputPortEvents { + protected: + static IVideoOutputPortEventsImpl* impl; + + public: + static void setImpl(IVideoOutputPortEventsImpl* newImpl); + static IVideoOutputPortEvents& getInstance(); + + virtual void OnResolutionPreChange(const int width, const int height); + virtual void OnResolutionPostChange(const int width, const int height); + virtual void OnVideoFormatUpdate(dsHDRStandard_t videoFormatHDR); + virtual void OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus); +}; + +virtual dsError_t Register(IVideoDeviceEvents* listener, const std::string& clientName = ""); +virtual dsError_t UnRegister(IVideoDeviceEvents* listener); +virtual dsError_t Register(IDisplayEvents* listener, const std::string& clientName = ""); +virtual dsError_t UnRegister(IDisplayEvents* listener); +virtual dsError_t Register(IAudioOutputPortEvents* listener, const std::string& clientName = ""); +virtual dsError_t UnRegister(IAudioOutputPortEvents* listener); +virtual dsError_t Register(IDisplayDeviceEvents* listener, const std::string& clientName = ""); +virtual dsError_t UnRegister(IDisplayDeviceEvents* listener); +virtual dsError_t Register(IHdmiInEvents* listener, const std::string& clientName = ""); +virtual dsError_t UnRegister(IHdmiInEvents* listener); +virtual dsError_t Register(IVideoOutputPortEvents* listener, const std::string& clientName = ""); +virtual dsError_t UnRegister(IVideoOutputPortEvents* listener); +virtual dsError_t Register(ICompositeInEvents* listener, const std::string& clientName = ""); +virtual dsError_t UnRegister(ICompositeInEvents* listener); +}; + +class HostImpl { +public: + virtual ~HostImpl() = default; + virtual SleepMode getPreferredSleepMode() = 0; + virtual int setPreferredSleepMode(const SleepMode mode) = 0; + virtual List getAvailableSleepModes() = 0; + virtual List getVideoOutputPorts() = 0; + virtual List getAudioOutputPorts() = 0; + virtual List getVideoDevices() = 0; + virtual VideoOutputPort& getVideoOutputPort(const std::string& name) = 0; + virtual AudioOutputPort& getAudioOutputPort(const std::string& name) = 0; + virtual void getHostEDID(std::vector& edid) const = 0; + virtual std::string getDefaultVideoPortName() = 0; + virtual std::string getDefaultAudioPortName() = 0; + + virtual void getMS12ConfigDetails(std::string type)=0; + virtual bool isHDMIOutPortPresent() = 0; + virtual void getSecondaryLanguage(std::string secondaryLanguage) = 0; + virtual void setSecondaryLanguage(std::string secondaryLanguage) = 0; + virtual void getSinkDeviceAtmosCapability(dsATMOSCapability_t atmosCapability) = 0; + virtual void getFaderControl(int *mixerBalance) = 0; + virtual void setFaderControl(int mixerBalance) = 0; + virtual void setPrimaryLanguage(std::string primaryLanguage) = 0; + virtual void getPrimaryLanguage(std::string primaryLanguage) = 0; + virtual void setAudioAtmosOutputMode (int enable) = 0; + virtual void setAssociatedAudioMixing(bool mixing) = 0; + virtual void getCurrentAudioFormat(dsAudioFormat_t audioFormat) = 0; + virtual void getAssociatedAudioMixing(bool *mixing) = 0; + virtual void setAudioMixerLevels(dsAudioInput_t inputType, int volumeLevel) = 0; + + virtual dsError_t Register(Host::IDisplayEvents* listener) = 0; + virtual dsError_t UnRegister(Host::IDisplayEvents* listener) = 0; + virtual dsError_t Register(Host::IAudioOutputPortEvents* listener) = 0; + virtual dsError_t UnRegister(Host::IAudioOutputPortEvents* listener) = 0; + virtual dsError_t Register(Host::IDisplayDeviceEvents* listener) = 0; + virtual dsError_t UnRegister(Host::IDisplayDeviceEvents* listener) = 0; + virtual dsError_t Register(Host::IHdmiInEvents* listener) = 0; + virtual dsError_t UnRegister(Host::IHdmiInEvents* listener) = 0; + virtual dsError_t Register(Host::IVideoDeviceEvents* listener) = 0; + virtual dsError_t UnRegister(Host::IVideoDeviceEvents* listener) = 0; + virtual dsError_t Register(Host::IVideoOutputPortEvents* listener) = 0; + virtual dsError_t UnRegister(Host::IVideoOutputPortEvents* listener) = 0; + virtual dsError_t Register(Host::ICompositeInEvents* listener) = 0; + virtual dsError_t UnRegister(Host::ICompositeInEvents* listener) = 0; +}; + + +class IDisplayEventsImpl { +public: + virtual ~IDisplayEventsImpl() = default; + virtual void OnDisplayRxSense(dsDisplayEvent_t displayEvent) = 0; +}; + +class IAudioOutputPortEventsImpl { +public: + virtual ~IAudioOutputPortEventsImpl() = default; + + virtual void OnAudioOutHotPlug(dsAudioPortType_t portType, uint32_t uiPortNumber, bool isPortConnected) = 0; + virtual void OnAudioFormatUpdate(dsAudioFormat_t audioFormat) = 0; + virtual void OnDolbyAtmosCapabilitiesChanged(dsATMOSCapability_t atmosCapability, bool status) = 0; + virtual void OnAudioPortStateChanged(dsAudioPortState_t audioPortState) = 0; + virtual void OnAssociatedAudioMixingChanged(bool mixing) = 0; + virtual void OnAudioFaderControlChanged(int mixerBalance) = 0; + virtual void OnAudioPrimaryLanguageChanged(const std::string& primaryLanguage) = 0; + virtual void OnAudioSecondaryLanguageChanged(const std::string& secondaryLanguage) = 0; + virtual void OnAudioModeEvent(dsAudioPortType_t audioPortType, dsAudioStereoMode_t audioStereoMode) = 0; + virtual void OnAudioLevelChangedEvent(int audioLevel) = 0; + +}; + +class IDisplayDeviceEventsImpl { +public: + virtual ~IDisplayDeviceEventsImpl() = default; + + virtual void OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) = 0; +}; + +class IHdmiInEventsImpl { +public: + virtual ~IHdmiInEventsImpl() = default; + + virtual void OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) = 0; + virtual void OnHdmiInEventSignalStatus(dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus) = 0; + virtual void OnHdmiInEventStatus(dsHdmiInPort_t activePort, bool isPresented) = 0; + virtual void OnHdmiInVideoModeUpdate(dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution) = 0; + virtual void OnHdmiInAllmStatus(dsHdmiInPort_t port, bool allmStatus) = 0; + virtual void OnHdmiInAVIContentType(dsHdmiInPort_t port, dsAviContentType_t aviContentType) = 0; + virtual void OnHdmiInVRRStatus(dsHdmiInPort_t port, dsVRRType_t vrrType) = 0; + virtual void OnHdmiInAVLatency(int audioDelay, int videoDelay) = 0; + +}; + + class ICompositeInEventsImpl { + public: + virtual ~ICompositeInEventsImpl() = default; + virtual void OnCompositeInHotPlug(dsCompositeInPort_t port, bool isConnected) = 0; + virtual void OnCompositeInSignalStatus(dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus) = 0; + virtual void OnCompositeInStatus(dsCompositeInPort_t activePort, bool isPresented) = 0; + virtual void OnCompositeInVideoModeUpdate(dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution) = 0; + }; + +class IVideoDeviceEventsImpl { +public: + virtual ~IVideoDeviceEventsImpl() = default; + + virtual void OnZoomSettingsChanged(dsVideoZoom_t zoomSetting) = 0; + virtual void OnDisplayFrameratePreChange(const std::string& frameRate) = 0; + virtual void OnDisplayFrameratePostChange(const std::string& frameRate) = 0; + +}; + +class IVideoOutputPortEventsImpl { +public: + virtual ~IVideoOutputPortEventsImpl() = default; + + virtual void OnResolutionPreChange(const int width, const int height) = 0; + virtual void OnResolutionPostChange(const int width, const int height) = 0; + virtual void OnVideoFormatUpdate(dsHDRStandard_t videoFormatHDR) = 0; + virtual void OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus) = 0; + +}; + +} + +namespace device { +class FrontPanelIndicator { +public: + class Color; + class ColorImpl { + public: + virtual ~ColorImpl() = default; + virtual const Color& getInstanceById(int id) = 0; + virtual const Color& getInstanceByName(const std::string& name) = 0; + virtual std::string getName() const = 0; + }; + + class Color { +protected: + static ColorImpl* impl; + +public: + Color(); + + static void setImpl(ColorImpl* newImpl); + static Color& getInstance(); + static const Color& getInstance(int id); + static const Color& getInstance(const std::string& name); + + static const int kWhite; + + std::string getName() const; + virtual ~Color(); + }; + + // static FrontPanelIndicator& getInstance() + // { + // static FrontPanelIndicator instance; + // return instance; + // } + + class FrontPanelIndicatorImpl { + public: + virtual ~FrontPanelIndicatorImpl() = default; + virtual FrontPanelIndicator& getInstanceInt(int id) = 0; + virtual FrontPanelIndicator& getInstanceString(const std::string& name) = 0; + virtual void setState(const bool bState) const = 0; + virtual std::string getName() const = 0; + virtual void setBrightness(const int brightness, const bool toPersist = false) const = 0; + virtual int getBrightness(const bool persist=false) const = 0; + virtual void setColor(const Color &newColor, const bool toPersist) const = 0; + virtual void setColorInt(const uint32_t color, const bool toPersist) const = 0; + virtual void getBrightnessLevels(int &levels,int &min,int &max) const = 0; + virtual int getColorMode() const = 0; + virtual std::string getColorName() const = 0; + virtual List getSupportedColors() const =0; + }; + + // FrontPanelIndicatorImpl* impl; + + public: + static FrontPanelIndicatorImpl* impl; + FrontPanelIndicator(); + + static void setImpl(FrontPanelIndicatorImpl* newImpl); + + static FrontPanelIndicator& getInstance(const std::string& name); + static FrontPanelIndicator& getInstance(int id); + static FrontPanelIndicator& getInstance(); + + void setState(const bool bState) const; + std::string getName() const; + void setBrightness(const int brightness, const bool toPersist = false) const; + int getBrightness(const bool persist = false) const; + void setColor(const Color& newColor, const bool toPersist = false) const; + void setColor(const uint32_t color, const bool toPersist = false) const; + // void setColorInt(const uint32_t color, const bool toPersist) const; + void getBrightnessLevels(int& levels, int& min, int& max) const; + int getColorMode() const; + std::string getColorName() const; + List getSupportedColors() const; + +}; + +class FrontPanelTextDisplay; +class FrontPanelTextDisplayImpl { +public: + virtual ~FrontPanelTextDisplayImpl() = default; + virtual int getCurrentTimeFormat() const = 0; + virtual void setTimeFormat(const int iTimeFormat) const = 0; + virtual void setText(const std::string text) const = 0; + virtual void setMode(int mode) const = 0; + virtual int getTextBrightness() const = 0; + virtual void setTextBrightness(const int brightness) const = 0; + virtual FrontPanelTextDisplay& getInstanceById(int id) = 0; + virtual FrontPanelTextDisplay& getInstanceByName(const std::string& name) = 0; +}; + +class FrontPanelTextDisplay : public FrontPanelIndicator{ +protected: + static FrontPanelTextDisplayImpl* impl; + +public: + FrontPanelTextDisplay(); + + static void setImpl(FrontPanelTextDisplayImpl* newImpl); + + int getCurrentTimeFormat() const; + void setTimeFormat(const int iTimeFormat); + static FrontPanelTextDisplay& getInstance(const std::string& name); + static FrontPanelTextDisplay& getInstance(int id); + static FrontPanelTextDisplay& getInstance(); + static const int kModeClock12Hr; + static const int kModeClock24Hr; + + void setText(const std::string text); + void setMode(int mode); + int getTextBrightness() const; + void setTextBrightness(const int brightness) const; +}; + +class FrontPanelConfig; +class FrontPanelConfigImpl { +public: + virtual ~FrontPanelConfigImpl() = default; + virtual List getIndicators() const = 0; + virtual FrontPanelTextDisplay& getTextDisplay() const = 0; + virtual FrontPanelTextDisplay& getTextDisplay(const std::string &name) const = 0; + virtual List getTextDisplays() const = 0; + virtual FrontPanelTextDisplay& getTextDisplay(int id) const = 0; +}; + +class FrontPanelConfig { +protected: + static FrontPanelConfigImpl* impl; + +public: + FrontPanelConfig(); + + static void setImpl(FrontPanelConfigImpl* newImpl); + static FrontPanelConfig& getInstance(); + + List getIndicators(); + FrontPanelTextDisplay& getTextDisplay(const std::string& name); + List getTextDisplays(); + FrontPanelTextDisplay& getTextDisplay(int id); + FrontPanelTextDisplay& getTextDisplay() const; +}; + +} + + +#define RT_OK 0 +#define RT_ERROR 1 +#define RT_ERROR_QUEUE_EMPTY 1006 + + +typedef uint32_t rtError; +typedef void(*remoteDisconnectCallback)(void *data); + +class rtValue; + +class rtIObject +{ + public: + typedef unsigned long refcount_t; + + virtual ~rtIObject(){ + } +}; + +class rtString{ + public: + std::string mData; + rtString(const char* s){ + mData = s; + } + rtString(const rtString& s){ + mData = s.mData; + } + rtString(){ + mData = ""; + } + const char* cString() const{ + return mData.c_str(); + } + rtString& operator=(const char* s){ + mData = s; + return *this; + } + + rtString& operator=(const rtString& s){ + mData = s.mData; + return *this; + } + +}; +typedef rtError (*rtFunctionCB)(int numArgs, const rtValue* args, rtValue* result, void* context); + +class rtFunctionCallback{ + public: + rtFunctionCallback(rtFunctionCB cb, void* context = NULL){ + + } + ~rtFunctionCallback() = default; + +}; + +/* +Based on pxCore, Copyright 2015-2018 John Robinson +Licensed under the Apache License, Version 2.0 +*/ +template +class rtRef +{ +public: + rtRef(): mRef(NULL) {} + rtRef(const T* p): mRef(NULL) {asn(p); } + rtRef(const rtRef& r): mRef(NULL) {asn(r.getPtr());} + rtRef(rtRef&& r) noexcept: mRef(r.mRef) {r.mRef = nullptr;} + virtual ~rtRef() { + } + + T* operator->() const {return mRef;} + operator T* () const {return mRef;} + T* getPtr() const {return mRef;} + T* ptr() const {return mRef;} + T& operator*() const {return *mRef;} + + bool operator! () const {return mRef == NULL; } + inline rtRef& operator=(const T* p) {asn(p); return *this;} + inline rtRef& operator=(const rtRef& r) {asn(r.mRef); return *this;} + + inline friend bool operator==(const T* lhs,const rtRef& rhs) {return lhs==rhs.mRef;} + inline friend bool operator==(const rtRef& lhs,const T* rhs) {return lhs.mRef==rhs;} + inline friend bool operator==(const rtRef& lhs,const rtRef& rhs) {return lhs.mRef==rhs.mRef;} + + void asn(const T* p) + { + if (mRef != p) + { + if (mRef) + { + delete mRef; + mRef = NULL; + } + mRef = const_cast(p); + + } + } + + T* mRef; +}; + +class rtObjectBaseImpl{ + public: + virtual ~rtObjectBaseImpl() = default; + virtual rtError set(const char* name, const char* value) const = 0; + virtual rtError set(const char* name, bool value) const = 0; + virtual rtError set(const char* name, const rtValue& value) const = 0; + virtual rtString get(const char* name) const = 0; + virtual rtError sendReturns(const char* messageName, rtString& result) const = 0; +}; + +class rtObjectBase{ +protected: + static rtObjectBaseImpl* impl; +public: + + static rtObjectBase& getInstance(); + static void setImpl(rtObjectBaseImpl* newImpl); + + rtError set(const char* name, const char* value); + rtError set(const char* name, bool value); + rtError set(const char* name, const rtValue& value); + + //To avoid linker issues with templated code, the complete definition of this + //templated function is included in this header file instead of separating it to .cpp + template + rtError sendReturns(const char* messageName, T& result) { + return impl->sendReturns(messageName, result); + } + + template + T get(const char* name) { + return impl->get(name); + } + virtual ~rtObjectBase() = default; +}; + +class rtMapObject: public rtObjectBase, public rtIObject{ + public: + virtual ~rtMapObject() = default; + +}; + +class rtObjectRef; +class rtObjectRefImpl{ + public: + virtual rtError send(const char* messageName, const rtValue& arg1) = 0; + virtual rtError send(const char* messageName) = 0; + virtual rtError send(const char* messageName, const char* method, rtFunctionCallback* callback) = 0; + virtual rtError send(const char* messageName, rtObjectRef& base) = 0; + +}; + +class rtObjectRef : public rtRef, public rtObjectBase{ +protected: + static rtObjectRefImpl* impl; +public: + + + static rtObjectRef& getInstance(); + + static void setImpl(rtObjectRefImpl* newImpl); + + rtObjectRef(); + + rtObjectRef(const rtObjectRef&); + + rtObjectRef(const rtMapObject* o); + + rtObjectRef& operator=(rtMapObject* o); + + rtObjectRef& operator=(const rtObjectRef&); + + rtObjectRef& operator=(rtIObject* o); + + rtObjectRef& operator=(rtObjectRef&&); + + rtError send(const char* messageName); + + rtError send(const char* messageName, const char* method, rtFunctionCallback* callback); + + rtError send(const char* messageName, const rtValue& arg1); + + rtError send(const char* messageName, rtObjectRef& base); + virtual ~rtObjectRef(); + +}; + +class rtArrayObject; + +struct rtValue_{ + std::string stringValue; + bool boolValue; +}; + +class rtValueImpl{ + public: + virtual void rtValueConstructor(bool v) const = 0; + virtual void rtValueConstructor(const char* v) const = 0; + virtual void rtValueConstructor(rtArrayObject* v) const = 0; + virtual void rtValueConstructor(const rtString& v) const = 0; +}; + +class rtValue +{ + protected: + static rtValueImpl* impl; + public: + rtValue_ mValue; + + static rtValue& getInstance(); + static void setImpl(rtValueImpl* newImpl); + + rtValue(); + rtValue(bool v); + rtValue(const char* v); + rtValue(const rtString& v); + rtValue(rtIObject* v); + + rtValue(const rtObjectRef& v); + rtValue(const rtValue& v); + ~rtValue(); + rtValue& operator=(bool v); + rtValue& operator=(const char* v); + rtValue& operator=(const rtString& v); + rtValue& operator=(const rtIObject* v); + rtValue& operator=(const rtObjectRef& v); + rtValue& operator=(const rtValue& v); + + rtObjectRef toObject() const; + void setString (const char* v); + void setString (const rtString& v); + +}; + +class rtArrayObjectImpl{ + public: + virtual void pushBack(const char* v) const = 0; + virtual void pushBack(rtValue v) const = 0; +}; + + +class rtArrayObject : public rtObjectBase, public rtIObject{ +protected: + static rtArrayObjectImpl* impl; +public: + static rtArrayObject& getInstance(); + static void setImpl(rtArrayObjectImpl* newImpl); + + void pushBack(const char* v); + void pushBack(rtValue v); + virtual ~rtArrayObject() = default; + +}; + +class rtRemoteEnvironment{ + + +}; + +class floatingRtFunctionsImpl{ + public: + virtual ~floatingRtFunctionsImpl() = default; + virtual rtError rtRemoteLocateObject(rtRemoteEnvironment *env, const char* str, rtObjectRef& obj, int x, remoteDisconnectCallback back, void *cbdata=NULL) = 0; + virtual rtRemoteEnvironment* rtEnvironmentGetGlobal() = 0; + virtual rtError rtRemoteShutdown(rtRemoteEnvironment *env) = 0; + virtual rtError rtRemoteInit(rtRemoteEnvironment *env) = 0; + virtual rtError rtRemoteProcessSingleItem() = 0; + virtual char* rtStrError(rtError err) = 0; + +}; + +class floatingRtFunctions{ +public: + static floatingRtFunctionsImpl* impl; + static floatingRtFunctions& getInstance(); + static void setImpl(floatingRtFunctionsImpl* newImpl); + +}; + + rtError rtRemoteProcessSingleItem(); + rtError rtRemoteLocateObject(rtRemoteEnvironment* env, const char* str, rtObjectRef& obj, int x, remoteDisconnectCallback back, void* cbdata = nullptr); + rtRemoteEnvironment* rtEnvironmentGetGlobal(); + rtError rtRemoteInit(rtRemoteEnvironment* env); + rtError rtRemoteShutdown(rtRemoteEnvironment* env); + char* rtStrError(rtError err); + + +namespace edid_parser { + + enum edid_status_e { + EDID_STATUS_OK, + EDID_STATUS_INVALID_PARAMETER, + EDID_STATUS_NOT_SUPPORTED, + EDID_STATUS_INVALID_HEADER, + EDID_STATUS_INVALID_CHECKSUM + }; + + enum edid_native_e { + EDID_NATIVE, + EDID_NOT_NATIVE + }; + + enum edid_progressive_e { + EDID_PROGRESSIVE, + EDID_INTERLACED + }; + + enum HDR_standard_t { + HDR_standard_NONE = 0x0, + HDR_standard_HDR10 = 0x01, // SMPTE ST 2084 + HDR_standard_HLG = 0x02, // Hybrid Log-Gamma + HDR_standard_DolbyVersion = 0x04, // ? + HDR_standard_SDR = 0x08, // Traditional gamma - SDR Luminance Range + HDR_standard_Traditional_HDR = 0x10 // Traditional gamma - HDR Luminance Range + }; + + struct edid_res_t { + int width; + int height; + int refresh; + edid_progressive_e progressive; + edid_native_e native; + }; + + enum colorimetry_info_t { + COLORIMETRY_INFO_NONE = 0x0, + COLORIMETRY_INFO_XVYCC601 = 0x01, + COLORIMETRY_INFO_XVYCC709 = 0x02, + COLORIMETRY_INFO_SYCC601 = 0x04, + COLORIMETRY_INFO_ADOBEYCC601 = 0x08, + COLORIMETRY_INFO_ADOBERGB = 0x10, + COLORIMETRY_INFO_BT2020CL = 0x20, + COLORIMETRY_INFO_BT2020NCL = 0x40, + COLORIMETRY_INFO_BT2020RGB = 0x80, + COLORIMETRY_INFO_DCI_P3 = 0x100 + }; + + struct edid_data_t { + edid_res_t res; + // bitmask of HDR_standard_t values + uint8_t hdr_capabilities; + char manufacturer_name[4]; /* Manufacturer name of the display device.*/ + int32_t product_code; /* Product code of the display device. */ + int32_t serial_number; /* Serial number of the display device. */ + int32_t manufacture_week; /* Manufacturing week of the display device. */ + int32_t manufacture_year; /* Manufacturing year of the display device. */ + uint8_t edid_version[2]; /* EDID version. */ + uint8_t physical_address_a; /* Physical Address for HDMI node A */ + uint8_t physical_address_b; /* Physical Address for HDMI node B */ + uint8_t physical_address_c; /* Physical Address for HDMI node C */ + uint8_t physical_address_d; /* Physical Address for HDMI node D */ + char monitor_name[14]; /* Connected display monitor name. */ + uint32_t colorimetry_info; /* bitmask of enum colorimetry_info_t */ +}; + + class edidParserImpl{ + public: + static edidParserImpl* impl; + + static void setImpl(edidParserImpl* newImpl); + + virtual edid_status_e EDID_Parse(unsigned char* bytes, size_t count, edid_data_t* data_ptr) = 0; + virtual edid_status_e EDID_Verify(unsigned char* bytes, size_t count) = 0; + + }; + + edid_status_e EDID_Parse(unsigned char* bytes, size_t count, edid_data_t* data_ptr); + edid_status_e EDID_Verify(unsigned char* bytes, size_t count); +} + +class drmImpl{ + public: + virtual ~drmImpl() = default; + static drmImpl* impl; + static void setImpl(drmImpl* newImpl); + + virtual drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id) = 0; + virtual void drmModeFreeEncoder(drmModeEncoderPtr* encoder) = 0; + virtual drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connectorId) = 0; + virtual drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId) = 0; + virtual drmModeResPtr drmModeGetResources(int fd) = 0; + virtual void drmModeFreeConnector( drmModeConnectorPtr ptr ) = 0; + virtual void drmModeFreeCrtc( drmModeCrtcPtr ptr ) = 0; + virtual void drmModeFreeResources( drmModeResPtr ptr ) = 0; + virtual drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId) = 0; + virtual void drmModeFreeProperty(drmModePropertyPtr ptr) = 0; + virtual drmModePlaneResPtr drmModeGetPlaneResources(int fd) = 0; + virtual drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id) = 0; + virtual drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,uint32_t object_id, uint32_t object_type) = 0; + virtual void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr) = 0; + virtual void drmModeFreePlane( drmModePlanePtr ptr ) = 0; + virtual void drmModeFreePlaneResources(drmModePlaneResPtr ptr) = 0; + virtual void drmModeFreeFB(drmModeFBPtr ptr) = 0; + virtual drmModeFBPtr drmModeGetFB(int fd, uint32_t bufferId) = 0; + virtual void drmModeFreeEncoder( drmModeEncoderPtr ptr ) = 0; + virtual int drmSetClientCap(int fd, uint64_t capability, uint64_t value) = 0; + +}; + +//drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id); +//void drmModeFreeEncoder(drmModeEncoderPtr* encoder); +//drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connectorId); +//drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId); +//drmModeResPtr drmModeGetResources(int fd); +//void drmModeFreeConnector( drmModeConnectorPtr ptr ); +//void drmModeFreeCrtc( drmModeCrtcPtr ptr ); +//void drmModeFreeResources( drmModeResPtr ptr ); +//drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId); +//void drmModeFreeProperty(drmModePropertyPtr ptr); +//drmModePlaneResPtrResPtr drmModeGetPlaneResources(int fd); +//drmModePlaneResPtr drmModeGetPlane(int fd, uint32_t plane_id); +//drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,uint32_t object_id, uint32_t object_type); +//void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr); +//void drmModeFreePlane( drmModePlaneResPtr ptr ); +//void drmModeFreePlaneResources(drmModePlaneResPtrResPtr ptr); + diff --git a/ci/mocks/devicesettings/AudioOutputPortMock.h b/ci/mocks/devicesettings/AudioOutputPortMock.h new file mode 100644 index 00000000..148ac73f --- /dev/null +++ b/ci/mocks/devicesettings/AudioOutputPortMock.h @@ -0,0 +1,117 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include +#include + +#include "audioOutputPort.hpp" + +class AudioOutputPortMock : public device::AudioOutputPortImpl { +public: + virtual ~AudioOutputPortMock() = default; + + MOCK_METHOD(const std::string&, getName, (), (const, override)); + MOCK_METHOD(std::vector, getMS12AudioProfileList, (), (const, override)); + MOCK_METHOD(void, getAudioCapabilities, (int* capabilities), (override)); + MOCK_METHOD(void, getMS12Capabilities, (int* capabilities), (override)); + MOCK_METHOD(bool, isAudioMSDecode, (), (const,override)); + + MOCK_METHOD(bool, getEnablePersist, (), (override)); + MOCK_METHOD(void, getHdmiArcPortId, (int *portId), (override)); + MOCK_METHOD(bool, isConnected, (), (override)); + MOCK_METHOD(void, setDRCMode, (int DRCMode), (override)); + MOCK_METHOD(void, setCompression, (int compressionLevel), (override)); + MOCK_METHOD(int, getCompression, (), (override)); + MOCK_METHOD(void, setDolbyVolumeMode, (bool dolbyVolumeMode), (override)); + MOCK_METHOD(void, setDialogEnhancement, (int enhancerlevel), (override)); + MOCK_METHOD(int, getDialogEnhancement, (), (override)); + MOCK_METHOD(void, setIntelligentEqualizerMode, (int intelligentEqualizerMode), (override)); + MOCK_METHOD(int, getIntelligentEqualizerMode, (), (override)); + MOCK_METHOD(void, setGraphicEqualizerMode, (int graphicEqualizerMode), (override)); + MOCK_METHOD(int, getGraphicEqualizerMode, (), (override)); + MOCK_METHOD(void, setMS12AudioProfile, (std::string audioProfileName), (override)); + MOCK_METHOD(void, resetVolumeLeveller, (), (override)); + MOCK_METHOD(void, resetSurroundVirtualizer, (), (override)); + MOCK_METHOD(void, resetBassEnhancer, (), (override)); + MOCK_METHOD(void, resetDialogEnhancement, (), (override)); + MOCK_METHOD(void, getSupportedARCTypes, (int *types), (override)); + MOCK_METHOD(void, setEnablePersist, (bool pEnable), (override)); + MOCK_METHOD(dsError_t, setEnablePort, (bool pEnable), (override)); + MOCK_METHOD(bool, isMuted, (), (override)); + MOCK_METHOD(void, setAudioAtmosOutputMode, (int enable), (override)); + MOCK_METHOD(bool, getSinkDeviceAtmosCapability, (dsATMOSCapability_t& atmosCapability), (override)); + MOCK_METHOD(void, setAudioDelayOffset, (int audioDelayOffsetMs), (override)); + MOCK_METHOD(void, setAudioDelay, (int audioDelayMs), (override)); + MOCK_METHOD(void, getAudioDelay, (uint32_t audioDelayMs), (override)); + MOCK_METHOD(void, getAudioDelayOffset, (uint32_t audioDelayOffsetMs), (override)); + MOCK_METHOD(void, getSecondaryLanguage, (std::string secondaryLanguage), (override)); + MOCK_METHOD(void,setSecondaryLanguage, (std::string secondaryLanguage), (override)); + MOCK_METHOD(void, setPrimaryLanguage, (std::string primaryLanguage), (override)); + MOCK_METHOD(void, getPrimaryLanguage, (std::string primaryLanguage), (override)); + MOCK_METHOD(void, getFaderControl, (int *mixerBalance), (override)); + MOCK_METHOD(void, setFaderControl, (int mixerBalance), (override)); + MOCK_METHOD(void, setAssociatedAudioMixing, (bool mixing), (override)); + MOCK_METHOD(void, setGain, (float newGain), (override)); + MOCK_METHOD(void, setMISteering, (bool MISteering), (override)); + MOCK_METHOD(void, setSurroundVirtualizer, (dsSurroundVirtualizer_t surroundVirtualizer), (override)); + MOCK_METHOD(void, setBassEnhancer, (int bassBoost), (override)); + MOCK_METHOD(void, enableSurroundDecoder, (bool enableSurroundDecoder), (override)); + MOCK_METHOD(void, setVolumeLeveller, (dsVolumeLeveller_t volumeLeveller), (override)); + MOCK_METHOD(bool, getMISteering, (), (override)); + MOCK_METHOD(dsSurroundVirtualizer_t, getSurroundVirtualizer, (), (override)); + MOCK_METHOD(int, getDRCMode, (), (override)); + MOCK_METHOD(float, getLevel, (), (override)); + MOCK_METHOD(float, getGain, (), (override)); + MOCK_METHOD(bool, isSurroundDecoderEnabled, (), (override)); + MOCK_METHOD(int, getBassEnhancer, (), (override)); + MOCK_METHOD(dsVolumeLeveller_t, getVolumeLeveller, (), (override)); + MOCK_METHOD(bool, getStereoAuto, (), (override)); + + MOCK_METHOD(std::string, getMS12AudioProfile, (), (override)); + MOCK_METHOD(void, setMS12AudioProfileSetttingsOverride, (std::string audioProfileState,std::string audioProfileName,std::string audioProfileSettingsName, std::string audioProfileSettingValue), (override)); + + MOCK_METHOD(void, setLevel, (float level), (override)); + MOCK_METHOD(void, setMuted, (bool muted), (override)); + MOCK_METHOD(void, getAssociatedAudioMixing, (bool *mixing), (override)); + MOCK_METHOD(bool, isEnabled, (), (override)); + MOCK_METHOD(void, setSAD, (std::vector sad_list), (override)); + MOCK_METHOD(void, setStereoAuto, (bool stereoAuto, bool persist), (override)); + MOCK_METHOD(void, reInitializeAudioOutputPort, (), (override)); + + MOCK_METHOD(std::vector, getSupportedStereoModes, (), (const, override)); + + MOCK_METHOD(void, enableARC, (dsAudioARCTypes_t type, bool enable), (override)); + + MOCK_METHOD(void, setStereoMode, (const std::string &mode, bool persist), (override)); + + MOCK_METHOD(device::AudioStereoMode, getStereoMode, (const bool toPersist), (const, override)); + + + MOCK_METHOD(device::AudioStereoMode, getStereoMode, (), (const, override)); + + MOCK_METHOD(uint32_t, getDolbyVolumeMode, (), (const, override)); + + MOCK_METHOD(const device::AudioOutputPortType&, getType, (), (const, override)); + + + + +}; diff --git a/ci/mocks/devicesettings/AudioOutputPortTypeMock.h b/ci/mocks/devicesettings/AudioOutputPortTypeMock.h new file mode 100644 index 00000000..1e941840 --- /dev/null +++ b/ci/mocks/devicesettings/AudioOutputPortTypeMock.h @@ -0,0 +1,32 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2025 RDK Management +* +* 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. +*/ + +#pragma once + +#include + +#include "audioOutputPortType.hpp" + +class AudioOutputPortTypeMock : public device::AudioOutputPortTypeImpl { +public: + virtual ~AudioOutputPortTypeMock() = default; + + MOCK_METHOD(int, getId, (), (const, override)); + // MOCK_METHOD(const device::List, getSupportedResolutions, (), (const, override)); +}; \ No newline at end of file diff --git a/ci/mocks/devicesettings/AudioStereoModeMock.h b/ci/mocks/devicesettings/AudioStereoModeMock.h new file mode 100644 index 00000000..292ebd5b --- /dev/null +++ b/ci/mocks/devicesettings/AudioStereoModeMock.h @@ -0,0 +1,35 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2025 RDK Management +* +* 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. +*/ + +#pragma once + +#include + +#include "AudioStereoMode.hpp" + +class AudioStereoModeMock : public device::AudioStereoModeImpl { +public: + virtual ~AudioStereoModeMock() = default; + + + MOCK_METHOD(const std::string&, getName, (), (const, override)); + MOCK_METHOD( std::string, toString, (), (override)); + + +}; diff --git a/ci/mocks/devicesettings/ColorMock.h b/ci/mocks/devicesettings/ColorMock.h new file mode 100644 index 00000000..17529786 --- /dev/null +++ b/ci/mocks/devicesettings/ColorMock.h @@ -0,0 +1,32 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +class ColorMock : public device::FrontPanelIndicator::ColorImpl { +public: + virtual ~ColorMock() = default; + + MOCK_METHOD(const device::FrontPanelIndicator::Color&, getInstanceById, (int id), (override)); + MOCK_METHOD(const device::FrontPanelIndicator::Color&, getInstanceByName, (const std::string& name), (override)); + MOCK_METHOD(std::string,getName, (), (const, override)); + +}; diff --git a/ci/mocks/devicesettings/CompositeInputMock.h b/ci/mocks/devicesettings/CompositeInputMock.h new file mode 100644 index 00000000..ce638fdd --- /dev/null +++ b/ci/mocks/devicesettings/CompositeInputMock.h @@ -0,0 +1,35 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "compositeIn.hpp" + +class CompositeInputImplMock : public device::CompositeInputImpl { +public: + virtual ~CompositeInputImplMock() = default; + + MOCK_METHOD(uint8_t, getNumberOfInputs, (), (const, override)); + MOCK_METHOD(bool, isPortConnected, (int8_t Port), (const, override)); + MOCK_METHOD(void, selectPort, (int8_t Port), (const, override)); + MOCK_METHOD(void, scaleVideo, (int32_t x, int32_t y, int32_t width, int32_t height), (const, override)); + +}; diff --git a/ci/mocks/devicesettings/DisplayMock.h b/ci/mocks/devicesettings/DisplayMock.h new file mode 100644 index 00000000..af818a18 --- /dev/null +++ b/ci/mocks/devicesettings/DisplayMock.h @@ -0,0 +1,36 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "devicesettings.h" + +class DisplayMock : public device::DisplayImpl { +public: + virtual ~DisplayMock() = default; + + MOCK_METHOD(void, getEDIDBytes, (std::vector &edid), (const, override)); + MOCK_METHOD(bool, isConnectedDeviceRepeater, (), (override)); + MOCK_METHOD(int, getSurroundMode, (), (override)); + MOCK_METHOD(void, setAllmEnabled, (bool enable), (override)); + MOCK_METHOD(void, setAVIContentType, (int contentType), (override)); + MOCK_METHOD(void, setAVIScanInformation, (int scanInfo), (override)); +}; diff --git a/ci/mocks/devicesettings/DrmMock.h b/ci/mocks/devicesettings/DrmMock.h new file mode 100644 index 00000000..64821642 --- /dev/null +++ b/ci/mocks/devicesettings/DrmMock.h @@ -0,0 +1,50 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include +#include + +class DRMMock : public drmImpl { +public: + virtual ~DRMMock() = default; + + MOCK_METHOD(drmModeEncoderPtr, drmModeGetEncoder, (int fd, uint32_t encoder_id), (override)); + MOCK_METHOD(void, drmModeFreeEncoder, (drmModeEncoderPtr* encoder), (override)); + MOCK_METHOD(drmModeConnectorPtr, drmModeGetConnector, (int fd, uint32_t connectorId), (override)); + MOCK_METHOD(drmModeCrtcPtr, drmModeGetCrtc, (int fd, uint32_t crtcId), (override)); + MOCK_METHOD(drmModeResPtr, drmModeGetResources, (int fd), (override)); + MOCK_METHOD(void, drmModeFreeConnector, (drmModeConnectorPtr ptr), (override)); + MOCK_METHOD(void, drmModeFreeCrtc, (drmModeCrtcPtr ptr), (override)); + MOCK_METHOD(void, drmModeFreeResources, (drmModeResPtr ptr), (override)); + MOCK_METHOD(drmModePropertyPtr, drmModeGetProperty, (int fd, uint32_t propertyId), (override)); + MOCK_METHOD(void, drmModeFreeProperty, (drmModePropertyPtr ptr), (override)); + MOCK_METHOD(drmModePlaneResPtr, drmModeGetPlaneResources, (int fd), (override)); + MOCK_METHOD(drmModePlanePtr, drmModeGetPlane, (int fd, uint32_t plane_id), (override)); + MOCK_METHOD(drmModeObjectPropertiesPtr, drmModeObjectGetProperties, (int fd, uint32_t object_id, uint32_t object_type), (override)); + MOCK_METHOD(void, drmModeFreeObjectProperties, (drmModeObjectPropertiesPtr ptr), (override)); + MOCK_METHOD(void, drmModeFreePlane, (drmModePlanePtr ptr), (override)); + MOCK_METHOD(void, drmModeFreePlaneResources, (drmModePlaneResPtr ptr), (override)); + MOCK_METHOD(int, drmSetClientCap, (int fd, uint64_t capability, uint64_t value), (override)); + MOCK_METHOD(void, drmModeFreeFB, (drmModeFBPtr ptr), (override)); + MOCK_METHOD(drmModeFBPtr, drmModeGetFB, (int fd, uint32_t bufferId), (override)); + MOCK_METHOD(void, drmModeFreeEncoder, (drmModeEncoderPtr ptr), (override)); + +}; \ No newline at end of file diff --git a/ci/mocks/devicesettings/EdidParserMock.h b/ci/mocks/devicesettings/EdidParserMock.h new file mode 100644 index 00000000..e8313a9c --- /dev/null +++ b/ci/mocks/devicesettings/EdidParserMock.h @@ -0,0 +1,30 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "devicesettings.h" +class EdidParserMock : public edid_parser::edidParserImpl { +public: + virtual ~EdidParserMock() = default; + MOCK_METHOD(edid_parser::edid_status_e, EDID_Parse, (unsigned char* bytes, size_t count, edid_parser::edid_data_t* data_ptr), (override)); + MOCK_METHOD(edid_parser::edid_status_e, EDID_Verify, (unsigned char* bytes, size_t count), (override)); +}; diff --git a/ci/mocks/devicesettings/FloatingRtFunctionsMock.h b/ci/mocks/devicesettings/FloatingRtFunctionsMock.h new file mode 100644 index 00000000..599ee049 --- /dev/null +++ b/ci/mocks/devicesettings/FloatingRtFunctionsMock.h @@ -0,0 +1,35 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2022 RDK Management + * + * 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. + */ +#pragma once + +#include + +class floatingRtFunctionsMock : public floatingRtFunctionsImpl { +public: + virtual ~floatingRtFunctionsMock() = default; + + MOCK_METHOD(rtError, rtRemoteLocateObject, (rtRemoteEnvironment *env, const char* str, rtObjectRef& obj, int x, remoteDisconnectCallback back, void *cbdata), (override)); + MOCK_METHOD(rtRemoteEnvironment*, rtEnvironmentGetGlobal, (), (override)); + MOCK_METHOD(rtError,rtRemoteShutdown, (rtRemoteEnvironment *env), (override)); + MOCK_METHOD(rtError,rtRemoteInit, (rtRemoteEnvironment *env), (override)); + MOCK_METHOD(rtError,rtRemoteProcessSingleItem, (), (override)); + MOCK_METHOD(char*, rtStrError, (rtError err), (override)); + + +}; diff --git a/ci/mocks/devicesettings/FrontPanelConfigMock.h b/ci/mocks/devicesettings/FrontPanelConfigMock.h new file mode 100644 index 00000000..8acbbd45 --- /dev/null +++ b/ci/mocks/devicesettings/FrontPanelConfigMock.h @@ -0,0 +1,33 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +class FrontPanelConfigMock : public device::FrontPanelConfigImpl { +public: + virtual ~FrontPanelConfigMock() = default; + + MOCK_METHOD(device::List,getIndicators, (), (const, override)); + MOCK_METHOD(device::FrontPanelTextDisplay&,getTextDisplay, (const std::string &name), (const, override)); + MOCK_METHOD(device::FrontPanelTextDisplay&,getTextDisplay, (int id), (const, override)); + MOCK_METHOD(device::FrontPanelTextDisplay&,getTextDisplay, (), (const, override)); + MOCK_METHOD(device::List,getTextDisplays, (), (const, override)); +}; diff --git a/ci/mocks/devicesettings/FrontPanelIndicatorMock.h b/ci/mocks/devicesettings/FrontPanelIndicatorMock.h new file mode 100644 index 00000000..8618b619 --- /dev/null +++ b/ci/mocks/devicesettings/FrontPanelIndicatorMock.h @@ -0,0 +1,40 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +class FrontPanelIndicatorMock : public device::FrontPanelIndicator::FrontPanelIndicatorImpl { +public: + virtual ~FrontPanelIndicatorMock() = default; + + MOCK_METHOD(device::FrontPanelIndicator&, getInstanceString, (const std::string& name), (override)); + MOCK_METHOD(device::FrontPanelIndicator&, getInstanceInt, (int id), (override)); + MOCK_METHOD(void,setState, (const bool bState), (const, override)); + MOCK_METHOD(std::string,getName, (), (const, override)); + MOCK_METHOD(void,setBrightness, (const int brightness, const bool toPersist), (const, override)); + MOCK_METHOD(int,getBrightness, (const bool persist), (const, override)); + MOCK_METHOD(void,setColor, (const device::FrontPanelIndicator::Color &newColor, const bool toPersist), (const, override)); + MOCK_METHOD(void,setColorInt, (const uint32_t color, const bool toPersist), (const, override)); + MOCK_METHOD(void,getBrightnessLevels, (int &levels,int &min,int &max), (const, override)); + MOCK_METHOD(int,getColorMode, (), (const, override)); + MOCK_METHOD(std::string,getColorName, (), (const, override)); + MOCK_METHOD(device::List,getSupportedColors, (), (const, override)); +}; diff --git a/ci/mocks/devicesettings/FrontPanelTextDisplayMock.h b/ci/mocks/devicesettings/FrontPanelTextDisplayMock.h new file mode 100644 index 00000000..1923b4ab --- /dev/null +++ b/ci/mocks/devicesettings/FrontPanelTextDisplayMock.h @@ -0,0 +1,35 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +class FrontPanelTextDisplayMock : public device::FrontPanelTextDisplayImpl { +public: + virtual ~FrontPanelTextDisplayMock() = default; + MOCK_METHOD(device::FrontPanelTextDisplay&, getInstanceByName, (const std::string& name), (override)); + MOCK_METHOD(device::FrontPanelTextDisplay&, getInstanceById, (int id), (override)); + MOCK_METHOD(int,getCurrentTimeFormat, (), (const, override)); + MOCK_METHOD(void,setTimeFormat, (const int iTimeFormat), (const, override)); + MOCK_METHOD(int,getTextBrightness, (), (const, override)); + MOCK_METHOD(void,setTextBrightness, (const int brightness), (const, override)); + MOCK_METHOD(void,setText, (const std::string text), (const, override)); + MOCK_METHOD(void,setMode, (const int mode), (const, override)); +}; diff --git a/ci/mocks/devicesettings/HdmiCecMock.h b/ci/mocks/devicesettings/HdmiCecMock.h new file mode 100644 index 00000000..73cd7ed2 --- /dev/null +++ b/ci/mocks/devicesettings/HdmiCecMock.h @@ -0,0 +1,107 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once +#include +#include "HdmiCec.h" + +class LibCCECImplMock : public LibCCECImpl { +public: + virtual ~LibCCECImplMock() = default; + + MOCK_METHOD(void, init, (const char *name), (const, override)); + MOCK_METHOD(void, init, (), (const, override)); + MOCK_METHOD(void, term, (), (const, override)); + MOCK_METHOD(void, getPhysicalAddress, (unsigned int *physicalAddress), (const, override)); + MOCK_METHOD(int, addLogicalAddress, (const LogicalAddress &source), (const, override)); + MOCK_METHOD(int, getLogicalAddress, (int devType), (const, override)); +}; + +class SystemAudioStatusImplMock : public SystemAudioStatusImpl { +public: + virtual ~SystemAudioStatusImplMock() = default; + + MOCK_METHOD(int, toInt, (), (const, override)); +}; + +class AudioStatusImplMock : public AudioStatusImpl { +public: + virtual ~AudioStatusImplMock() = default; + + MOCK_METHOD(int, getAudioMuteStatus, (), (const, override)); + MOCK_METHOD(int, getAudioVolume, (), (const, override)); +}; + +class PowerStatusImplMock : public PowerStatusImpl { +public: + virtual ~PowerStatusImplMock() = default; + + MOCK_METHOD(int, toInt, (), (const, override)); +}; + +class AbortReasonImplMock : public AbortReasonImpl { +public: + virtual ~AbortReasonImplMock() = default; + + MOCK_METHOD(int, toInt, (), (const, override)); +}; + +class ShortAudioDescriptorImplMock : public ShortAudioDescriptorImpl { +public: + virtual ~ShortAudioDescriptorImplMock() = default; + + MOCK_METHOD(uint32_t, getAudiodescriptor, (), (const, override)); +}; + +class ConnectionImplMock : public ConnectionImpl { +public: + virtual ~ConnectionImplMock() = default; + + MOCK_METHOD(void, open, (), (const, override)); + MOCK_METHOD(void, close, (), (const, override)); + MOCK_METHOD(void, addFrameListener, (FrameListener *listener), (const, override)); + MOCK_METHOD(void, ping, (const LogicalAddress &from, const LogicalAddress &to, const Throw_e &doThrow), (const, override)); + MOCK_METHOD(void, sendToAsync, (const LogicalAddress &to, const CECFrame &frame), (const, override)); + MOCK_METHOD(void, sendTo, (const LogicalAddress &to, const CECFrame &frame), (const, override)); + MOCK_METHOD(void, sendTo, (const LogicalAddress &to, const CECFrame &frame, int timeout), (const, override)); + MOCK_METHOD(void, poll, (const LogicalAddress &from, const Throw_e &doThrow), (const, override)); + MOCK_METHOD(void, sendAsync, (const CECFrame &frame), (const, override)); +}; + +class LogicalAddressImplMock : public LogicalAddressImpl { +public: + virtual ~LogicalAddressImplMock() = default; + + MOCK_METHOD(int, getType, (), (const, override)); +}; + +class MessageEncoderMock : public MessageEncoderImpl{ +public: + virtual ~MessageEncoderMock() = default; + + MOCK_METHOD(CECFrame&, encode, (const DataBlock &m), (const, override)); + MOCK_METHOD(CECFrame&, encode, (const UserControlPressed &m), (const, override)); +}; + +class MessageDecoderMock : public MessageDecoderImpl{ +public: + virtual ~MessageDecoderMock() = default; + + MOCK_METHOD(void, decode, (const CECFrame& in), (const, override)); +}; diff --git a/ci/mocks/devicesettings/HdmiInputMock.h b/ci/mocks/devicesettings/HdmiInputMock.h new file mode 100644 index 00000000..ae5faf75 --- /dev/null +++ b/ci/mocks/devicesettings/HdmiInputMock.h @@ -0,0 +1,51 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "hdmiIn.hpp" + +class HdmiInputImplMock : public device::HdmiInputImpl { +public: + virtual ~HdmiInputImplMock() = default; + + MOCK_METHOD(uint8_t, getNumberOfInputs, (), (const, override)); + MOCK_METHOD(bool, isPortConnected, (int8_t Port), (const, override)); + MOCK_METHOD(std::string, getCurrentVideoMode, (), (const, override)); + MOCK_METHOD(void, selectPort, (int8_t Port,bool audioMix, int videoPlane,bool topMost), (const, override)); + MOCK_METHOD(void, scaleVideo, (int32_t x, int32_t y, int32_t width, int32_t height), (const, override)); + MOCK_METHOD(void, getEDIDBytesInfo, (int iHdmiPort, std::vector &edid), (const, override)); + MOCK_METHOD(void, getHDMISPDInfo, (int iHdmiPort, std::vector &data), (const, override)); + MOCK_METHOD(void, setEdidVersion, (int iHdmiPort, int iEdidVersion), (const, override)); + MOCK_METHOD(void, getEdidVersion, (int iHdmiPort, int *iEdidVersion), (const, override)); + MOCK_METHOD(void, setEdid2AllmSupport, (int iHdmiPort, bool allmSupport), (const, override)); + MOCK_METHOD(void, getEdid2AllmSupport, (int iHdmiPort, bool *allmSupport), (const, override)); + MOCK_METHOD(void, setVRRSupport, (int iHdmiPort, bool vrrsupport), (const, override)); + MOCK_METHOD(void, getVRRSupport, (int iHdmiPort, bool *vrrsupport), (const, override)); + // MOCK_METHOD(void, setAudioMixerLevels, (dsAudioInput_t gain, int volume), (const, override)); + MOCK_METHOD(void, getHdmiALLMStatus, (int iHdmiPort, bool *allmStatus), (const, override)); + MOCK_METHOD(void, getVRRStatus, (int iHdmiPort, dsHdmiInVrrStatus_t *vrrStatus), (const, override)); + MOCK_METHOD(void, getSupportedGameFeatures, (std::vector &featureList), (const, override)); + MOCK_METHOD(void, getAVLatency, (int *audio_output_delay,int *video_latency), (const, override)); + MOCK_METHOD(void, getCurrentVideoModeObj, (dsVideoPortResolution_t& resolution), (const, override)); + MOCK_METHOD(void, getHdmiVersion, (int iHdmiPort, dsHdmiMaxCapabilityVersion_t *capVersion), (const, override)); + MOCK_METHOD(dsError_t, getHDMIARCPortId, (int &portId), (const, override)); +}; diff --git a/ci/mocks/devicesettings/HostMock.h b/ci/mocks/devicesettings/HostMock.h new file mode 100644 index 00000000..c73e6af1 --- /dev/null +++ b/ci/mocks/devicesettings/HostMock.h @@ -0,0 +1,148 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "host.hpp" + +class HostImplMock : public device::HostImpl { +public: + virtual ~HostImplMock() = default; + + MOCK_METHOD(device::SleepMode, getPreferredSleepMode, (), (override)); + MOCK_METHOD(int, setPreferredSleepMode, (const device::SleepMode), (override)); + MOCK_METHOD(device::List, getAvailableSleepModes, (), (override)); + MOCK_METHOD(device::List, getVideoOutputPorts, (), (override)); + MOCK_METHOD(device::List, getAudioOutputPorts, (), (override)); + MOCK_METHOD(device::List, getVideoDevices, (), (override)); + MOCK_METHOD(device::VideoOutputPort&, getVideoOutputPort, (const std::string& name), (override)); + MOCK_METHOD(device::AudioOutputPort&, getAudioOutputPort, (const std::string& name), (override)); + MOCK_METHOD(void, getHostEDID, (std::vector & edid), (const, override)); + MOCK_METHOD(std::string, getDefaultVideoPortName, (), (override)); + //MOCK_METHOD(void, setAudioMixerLevels, (dsAudioInput_t aInput, int volume), (override)); + MOCK_METHOD(std::string, getDefaultAudioPortName, (), (override)); + + MOCK_METHOD(void, getMS12ConfigDetails, (std::string type), (override)); + MOCK_METHOD(bool, isHDMIOutPortPresent, (), (override)); + MOCK_METHOD(void, getSinkDeviceAtmosCapability, (dsATMOSCapability_t atmosCapability), (override)); + MOCK_METHOD(void, getSecondaryLanguage, (std::string secondaryLanguage), (override)); + MOCK_METHOD(void,setSecondaryLanguage, (std::string secondaryLanguage), (override)); + MOCK_METHOD(void, getFaderControl, (int *mixerBalance), (override)); + MOCK_METHOD(void, setFaderControl, (int mixerBalance), (override)); + MOCK_METHOD(void, setPrimaryLanguage, (std::string primaryLanguage), (override)); + MOCK_METHOD(void, getPrimaryLanguage, (std::string primaryLanguage), (override)); + MOCK_METHOD(void, setAudioAtmosOutputMode, (int enable), (override)); + MOCK_METHOD(void, setAssociatedAudioMixing, (bool mixing), (override)); + MOCK_METHOD(void, getCurrentAudioFormat, (dsAudioFormat_t audioFormat), (override)); + MOCK_METHOD(void, getAssociatedAudioMixing, (bool *mixing), (override)); + MOCK_METHOD(void, setAudioMixerLevels, (dsAudioInput_t gain, int volume), (override)); + + MOCK_METHOD(dsError_t, Register, (device::Host::IDisplayEvents* listener), (override)); + MOCK_METHOD(dsError_t, UnRegister, (device::Host::IDisplayEvents* listener), (override)); + MOCK_METHOD(dsError_t, Register, (device::Host::IAudioOutputPortEvents* listener), (override)); + MOCK_METHOD(dsError_t, UnRegister, (device::Host::IAudioOutputPortEvents* listener), (override)); + MOCK_METHOD(dsError_t, Register, (device::Host::IDisplayDeviceEvents* listener), (override)); + MOCK_METHOD(dsError_t, UnRegister, (device::Host::IDisplayDeviceEvents* listener), (override)); + MOCK_METHOD(dsError_t, Register, (device::Host::IHdmiInEvents* listener), (override)); + MOCK_METHOD(dsError_t, UnRegister, (device::Host::IHdmiInEvents* listener), (override)); + MOCK_METHOD(dsError_t, Register, (device::Host::IVideoDeviceEvents* listener), (override)); + MOCK_METHOD(dsError_t, UnRegister, (device::Host::IVideoDeviceEvents* listener), (override)); + MOCK_METHOD(dsError_t, Register, (device::Host::IVideoOutputPortEvents* listener), (override)); + MOCK_METHOD(dsError_t, UnRegister, (device::Host::IVideoOutputPortEvents* listener), (override)); + MOCK_METHOD(dsError_t, Register, (device::Host::ICompositeInEvents* listener), (override)); + MOCK_METHOD(dsError_t, UnRegister, (device::Host::ICompositeInEvents* listener), (override)); +}; + +class IDisplayEventsImplMock : public device::IDisplayEventsImpl { +public: + virtual ~IDisplayEventsImplMock() = default; + + MOCK_METHOD(void, OnDisplayRxSense, (dsDisplayEvent_t displayEvent), (override)); +}; + +class IAudioOutputPortEventsImplMock : public device::IAudioOutputPortEventsImpl { +public: + virtual ~IAudioOutputPortEventsImplMock() = default; + + MOCK_METHOD(void, OnAudioOutHotPlug, (dsAudioPortType_t portType, uint32_t uiPortNumber, bool isPortConnected), (override)); + MOCK_METHOD(void, OnAudioFormatUpdate, (dsAudioFormat_t audioFormat), (override)); + MOCK_METHOD(void, OnDolbyAtmosCapabilitiesChanged, (dsATMOSCapability_t atmosCapability, bool status), (override)); + MOCK_METHOD(void, OnAudioPortStateChanged, (dsAudioPortState_t audioPortState), (override)); + MOCK_METHOD(void, OnAssociatedAudioMixingChanged, (bool mixing), (override)); + MOCK_METHOD(void, OnAudioFaderControlChanged, (int mixerBalance), (override)); + MOCK_METHOD(void, OnAudioPrimaryLanguageChanged, (const std::string& primaryLanguage), (override)); + MOCK_METHOD(void, OnAudioSecondaryLanguageChanged, (const std::string& secondaryLanguage), (override)); + MOCK_METHOD(void, OnAudioModeEvent, (dsAudioPortType_t audioPortType, dsAudioStereoMode_t audioStereoMode), (override)); + MOCK_METHOD(void, OnAudioLevelChangedEvent, (int audioLevel), (override)); +}; + +class IDisplayDeviceEventsImplMock : public device::IDisplayDeviceEventsImpl { +public: + virtual ~IDisplayDeviceEventsImplMock() = default; + + MOCK_METHOD(void, OnDisplayHDMIHotPlug, (dsDisplayEvent_t displayEvent), (override)); +}; + +class IHdmiInEventsImplMock : public device::IHdmiInEventsImpl { +public: + virtual ~IHdmiInEventsImplMock() = default; + + MOCK_METHOD(void, OnHdmiInEventHotPlug, (dsHdmiInPort_t port, bool isConnected), (override)); + MOCK_METHOD(void, OnHdmiInEventSignalStatus, (dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus), (override)); + MOCK_METHOD(void, OnHdmiInEventStatus, (dsHdmiInPort_t activePort, bool isPresented), (override)); + MOCK_METHOD(void, OnHdmiInVideoModeUpdate, (dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution), (override)); + MOCK_METHOD(void, OnHdmiInAllmStatus, (dsHdmiInPort_t port, bool allmStatus), (override)); + MOCK_METHOD(void, OnHdmiInAVIContentType, (dsHdmiInPort_t port, dsAviContentType_t aviContentType), (override)); + MOCK_METHOD(void, OnHdmiInVRRStatus, (dsHdmiInPort_t port, dsVRRType_t vrrType), (override)); + MOCK_METHOD(void, OnHdmiInAVLatency, (int audioDelay, int videoDelay), (override)); + +}; + +class ICompositeInEventsImplMock : public device::ICompositeInEventsImpl { +public: + virtual ~ICompositeInEventsImplMock() = default; + + MOCK_METHOD(void, OnCompositeInHotPlug, (dsCompositeInPort_t port, bool isConnected), (override)); + MOCK_METHOD(void, OnCompositeInSignalStatus, (dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus), (override)); + MOCK_METHOD(void, OnCompositeInStatus, (dsCompositeInPort_t activePort, bool isPresented), (override)); + MOCK_METHOD(void, OnCompositeInVideoModeUpdate, (dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution), (override)); +}; + +class IVideoDeviceEventsImplMock : public device::IVideoDeviceEventsImpl { +public: + virtual ~IVideoDeviceEventsImplMock() = default; + + MOCK_METHOD(void, OnZoomSettingsChanged, (dsVideoZoom_t zoomSetting), (override)); + MOCK_METHOD(void, OnDisplayFrameratePreChange, (const std::string& frameRate), (override)); + MOCK_METHOD(void, OnDisplayFrameratePostChange, (const std::string& frameRate), (override)); + +}; + +class IVideoOutputPortEventsImplMock : public device::IVideoOutputPortEventsImpl { +public: + virtual ~IVideoOutputPortEventsImplMock() = default; + + MOCK_METHOD(void, OnResolutionPreChange, (const int width, const int height), (override)); + MOCK_METHOD(void, OnResolutionPostChange, (const int width, const int height), (override)); + MOCK_METHOD(void, OnVideoFormatUpdate,(dsHDRStandard_t videoFormatHDR),(override)); + MOCK_METHOD(void, OnHDCPStatusChange,(dsHdcpStatus_t hdcpStatus),(override)); + +}; diff --git a/ci/mocks/devicesettings/ManagerMock.h b/ci/mocks/devicesettings/ManagerMock.h new file mode 100644 index 00000000..8cfab31c --- /dev/null +++ b/ci/mocks/devicesettings/ManagerMock.h @@ -0,0 +1,32 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "manager.hpp" + +class ManagerImplMock : public ManagerImpl { +public: + virtual ~ManagerImplMock() = default; + + MOCK_METHOD(void, Initialize, (), (override)); + MOCK_METHOD(void, DeInitialize, (), (override)); +}; diff --git a/ci/mocks/devicesettings/MotionDetectionMock.h b/ci/mocks/devicesettings/MotionDetectionMock.h new file mode 100644 index 00000000..70c5012d --- /dev/null +++ b/ci/mocks/devicesettings/MotionDetectionMock.h @@ -0,0 +1,53 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + + +class MotionDetectionImplMock : public MotionDetectionImpl { +public: + + MotionDetectionImplMock():MotionDetectionImpl() + { + ON_CALL(*this, MOTION_DETECTION_Platform_Init()) + .WillByDefault(::testing::Return(MOTION_DETECTION_RESULT_SUCCESS)); + + ON_CALL(*this, MOTION_DETECTION_Platform_Term()) + .WillByDefault(::testing::Return(MOTION_DETECTION_RESULT_SUCCESS)); + } + + virtual ~MotionDetectionImplMock() = default; + + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_Platform_Init, (), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_Platform_Term, (), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_RegisterEventCallback, (MOTION_DETECTION_OnMotionEventCallback motionEvent), (override)); + + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_GetMotionDetectors, (MOTION_DETECTION_CurrentSensorSettings_t* motionDetectors), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_ArmMotionDetector, (MOTION_DETECTION_Mode_t mode, std::string index), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_DisarmMotionDetector, (std::string index), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_IsMotionDetectorArmed, (std::string index, bool* armState), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_SetNoMotionPeriod, (std::string index, int period), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_GetNoMotionPeriod, (std::string index, unsigned int* period), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_SetSensitivity, (std::string index, std::string sensitivity, int inferredMode), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_GetSensitivity, (std::string index, char** sensitivity, int* currentMode), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_SetActivePeriod, (std::string index, MOTION_DETECTION_TimeRange_t timeSet), (override)); + MOCK_METHOD(MOTION_DETECTION_Result_t, MOTION_DETECTION_GetActivePeriod, (MOTION_DETECTION_TimeRange_t* timeSet), (override)); +}; diff --git a/ci/mocks/devicesettings/RtArrayObjectMock.h b/ci/mocks/devicesettings/RtArrayObjectMock.h new file mode 100644 index 00000000..670f03f4 --- /dev/null +++ b/ci/mocks/devicesettings/RtArrayObjectMock.h @@ -0,0 +1,31 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2022 RDK Management + * + * 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. + */ +#pragma once + +#include + +class rtArrayObjectMock : public rtArrayObjectImpl { +public: + virtual ~rtArrayObjectMock() = default; + + MOCK_METHOD(void, pushBack, (const char* v), (const, override)); + MOCK_METHOD(void, pushBack, (rtValue v), (const, override)); + + +}; diff --git a/ci/mocks/devicesettings/RtObjectBaseMock.h b/ci/mocks/devicesettings/RtObjectBaseMock.h new file mode 100644 index 00000000..564f6b10 --- /dev/null +++ b/ci/mocks/devicesettings/RtObjectBaseMock.h @@ -0,0 +1,34 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2022 RDK Management + * + * 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. + */ +#pragma once + +#include + +class rtObjectBaseMock : public rtObjectBaseImpl { +public: + virtual ~rtObjectBaseMock() = default; + + MOCK_METHOD(rtError, set, (const char* name, const char* value), (const, override)); + MOCK_METHOD(rtError, set, (const char* name, const rtValue& value), (const, override)); + MOCK_METHOD(rtError, set, (const char* name, bool value), (const, override)); + MOCK_METHOD(rtString, get, (const char* name), (const, override)); + MOCK_METHOD(rtError, sendReturns, (const char* messageName, rtString& result), (const, override)); + + +}; diff --git a/ci/mocks/devicesettings/RtObjectRefMock.h b/ci/mocks/devicesettings/RtObjectRefMock.h new file mode 100644 index 00000000..634a9e4c --- /dev/null +++ b/ci/mocks/devicesettings/RtObjectRefMock.h @@ -0,0 +1,33 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2022 RDK Management + * + * 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. + */ +#pragma once + +#include + +class rtObjectRefMock : public rtObjectRefImpl { +public: + virtual ~rtObjectRefMock() = default; + + MOCK_METHOD(rtError, send, (const char* messageName), (override)); + MOCK_METHOD(rtError, send, (const char* messageName, const char* method, rtFunctionCallback* callback), (override)); + MOCK_METHOD(rtError, send, (const char* messageName, const rtValue& arg1), (override)); + MOCK_METHOD(rtError, send, (const char* messageName, rtObjectRef& base), (override)); + + +}; diff --git a/ci/mocks/devicesettings/SleepModeMock.h b/ci/mocks/devicesettings/SleepModeMock.h new file mode 100644 index 00000000..dac4b8b8 --- /dev/null +++ b/ci/mocks/devicesettings/SleepModeMock.h @@ -0,0 +1,32 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +class SleepModeMock : public device::SleepModeImpl { +public: + virtual ~SleepModeMock() = default; + + MOCK_METHOD(device::SleepMode&, getInstanceById, (int id), (override)); + MOCK_METHOD(device::SleepMode&, getInstanceByName, (const std::string &name), (override)); + MOCK_METHOD(device::List, getSleepModes, (), (override)); + MOCK_METHOD(const std::string&, toString, (), (const, override)); +}; diff --git a/ci/mocks/devicesettings/VideoDFCMock.h b/ci/mocks/devicesettings/VideoDFCMock.h new file mode 100644 index 00000000..57bf7e44 --- /dev/null +++ b/ci/mocks/devicesettings/VideoDFCMock.h @@ -0,0 +1,32 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2025 RDK Management +* +* 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. +*/ + +#pragma once + +#include + +#include "VideoDFC.hpp" + +class VideoDFCMock : public device::VideoDFCImpl { +public: + virtual ~VideoDFCMock() = default; + + + MOCK_METHOD(const std::string&, getName, (), (const, override)); +}; diff --git a/ci/mocks/devicesettings/VideoDeviceMock.h b/ci/mocks/devicesettings/VideoDeviceMock.h new file mode 100644 index 00000000..09cc3e30 --- /dev/null +++ b/ci/mocks/devicesettings/VideoDeviceMock.h @@ -0,0 +1,39 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "host.hpp" + +class VideoDeviceMock : public device::VideoDeviceImpl { +public: + virtual ~VideoDeviceMock() = default; + + MOCK_METHOD(int, getFRFMode, (int* frfmode), (const, override)); + MOCK_METHOD(int, setFRFMode, (int frfmode), (const, override)); + MOCK_METHOD(int, getCurrentDisframerate, (char* framerate), (const, override)); + MOCK_METHOD(int, setDisplayframerate, (const char* framerate), (const, override)); + MOCK_METHOD(void, getHDRCapabilities, (int* capabilities), (override)); + MOCK_METHOD(void, getSettopSupportedResolutions, (std::list& resolutions), (override)); + MOCK_METHOD(void, setDFC, (std::string zoomSetting), (override)); + // MOCK_METHOD(const VideoDFC&, getDFC, (), (const, override)); + MOCK_METHOD(const device::VideoDFC&, getDFC, (), (override)); +}; diff --git a/ci/mocks/devicesettings/VideoOutputPortConfigMock.h b/ci/mocks/devicesettings/VideoOutputPortConfigMock.h new file mode 100644 index 00000000..202d5a92 --- /dev/null +++ b/ci/mocks/devicesettings/VideoOutputPortConfigMock.h @@ -0,0 +1,32 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "videoOutputPortConfig.hpp" + +class VideoOutputPortConfigImplMock : public device::VideoOutputPortConfigImpl { +public: + virtual ~VideoOutputPortConfigImplMock() = default; + + MOCK_METHOD(device::VideoOutputPortType&, getPortType, (int id), (override)); + MOCK_METHOD(device::VideoOutputPort&, getPort, (const std::string& name), (override)); +}; diff --git a/ci/mocks/devicesettings/VideoOutputPortMock.h b/ci/mocks/devicesettings/VideoOutputPortMock.h new file mode 100644 index 00000000..5296bd40 --- /dev/null +++ b/ci/mocks/devicesettings/VideoOutputPortMock.h @@ -0,0 +1,61 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "videoOutputPort.hpp" + +class VideoOutputPortMock : public device::VideoOutputPortImpl { +public: + virtual ~VideoOutputPortMock() = default; + + MOCK_METHOD(const device::VideoOutputPortType&, getType, (), (const, override)); + MOCK_METHOD(const std::string&, getName, (), (const, override)); + MOCK_METHOD(const device::VideoResolution&, getDefaultResolution, (), (const, override)); + MOCK_METHOD(int, getHDCPProtocol, (), (override)); + MOCK_METHOD(int, getHDCPReceiverProtocol, (), (override)); + MOCK_METHOD(int, getHDCPCurrentProtocol, (), (override)); + MOCK_METHOD(device::AudioOutputPort&, getAudioOutputPort, (), (const, override)); + MOCK_METHOD(bool, isDisplayConnected, (), (override)); + MOCK_METHOD(int, getHDCPStatus, (), (override)); + MOCK_METHOD(bool, isContentProtected, (), (override)); + MOCK_METHOD(device::Display&, getDisplay, (), (override)); + MOCK_METHOD(bool, setScartParameter, (std::string sScartParameter, std::string sScartParameterData), (override)); + MOCK_METHOD(void, getTVHDRCapabilities, (int* capabilities), (override)); + MOCK_METHOD(bool, setForceHDRMode, (dsHDRStandard_t mode), (override)); + MOCK_METHOD(int, getPreferredColorDepth, (bool persist), (override)); + MOCK_METHOD(void, getColorDepthCapabilities, (unsigned int* capabilities), (override)); + MOCK_METHOD(void, setPreferredColorDepth, (dsDisplayColorDepth_t colorDepth, bool persist), (override)); + MOCK_METHOD(bool, getCurrentOutputSettings, (int& videoEOTF, int& matrixCoefficients, int& colorSpace, int& colorDepth, int& quantizationRange), (override)); + MOCK_METHOD(bool, isConnected, (), (const, override)); + MOCK_METHOD(void, setResolution, (std::string resolution, bool persist, bool isIgnoreEdid), (override)); + MOCK_METHOD(const device::VideoResolution&, getResolution, (), (const, override)); + MOCK_METHOD(void, getSupportedTvResolutions, (int* tvResolutions), (override)); + MOCK_METHOD(int, getVideoEOTF, (), (override)); + MOCK_METHOD(bool, isActive, (), (override)); + MOCK_METHOD(void, setAllmEnabled, (bool enable), (override)); + MOCK_METHOD(int, GetHdmiPreference, (), (override)); + MOCK_METHOD(bool, SetHdmiPreference, (dsHdcpProtocolVersion_t hdcpProtocol), (override)); + MOCK_METHOD(int, getColorSpace, (), (const, override)); + MOCK_METHOD(int, getColorDepth, (), (const, override)); + MOCK_METHOD(int, getQuantizationRange, (), (const, override)); + MOCK_METHOD(bool, IsOutputHDR, (), (override)); +}; diff --git a/ci/mocks/devicesettings/VideoOutputPortTypeMock.h b/ci/mocks/devicesettings/VideoOutputPortTypeMock.h new file mode 100644 index 00000000..b65fbb67 --- /dev/null +++ b/ci/mocks/devicesettings/VideoOutputPortTypeMock.h @@ -0,0 +1,32 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "videoOutputPortType.hpp" + +class VideoOutputPortTypeMock : public device::VideoOutputPortTypeImpl { +public: + virtual ~VideoOutputPortTypeMock() = default; + + MOCK_METHOD(int, getId, (), (const, override)); + MOCK_METHOD(const device::List, getSupportedResolutions, (), (const, override)); +}; diff --git a/ci/mocks/devicesettings/VideoResolutionMock.h b/ci/mocks/devicesettings/VideoResolutionMock.h new file mode 100644 index 00000000..fe536353 --- /dev/null +++ b/ci/mocks/devicesettings/VideoResolutionMock.h @@ -0,0 +1,34 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "videoResolution.hpp" +#include "pixelResolution.hpp" + +class VideoResolutionMock : public device::VideoResolutionImpl { +public: + virtual ~VideoResolutionMock() = default; + + MOCK_METHOD(const std::string&, getName, (), (const, override)); + MOCK_METHOD(const device::PixelResolution&, getPixelResolution, (), (const, override)); + MOCK_METHOD(const device::FrameRate&, getFrameRate, (), (const, override)); +}; diff --git a/ci/mocks/mfrTypes.h b/ci/mocks/mfrTypes.h new file mode 100644 index 00000000..55ef63e5 --- /dev/null +++ b/ci/mocks/mfrTypes.h @@ -0,0 +1,651 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2016 RDK Management + * + * 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. +*/ + +/** + * @addtogroup HPK Hardware Porting Kit + * @{ + * @par The Hardware Porting Kit + * HPK is the next evolution of the well-defined Hardware Abstraction Layer + * (HAL), but augmented with more comprehensive documentation and test suites + * that OEM or SOC vendors can use to self-certify their ports before taking + * them to RDKM for validation or to an operator for final integration and + * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC + * vendor to self-certify their own Video Accelerator devices, with minimal RDKM + * assistance + * + */ +/** @defgroup MFR MFR Module + * @{ + */ +/** @defgroup MFR_HAL MFR HAL + * @{ + * @par Application API Specification + * MFR HAL provides an interface for reading and writing device serialization information and doing image flashing operations + */ + +/** @defgroup PLAT_MFR_DATA PLAT MFR DATA + * @{ + */ + +/** + * @file mfrTypes.h + * + * @brief MFR HAL header + * + * This file defines APIs, datatypes and error codes used by the MFR HAL + * + * @par Document + * Document reference. + * + * @par Open Issues (in no particular order) + * -# None + * + * @par Assumptions + * -# None + * + * @par Abbreviations + * - MFR: Manufacturer library + * - HDMI: High-Definition multimedia Interface + * - HDCP: High-Bandwidth digital content protection + * - MOCA: Multimedia over coax alliance + * - auth: Authentication + * - DTCP: Digital transmission content protection + * - CDL: Code download + * - RCDL: Remote code download + * - CA: Certificate authority + * - DVR: Digital video recording + * - SVN: Software version number + * - CRC: Cyclic redundancy check + * - oui: Organizationally unique identifier + * - DRI: Disaster recovery image + * - PDRI: Peripheral disaster recovery image + * - WIFI: Wireless fidelity + * - MAC: Media access control address + * - RF4CE: Radio frequency for consumer electronics + * - DTB: Device tree binary + * - PMI: Product manufacturer information + * - SOC: System on chip + * - TV: Television + * - BDRI: Backup disaster recovery image + * - CPD: Critical panel data + * - WB: White balancing + * - ALS: Ambient light sensor + * - LUX: Unit of luminance or illumination of a one metre square area + * - PCI: Peripheral component interconnect + * - AV: Audio video + * - TPV: TPV technology limited + * - FTA: Factory test app + * - WPS: Wi-Fi protected setup + */ + + +#ifndef _MFR_TYPES_H +#define _MFR_TYPES_H + +#include +#include +#include + + +/** + * @brief MFR status codes. + * + */ +typedef enum _mfrError_t +{ + mfrERR_NONE = 0, ///< Input output operation is successful + mfrERR_GENERAL = 0x1000, ///< Operation general error. This enum is deprecated + mfrERR_INVALID_PARAM, ///< Invalid argument is passed to the module + mfrERR_NOT_INITIALIZED, ///< Module is not initialised + mfrERR_OPERATION_NOT_SUPPORTED, ///< Not suppoted operation is performed + mfrERR_UNKNOWN, ///< Unknown error. This enum is deprecated + /* Please add Error Code here */ + mfrERR_MEMORY_EXHAUSTED, ///< Memory exhausted + mfrERR_SRC_FILE_ERROR, ///< File related errors + mfrERR_WRITE_FLASH_FAILED, ///< Flash write failed + mfrERR_UPDATE_BOOT_PARAMS_FAILED, ///< Boot params update failed + mfrERR_FAILED_CRC_CHECK, ///< CRC check failed + mfrERR_BAD_IMAGE_HEADER, ///< Bad image header error. Invalid Image(Not a valid image to flash in the partition) + mfrERR_IMPROPER_SIGNATURE, ///< Improper signature error. Invalidate section data available in the image + mfrERR_IMAGE_TOO_BIG, ///< Image too big error + mfrERR_FAILED_INVALID_SIGNING_TIME, ///< Invalid image signing time value + mfrERR_FAILED_INVALID_SVN, ///< Invalid SVN error + mfrERR_FAILED_IMAGE_SIGNING_TIME_OLDER, ///< Image signing time is older than expected. By comparing the signing time available in flash data with current image timing. return mfrERR_FAILED_IMAGE_SIGNING_TIME_OLDER flash signing image time is older + mfrERR_FAILED_IMAGE_SVN_OLDER, ///< SVN is older + mfrERR_FAILED_SAME_DRI_CODE_VERSION, ///< Same DRI trying to write again. Current DRI image is requested to flash again. If curren image is corrupted this operation will corrupt the alternate bank also + mfrERR_FAILED_SAME_PCI_CODE_VERSION, ///< Same PCI trying to write again. Current PCI image is requested to flash again. If curren image is corrupted this operation will corrupt the alternate bank also + mfrERR_IMAGE_FILE_OPEN_FAILED, ///< Not able to open image file + mfrERR_GET_FLASHED_IMAGE_DETAILS_FAILED, ///< Not able to retrieve the flashed image details + mfrERR_FLASH_VERIFY_FAILED, ///< Not able to verify the flash + mfrERR_ALREADY_INITIALIZED, ///< Module already initialised + mfrERR_FLASH_READ_FAILED, ///< Flash read failed + mfrERR_FLASH_SOFT_LOCK_FAILED, ///< Flash soft lock failed + mfrERR_TEMP_READ_FAILED, ///< Temperature read failed + mfrERR_MAX ///< Out of range - required to be the last item of the enum +} mfrError_t; + +/** + * @brief Serialization data + * + */ +typedef struct _mfrSerializedData_t +{ + char * buf; ///< Buffer containing the data + size_t bufLen; ///< Length of the data buffer + void (* freeBuf) (char *buf); ///< Function used to free the buffer. If NULL, the user does not need to free the buffer +} mfrSerializedData_t; + +/** + * @brief Serialization data types. All values are platform specific + * + * + * White balancing calibration for TV sources involves applying calibration to the linear playback streams. + * White balancing calibration for AV involves applying calibration specifically to the composite source + * + */ +typedef enum _mfrSerializedType_t +{ + mfrSERIALIZED_TYPE_MANUFACTURER = 0, ///< manufacture field. ASCII string + mfrSERIALIZED_TYPE_MANUFACTUREROUI, ///< manufacture oui field. HEX string value + mfrSERIALIZED_TYPE_MODELNAME, ///< model name field. ASCII string + mfrSERIALIZED_TYPE_DESCRIPTION, ///< description field. ASCII string + mfrSERIALIZED_TYPE_PRODUCTCLASS, ///< product class field. ASCII string + mfrSERIALIZED_TYPE_SERIALNUMBER, ///< serial number field. Alphanumerical string value + mfrSERIALIZED_TYPE_HARDWAREVERSION, ///< Hardware version field. String value + mfrSERIALIZED_TYPE_SOFTWAREVERSION, ///< software field. Decimal stirng value + mfrSERIALIZED_TYPE_PROVISIONINGCODE, ///< provisioning code field. String value + mfrSERIALIZED_TYPE_FIRSTUSEDATE, ///< first use date field. String value + mfrSERIALIZED_TYPE_DEVICEMAC, ///< device mac field. HEX string MAC value separated with colon + mfrSERIALIZED_TYPE_MOCAMAC, ///< MOCA mac field. HEX string MAC value separated with colon + mfrSERIALIZED_TYPE_HDMIHDCP, ///< HDMI HDCP field. String value + + mfrSERIALIZED_TYPE_PDRIVERSION, ///< PDRI version field. It provide the primary Disaster Recovery Image version information + mfrSERIALIZED_TYPE_WIFIMAC, ///< wifi mac field. HEX string MAC value separated with colon + mfrSERIALIZED_TYPE_BLUETOOTHMAC, ///< bluetooth MAC field. HEX string MAC value separated with colon + mfrSERIALIZED_TYPE_WPSPIN, ///< WPS PIN filed. Decimal string + mfrSERIALIZED_TYPE_MANUFACTURING_SERIALNUMBER, ///< manufacturing serial number field. Alphanumerical string value + mfrSERIALIZED_TYPE_ETHERNETMAC, ///< ethernet MAC field. HEX string MAC value separated with colon + mfrSERIALIZED_TYPE_ESTBMAC, ///< estb mac field. HEX string MAC value separated with colon. Device MAC is same as the ethernet (mfrSERIALIZED_TYPE_ETHERNETMAC) mac + mfrSERIALIZED_TYPE_RF4CEMAC, ///< RF4CE MAC field. HEX string MAC value separated with colon + + mfrSERIALIZED_TYPE_PROVISIONED_MODELNAME, ///< provisioned model name field + mfrSERIALIZED_TYPE_PMI, ///< PMI field. Alphanumerical string value of the model + mfrSERIALIZED_TYPE_HWID, ///< hardware ID field. HEX sting value of hardware id + mfrSERIALIZED_TYPE_MODELNUMBER, ///< Model number field. HEX sting value of model number + /* boot data */ + mfrSERIALIZED_TYPE_SOC_ID, ///< SOC id field. String value + mfrSERIALIZED_TYPE_IMAGENAME, ///< image name field. Alphanumerical name of the monolitic image flashed + mfrSERIALIZED_TYPE_IMAGETYPE, ///< image type field. Alphanumerical type name of the image. Eg: PC1 + mfrSERIALIZED_TYPE_BLVERSION, ///< boot loader version field. Boot loader version value separated with dots. Eg: 6.9.7 + /* provisional data */ + mfrSERIALIZED_TYPE_REGION, ///< region field. String value + /* other data */ + mfrSERIALIZED_TYPE_BDRIVERSION, ///< BDRI version field. It provide the Backup DRI version information + + /* led data */ + mfrSERIALIZED_TYPE_LED_WHITE_LEVEL, ///< led white level field. String value + mfrSERIALIZED_TYPE_LED_PATTERN, ///< led pattern field. String value + mfrSERIALIZED_TYPE_MAX, ///< Out of range - required to be the last item of the enum +#ifdef PANEL_SERIALIZATION_TYPES + //As MFR HAL is a precompiled binary across all existing platforms, a distinct region is allocated for panel-based enums, beginning at 0x51. + //This approach allows us to utilize the same type field for corresponding APIs. + mfrSERIALIZED_TYPE_COREBOARD_SERIALNUMBER=0x51, ///< core board serial number field + mfrSERIALIZED_TYPE_FACTORYBOOT, ///< factory boot field. String value + mfrSERIALIZED_TYPE_COUNTRYCODE, ///< country code field. To configure country code + mfrSERIALIZED_TYPE_LANGUAGECODE, ///< language code field.To configure language code + mfrSERIALIZED_TYPE_MANUFACTURERDATA, ///< manufacture data field. To configure HDCP filename, PCBA serial number, project id, logo, device lock information + mfrSERIALIZED_TYPE_CPD_SIZE, ///< CPD size field. It represent the Size of the Critical panel data + mfrSERIALIZED_TYPE_PANEL_ID, ///< panel id field. It is unique ID to represent the each unique version(ex: 43", 55" inches etc) of panel + mfrSERIALIZED_TYPE_PANEL_TYPE, ///< panel type field. Its unique id mapped with each panel ID + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_NORMAL, ///< HDMI WB data normal field. Standard colour temperature in HDMI source, to adjust r,g,b gain equally to achieve accurate color reproduction. + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_COLD, ///< HDMI WB data cold field. COLD colour temperature in HDMI source, to adjust the blue gain alone to achieve blueish color pattern + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_WARM, ///< HDMI WB data warm field. WARM colour temperature in HDMI source, to adjust the red gain alone to achieve reddish colour pattern + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_USER, ///< HDMI WB data user field. User can change the picture modes as per their requirement in USER colour temperature mode + mfrSERIALIZED_TYPE_PANEL_TV_WB_DATA_NORMAL, ///< panel TV WB data normal field Standard colour temperature in TV source, to adjust r,g,b gain equally to achieve accurate color reproduction. Applicable for linear playback streams + mfrSERIALIZED_TYPE_PANEL_TV_WB_DATA_COLD, ///< panel TV WB data cold field. COLD colour temperature in TV source, to adjust the blue gain alone to to achieve blueish color pattern. Applicable for linear playback streams + mfrSERIALIZED_TYPE_PANEL_TV_WB_DATA_WARM, ///< panel TV WB data warm field. WARM colour temperature in TV source, to adjust the red gain alone to to achieve reddish colour pattern. Applicable for linear playback streams + mfrSERIALIZED_TYPE_PANEL_TV_WB_DATA_USER, ///< panel TV WB data user field. User can change the picture modes as per their requirement in USER colour temperature mode. Applicable for linear playback streams + mfrSERIALIZED_TYPE_PANEL_AV_WB_DATA_NORMAL, ///< panel AV WB data normal field what is the difference between TV and AV white balance here. TV targets for Linear playback source and For AV target composite source. Applicable for composite source + mfrSERIALIZED_TYPE_PANEL_AV_WB_DATA_COLD, ///< panel AV WB data cold field. COLD colour temperature in AV source, to adjust the blue gain alone to to achieve blueish color pattern. Applicable for composite source + mfrSERIALIZED_TYPE_PANEL_AV_WB_DATA_WARM, ///< panel AV WB data warm field. WARM colour temperature in AV source, to adjust the red gain alone to to achieve reddish colour pattern. Applicable for composite source + mfrSERIALIZED_TYPE_PANEL_AV_WB_DATA_USER, ///< panel AV WB data user field. User can change the picture modes as per their requirement in USER colour temperature mode. Applicable for composite source + mfrSERIALIZED_TYPE_PANEL_DTB_VERSION, ///< Version of the device tree binary(DTB) + mfrSERIALIZED_TYPE_PANEL_DTB_DATA_SIZE, ///< Size of the device tree binary(DTB) + mfrSERIALIZED_TYPE_PANEL_DTB_DATA, ///< panel DTB data. The DTB file contains a binary-formatted flattened device tree data + + /* panel data*/ + mfrSERIALIZED_TYPE_PANEL_DATA_FUNCTION_STATUS, + mfrSERIALIZED_TYPE_PANEL_DATA_AGEING_TIME, + mfrSERIALIZED_TYPE_PANEL_DATA_POWER_ON_TIME, + mfrSERIALIZED_TYPE_PANEL_DATA_BACKLIGHT_TIME, + mfrSERIALIZED_TYPE_PANEL_DATA_VALID, + mfrSERIALIZED_TYPE_PANEL_DATA_TPV_APP_VERSION, + mfrSERIALIZED_TYPE_PANEL_ALS_CALIBRATION_INDEX0, + mfrSERIALIZED_TYPE_PANEL_ALS_CALIBRATION_INDEX1, + /*Gamma data*/ + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_NORMAL, + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_COLD, + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_WARM, + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_BOOST_NORMAL, + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_BOOST_COLD, + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_BOOST_WARM, + /*WB data boost*/ + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_BOOST_NORMAL, + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_BOOST_COLD, + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_BOOST_WARM, + /*Tmax*/ + mfrSERIALIZED_TYPE_PANEL_PEAK_BRIGHTNESS_NONBOOST, + mfrSERIALIZED_TYPE_PANEL_PEAK_BRIGHTNESS_BOOST, + mfrSERIALIZED_TYPE_PANEL_PEAK_BRIGHTNESS_BURST, + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_SUPERCOLD, + mfrSERIALIZED_TYPE_PANEL_HDMI_WB_DATA_BOOST_SUPERCOLD, + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_SUPERCOLD, + mfrSERIALIZED_TYPE_PANEL_GAMMA_CALIBRATED_BOOST_SUPERCOLD, + mfrSERIALIZED_TYPE_PANEL_MAX, +#endif + mfrSERIALIZED_TYPE_SKYMODELNAME = 8000, //Sky specific MFRLib flags + mfrSERIALIZED_TYPE_DE_SERIAL_PREFIX, //Sky specific MFRLib flags +} mfrSerializedType_t; + + +/** + * @brief MFR image types + * + */ +typedef enum _mfrImageType_t +{ + mfrIMAGE_TYPE_CDL, ///< CDL image type + mfrIMAGE_TYPE_RCDL, ///< RCDL image type. + mfrUPGRADE_IMAGE_MONOLITHIC, ///< Monolithic image type + mfrUPGRADE_IMAGE_PACKAGEHEADER, ///< Package header image type + mfrIMAGE_TYPE_MAX, ///< Out of range - required to be the last item of the enum +} mfrImageType_t; + + +/** + * @brief MFR image write progress status + * + */ + typedef enum _mfrUpgradeProgress_t + { + mfrUPGRADE_PROGRESS_NOT_STARTED = 0, ///< not started + mfrUPGRADE_PROGRESS_STARTED, ///< in progress + mfrUPGRADE_PROGRESS_ABORTED, ///< failed + mfrUPGRADE_PROGRESS_VERIFYING, ///< Verifying + mfrUPGRADE_PROGRESS_FLASHING, ///< Flashing + mfrUPGRADE_PROGRESS_REBOOTING, ///< Rebooting + mfrUPGRADE_PROGRESS_COMPLETED, ///< success + mfrUPGRADE_PROGRESS_MAX ///< Out of range - required to be the last item of the enum + } mfrUpgradeProgress_t; + + +/** + * @brief MFR boot loader patterns + * + */ +typedef enum _mfrBlPattern_t +{ + mfrBL_PATTERN_NORMAL = 0, ///< normal boot loader pattern. This Boot pattern enable both LOGO as well LED ON during boot up + mfrBL_PATTERN_SILENT, ///< silent boot loader pattern. Keep the led off + mfrBL_PATTERN_SILENT_LED_ON, ///< silent LED on pattern. This Boot pattern enable only LED and disable LOGO during this boot up + mfrBL_PATTERN_LOGO_DISABLED, ///< Logo is disabled + mfrBL_PATTERN_MAX, ///< Out of range - required to be the last item of the enum +} mfrBlPattern_t; + +/** + * @brief MFR image upgrade status + * + */ +typedef struct _mfrUpgradeStatus_t +{ + mfrUpgradeProgress_t progress; ///< MFR upgrade progress status. @see mfrUpgradeProgress_t + mfrError_t error; ///< Error @see mfrError_t + char error_string[32]; ///< Error string + int percentage; ///< MFR upgrade percentage +} mfrUpgradeStatus_t; + +/** + * @brief MFR image upgrade status notify stucture + * + */ +typedef struct _mfrUpgradeStatusNotify_t +{ + void * cbData; ///< Upgrade status notify call back data + void (*cb) (mfrUpgradeStatus_t * status); ///< Upgrade status notify call back + int interval; ///< number of seconds between two callbacks. 0 means invoking callback only once to report final upgrade result +} mfrUpgradeStatusNotify_t; + +/** + * @brief Initializes the MFR library + * + * This function will initialize all the respective internal components responsible for MFR functionalities. + * This API need to be called before any other APIs in this module@n + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_ALREADY_INITIALIZED - Module is already initialised + * @retval mfrERR_MEMORY_EXHAUSTED - memory allocation failure + * + * @warning This API is Not thread safe + * + */ +mfrError_t mfr_init( void ); + +/** + * @brief Initialize the mfr partition. + * + * mfr_init invokes this mfr_partition_init. + * This function should be call once before accessing serialized data. + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_ALREADY_INITIALIZED - Module is already initialised + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. +*/ +mfrError_t mfr_partition_init(void); + +/** + * @brief Uninitializes the MFR library + * + * This function will uninitialize all the respective internal components responsible for MFR functionalities. + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * + * @warning This API is Not thread safe + * + */ +mfrError_t mfr_term( void ); + +/** + * @brief Retrieves serialized Read-Only data from device + * + * + * @param [in] type : specifies the serialized data type to be read. @see mfrSerializedType_t + * @param [in] data : serialized data for the specific type requested. (buffer location, length, and func to free the buffer). @see mfrSerializedData_t + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_INVALID_PARAM - Parameter passed to this function is invalid + * @retval mfrERR_MEMORY_EXHAUSTED - memory allocation failure + * @retval mfrERR_FAILED_CRC_CHECK - CRC check failed + * @retval mfrERR_FLASH_READ_FAILED - Flash read failed + * + * @note The serialized data is returned as a byte stream. It is upto the application to deserialize and make sense of the data returned. + * Even if the serialized data returned is "string", the buffer is not required to contain the null-terminator + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. + * @warning This API is Not thread safe + * + */ +mfrError_t mfrGetSerializedData( mfrSerializedType_t type, mfrSerializedData_t *data ); + +/** + * @brief Sets the read write Serialization data on device + * + * @param [in] type : specifies the serialized data type to write. @see mfrSerializedType_t + * @param [in] data : serialized data to set for the specific type requested. (buffer location, length, and func to free the buffer). @see mfrSerializedData_t + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_INVALID_PARAM - Parameter passed to this function is invalid + * @retval mfrERR_MEMORY_EXHAUSTED - memory allocation failure + * @retval mfrERR_FAILED_CRC_CHECK - CRC check failed + * @retval mfrERR_WRITE_FLASH_FAILED - Flash write failed + * @retval mfrERR_FLASH_READ_FAILED - Flash read failed + * @retval mfrERR_FLASH_VERIFY_FAILED - Flash verification failed + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. + * @warning This API is Not thread safe + * + */ +mfrError_t mfrSetSerializedData( mfrSerializedType_t type, mfrSerializedData_t *data); + +/** + * @brief Writes the image into flash + * + * The process should follow these major steps: + * 1) Verify the validity of the image and flash + * 2) Update boot params and switch banks to prepare for a reboot event + * 3) All upgrades should be done in the alternate bank. The current bank should not be disturbed + * + * State Transition: + * 0) Before the API is invoked, the Upgrade process should be in PROGRESS_NOT_STARTED state + * 1) After the API returns with success, the Upgrade process moves to PROGRESS_STARTED state + * 2) After the API returns with error, the Upgrade process stays in PROGRESS_NOT_STARTED state. Notify function will not be invoked + * 3) The notify function is called at regular interval with process = PROGRESS_STARTED + * 4) The last invocation of notify function should have either progress = PROGRESS_COMPLETED or progress = PROGRESS_ABORTED with error code set + * + * @note mfrWriteImage() should work without any issue when device transition to DEEPSLEEP state and Wakeup. During DEEPSLEEP state processor will + * cache all the pc and stack state and will enter to low power state. On wakeup system will use the saved pc and stack and resume from the same point. + * + * @param [in] name : the filename of the image file + * @param [in] path : the path of the image file in the file system + * @param [in] type : the type (format, signature type) of the image. This can dictate the handling of the image within the MFR library. @see mfrImageType_t + * @param[in] notify: function to provide status of the image flashing process. @see mfrUpgradeStatusNotify_t + * + * + * @return mfrError_t - Status + * + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_INVALID_PARAM - Parameter passed to this function is invalid + * @retval mfrERR_MEMORY_EXHAUSTED - memory allocation failure + * @retval mfrERR_FAILED_CRC_CHECK - CRC is failed + * @retval mfrERR_WRITE_FLASH_FAILED - Flash write failed + * @retval mfrERR_FLASH_VERIFY_FAILED - Flash verification failed + * @retval mfrERR_BAD_IMAGE_HEADER - Image header is corrupted + * @retval mfrERR_IMPROPER_SIGNATURE - Image signature is invalid + * @retval mfrERR_IMAGE_TOO_BIG - Image size is more than allocated maximum + * @retval mfrERR_FAILED_INVALID_SIGNING_TIME - Image signing time invalid + * @retval mfrERR_FAILED_IMAGE_SVN_OLDER - software version number is older than existing image + * @retval mfrERR_FAILED_SAME_DRI_CODE_VERSION - DRI code version is same + * @retval mfrERR_FAILED_SAME_PCI_CODE_VERSION - PCI code version is same + * @retval mfrERR_IMAGE_FILE_OPEN_FAILED - Not able to open the input image file + * @retval mfrERR_GET_FLASHED_IMAGE_DETAILS_FAILED - Not able to get the current image version details + * + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. . + * @warning This API is Not thread safe + * + */ +mfrError_t mfrWriteImage(const char *name, const char *path, mfrImageType_t type, mfrUpgradeStatusNotify_t notify); + +/** + * @brief Deletes the PDRI image if it is present + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_WRITE_FLASH_FAILED - Flash write failed + * @retval mfrERR_FLASH_VERIFY_FAILED - Flash verification failed + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. + * @warning This API is Not thread safe + * + */ +mfrError_t mfrDeletePDRI(void); + +/** + * @brief Deletes the platform images. Deletes the main image from primary and secondary bank + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_WRITE_FLASH_FAILED - Flash write failed + * @retval mfrERR_FLASH_VERIFY_FAILED - Flash verification failed + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. + * @warning This API is Not thread safe + * + */ +mfrError_t mfrScrubAllBanks(void); + +/** + * @brief Sets bootloader LED pattern + * + * This function stores the bootup pattern in the persistance storage for bootloader to read + * and control the front panel LED and/or TV backlight sequence on bootup + * + * @param [in] pattern : options are defined by enum mfrBlPattern_t. @see mfrBlPattern_t + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_INVALID_PARAM - Parameter passed to this function is invalid + * @retval mfrERR_WRITE_FLASH_FAILED - Flash write failed + * @retval mfrERR_FLASH_VERIFY_FAILED - Flash verification failed + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. + * @warning This API is Not thread safe + * + */ +mfrError_t mfrSetBootloaderPattern(mfrBlPattern_t pattern); + +/** + * @brief API to update Primary Splash screen Image and to override the default the Splash screen image + * + * @param [in] path : char pointer which holds the path of input bootloader OSD image. + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_INVALID_PARAM - Parameter passed to this function is invalid + * @retval mfrERR_IMAGE_FILE_OPEN_FAILED - Failed to open the downloaded splash screen file + * @retval mfrERR_MEMORY_EXHAUSTED - memory allocation failure + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. + * @warning This API is Not thread safe + * + */ +mfrError_t mfrSetBlSplashScreen(const char *path); + +/** + * @brief API to clear the primary Splash screen Image and to make + * use of default Splash screen image + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_IMAGE_FILE_OPEN_FAILED - Failed to open the downloaded splash screen file + * @retval mfrERR_MEMORY_EXHAUSTED - memory allocation failure + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return mfrERR_NOT_INITIALIZED. + * @warning This API is Not thread safe + * + */ +mfrError_t mfrClearBlSplashScreen(void); + +/** +* @brief API to retrive the secure time from TEE +* +* @param [in] params : unit32 timeptr to get the UTC time in seconds +* +* @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails +*/ +mfrError_t mfrGetSecureTime(uint32_t *timeptr); + +/** +* @brief API to set the secure time from TEE +* +* @param [in] params : unit32 timeptr to set the UTC time in seconds +* +* @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails +*/ +mfrError_t mfrSetSecureTime(uint32_t *timeptr); + + +/** + * @brief API to set the fsr flag into the emmc raw area + * + * @param [in] params : uint16_t fsrflag to set the FSR flag + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @retval mfrERR_INVALID_PARAM - Parameter passed to this function is invalid + * @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails + * + **/ +mfrError_t mfrSetFSRflag(uint16_t *newFsrFlag); + +/** + * @brief API to get the fsr flag from emmc + * + * @param [in] params : uint16_t fsrflag to get the FSR flag + * + * @return mfrError_t - Status + * @retval mfrERR_NONE - Success + * @retval mfrERR_INVALID_PARAM - Parameter passed to this function is invalid + * @retval mfrERR_NOT_INITIALIZED - Module is not initialised + * @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails + * + **/ +mfrError_t mfrGetFSRflag(uint16_t *newFsrFlag); + +/** +* @brief API to retrive the secure time from TEE +* +* @param [in] params : unit32 timeptr to get the UTC time in seconds +* +* @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails +*/ +mfrError_t mfrGetSecureTime(uint32_t *timeptr); + +/** +* @brief API to set the secure time from TEE +* +* @param [in] params : unit32 timeptr to set the UTC time in seconds +* +* @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails +*/ +mfrError_t mfrSetSecureTime(uint32_t *timeptr); + + +/** +* @brief API to set the fsr flag into the emmc raw area +* +* @param [in] params : unit32 fsrflag to set the FSR flag +* +* @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails +*/ +mfrError_t mfrSetFSRflag(uint16_t *newFsrFlag); + + +/** +* @brief API to get the fsr flag from emmc +* +* @param [in] params : unit32 fsrflag to get the FSR flag +* +* @return Error Code: Return mfrERR_NONE if operation is successful, mfrERR_GENERAL if it fails +*/ +mfrError_t mfrGetFSRflag(uint16_t *newFsrFlag); + +#endif + +/** @} */ // End of PLAT_MFR_DATA +/** @} */ // End of MFR_HAL +/** @} */ // End of MFR Module +/** @} */ // End of HPK diff --git a/ci/mocks/secure_wrappermock.h b/ci/mocks/secure_wrappermock.h new file mode 100755 index 00000000..37dd7a2e --- /dev/null +++ b/ci/mocks/secure_wrappermock.h @@ -0,0 +1,37 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once +#include +#include + +# ifdef __cplusplus +extern "C" { +# endif + + +FILE *v_secure_popen(const char *direction, const char *command, ...); + +int v_secure_pclose(FILE *); + +int v_secure_system(const char *command, ...); + +# ifdef __cplusplus +} +# endif diff --git a/ci/mocks/thunder/COMLinkMock.h b/ci/mocks/thunder/COMLinkMock.h new file mode 100644 index 00000000..48930142 --- /dev/null +++ b/ci/mocks/thunder/COMLinkMock.h @@ -0,0 +1,50 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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 RDKSERVICES_TESTS_MOCKS_COMLINKMOCK_H_ +#define RDKSERVICES_TESTS_MOCKS_COMLINKMOCK_H_ + +#include + +#include "Module.h" + +#ifndef USE_THUNDER_R4 +class COMLinkMock : public WPEFramework::PluginHost::IShell::ICOMLink { +public: + virtual ~COMLinkMock() = default; + + MOCK_METHOD(void, Register, (WPEFramework::RPC::IRemoteConnection::INotification*), (override)); + MOCK_METHOD(void, Unregister, (WPEFramework::RPC::IRemoteConnection::INotification*), (override)); + MOCK_METHOD(WPEFramework::RPC::IRemoteConnection*, RemoteConnection, (const uint32_t), (override)); + MOCK_METHOD(void*, Instantiate, (const WPEFramework::RPC::Object&, const uint32_t, uint32_t&, const string&, const string&), (override)); +}; +#else +class COMLinkMock : public WPEFramework::PluginHost::IShell::ICOMLink { +public: + virtual ~COMLinkMock() = default; + + MOCK_METHOD(void, Register, (WPEFramework::RPC::IRemoteConnection::INotification*), (override)); + MOCK_METHOD(void, Unregister, (const WPEFramework::RPC::IRemoteConnection::INotification*), (override)); + MOCK_METHOD(void, Register, (INotification*), (override)); + MOCK_METHOD(void, Unregister, (INotification*), (override)); + MOCK_METHOD(WPEFramework::RPC::IRemoteConnection*, RemoteConnection, (const uint32_t), (override)); + MOCK_METHOD(void*, Instantiate, (const WPEFramework::RPC::Object&, const uint32_t, uint32_t&), (override)); +}; +#endif /* ! USE_THUNDER_R4 */ +#endif //RDKSERVICES_TESTS_MOCKS_COMLINKMOCK_H_ diff --git a/ci/mocks/thunder/Communicator.cpp b/ci/mocks/thunder/Communicator.cpp new file mode 100755 index 00000000..2bb1bceb --- /dev/null +++ b/ci/mocks/thunder/Communicator.cpp @@ -0,0 +1,30 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2025 RDK Management +* +* 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. +*/ + +#include "Communicator.h" +#include + +ICommunicatorClient* WPEFramework::RPC::CommunicatorClient::impl = nullptr; + +void WPEFramework::RPC::CommunicatorClient::setImpl(ICommunicatorClient* newImpl) +{ + // Handles both resetting 'impl' to nullptr and assigning a new value to 'impl' + EXPECT_TRUE ((nullptr == impl) || (nullptr == newImpl)); + impl = newImpl; +} diff --git a/ci/mocks/thunder/Communicator.h b/ci/mocks/thunder/Communicator.h new file mode 100755 index 00000000..5d0524b8 --- /dev/null +++ b/ci/mocks/thunder/Communicator.h @@ -0,0 +1,286 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2025 RDK Management +* +* 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 __COM_PROCESSLAUNCH_H +#define __COM_PROCESSLAUNCH_H + +#include +#include "Proxy.h" +#include "NodeId.h" +#include "IPCConnector.h" + +using std::string; +const uint32_t CommunicationTimeOut = 3000; + +class ICommunicatorClient { +public: + virtual ~ICommunicatorClient() = default; + virtual uint32_t Open(const uint32_t waitTime) = 0; + virtual void* Open(const std::string& className, const uint32_t version, const uint32_t waitTime) = 0; + virtual void* Acquire(const uint32_t waitTime, const std::string& className, const uint32_t versionId) = 0; + virtual uint32_t Offer(void* offer, const uint32_t version, const uint32_t waitTime) = 0; + virtual uint32_t Revoke(void* offer, const uint32_t version, const uint32_t waitTime) = 0; + virtual uint32_t Close(const uint32_t waitTime) = 0; + virtual void* Acquire(const std::string& className, const uint32_t interfaceId, const uint32_t versionId) = 0; +}; + +namespace WPEFramework { +namespace RPC { + class Object { + public: + enum class HostType { + LOCAL, + DISTRIBUTED, + CONTAINER + }; + + Object() + : _locator() + , _className() + , _callsign() + , _interface(~0) + , _version(~0) + , _user() + , _group() + , _threads() + , _priority() + , _type(HostType::LOCAL) + , _systemRootPath() + , _remoteAddress() + , _configuration() + { + } + Object(const Object& copy) + : _locator(copy._locator) + , _className(copy._className) + , _callsign(copy._callsign) + , _interface(copy._interface) + , _version(copy._version) + , _user(copy._user) + , _group(copy._group) + , _threads(copy._threads) + , _priority(copy._priority) + , _type(copy._type) + , _systemRootPath(copy._systemRootPath) + , _remoteAddress(copy._remoteAddress) + , _configuration(copy._configuration) + { + } + Object(const string& locator, + const string& className, + const string& callsign, + const uint32_t interface, + const uint32_t version, + const string& user, + const string& group, + const uint8_t threads, + const int8_t priority, + const HostType type, + const string& systemRootPath, + const string& remoteAddress, + const string& configuration) + : _locator(locator) + , _className(className) + , _callsign(callsign) + , _interface(interface) + , _version(version) + , _user(user) + , _group(group) + , _threads(threads) + , _priority(priority) + , _type(type) + , _systemRootPath(systemRootPath) + , _remoteAddress(remoteAddress) + , _configuration(configuration) + { + } + ~Object() + { + } + + Object& operator=(const Object& RHS) + { + _locator = RHS._locator; + _className = RHS._className; + _callsign = RHS._callsign; + _interface = RHS._interface; + _version = RHS._version; + _user = RHS._user; + _group = RHS._group; + _threads = RHS._threads; + _priority = RHS._priority; + _systemRootPath = RHS._systemRootPath; + _type = RHS._type; + _remoteAddress = RHS._remoteAddress; + _configuration = RHS._configuration; + + return (*this); + } + + public: + inline const string& Locator() const + { + return (_locator); + } + inline const string& ClassName() const + { + return (_className); + } + inline const string& Callsign() const + { + return (_callsign); + } + inline uint32_t Interface() const + { + return (_interface); + } + inline uint32_t Version() const + { + return (_version); + } + inline const string& User() const + { + return (_user); + } + inline const string& Group() const + { + return (_group); + } + inline uint8_t Threads() const + { + return (_threads); + } + inline int8_t Priority() const + { + return (_priority); + } + inline HostType Type() const + { + return (_type); + } + inline const string& SystemRootPath() const + { + return (_systemRootPath); + } + inline const Core::NodeId RemoteAddress() const + { + return (Core::NodeId(_remoteAddress.c_str())); + } + inline const string& Configuration() const + { + return (_configuration); + } + + private: + string _locator; + string _className; + string _callsign; + uint32_t _interface; + uint32_t _version; + string _user; + string _group; + uint8_t _threads; + int8_t _priority; + HostType _type; + string _systemRootPath; + string _remoteAddress; + string _configuration; + }; + + class CommunicatorClient{ + protected: + static ICommunicatorClient* impl; + + public: + class Source { + bool IsOpen() const + { + return true; + } + }; + CommunicatorClient() = delete; + CommunicatorClient(CommunicatorClient&&) = delete; + CommunicatorClient(const CommunicatorClient&) = delete; + CommunicatorClient& operator=(CommunicatorClient&&) = delete; + CommunicatorClient& operator=(const CommunicatorClient&) = delete; + + static void setImpl(ICommunicatorClient* newImpl); + + CommunicatorClient(const Core::NodeId& remoteNode) { + //Mock CommunicatorClient constructor. + } + + CommunicatorClient(const Core::NodeId& remoteNode, const Core::ProxyType& handler) { + //Mock CommunicatorClient constructor. + } + + ~CommunicatorClient() { + } + + public: + inline uint32_t ConnectionId() const { + return _connectionId; + } + + // Open a communication channel with this process, no need for an initial exchange + uint32_t Open(const uint32_t waitTime) + { + return impl->Open(waitTime); + } + template + INTERFACE* Open(const std::string& className, const uint32_t version = static_cast(~0), const uint32_t waitTime = CommunicationTimeOut) + { + return static_cast(impl->Open(className, version, waitTime)); + } + template + INTERFACE* Acquire(const uint32_t waitTime, const std::string& className, const uint32_t versionId) + { + return static_cast(impl->Acquire(waitTime, className, versionId)); + } + template + uint32_t Offer(INTERFACE* offer, const uint32_t version = static_cast(~0), const uint32_t waitTime = CommunicationTimeOut) + { + return static_cast(impl->Offer(static_cast(offer), version, CommunicationTimeOut)); + } + template + uint32_t Revoke(INTERFACE* offer, const uint32_t version = static_cast(~0), const uint32_t waitTime = CommunicationTimeOut) + { + return static_cast(impl->Revoke(static_cast(offer), version, CommunicationTimeOut)); + } + uint32_t Close(const uint32_t waitTime) + { + if (impl) + return impl->Close(waitTime); + return Core::ERROR_GENERAL; + } + virtual void* Acquire(const std::string& className, const uint32_t interfaceId, const uint32_t versionId) + { + return impl->Acquire(className, interfaceId, versionId); + } + protected: + void StateChange() { + //Mock CommunicatorClient StateChange is calling. + } + private: + uint32_t _connectionId; + }; +} +} +#endif // __COM_PROCESSLAUNCH_H + diff --git a/ci/mocks/thunder/CommunicatorMock.h b/ci/mocks/thunder/CommunicatorMock.h new file mode 100755 index 00000000..60bfdcef --- /dev/null +++ b/ci/mocks/thunder/CommunicatorMock.h @@ -0,0 +1,53 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2025 RDK Management +* +* 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. +*/ + +#pragma once + +#include +#include "Communicator.h" + +#if 0 +class CommunicatorClientMock : public ICommunicatorClient +{ +public: + virtual ~CommunicatorClientMock() = default; + + MOCK_METHOD(uint32_t, Open, (const uint32_t waitTime), (override)); + MOCK_METHOD(INTERFACE*, Open, (const std::string& className, const uint32_t version, const uint32_t waitTime), (override)); + MOCK_METHOD(INTERFACE*, Acquire, (const uint32_t waitTime, const std::string& className, const uint32_t versionId), (override)); + MOCK_METHOD(uint32_t, Offer, (INTERFACE* offer, const uint32_t version, const uint32_t waitTime), (override)); + MOCK_METHOD(uint32_t, Revoke, (INTERFACE* offer, const uint32_t version, const uint32_t waitTime), (override)); + MOCK_METHOD(uint32_t, Close, (const uint32_t waitTime), (override)); +}; +#else +class CommunicatorClientMock : public ICommunicatorClient { +public: + virtual ~CommunicatorClientMock() = default; + MOCK_METHOD(void, AddRef, (), (const)); + MOCK_METHOD(uint32_t, Release, (), (const)); + MOCK_METHOD(uint32_t, Open, (const uint32_t waitTime), (override)); + MOCK_METHOD(void*, Open, (const std::string& className, const uint32_t version, const uint32_t waitTime), (override)); + MOCK_METHOD(void*, Acquire, (const uint32_t waitTime, const std::string& className, const uint32_t versionId), (override)); + MOCK_METHOD(uint32_t, Offer, (void* offer, const uint32_t version, const uint32_t waitTime), (override)); + MOCK_METHOD(uint32_t, Revoke, (void* offer, const uint32_t version, const uint32_t waitTime), (override)); + MOCK_METHOD(uint32_t, Close, (const uint32_t waitTime), (override)); + MOCK_METHOD(void*, Acquire, (const std::string& className, const uint32_t interfaceId, const uint32_t versionId), (override)); +}; + +#endif diff --git a/ci/mocks/thunder/DispatcherMock.h b/ci/mocks/thunder/DispatcherMock.h new file mode 100644 index 00000000..fdc40b63 --- /dev/null +++ b/ci/mocks/thunder/DispatcherMock.h @@ -0,0 +1,55 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2023 RDK Management + * + * 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 DISPATCHERMOCK_H +#define DISPATCHERMOCK_H + +#include + +#include "Module.h" + +#ifndef USE_THUNDER_R4 + class DispatcherMock: public WPEFramework::PluginHost::IDispatcher{ + public: + virtual ~DispatcherMock() = default; + MOCK_METHOD(void, AddRef, (), (const, override)); + MOCK_METHOD(uint32_t, Release, (), (const, override)); + MOCK_METHOD(void*, QueryInterface, (const uint32_t interfaceNummer), (override)); + MOCK_METHOD(void, Activate, (WPEFramework::PluginHost::IShell* service)); + MOCK_METHOD(void, Deactivate, ()); + MOCK_METHOD(WPEFramework::Core::ProxyType, Invoke, (const string&, uint32_t, const WPEFramework::Core::JSONRPC::Message&), (override)); +}; +#else + class DispatcherMock: public WPEFramework::PluginHost::ILocalDispatcher{ + public: + virtual ~DispatcherMock() = default; + MOCK_METHOD(void, AddRef, (), (const, override)); + MOCK_METHOD(uint32_t, Release, (), (const, override)); + MOCK_METHOD(void*, QueryInterface, (const uint32_t interfaceNummer), (override)); + MOCK_METHOD(void, Activate, (WPEFramework::PluginHost::IShell* service)); + MOCK_METHOD(void, Deactivate, ()); + MOCK_METHOD(void, Dropped, (const uint32_t)); + MOCK_METHOD(uint32_t, Invoke, (const uint32_t channelId, const uint32_t id, const string& token, const string& method, const string& parameters, string& response), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Invoke, (WPEFramework::PluginHost::IDispatcher::ICallback* callback, const uint32_t channelId, const uint32_t id, const string& token, const string& method, const string& parameters /* @restrict:(4M-1) */, string& response /* @restrict:(4M-1) @out */), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Revoke, (WPEFramework::PluginHost::IDispatcher::ICallback* callback), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Validate, (const string& token, const string& method, const string& paramaters /* @restrict:(4M-1) */), (const, override)); + MOCK_METHOD(WPEFramework::PluginHost::ILocalDispatcher*, Local, (), (override)); +}; +#endif /* ! USE_THUNDER_R4 */ +#endif //DISPATCHERMOCK_H diff --git a/ci/mocks/thunder/FactoriesImplementation.h b/ci/mocks/thunder/FactoriesImplementation.h new file mode 100644 index 00000000..2fe178f8 --- /dev/null +++ b/ci/mocks/thunder/FactoriesImplementation.h @@ -0,0 +1,66 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "Module.h" + +class FactoriesImplementation : public WPEFramework::PluginHost::IFactories { +public: + FactoriesImplementation(const FactoriesImplementation&) = delete; + FactoriesImplementation& operator=(const FactoriesImplementation&) = delete; + + FactoriesImplementation() + : _requestFactory(5) + , _responseFactory(5) + , _fileBodyFactory(5) + , _jsonRPCFactory(5) + { + // Defaults: + ON_CALL(*this, Request()) + .WillByDefault(::testing::Invoke( + [&]() { return (_requestFactory.Element()); })); + ON_CALL(*this, Response()) + .WillByDefault(::testing::Invoke( + [&]() { return (_responseFactory.Element()); })); + ON_CALL(*this, FileBody()) + .WillByDefault(::testing::Invoke( + [&]() { return (_fileBodyFactory.Element()); })); + ON_CALL(*this, JSONRPC()) + .WillByDefault(::testing::Invoke( + [&]() { + return (WPEFramework::Core::ProxyType>(_jsonRPCFactory.Element())); + })); + } + + virtual ~FactoriesImplementation() = default; + + MOCK_METHOD(WPEFramework::Core::ProxyType, Request, (), (override)); + MOCK_METHOD(WPEFramework::Core::ProxyType, Response, (), (override)); + MOCK_METHOD(WPEFramework::Core::ProxyType, FileBody, (), (override)); + MOCK_METHOD(WPEFramework::Core::ProxyType>, JSONRPC, (), (override)); + +private: + WPEFramework::Core::ProxyPoolType _requestFactory; + WPEFramework::Core::ProxyPoolType _responseFactory; + WPEFramework::Core::ProxyPoolType _fileBodyFactory; + WPEFramework::Core::ProxyPoolType _jsonRPCFactory; +}; diff --git a/ci/mocks/thunder/Module.cpp b/ci/mocks/thunder/Module.cpp new file mode 100644 index 00000000..cd6d4d14 --- /dev/null +++ b/ci/mocks/thunder/Module.cpp @@ -0,0 +1,22 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#include "Module.h" + +MODULE_NAME_DECLARATION(BUILD_REFERENCE) diff --git a/ci/mocks/thunder/Module.h b/ci/mocks/thunder/Module.h new file mode 100644 index 00000000..c7532ae3 --- /dev/null +++ b/ci/mocks/thunder/Module.h @@ -0,0 +1,27 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#ifndef MODULE_NAME +#define MODULE_NAME RdkServicesL1Test +#endif + +#include +#include diff --git a/ci/mocks/thunder/ServiceMock.h b/ci/mocks/thunder/ServiceMock.h new file mode 100644 index 00000000..1652dbdd --- /dev/null +++ b/ci/mocks/thunder/ServiceMock.h @@ -0,0 +1,92 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2022 RDK Management + * + * 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 SERVICEMOCK_H +#define SERVICEMOCK_H + +#include + +#include "Module.h" + +class ServiceMock : public WPEFramework::PluginHost::IShell { +public: + virtual ~ServiceMock() = default; + + MOCK_METHOD(void, AddRef, (), (const, override)); + MOCK_METHOD(uint32_t, Release, (), (const, override)); + MOCK_METHOD(string, Versions, (), (const, override)); + MOCK_METHOD(string, Locator, (), (const, override)); + MOCK_METHOD(string, ClassName, (), (const, override)); + MOCK_METHOD(string, Callsign, (), (const, override)); + MOCK_METHOD(string, WebPrefix, (), (const, override)); + MOCK_METHOD(string, ConfigLine, (), (const, override)); + MOCK_METHOD(string, PersistentPath, (), (const, override)); + MOCK_METHOD(string, VolatilePath, (), (const, override)); + MOCK_METHOD(string, DataPath, (), (const, override)); + MOCK_METHOD(state, State, (), (const, override)); +#ifdef USE_THUNDER_R4 + MOCK_METHOD(WPEFramework::Core::hresult, Activate, (const reason), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Deactivate, (const reason), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Unavailable, (const reason), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, ConfigLine, (const string& config), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, SystemRootPath, (const string& systemRootPath), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Hibernate, (const uint32_t timeout), (override)); + MOCK_METHOD(string, SystemPath, (), (const, override)); + MOCK_METHOD(string, PluginPath, (), (const, override)); + MOCK_METHOD(WPEFramework::PluginHost::IShell::startup, Startup, (), (const, override)); + MOCK_METHOD(WPEFramework::Core::hresult, Startup, (const startup value), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Resumed, (const bool value), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, Metadata, (string& info), (const, override)); +#else + MOCK_METHOD(bool, AutoStart, (), (const, override)); + MOCK_METHOD(string, Version, (), (const, override)); + MOCK_METHOD(uint32_t, Activate, (const reason), (override)); + MOCK_METHOD(uint32_t, Deactivate, (const reason), (override)); + MOCK_METHOD(uint32_t, Unavailable, (const reason), (override)); + MOCK_METHOD(uint8_t, Major, (), (const, override)); + MOCK_METHOD(uint8_t, Minor, (), (const, override)); + MOCK_METHOD(uint8_t, Patch, (), (const, override)); + MOCK_METHOD(uint32_t, ConfigLine, (const string& config), (override)); + MOCK_METHOD(uint32_t, SystemRootPath, (const string& systemRootPath), (override)); + MOCK_METHOD(uint32_t, Hibernate, (const string &processSequence, const uint32_t timeout), (override)); + MOCK_METHOD(uint32_t, Wakeup, (const string &processSequence, const uint32_t timeout), (override)); +#endif + MOCK_METHOD(bool, Resumed, (), (const, override)); + MOCK_METHOD(bool, IsSupported, (const uint8_t), (const, override)); + MOCK_METHOD(void, EnableWebServer, (const string&, const string&), (override)); + MOCK_METHOD(void, DisableWebServer, (), (override)); + MOCK_METHOD(WPEFramework::PluginHost::ISubSystem*, SubSystems, (), (override)); + MOCK_METHOD(uint32_t, Submit, (const uint32_t, const WPEFramework::Core::ProxyType&), (override)); + MOCK_METHOD(void, Notify, (const string&), (override)); + MOCK_METHOD(void*, QueryInterface, (const uint32_t), (override)); + MOCK_METHOD(void*, QueryInterfaceByCallsign, (const uint32_t, const string&), (override)); + MOCK_METHOD(void, Register, (WPEFramework::PluginHost::IPlugin::INotification*), (override)); + MOCK_METHOD(void, Unregister, (WPEFramework::PluginHost::IPlugin::INotification*), (override)); + MOCK_METHOD(string, Model, (), (const, override)); + MOCK_METHOD(bool, Background, (), (const, override)); + MOCK_METHOD(string, Accessor, (), (const, override)); + MOCK_METHOD(string, ProxyStubPath, (), (const, override)); + MOCK_METHOD(string, HashKey, (), (const, override)); + MOCK_METHOD(string, Substitute, (const string&), (const, override)); + MOCK_METHOD(WPEFramework::PluginHost::IShell::ICOMLink*, COMLink, (), (override)); + MOCK_METHOD(reason, Reason, (), (const, override)); + MOCK_METHOD(string, SystemRootPath, (), (const, override)); +}; + +#endif //SERVICEMOCK_H diff --git a/ci/mocks/thunder/SystemInfo.h b/ci/mocks/thunder/SystemInfo.h new file mode 100644 index 00000000..52a8b75d --- /dev/null +++ b/ci/mocks/thunder/SystemInfo.h @@ -0,0 +1,85 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "Module.h" + +class SystemInfo : public WPEFramework::PluginHost::ISubSystem { +private: + SystemInfo(const SystemInfo&) = delete; + SystemInfo& operator=(const SystemInfo&) = delete; + +public: + SystemInfo() + : _flags(0) + { + // Defaults: + ON_CALL(*this, Set(::testing::_, ::testing::_)) + .WillByDefault(::testing::Invoke( + [&](const subsystem type, WPEFramework::Core::IUnknown* information) { + _subsystems.emplace(type, information); + + if (type >= NEGATIVE_START) { + _flags &= ~(1 << (type - NEGATIVE_START)); + } else { + _flags |= (1 << type); + } + })); + ON_CALL(*this, Get(::testing::_)) + .WillByDefault(::testing::Invoke( + [&](const subsystem type) -> const WPEFramework::Core::IUnknown* { + const WPEFramework::Core::IUnknown* result(nullptr); + + auto it = _subsystems.find(type); + if (it != _subsystems.end()) { + result = it->second; + } + + return result; + })); + ON_CALL(*this, IsActive(::testing::_)) + .WillByDefault(::testing::Invoke( + [&](const subsystem type) -> bool { + return ((type < END_LIST) && ((_flags & (1 << type)) != 0)); + })); + } + virtual ~SystemInfo() = default; + +public: + MOCK_METHOD(void, Register, (WPEFramework::PluginHost::ISubSystem::INotification * notification), (override)); + MOCK_METHOD(void, Unregister, (WPEFramework::PluginHost::ISubSystem::INotification * notification), (override)); + MOCK_METHOD(string, BuildTreeHash, (), (const, override)); + MOCK_METHOD(void, Set, (const subsystem type, WPEFramework::Core::IUnknown* information), (override)); + MOCK_METHOD(const WPEFramework::Core::IUnknown*, Get, (const subsystem type), (const, override)); + MOCK_METHOD(bool, IsActive, (const subsystem type), (const, override)); +#ifdef USE_THUNDER_R4 + MOCK_METHOD(string, Version, (), (const, override)); +#endif /*USE_THUNDER_R4 */ + + BEGIN_INTERFACE_MAP(SystemInfo) + INTERFACE_ENTRY(WPEFramework::PluginHost::ISubSystem) + END_INTERFACE_MAP + +private: + std::map _subsystems; + uint32_t _flags; +}; diff --git a/ci/mocks/thunder/ThunderPortability.h b/ci/mocks/thunder/ThunderPortability.h new file mode 100755 index 00000000..d0f43f80 --- /dev/null +++ b/ci/mocks/thunder/ThunderPortability.h @@ -0,0 +1,52 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include +#include + +#ifdef USE_THUNDER_R4 +#define EVENT_SUBSCRIBE(__A__, __B__, __C__, __D__) \ + { \ + auto ret = plugin->Subscribe(__A__, __B__, __C__); \ + EXPECT_EQ(Core::ERROR_NONE, ret); \ + (void)__D__; \ + } + +#define EVENT_UNSUBSCRIBE(__A__, __B__, __C__, __D__) \ + { \ + auto ret = plugin->Unsubscribe(__A__, __B__, __C__); \ + EXPECT_EQ(Core::ERROR_NONE, ret); \ + (void)__D__; \ + } + +#define DECL_CORE_JSONRPC_CONX Core::JSONRPC::Context +#define INIT_CONX(__X__, __Y__) connection(__X__, __Y__, "") +#define PLUGINHOST_DISPATCHER PluginHost::ILocalDispatcher +#define PLUGINHOST_DISPATCHER_ID PluginHost::ILocalDispatcher::ID +#else +#define EVENT_SUBSCRIBE(__A__, __B__, __C__, __D__) { handler.Subscribe(__A__, __B__, __C__, __D__); } +#define EVENT_UNSUBSCRIBE(__A__, __B__, __C__, __D__) { handler.Unsubscribe(__A__, __B__, __C__, __D__); } + +#define DECL_CORE_JSONRPC_CONX Core::JSONRPC::Connection +#define INIT_CONX(__X__, __Y__) connection(__X__, __Y__) +#define PLUGINHOST_DISPATCHER PluginHost::IDispatcher +#define PLUGINHOST_DISPATCHER_ID PluginHost::IDispatcher::ID +#endif diff --git a/ci/mocks/thunder/WorkerPoolImplementation.h b/ci/mocks/thunder/WorkerPoolImplementation.h new file mode 100644 index 00000000..bb746615 --- /dev/null +++ b/ci/mocks/thunder/WorkerPoolImplementation.h @@ -0,0 +1,63 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* 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. +**/ + +#pragma once + +#include + +#include "Module.h" + +class WorkerPoolImplementation : public WPEFramework::Core::WorkerPool { +private: + class Dispatcher : public WPEFramework::Core::ThreadPool::IDispatcher { + public: + Dispatcher(const Dispatcher&) = delete; + Dispatcher& operator=(const Dispatcher&) = delete; + + Dispatcher() = default; + ~Dispatcher() override = default; + + private: + void Initialize() override {} + void Deinitialize() override {} + void Dispatch(WPEFramework::Core::IDispatch* job) override + { + job->Dispatch(); + } + }; + +public: + WorkerPoolImplementation() = delete; + WorkerPoolImplementation(const WorkerPoolImplementation&) = delete; + WorkerPoolImplementation& operator=(const WorkerPoolImplementation&) = delete; + + WorkerPoolImplementation(const uint8_t threads, const uint32_t stackSize, const uint32_t queueSize) + : WPEFramework::Core::WorkerPool(threads - 1, stackSize, queueSize, &_dispatcher) + , _dispatcher() + { + } + + virtual ~WorkerPoolImplementation() + { + WPEFramework::Core::WorkerPool::Stop(); + } + +private: + Dispatcher _dispatcher; +}; diff --git a/ci/mocks/thunder/mockauthservices.h b/ci/mocks/thunder/mockauthservices.h new file mode 100644 index 00000000..e3dc7152 --- /dev/null +++ b/ci/mocks/thunder/mockauthservices.h @@ -0,0 +1,89 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2023 RDK Management + * + * 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 MOCKAUTHSERVICES_H +#define MOCKAUTHSERVICES_H + +#include + +#include "Module.h" + +class MockAuthService : public WPEFramework::Exchange::IAuthService { +public: + virtual ~MockAuthService() = default; + MOCK_METHOD(uint32_t, GetActivationStatus, (ActivationStatusResult&), (override)); + MOCK_METHOD(uint32_t, SetActivationStatus, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, ClearAuthToken, (SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, ClearSessionToken, (SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, ClearServiceAccessToken, (SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, ClearLostAndFoundAccessToken, (SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, ClearServiceAccountId, (SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, ClearCustomProperties, (SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetCustomProperties, (std::string&, bool&), (override)); + MOCK_METHOD(uint32_t, SetCustomProperties, (const std::string&, bool&), (override)); + MOCK_METHOD(uint32_t, GetAlternateIds, (std::string&, std::string&, bool&), (override)); + MOCK_METHOD(uint32_t, SetAlternateIds, (const std::string&, std::string&, bool&), (override)); + MOCK_METHOD(uint32_t, GetTransitionData, (std::string&, std::string&, bool&), (override)); + MOCK_METHOD(void, AddRef, (), (const, override)); + MOCK_METHOD(uint32_t, Release, (), (const, override)); + MOCK_METHOD(void*, QueryInterface, (uint32_t), (override)); + MOCK_METHOD(uint32_t, Register, (IAuthService::INotification*), (override)); + MOCK_METHOD(uint32_t, Unregister, (IAuthService::INotification*), (override)); + MOCK_METHOD(uint32_t, Configure, (), (override)); + MOCK_METHOD(uint32_t, GetInfo, (GetInfoResult&), (override)); + MOCK_METHOD(uint32_t, GetDeviceInfo, (GetDeviceInfoResult&), (override)); + MOCK_METHOD(uint32_t, GetDeviceId, (GetDeviceIdResult&), (override)); + MOCK_METHOD(uint32_t, SetDeviceId, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, SetPartnerId, (const std::string&, SetPartnerIdResult&), (override)); + MOCK_METHOD(uint32_t, GetAuthToken, (const bool, const bool, GetAuthTokenResult&), (override)); + MOCK_METHOD(uint32_t, GetSessionToken, (GetSessionTokenResult&), (override)); + MOCK_METHOD(uint32_t, SetSessionToken, (const int32_t&, const std::string&, uint32_t, const std::string&, const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetServiceAccessToken, (GetServiceAccessTokenResult&), (override)); + MOCK_METHOD(uint32_t, SetServiceAccessToken, (const int32_t&, const std::string&, uint32_t, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetServiceAccountId, (GetServiceAccountIdResult&), (override)); + MOCK_METHOD(uint32_t, SetServiceAccountId, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, SetAuthIdToken, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, Ready, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetBootstrapProperty, (const std::string&, GetBootstrapPropResult&), (override)); + MOCK_METHOD(uint32_t, ActivationStarted, (SuccessResult&), (override)); + MOCK_METHOD(uint32_t, ActivationComplete, (SuccessResult&), (override)); + MOCK_METHOD(uint32_t, GetLostAndFoundAccessToken, (std::string&, std::string&, bool&), (override)); + MOCK_METHOD(uint32_t, SetLostAndFoundAccessToken, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetXDeviceId, (GetXDeviceIdResult&), (override)); + MOCK_METHOD(uint32_t, SetXDeviceId, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetExperience, (GetExpResult&), (override)); + MOCK_METHOD(uint32_t, SetExperience, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetXifaId, (GetxifaIdResult&), (override)); + MOCK_METHOD(uint32_t, SetXifaId, (const std::string&, SuccessMsgResult&), (override)); + MOCK_METHOD(uint32_t, GetAdvtOptOut, (AdvtOptOutResult&), (override)); + MOCK_METHOD(uint32_t, SetAdvtOptOut, (const bool&, SuccessMsgResult&), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, SetContentAccessToken, (const std::string&, const uint32_t, bool&), (override)); + MOCK_METHOD(WPEFramework::Core::hresult, GetContentAccessToken, (std::string&, uint32_t&), (override)); +}; + +class MockIAuthenticate : public WPEFramework::PluginHost::IAuthenticate { +public: + MOCK_METHOD(void*, QueryInterfaceByCallsign, (const uint32_t, const string&)); + MOCK_METHOD(uint32_t, CreateToken, (uint16_t, const uint8_t*, std::string&)); + MOCK_METHOD(uint32_t, Release, (), (const, override)); + MOCK_METHOD(void*, QueryInterface, (uint32_t), (override)); + MOCK_METHOD(void, AddRef, (), (const, override)); + MOCK_METHOD(WPEFramework::PluginHost::ISecurity*, Officer, (const std::string& token), (override)); +}; +#endif diff --git a/ci/patches/00010-R4.4-Add-support-for-project-dir.patch b/ci/patches/00010-R4.4-Add-support-for-project-dir.patch new file mode 100755 index 00000000..dbb94881 --- /dev/null +++ b/ci/patches/00010-R4.4-Add-support-for-project-dir.patch @@ -0,0 +1,116 @@ +diff --git a/JsonGenerator/source/class_emitter.py b/JsonGenerator/source/class_emitter.py +index 7f2fb01..67a6469 100644 +--- a/JsonGenerator/source/class_emitter.py ++++ b/JsonGenerator/source/class_emitter.py +@@ -113,7 +113,6 @@ + emit.Line("#include ") + emit.Line() + +- emit.Line("#include \"definitions.h\"") + + if not config.NO_INCLUDES: + if if_file.endswith(".h"): +diff --git a/ProxyStubGenerator/StubGenerator.py b/ProxyStubGenerator/StubGenerator.py +index 6e079b6..d2de681 100755 +--- a/ProxyStubGenerator/StubGenerator.py ++++ b/ProxyStubGenerator/StubGenerator.py +@@ -193,7 +193,7 @@ + + + # Generate interface information in lua +-def GenerateLuaData(emit, interfaces_list, enums_list, source_file=None, tree=None, ns=None): ++def GenerateLuaData(emit, interfaces_list, enums_list, project_dir, source_file=None, tree=None, ns=None): + + if not source_file: + assert(tree==None) +@@ -535,7 +535,7 @@ + + return tree + +-def GenerateStubs2(output_file, source_file, tree, ns, scan_only=False): ++def GenerateStubs2(output_file, source_file, project_dir, tree, ns, scan_only=False): + log.Info("Scanning '%s' (in %s)..." % (source_file, ns)) + + if not FORCE and (os.path.exists(output_file) and (os.path.getmtime(source_file) < os.path.getmtime(output_file))): +@@ -579,7 +579,7 @@ + emit.Line + emit.Line() + +- if os.path.isfile(os.path.join(os.path.dirname(source_file), "Module.h")): ++ if os.path.isfile(os.path.join(project_dir, "Module.h")): + emit.Line('#include "Module.h"') + + if os.path.isfile(os.path.join(os.path.dirname(source_file), interface_header_name)): +@@ -2085,6 +2085,8 @@ + help="include an additional C++ header file, may be used multiple times (default: include 'Ids.h')") + argparser.add_argument('-I', dest="includePaths", metavar="INCLUDE_DIR", action='append', default=[], type=str, + help='add an include search path, can be used multiple times') ++ argparser.add_argument("--projectdir",dest="project_dir",metavar="DIR",type=str,default="", ++ help="specify the project directory") + + args = argparser.parse_args(sys.argv[1:]) + SHOW_WARNINGS = not args.no_warnings +@@ -2221,7 +2223,10 @@ + + for source_file in interface_files: + try: +- _extra_includes = [ os.path.join("@" + os.path.dirname(source_file), IDS_DEFINITIONS_FILE) ] ++ if args.project_dir is not None: ++ _extra_includes = [ os.path.join("@" + args.project_dir, IDS_DEFINITIONS_FILE) ] ++ else: ++ _extra_includes = [ os.path.join("@" + os.path.dirname(source_file), IDS_DEFINITIONS_FILE) ] + _extra_includes.extend(args.extra_includes) + + tree = Parse(source_file, args.includePaths, +@@ -2242,7 +2247,7 @@ + some_omitted = False + + for ns in INTERFACE_NAMESPACES: +- output, some_omitted = GenerateStubs2(output_file, source_file, tree, ns, scan_only) ++ output, some_omitted = GenerateStubs2(output_file, source_file, args.project_dir, tree, ns, scan_only) + + new_faces += output + +@@ -2265,7 +2270,7 @@ + log.Print("(lua generator) Scanning %s..." % os.path.basename(source_file)) + + for ns in INTERFACE_NAMESPACES: +- GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums, source_file, tree, ns) ++ GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums, args.project_dir, source_file, tree, ns) + + except NotModifiedException as err: + log.Print("skipped file %s, up-to-date" % os.path.basename(output_file)) +@@ -2316,7 +2321,7 @@ + if args.lua_code: + # Epilogue + for ns in INTERFACE_NAMESPACES: +- GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums) ++ GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums,args.project_dir) + log.Print("Created %s (%s interfaces, %s enums)" % (lua_file.name, len(lua_interfaces), len(lua_enums))) + + else: + +diff --git a/cmake/FindProxyStubGenerator.cmake.in b/cmake/FindProxyStubGenerator.cmake.in +index 1344452..a8dbcea 100644 +--- a/cmake/FindProxyStubGenerator.cmake.in ++++ b/cmake/FindProxyStubGenerator.cmake.in. +@@ -31,7 +31,7 @@ function(ProxyStubGenerator) + endif() + + set(optionsArgs SECURE COHERENT TRACES VERBOSE NO_WARNINGS KEEP FORCE_GENERATE) +- set(oneValueArgs OUTDIR) ++ set(oneValueArgs OUTDIR PROJECT_DIR) + set(multiValueArgs INPUT INCLUDE INCLUDE_PATH NAMESPACE) + + cmake_parse_arguments(Argument "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +@@ -81,6 +81,10 @@ function(ProxyStubGenerator) + list(APPEND _execute_command "--outdir" "${Argument_OUTDIR}") + endif() + ++ if(Argument_PROJECT_DIR) ++ list(APPEND _execute_command "--projectdir" "${Argument_PROJECT_DIR}") ++ endif() ++ + foreach(_include ${Argument_INCLUDE}) + list(APPEND _execute_command "-I" "${_include}") + endforeach(_include) diff --git a/ci/patches/1004-Add-support-for-project-dir.patch b/ci/patches/1004-Add-support-for-project-dir.patch new file mode 100755 index 00000000..26fdee12 --- /dev/null +++ b/ci/patches/1004-Add-support-for-project-dir.patch @@ -0,0 +1,42 @@ +diff --git a/Source/plugins/CMakeLists.txt b/Source/plugins/CMakeLists.txt +index 4d362d545..9357c647c 100644 +--- a/Source/plugins/CMakeLists.txt ++++ b/Source/plugins/CMakeLists.txt +@@ -20,14 +20,14 @@ + string(TOLOWER ${NAMESPACE} NAMESPACE_LIB) + + option(VIRTUALINPUT_TOOLS "Build VirtualInput tools" OFF) +- +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IPlugin.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IShell.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::Exchange" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IController.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/..") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IControllerDeprecated.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/..") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IStateControl.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ISubSystem.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IDispatcher.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") ++set(PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IPlugin.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IShell.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::Exchange" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IController.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IControllerDeprecated.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IStateControl.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ISubSystem.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IDispatcher.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) + + JsonGenerator(CODE NAMESPACE WPEFramework::Exchange::Controller INPUT ${CMAKE_CURRENT_SOURCE_DIR}/IController.h OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." NO_INCLUDES LEGACY_ALT) + +diff --git a/Source/com/CMakeLists.txt b/Source/com/CMakeLists.txt +index 1de9ac176..bcf9489d1 100644 +--- a/Source/com/CMakeLists.txt ++++ b/Source/com/CMakeLists.txt +@@ -16,8 +16,8 @@ + # limitations under the License. + + set(TARGET ${NAMESPACE}COM) +- +-ProxyStubGenerator(NAMESPACE "WPEFramework::RPC" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ICOM.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") ++set(PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++ProxyStubGenerator(NAMESPACE "WPEFramework::RPC" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ICOM.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) + + add_library(${TARGET} SHARED + Administrator.cpp diff --git a/ci/patches/RDKEMW-733-Add-ENTOS-IDS.patch b/ci/patches/RDKEMW-733-Add-ENTOS-IDS.patch new file mode 100755 index 00000000..c8fd3213 --- /dev/null +++ b/ci/patches/RDKEMW-733-Add-ENTOS-IDS.patch @@ -0,0 +1,21 @@ +From: Sitaram, Soundaryaa +Date: 05 Feb 2025 17:24:43 +0000 +Subject: [PATCH] ENTOS IDs offset to be adjusted in rdkservices-apis + +Upstream-Status: None +Signed-off-by: ssitar583 +--- +diff --git a/Source/com/Ids.h b/Source/com/Ids.h +index cf2060333..75d235bbd 100644 +--- a/Source/com/Ids.h ++++ b/Source/com/Ids.h +@@ -74,7 +74,8 @@ namespace RPC { + ID_COMREQUEST_NOTIFICATION = (ID_OFFSET_INTERNAL + 0x003D), + ID_SYSTEM_METADATA = (ID_OFFSET_INTERNAL + 0x003E), + +- ID_EXTERNAL_INTERFACE_OFFSET = (ID_OFFSET_INTERNAL + 0x0040) ++ ID_EXTERNAL_INTERFACE_OFFSET = (ID_OFFSET_INTERNAL + 0x0040), ++ ID_EXTERNAL_CC_INTERFACE_OFFSET = (0xCC00) // ends on 0xDFFF + }; + } + } diff --git a/ci/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch b/ci/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch new file mode 100755 index 00000000..c5b4a36f --- /dev/null +++ b/ci/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch @@ -0,0 +1,20 @@ +commit 810aae64cb31c907698e468b615797750094b847 +Author: Pesala Lakshmi Jwala Priya +Date: Thu Aug 29 12:31:30 2024 +0530 + + Alt change + +diff --git a/Source/plugins/CMakeLists.txt b/Source/plugins/CMakeLists.txt +index 4d362d54..cdb53cdc 100644 +--- a/Source/plugins/CMakeLists.txt ++++ b/Source/plugins/CMakeLists.txt +@@ -29,7 +29,7 @@ ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_S + ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ISubSystem.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") + ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IDispatcher.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") + +-JsonGenerator(CODE NAMESPACE WPEFramework::Exchange::Controller INPUT ${CMAKE_CURRENT_SOURCE_DIR}/IController.h OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." NO_INCLUDES) ++JsonGenerator(CODE NAMESPACE WPEFramework::Exchange::Controller INPUT ${CMAKE_CURRENT_SOURCE_DIR}/IController.h OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." NO_INCLUDES LEGACY_ALT) + + add_library(${TARGET} SHARED + Channel.cpp + diff --git a/ci/patches/error_code_R4_4.patch b/ci/patches/error_code_R4_4.patch new file mode 100644 index 00000000..954ca083 --- /dev/null +++ b/ci/patches/error_code_R4_4.patch @@ -0,0 +1,64 @@ +diff --git a/Source/WPEFramework/PluginServer.h b/Source/WPEFramework/PluginServer.h +index e87933d9a..591385222 100644 +--- a/Source/WPEFramework/PluginServer.h ++++ b/Source/WPEFramework/PluginServer.h +@@ -1535,6 +1535,22 @@ namespace PluginHost { + response->Error.SetError(Core::ERROR_ILLEGAL_STATE); + response->Error.Text = _T("The service is in an illegal state!!!."); + break; ++ case Core::ERROR_INVALID_PARAMETER: ++ response->Error.SetError(Core::ERROR_INVALID_SIGNATURE); ++ response->Error.Text = _T("Invalid Parameter"); ++ break; ++ case Core::ERROR_INVALID_DEVICENAME: ++ response->Error.SetError(Core::ERROR_INVALID_DEVICENAME); ++ response->Error.Text = _T("Invalid device name"); ++ break; ++ case Core::ERROR_INVALID_MOUNTPOINT: ++ response->Error.SetError(Core::ERROR_INVALID_MOUNTPOINT); ++ response->Error.Text = _T("Invalid mount path"); ++ break; ++ case Core::ERROR_FIRMWAREUPDATE_INPROGRESS: ++ response->Error.SetError(Core::ERROR_FIRMWAREUPDATE_INPROGRESS); ++ response->Error.Text = _T("Firmware update already in progress"); ++ break; + case static_cast(~0): + response.Release(); + break; +diff --git a/Source/core/JSONRPC.h b/Source/core/JSONRPC.h +index a9c4360fb..5fcef161d 100644 +--- a/Source/core/JSONRPC.h ++++ b/Source/core/JSONRPC.h +@@ -98,6 +98,15 @@ namespace Core { + case Core::ERROR_TIMEDOUT: + Code = -32000; // Server defined, now mapped to Timed out + break; ++ case Core::ERROR_INVALID_DEVICENAME: ++ Code = -32001; // Invalid device name ++ break; ++ case Core::ERROR_INVALID_MOUNTPOINT: ++ Code = -32002; // Invalid mount path ++ break; ++ case Core::ERROR_FIRMWAREUPDATE_INPROGRESS: ++ Code = -32003; // Firmware update inprogress ++ break; + default: + Code = static_cast(frameworkError); + break; +diff --git a/Source/core/Portability.h b/Source/core/Portability.h +index 01e34d398..a5728eebf 100644 +--- a/Source/core/Portability.h ++++ b/Source/core/Portability.h +@@ -874,7 +874,11 @@ namespace Core { + ERROR_CODE(ERROR_HIBERNATED, 46) \ + ERROR_CODE(ERROR_INPROC, 47) \ + ERROR_CODE(ERROR_FAILED_REGISTERED, 48) \ +- ERROR_CODE(ERROR_FAILED_UNREGISTERED, 49) ++ ERROR_CODE(ERROR_FAILED_UNREGISTERED, 49) \ ++ ERROR_CODE(ERROR_INVALID_PARAMETER, 54) \ ++ ERROR_CODE(ERROR_INVALID_DEVICENAME, 59) \ ++ ERROR_CODE(ERROR_INVALID_MOUNTPOINT, 60) \ ++ ERROR_CODE(ERROR_FIRMWAREUPDATE_INPROGRESS,61) + + #define ERROR_CODE(CODE, VALUE) CODE = VALUE, +