From e77cb27cceb1369b3743085f5ac060865eecad69 Mon Sep 17 00:00:00 2001 From: Yuvaramachandran Gurusamy Date: Tue, 27 May 2025 18:34:52 +0530 Subject: [PATCH 1/6] RDKEMW-4132: Prepare standalone build for Coverity Signed-off-by: Yuvaramachandran Gurusamy --- Makefile.am | 24 +- configure.ac | 12 + .../IARM_Bus_CheckPowerStatus.c | 8 +- key_simulator/IrInputRemoteKeyCodes.h | 5 + mocks/IrKeyCodes.h | 382 ++++++++++ mocks/libIARM.h | 114 +++ mocks/libIARMCore.h | 364 ++++++++++ mocks/libIBus.h | 362 ++++++++++ mocks/libIBusDaemon.h | 270 ++++++++ mocks/mfrApi.h | 224 ++++++ mocks/mfrMgr.h | 218 ++++++ mocks/mfrTypes.h | 651 ++++++++++++++++++ mocks/mfr_wifi_api.h | 146 ++++ mocks/mfr_wifi_types.h | 139 ++++ mocks/mockInternal.cpp | 210 ++++++ mocks/power_controller.h | 415 +++++++++++ mocks/sysMgr.h | 385 +++++++++++ rdk_build.sh | 75 +- 18 files changed, 3994 insertions(+), 10 deletions(-) create mode 100644 mocks/IrKeyCodes.h create mode 100644 mocks/libIARM.h create mode 100644 mocks/libIARMCore.h create mode 100644 mocks/libIBus.h create mode 100644 mocks/libIBusDaemon.h create mode 100644 mocks/mfrApi.h create mode 100644 mocks/mfrMgr.h create mode 100644 mocks/mfrTypes.h create mode 100644 mocks/mfr_wifi_api.h create mode 100644 mocks/mfr_wifi_types.h create mode 100644 mocks/mockInternal.cpp create mode 100644 mocks/power_controller.h create mode 100644 mocks/sysMgr.h mode change 100644 => 100755 rdk_build.sh diff --git a/Makefile.am b/Makefile.am index bd0c328..d65c966 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,17 +39,31 @@ include_HEADERS = $(top_srcdir)/key_simulator/RDKIrKeyCodes.h bin_PROGRAMS = keySimulator mfr_util QueryPowerState SetPowerState IARM_event_sender mfr_util_SOURCES = mfr-utils/sys_mfr_utils.c -mfr_util_LDADD = -lIARMBus QueryPowerState_SOURCES=iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c -QueryPowerState_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -lWPEFrameworkPowerController +QueryPowerState_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) SetPowerState_SOURCES=iarm_set_powerstate/IARM_BUS_SetPowerStatus.c -SetPowerState_LDADD = -ldbus-1 -lstdc++ -lpthread -lWPEFrameworkPowerController +SetPowerState_LDADD = -ldbus-1 -lstdc++ -lpthread keySimulator_SOURCES=key_simulator/IARM_BUS_UIEventSimulator.c key_simulator/uinput.c -keySimulator_LDADD = $(GLIB_LIBS) -lIARMBus $(DBUS_LIBS) +keySimulator_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) IARM_event_sender_SOURCES = iarm-event-sender/IARM_event_sender.c -IARM_event_sender_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) -lIARMBus $(DBUS_LIBS) +IARM_event_sender_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) +if STANDALONE_BUILD +AM_CFLAGS += -I$(top_srcdir)/mocks -DSTANDALONE_BUILD +include_HEADERS += $(top_srcdir)/mocks/IrKeyCodes.h +mfr_util_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp +QueryPowerState_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp +SetPowerState_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp +keySimulator_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp +IARM_event_sender_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp +else +mfr_util_LDADD = -lIARMBus +keySimulator_LDADD += -lIARMBus +QueryPowerState_LDADD += -lWPEFrameworkPowerController +SetPowerState_LDADD += -lWPEFrameworkPowerController +IARM_event_sender_LDADD += -lIARMBus +endif diff --git a/configure.ac b/configure.ac index c710172..4b13415 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,18 @@ PKG_CHECK_MODULES([DBUS], [dbus-1]) AC_CHECK_LIB(gthread-2.0, g_thread_init) +STANDALONE_BUILD="" +AC_ARG_ENABLE([standalonebuild], + AS_HELP_STRING([--enable-standalonebuild],[This will enable mocks compilation. ]), + [ + case "${enableval}" in + yes) STANDALONE_BUILD=true ;; + *) STANDALONE_BUILD=false echo[Standalone Build is disabled];; + esac + ], + [ STANDALONE_BUILD=false ; echo "Standalone Build not used"]) +AM_CONDITIONAL(STANDALONE_BUILD, test "x$STANDALONE_BUILD" = xtrue) + # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T AC_TYPE_SIZE_T diff --git a/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c b/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c index 0550d61..c2aa6a0 100644 --- a/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c +++ b/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c @@ -25,7 +25,9 @@ // This include is still required for data types to read cached power status residing in /opt/uimgr_settings.bin // TODO: after IARM PwrMgr logic is moved to PowerManager plugin refactor this code and remove this header file too. +#ifndef STANDALONE_BUILD /*TODO: This check needs to be removed once old PowerManager reference addressed*/ #include "pwrMgr.h" +#endif #include "power_controller.h" @@ -41,7 +43,9 @@ typedef struct _PWRMgr_Settings_t { uint32_t magic; uint32_t version; uint32_t length; +#ifndef STANDALONE_BUILD /*TODO: This check needs to be removed once old PowerManager reference addressed*/ IARM_Bus_PWRMgr_PowerState_t powerState; +#endif /*STANDALONE_BUILD*/ PWRMgr_LED_Settings_t ledSettings; uint32_t deep_sleep_timeout; char padding[PADDING_SIZE]; @@ -122,7 +126,7 @@ int main(int argc, char* argv[]) close(fd); } - +#ifndef STANDALONE_BUILD /*TODO: This check needs to be removed once old PowerManager reference addressed*/ if (ret > 0) { if (IARM_BUS_PWRMGR_POWERSTATE_OFF == pwrSettings.powerState) { printf("OFF"); @@ -140,7 +144,7 @@ int main(int argc, char* argv[]) } else { printf("Error in reading PWRMgr settings File"); } - +#endif printf("\n"); } return 0; diff --git a/key_simulator/IrInputRemoteKeyCodes.h b/key_simulator/IrInputRemoteKeyCodes.h index 005017c..fa3a432 100644 --- a/key_simulator/IrInputRemoteKeyCodes.h +++ b/key_simulator/IrInputRemoteKeyCodes.h @@ -45,7 +45,12 @@ #include #include + +#ifdef STANDALONE_BUILD +#include "IrKeyCodes.h" +#else #include "comcastIrKeyCodes.h" +#endif #ifdef __cplusplus extern "C" { diff --git a/mocks/IrKeyCodes.h b/mocks/IrKeyCodes.h new file mode 100644 index 0000000..5850e50 --- /dev/null +++ b/mocks/IrKeyCodes.h @@ -0,0 +1,382 @@ +/* + * 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. +*/ + +//@todo : Need to rename this file name to some generic name. ir_manager_keympaps.h + +/** + * @addtogroup HPK HPK + * @{ + * @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. + * + */ + +/** @addtogroup IR_MANAGER_HAL IR MANAGER HAL + * @{ + * @par Application API Specification + * IR HAL provides an interface to register IR events with the low level interfaces, + * which will notify the caller based on received IR Key events. + */ + + +/** @defgroup IrKeyCodes IrKeyCodes + * @{ + */ + + +#ifndef _IR_MANAGER_KEYMAPS_H_ +#define _IR_MANAGER_KEYMAPS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + + +/** + * @file IrKeyCodes.h + * + * @brief IR key map header + * + * This file contains key definitions used by the IR HAL. + * + * @par Document + * Document reference. + * + * @par Open Issues (in no particular order) + * -# None + * + * @par Assumptions + * -# None + * + * @par Abbreviations + * - XR: Remote type + * - V: Version + * - PIP: Picture in picture + * - WPS: Wi-Fi Protected Setup + * - DMC: @todo what is DMC. + * - OTR: @todo what is OTR. + * + * @par Implementation Notes + * -# None + * + */ + +/*------------------------------------------------------------------- + Defines/Macros + + //@todo : All the definitions should be prefixed with IR_. Will do it in the next phase +-------------------------------------------------------------------*/ +///< Represents the mask for delay and repeat. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define DELAY_REPEAT_MASK 0x00000001 +///< Represents the mask for the language selection. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define LANGUAGE_MASK 0x00000010 +///< Represents the mask for the missed key timeout. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define MISSED_KEY_TIMEOUT_MASK 0x00000100 +///< Represents the mask for enabling key repeat. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define REPEAT_KEY_ENABLED_MASK 0x00001000 +///< Represents the mask for the key repeat frequency. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define REPEAT_FREQUENCY_MASK 0x00010000 +///< Represents the mask for reporting modifiers. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define REPORT_MODIFIERS_MASK 0x00100000 +///< Represents the mask for the number of devices. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define NUM_OF_DEVICES_MASK 0x01000000 + +///< Represents the key down event. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KET_KEYDOWN 0x00008000UL +///< Represents the key up event. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KET_KEYUP 0x00008100UL +///< Represents the key repeat event. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KET_KEYREPEAT 0x00008200UL + +/* Numeric keys (common in Remote and Key Board) */ +/* Combination of Key + device type (HID_DEVICES) is unique */ +///< Represents the key "0". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT0 0x00000030UL +///< Represents the key "1". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT1 0x00000031UL +///< Represents the key "2". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT2 0x00000032UL +///< Represents the key "3". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT3 0x00000033UL +///< Represents the key "4". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT4 0x00000034UL +///< Represents the key "5". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT5 0x00000035UL +///< Represents the key "6". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT6 0x00000036UL +///< Represents the key "7". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT7 0x00000037UL +///< Represents the key "8". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT8 0x00000038UL +///< Represents the key "9". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DIGIT9 0x00000039UL +///< Represents the key period (decimal point). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PERIOD 0x00000040UL + +///< Represents the key for discrete power on. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DISCRETE_POWER_ON 0x00000050UL +///< Represents the key for discrete power standby. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DISCRETE_POWER_STANDBY 0x00000051UL + +///< Represents the key for search. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_SEARCH 0x000000CFUL +///< Represents the key for setup. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_SETUP 0x00000052UL + +///< Represents the key for closed captioning. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_CLOSED_CAPTIONING 0x00000060UL +///< Represents the key for language selection. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_LANGUAGE 0x00000061UL +///< Represents the key for voice guidance. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_VOICE_GUIDANCE 0x00000062UL +///< Represents the key for heartbeat. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_HEARTBEAT 0x00000063UL +///< Represents the key for push-to-talk. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PUSH_TO_TALK 0x00000064UL +///< Represents the key for descriptive audio. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DESCRIPTIVE_AUDIO 0x00000065UL +///< Represents the key for volume optimization. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_VOLUME_OPTIMIZE 0x00000066UL +///< Represents the key XR2V3. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +///< @todo how KED_XR2V3 is used?? Is it key or protocol. Seems like XR is platform specific, +///< if so need to remove form generic header. time being keep it in generic it self +//< @todo platform specific key will be deprecated in the next phase. +#define KED_XR2V3 0x00000067UL +///< Represents the key XR5V2. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR5V2 0x00000068UL +///< Represents the key XR11V1. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR11V1 0x00000069UL +///< Represents the key XR11V2. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR11V2 0x0000006AUL +///< Represents the key XR13. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR13 0x0000006BUL +///< Represents the key XR11 notify. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR11_NOTIFY 0x0000006CUL + +///< Represents the key XR15V1 notify. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR15V1_NOTIFY 0x00000070UL +///< Represents the key XR15V1 select. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR15V1_SELECT 0x00000071UL +///< Represents the key XR15V1 push-to-talk. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +//< @todo platform specific key will be deprecated in the next phase +#define KED_XR15V1_PUSH_TO_TALK 0x00000072UL + +///< Represents the key for screen bind notify. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_SCREEN_BIND_NOTIFY 0x00000073UL + +///< Represents the key XR16V1 notify. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_XR16V1_NOTIFY 0x00000074UL +///< Represents the key XR16V1 select. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_XR16V1_SELECT 0x00000075UL +///< Represents the key XR16V1 push-to-talk. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_XR16V1_PUSH_TO_TALK 0x00000076UL + +///< Represents the key for RF power. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_RF_POWER 0x0000007FUL +///< Represents the key for power. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_POWER 0x00000080UL +///< Represents the key for FP power. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_FP_POWER KED_POWER +///< Represents the key for arrow up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_ARROWUP 0x00000081UL +///< Represents the key for arrow down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_ARROWDOWN 0x00000082UL +///< Represents the key for arrow left. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_ARROWLEFT 0x00000083UL +///< Represents the key for arrow right. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_ARROWRIGHT 0x00000084UL +///< Represents the key for select. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_SELECT 0x00000085UL +///< Represents the key for enter. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_ENTER 0x00000086UL +///< Represents the key for exit. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_EXIT 0x00000087UL +///< Represents the key for channel up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_CHANNELUP 0x00000088UL +///< Represents the key for channel down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_CHANNELDOWN 0x00000089UL +///< Represents the key for volume up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_VOLUMEUP 0x0000008AUL +///< Represents the key for volume down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_VOLUMEDOWN 0x0000008BUL +///< Represents the key for mute. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_MUTE 0x0000008CUL +///< Represents the key for guide. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_GUIDE 0x0000008DUL +///< Represents the key for viewing guide. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_VIEWINGGUIDE KED_GUIDE +///< Represents the key for info. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_INFO 0x0000008EUL +///< Represents the key for settings. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_SETTINGS 0x0000008FUL +///< Represents the key for page up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PAGEUP 0x00000090UL +///< Represents the key for page down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PAGEDOWN 0x00000091UL +///< Represents the key "A". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEYA 0x00000092UL +///< Represents the key "B". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEYB 0x00000093UL +///< Represents the key "C". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEYC 0x00000094UL +///< Represents the key "D". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEYD 0x0000009FUL +///< Represents the key for the red circle (Key C). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEY_RED_CIRCLE KED_KEYC //@todo platform specific key will be depricated in the next phase. +///< Represents the key for the green diamond (Key D). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEY_GREEN_DIAMOND KED_KEYD //@todo platform specific key will be depricated in the next phase. +///< Represents the key for the blue square (Key B). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEY_BLUE_SQUARE KED_KEYB //@todo platform specific key will be depricated in the next phase. +///< Represents the key for the yellow triangle (Key A). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_KEY_YELLOW_TRIANGLE KED_KEYA //@todo platform specific key will be depricated in the next phase. +///< Represents the key for the last channel. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_LAST 0x00000095UL +///< Represents the key for favorite. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_FAVORITE 0x00000096UL +///< Represents the key for rewind. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_REWIND 0x00000097UL +///< Represents the key for fast forward. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_FASTFORWARD 0x00000098UL +///< Represents the key for play. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PLAY 0x00000099UL +///< Represents the key for stop. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_STOP 0x0000009AUL +///< Represents the key for pause. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PAUSE 0x0000009BUL +///< Represents the key for record. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_RECORD 0x0000009CUL +///< Represents the key for bypass. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_BYPASS 0x0000009DUL +///< Represents the key for TV/VCR. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_TVVCR 0x0000009EUL + +///< Represents the key for replay. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_REPLAY 0x000000A0UL +///< Represents the key for help. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_HELP 0x000000A1UL +///< Represents the key for recalling favorite 0. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_RECALL_FAVORITE_0 0x000000A2UL +///< Represents the key for clear. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_CLEAR 0x000000A3UL +///< Represents the key for delete. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DELETE 0x000000A4UL +///< Represents the key for start. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_START 0x000000A5UL +///< Represents the key for pound. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_POUND 0x000000A6UL +///< Represents the key for front panel 1. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_FRONTPANEL1 0x000000A7UL +///< Represents the key for front panel 2. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_FRONTPANEL2 0x000000A8UL +///< Represents the key for OK. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_OK 0x000000A9UL +///< Represents the key for star. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_STAR 0x000000AAUL +///< Represents the key for program. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PROGRAM 0x000000ABUL + +///< Represents the key for TV power (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_TVPOWER 0x000000C1UL +///< Represents the key for previous (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PREVIOUS 0x000000C3UL +///< Represents the key for next (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_NEXT 0x000000C4UL +///< Represents the key for menu (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_MENU 0x000000C0UL +///< Represents the key for input key. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_INPUTKEY 0x000000D0UL +///< Represents the key for live. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_LIVE 0x000000D1UL +///< Represents the key for MyDVR. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_MYDVR 0x000000D2UL +///< Represents the key for on-demand. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_ONDEMAND 0x000000D3UL +///< Represents the key for STB menu. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_STB_MENU 0x000000D4UL +///< Represents the key for audio. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_AUDIO 0x000000D5UL +///< Represents the key for factory. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_FACTORY 0x000000D6UL +///< Represents the key for RF enable. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_RFENABLE 0x000000D7UL +///< Represents the key for list. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_LIST 0x000000D8UL +///< Represents the key for RF pair ghost. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_RF_PAIR_GHOST 0x000000EFUL /* Ghost code to implement auto pairing in RF remotes */ +///< Represents the key for WPS. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_WPS 0x000000F0UL /* Key to initiate WiFi WPS pairing */ +///< Key to initiate deepsleep wakeup. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DEEPSLEEP_WAKEUP 0x000000F1UL /* Key to initiate deepsleep wakeup */ +///< Signals a battery set was replaced. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_NEW_BATTERIES_INSERTED 0x000000F2UL /* Signals a battery set was replaced */ +///< Signals an external power supply device is shutting down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_GRACEFUL_SHUTDOWN 0x000000F3UL /* Signals an external power supply device is shutting down */ +///< Use for keys not defined here. Pass raw code as well. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_UNDEFINEDKEY 0x000000FEUL /* Use for keys not defined here. Pass raw code as well. */ + + +///< Represents the key for back. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_BACK 0x100000FEUL +///< Represents the key for display swap. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DISPLAY_SWAP 0x300000FEUL +///< Represents the key for PIP move. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PINP_MOVE 0x400000FEUL +///< Represents the key for PIP toggle. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PINP_TOGGLE 0x500000FEUL +///< Represents the key for PIP channel down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PINP_CHDOWN 0x600000FEUL +///< Represents the key for PIP channel up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_PINP_CHUP 0x700000FEUL +///< Represents the key for DMC activate. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DMC_ACTIVATE 0x800000FEUL +///< Represents the key for DMC deactivate. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DMC_DEACTIVATE 0x900000FEUL +///< Represents the key for DMC query. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_DMC_QUERY 0xA00000FEUL +///< Represents the key for OTR start. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_OTR_START 0xB00000FEUL +///< Represents the key for OTR stop. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_OTR_STOP 0xC00000FEUL +///< Represents the key for test. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase +#define KED_TEST 0xD00000FEUL + +#ifdef __cplusplus +} +#endif + +#endif /* _IR_KEYCODES_H_ */ + + +/** @} */ // End of IrKeyCodes +/** @} */ // End of IR_MANAGER_HAL +/** @} */ // End of HPK diff --git a/mocks/libIARM.h b/mocks/libIARM.h new file mode 100644 index 0000000..bb7e601 --- /dev/null +++ b/mocks/libIARM.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 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. +*/ + +/** +* @file libIARM.h +* +* @brief IARM-Bus IARM core library API. +* +* This API defines the core constants for IARM +* +* @par Document +* Document reference. +* +* @par Open Issues (in no particular order) +* -# None +* +* @par Assumptions +* -# None +* +* @par Abbreviations +* - BE: ig-Endian. +* - cb: allback function (suffix). +* - DS: Device Settings. +* - FPD: Front-Panel Display. +* - HAL: Hardware Abstraction Layer. +* - LE: Little-Endian. +* - LS: Least Significant. +* - MBZ: Must be zero. +* - MS: Most Significant. +* - RDK: Reference Design Kit. +* - _t: Type (suffix). +* +* @par Implementation Notes +* -# None +* +*/ + +/** @defgroup IARM_BUS IARM_BUS +* @ingroup IARM_BUS +* +* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows +* applications to communicate with each other by sending Events or invoking Remote +* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is +* independent of the operating system or the underlying IPC mechanism. +* +* Two applications connected to the same instance of IARM-Bus are able to exchange events +* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If +* desired, it is possible to have multiple IARM-Bus instances. However, applications +* connected to different buses will not be able to communicate with each other. +*/ + +/** @addtogroup IARM_BUS_IARM_CORE_API IARM-Core library. +* @ingroup IARM_BUS +* +* Described herein are the constants declarations that are part of the +* IARM Core library. +* +* @{ +*/ + + +#ifndef _LIB_IARM_H +#define _LIB_IARM_H + +#ifdef __cplusplus +extern "C" +{ +#endif +#include + + +#define IARM_BUS_NAME "com.comcast.rdk.iarm.bus" /*!< Well-known Bus Name */ +#define IARM_MAX_NAME_LEN 64 /*!< Maximum string length of names in IARM, including the null terminator */ + +typedef int IARM_EventId_t; + +typedef enum _IARM_Result_t +{ + IARM_RESULT_SUCCESS, + IARM_RESULT_INVALID_PARAM, /*!< Invalid input parameter */ + IARM_RESULT_INVALID_STATE, /*!< Invalid state encountered */ + IARM_RESULT_IPCCORE_FAIL, /*!< Underlying IPC failure */ + IARM_RESULT_OOM, /*!< Memory allocation failure */ + +} IARM_Result_t; + +#define IARM_METHOD_IPC_TIMEOUT_DEFAULT (-1) +#define IARM_METHOD_IPC_TIMEOUT_INFINITE ((int) 0x7fffffff) + +#ifdef __cplusplus +} +#endif +#endif + +/* End of IARM_BUS_IARM_CORE_API doxygen group */ +/** + * @} + */ diff --git a/mocks/libIARMCore.h b/mocks/libIARMCore.h new file mode 100644 index 0000000..175b5b8 --- /dev/null +++ b/mocks/libIARMCore.h @@ -0,0 +1,364 @@ +/* + * 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. +*/ + +/** +* @file libIARMCore.h +* +* @brief IARM-Bus IARM core library API. +* +* This API defines the core operations for IARM +* +* @par Document +* Document reference. +* +* @par Open Issues (in no particular order) +* -# None +* +* @par Assumptions +* -# None +* +* @par Abbreviations +* - BE: ig-Endian. +* - cb: allback function (suffix). +* - DS: Device Settings. +* - FPD: Front-Panel Display. +* - HAL: Hardware Abstraction Layer. +* - LE: Little-Endian. +* - LS: Least Significant. +* - MBZ: Must be zero. +* - MS: Most Significant. +* - RDK: Reference Design Kit. +* - _t: Type (suffix). +* +* @par Implementation Notes +* -# None +* +*/ + +/** @defgroup IARM_BUS IARM_BUS +* @ingroup IARM_BUS +* +* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows +* applications to communicate with each other by sending Events or invoking Remote +* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is +* independent of the operating system or the underlying IPC mechanism. +* +* Two applications connected to the same instance of IARM-Bus are able to exchange events +* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If +* desired, it is possible to have multiple IARM-Bus instances. However, applications +* connected to different buses will not be able to communicate with each other. +*/ + +/** @addtogroup IARM_BUS_IARM_CORE_API IARM-Core library. +* @ingroup IARM_BUS +* +* Described herein are the functions that are part of the +* IARM Core library. +* +* @{ +*/ + +#ifndef _LIB_IARMCORE_H +#define _LIB_IARMCORE_H + +#include "libIARM.h" + +#ifdef __cplusplus +extern "C" +{ +#endif +#include +#define IARM_ASSERT(cond) while(!(cond)) \ +{ \ + printf("IARM_ASSERT Failed at [%s @ %d]\r\n", __func__, __LINE__);\ + break; \ +}\ + +/*! IARM Event data*/ +typedef struct _IARM_EventData_t { + char owner[IARM_MAX_NAME_LEN]; /*!< Owner of the event*/ + IARM_EventId_t id; /*!< Event id*/ + size_t len; /*!< Size of event data*/ + char data[]; /*!< Event data*/ +} IARM_EventData_t; + +typedef enum _IARM_MemType_t +{ + IARM_MEMTYPE_THREADLOCAL = 1, /*!< Thread local memory */ + IARM_MEMTYPE_PROCESSLOCAL, /*!< Process local memory */ + IARM_MEMTYPE_PROCESSSHARE, /*!< Process shared memory */ +} IARM_MemType_t; + +/** + * @brief Callback prototype for IARM RPC Call. + * + */ +typedef void (*IARM_Call_t) (void *ctx, unsigned long methodID, void *arg, void *magic); + +/** + * @brief Callback prototype for IARM listener interface. + * + */ +typedef void (*IARM_Listener_t) (void *ctx, void *arg); + +/** + * @brief Initialize the IARM module for the calling process. + * + * This API is used to initialize the IARM module for the calling process, and regisers the calling process to + * be visible to other processes that it wishes to communicate to. The registered process is uniquely identified + * by (groupName, memberName). + * + * @param [in] groupName The IPC group this process wishes to participate. + * @param [in] memberName The name of the calling process. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_Init(const char *groupName, const char *memberName); + +/** + * @brief Allocate memory for IARM member processes. + * + * This API allows IARM member process to allocate local memory or shared memory. + * There are two types of local memory: Process local and thread local. Local memory + * is only accessible by the process who allocates. + * + * Shared memory, is accessible by all processes within the same group as the process that + * allocates the memory. + * + * For example, RPC call arguments of complicated structures should be allocated from shared + * memory so the RPC invocation can access these arguments from a different process. + * + * @param [in] type Thread-Local, Process-Local or Shared memory. + * @param [in] size Number of bytes to allocate. + * @param [out] ptr Return allocated memory. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr); + +/** + * @brief Free memory allocated by IARM member processes. + * + * This API allows IARM member process to free local memory or shared memory. + * The type specified in the free() API must match that specified in the malloc() + * call. + * + * @param [in] type Thread-Local, Process-Local or Shared memory. This must match the type of the allocated memory. + * @param [in] alloc Points to the allocated memory to be freed. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc); + + +/** + * @brief Register a RPC call so other processes can call. + * + * A process publishes a RPC function using this API. The RPC call, uniquely + * identified by (groupName, memberName, callName), can be invoked using the + * three names together. + * + * A RPC function implemented by one process must publish it first before other + * process can make a RPC call. Otherwise, the caller will be blocked until + * the RPC call is published. + * + * @param [in] ownerName The name of this member process that implements the Call. + * @param [in] callName The name of the function that this member offers as RPC-Call. + * @param [in] handler The function that can be called by (ownerName, callName) + * @param [in] ctx Local context to passed in when the function is called. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_RegisterCall(const char *ownerName, const char *callName, IARM_Call_t handler, void *ctx); + +/** + * @brief Make a RPC call + * + * Invoke the RPC function by specifying its names. This call will block until + * the specified RPC function is published. + * + * @param [in] ownerName The name of member process implementing the RPC call. + * @param [in] funcName The name of the function to call. + * @param [in] arg Supply the argument to be used by the RPC call. + * @param [out] ret Returns the return value of the RPC call. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_Call(const char *ownerName, const char *funcName, void *arg, int *ret); + +/** + * @brief Make a RPC call with Timeout + * + * Invoke the RPC function by specifying its names. This call will block until + * the specified RPC function is published. + * + * @param [in] ownerName The name of member process implementing the RPC call. + * @param [in] funcName The name of the function to call. + * @param [in] arg Supply the argument to be used by the RPC call. + * @param [in] timeout millisecond time interval to be used for the RPC call. + * @param [out] ret Returns the return value of the RPC call. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_CallWithTimeout(const char *ownerName, const char *funcName, void *arg, int timeout, int *ret); + +/** + * @brief Check whether a RPC call is registered or not. + * + * RPC calls should be registered so that other processes can call. + * + * @param [in] ownerName The name of owner process implementing the RPC call. + * @param [in] callName The name of the function to be checked. + * @param [out] isRegistered returns the status whether the RPC call is registered. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_IsCallRegistered(const char *ownerName, const char *callName, int *isRegistered); + +#if 1 +/** + * @brief Explicitly mark the return/finish of a RPC-Call + * + * This API must be called by the implementation of the RPC-Call to submit the return value to the caller. + * Otherwise the caller will be blocked forever waiting for the return value. + * + * This API does not need to be called at the end of the RPC invokation. It can be called anytime by anybody + * after the RPC call is requested, to unblocked the caller. + * + * @param [in] ownerName The name of owner process implementing the RPC call. + * @param [in] funcName The name of the function to call. + * @param [in] ret return value of the executed RPC-Call. + * @param [in] callMsg must match the "serial" passed in when the RPC implementation is executed. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_CallReturn(const char *ownerName, const char *funcName, void *arg, int ret, void *callMsg); + +#else +/** + * @brief Explicitly mark the return/finish of a RPC-Call + * + * This API must be called by the implementation of the RPC-Call to submit the return value to the caller. + * Otherwise the caller will be blocked forever waiting for the return value. + * + * This API does not need to be called at the end of the RPC invokation. It can be called anytime by anybody + * after the RPC call is requested, to unblocked the caller. + * + * @param [in] ownerName The name of owner process implementing the RPC call. + * @param [in] funcName The name of the function to call. + * @param [in] ret return value of the executed RPC-Call. + * @param [in] serial a number that must match the "serial" passed in when the RPC implementation is executed. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ + +IARM_Result_t IARM_CallReturn(const char *ownerName, const char *funcName, int ret, int serial); +#endif +/** + * @brief Register a event that can be listened to by other processes. + * + * All events published within a process group are uniquely identified by an eventId. + * A process uses this API to publish an event so this event can be listened by + * other processes. + * + * An event must be published before it can be "notified" + * + * @param [in] ownerName The name of the member process that owns the event. + * @param [in] eventId The ID of the event. This ID is unique across all processes. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_RegisterEvent(const char *ownerName, IARM_EventId_t eventId); + +/** + * @brief Notify listeners of event + * + * This API is used to notify all listeners of a certain event. + * + * @param [in] ownerName The name of the member process that owns the event. + * @param [in] eventId The ID of the event. + * @param [in] arg Argument to be passed to the listeners. Note that this arg must be allocated from shared memory + * via IARM_Malloc(IARM_MEMTYPE_PROCESSSHARE). IARM Module will free this memor once all listeners are + * notified. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_NotifyEvent(const char *ownerName, IARM_EventId_t eventId, void *arg); + +/** + * @brief Register to listen for an event. + * + * This API is used to register the calling process for a certain event. + * If the event is not yet published, this call be be blocked until the event + * is published. + * + * @param [in] ownerName The name of the member process that owns the event. + * @param [in] eventId The ID of the event. + * @param [in] listener Callback function when the event is received. + * @param [in] ctx Local context used when calling the listener's callback function. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_RegisterListner(const char *ownerName, IARM_EventId_t eventId, IARM_Listener_t listener, void *ctx); + +/** + * @brief UnRegister to listen for an event. + * + * This API is used to unregister the calling process for a certain event. + * + * @param [in] ownerName The name of the member process that owns the event. + * @param [in] eventId The ID of the event. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_UnRegisterListner(const char *ownerName, IARM_EventId_t eventId); + +/** + * @brief Terminate the IARM module for the calling process. + * + * This API is used to terminate the IARM module for the calling process, and cleanup resources + * used by MAF. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_Term(void); + +#ifdef __cplusplus +} +#endif +#endif + +/* End of IARM_BUS_IARM_CORE_API doxygen group */ +/** + * @} + */ diff --git a/mocks/libIBus.h b/mocks/libIBus.h new file mode 100644 index 0000000..9b72b22 --- /dev/null +++ b/mocks/libIBus.h @@ -0,0 +1,362 @@ + +/* + * 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. +*/ + +/** +* @file libIBus.h +* +* @brief RDK IARM-Bus API Declarations. +* +* @defgroup IARMBUS_API IARM Bus API +* @ingroup IARMBUS +* Application should use the APIs declared in this file to access +* services provided by IARM-Bus. Basically services provided by +* these APIs include: +*
1) Library Initialization and termination. +*
2) Connection to IARM-Bus. +*
3) Send and Receive Events. +*
4) Declared and Invoke RPC Methods. +* +* @par Document +* Document reference. +* +* @par Open Issues (in no particular order) +* -# None +* +* @par Assumptions +* -# None +* +* @par Abbreviations +* - BE: ig-Endian. +* - cb: allback function (suffix). +* - DS: Device Settings. +* - FPD: Front-Panel Display. +* - HAL: Hardware Abstraction Layer. +* - LE: Little-Endian. +* - LS: Least Significant. +* - MBZ: Must be zero. +* - MS: Most Significant. +* - RDK: Reference Design Kit. +* - _t: Type (suffix). +* +* @par Implementation Notes +* -# None +* +*/ + +/** @defgroup IARMBUS IARM Bus +* +* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows +* applications to communicate with each other by sending Events or invoking Remote +* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is +* independent of the operating system or the underlying IPC mechanism. +* +* Two applications connected to the same instance of IARM-Bus are able to exchange events +* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If +* desired, it is possible to have multiple IARM-Bus instances. However, applications +* connected to different buses will not be able to communicate with each other. +* +* @par Capabilities +*
    +*
  1. Invoke methods in other processes via Remote Procedure Call (RPC). +*
  2. Send interprocess messages. +*
  3. Manage shared memory and exclusive access to resources. +*
  4. Register for event notification. +*
  5. Publish event notification to registered listeners. +*
+*/ + +#ifndef _LIB_IARM_BUS_H +#define _LIB_IARM_BUS_H + + + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "libIARM.h" + +/** + * @brief Function signature for RPC Methods. + * + * All IARM RPC Methods must use IARM_BusCall_t as their function signature. + * Important Note: The argument structure cannot have pointers. The sizeof() operator applied + * on the @p arg must equal to the actual memory allocated. Internally an equivalent of + * memcpy() is used to dispatch parameters its target. If a pointer is used in the parameters, + * the pointer, not the content it points to, is sent to the destination. + * + * @param arg is the composite carrying all input and output parameters of the RPC Method. + * + */ +typedef IARM_Result_t (*IARM_BusCall_t) (void *arg); +/** + * @brief Function signature for event handlers. + * + * All IARM Event handlers must use IARM_EventHandler_t as their function signature. + * Important Note: The event data structure cannot have pointers. The sizeof() operator applied + * on the @p data must equal to the actual memory allocated. Internally an equivalent of + * memcpy() is used to dispatch event data to its target. If a pointer is used in the event data, + * the pointer, not the content it points to, is sent to the destination. + * + * @param owner is well-known name of the application sending the event. + * @param eventID is the integer uniquely identifying the event within the sending application. + * @param data is the composite carrying all input and output parameters of event. + * @param len is the result of sizeof() applied on the event data data structure. + * + * @return None + */ +typedef void (*IARM_EventHandler_t)(const char *owner, IARM_EventId_t eventId, void *data, size_t len); + +/** + * @addtogroup IARMBUS_API + * @{ + */ + +/** + * @brief This API is used to initialize the IARM-Bus library. + * + * The registered IARM client is uniquely identified by the given name in the IARM_Bus_Init() function. + * The application is not yet connected to the bus until IARM_Bus_Connect() is called. + * + * After the library is initialized, the application is ready to access events and RPC methods + * using the bus. + * + * @param[in] name A well-known name of the IARM client. The registered IARM client + * should be uniquely identified by (groupName, memberName) + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates the call was unsuccessful because the bus is + * already initialised and connected. + */ +IARM_Result_t IARM_Bus_Init(const char *name); + +/** + * @brief This API is used to terminate the IARM-Bus library. + * + * This function releases resources allocated by the IARM Bus Library. After it is called, + * the library returns to the state prior to IARM_Bus_Init function is called. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates the call was unsuccessful because the bus is + * not initialised. + */ +IARM_Result_t IARM_Bus_Term(void); + +/** + * @brief This API is used to connect application to the IARM bus daemon. + * After connected, the application can send/receive IARM events and invoke IARM RPC calls. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_STATE Indicates the call was unsuccessful. + */ +IARM_Result_t IARM_Bus_Connect(void); + +/** + * @brief This API disconnect Application from IARM Bus so the application will not receive + * any IARM event or RPC calls. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_STATE Indicates the call was unsuccessful. + */ +IARM_Result_t IARM_Bus_Disconnect(void); + +/** + * @brief Returns group context of the calling member + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_Bus_GetContext(void **context); + +/** + * @brief This API is used to publish an Asynchronous event to all IARM client registered for this + * perticular event. Upon returns of this function, all the listeners are notified of the event. + * + * @param[in] ownerName The IARM client that publishes/owns the broadcast event. + * @param[in] eventId The event id to publish. + * @param[in] data Data carried by this event. + * @param[in] len Length of the data parameter. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_STATE Indicates the call was unsuccessful because the bus is either + * not initialised nor connected. + * @retval IARM_RESULT_INVALID_PARAM Indicates invalid parameter. + */ +IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *data, size_t len); + +/** + * @brief This API is used to check if the current process is registered with IARM. + * + * @param[in] memberName IARMBUS member whose registration status has to be checked. + * @param[out] isRegistered True if the specified process is still registered. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter. + * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. + */ +IARM_Result_t IARM_Bus_IsConnected(const char *memberName, int *isRegistered); + +/** + * @brief This API register to listen to event and provide the callback function for event notification. + * Execution of the handler will not block the process sending the event. + * + * The API checks for duplicate handlers so a same handler for same event and owner name will not be registered twice + * NULL handler is not allowed. + * + * @param[in] ownerName The well-known name of the IARM client. + * @param[in] eventId The event to listen for. + * @param[in] handler The hander function to be called for event notification. + * + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameters. + * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus is either not initialised nor connected. + * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. + * @retval IARM_RESULT_OOM Indicates memory allocation failure. + * @see IARM_Bus_BroadcastEvent() + * @see IARM_EventHandler_t + */ +IARM_Result_t IARM_Bus_RegisterEventHandler(const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler); + +/** + * @brief This API is used to Remove ALL handlers registered for the given event. + * This API remove the all the event handlers. This API is not used to unregister a specific handler.. + + * @param[in] eventId The event whose listener to be removed. + * @param[in] ownerName The well-known name of the application. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter was passed. + * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus is either not initialised nor connected. + * @retval IARM_RESULT_IPCCORE_FAIL Indicates underlying IPC failure. + * @retval IARM_RESULT_OOM Indicates memory allocation failure. + */ +IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char *ownerName, IARM_EventId_t eventId); + +/** + * @brief Remove specific handler registered for the given event. + * + * This API remove the specific handlers. + * @param[in] ownerName The well-known name of the application. + * @param [in] eventId The event whose listener to remove. + * @param [in] handler The event handler to remove. + * + * @return IARM_Result_t Error Code. + */ +IARM_Result_t IARM_Bus_RemoveEventHandler(const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler); + + + +/** + * @brief This API is used to register an RPC method that can be invoked by other applications. + * + * The parameter methodName is the string name used to invoke the RPC method and the parameter handler + * is the implementation of the RPC method. When other application invokes the method via its string name, + * the function pointed to by the handler is executed. + * + * @param[in] methodName The name used to invoke the RPC method. + * @param[in] handler A pointer to RPC method implementation. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates invalid parameter. + * @retval IARM_RESULT_INVALID_STATE Indicates IARM_Bus is either not initialised nor connected. + * @retval IARM_RESULT_OOM Indicates memory allocation failure. + */ +IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler); + +/** + * @brief This API is used to Invoke RPC method by its application name and method name. + * + * @param[in] ownerName well-known name of the application that publish the RPC call. + * @param[in] methodName well-known name of the RPC method. + * @param[in] arg It is the data structure holding input & output parameters of the invocation. + * @param[in] argLen The size of the data pointed by arg parameter. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter. + * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus was either not initialised nor connected. + * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. + * @retval IARM_RESULT_OOM Indicates failure to allocate memory. + */ +IARM_Result_t IARM_Bus_Call(const char *ownerName, const char *methodName, void *arg, size_t argLen); + +/** + * @brief This API is used to Invoke RPC method by its application name and method + * name with specified timeout to wait for response. + * + * @param[in] ownerName well-known name of the application that publish the RPC call. + * @param[in] methodName well-known name of the RPC method. + * @param[in] arg It is the data structure holding input & output parameters of the invocation. + * @param[in] argLen The size of the data pointed by arg parameter. + * @param[in] timeout in millisecond for the RPC method. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter. + * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus was either not initialised nor connected. + * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. + * @retval IARM_RESULT_OOM Indicates failure to allocate memory. + */ +IARM_Result_t IARM_Bus_Call_with_IPCTimeout(const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout); + +/** + * @brief This API is used to register all the events that are published by the application. + * + * An application can publish multiple events and these events must have an enumeration value + * defined in the public header file of the HAL. + * It registers all events whose enum value is less than maxEventId. + * + * @param[in] maxEventId The maximum number of events that can be registered. + * + * @return Error Code. + * @retval IARM_RESULT_SUCCESS Indicates the call was successful. + * @retval IARM_RESULT_INVALID_STATE Indicates the IARM Bus is either not initialised nor connected. + */ +IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId); + +/** + * @brief Write PID file + * + * This API allows Daemon to write PID file + * + * @param full pathname to pidfile to write + */ +void IARM_Bus_WritePIDFile(const char *path); + + +/* End of IARM_BUS_IARM_CORE_API doxygen group */ +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/mocks/libIBusDaemon.h b/mocks/libIBusDaemon.h new file mode 100644 index 0000000..d711773 --- /dev/null +++ b/mocks/libIBusDaemon.h @@ -0,0 +1,270 @@ +/* + * 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. +*/ + +/** +* @file libIBusDaemon.h +* +* @brief IARM-Bus Daemon API +* +* This API defines the public operations for IARM bus Daemon. +* +* @par Document +* Document reference. +* +* @par Open Issues (in no particular order) +* -# None +* +* @par Assumptions +* -# None +* +* @par Abbreviations +* - BE: ig-Endian. +* - cb: allback function (suffix). +* - DS: Device Settings. +* - FPD: Front-Panel Display. +* - HAL: Hardware Abstraction Layer. +* - LE: Little-Endian. +* - LS: Least Significant. +* - MBZ: Must be zero. +* - MS: Most Significant. +* - RDK: Reference Design Kit. +* - _t: Type (suffix). +* +* @par Implementation Notes +* -# None +* +*/ + +/** @defgroup IARM_BUS IARM-Bus Daemon +* @ingroup IARM_RDK +* +* +*/ + +/** @addtogroup IARM_BUS_DAEMON_API IARM-BUS Daemon API. +* @ingroup IARM_BUS +* +* Described herein are the IARM Bus daemon types and functions. +* This includes +*
1) Calls and data structures for requesting and releasing resources through IARM +*
2) PreChange calls for power and resolution changes, which needs +* to be implemented by members if it requires some action to be done +* before these changes. +* +* +* @{ +*/ + +#ifndef _IARM_BUS_DAEMON_H +#define _IARM_BUS_DAEMON_H + + +#ifdef __cplusplus +extern "C" +{ +#endif +#define IARM_BUS_DAEMON_NAME "Daemon" /*!< IARM bus name for Daemon */ + +/*! Daemon events enumeration */ +typedef enum _IARM_Bus_Daemon_EventId_t { + IARM_BUS_EVENT_RESOURCEAVAILABLE, /*!< Resource available event */ + IARM_BUS_EVENT_RESOLUTIONCHANGE, /*!< Resolution change event */ + IARM_BUS_SIGNAL_MAX, /*!< Maximum value for IARM daemon event */ +} IARM_Bus_EventId_t; + +/*! Type of resources acknowledge through on Resource available event */ +typedef enum _IARM_Bus_Daemon_ResrcType_t { + IARM_BUS_RESOURCE_FOCUS = 0, + IARM_BUS_RESOURCE_DECODER_0, + IARM_BUS_RESOURCE_DECODER_1, + IARM_BUS_RESOURCE_PLANE_0, + IARM_BUS_RESOURCE_PLANE_1, + IARM_BUS_RESOURCE_POWER, + IARM_BUS_RESOURCE_RESOLUTION, + + IARM_BUS_RESOURCE_MAX +} IARM_Bus_ResrcType_t; + +/*! Data assosiated with Resolution change */ +typedef struct _IARM_Bus_ResolutionChange_EventData_t{ + + int width; /*!< new width after resoution change */ + int height; /*!< new height after resoution change */ + +} IARM_Bus_ResolutionChange_EventData_t; + +/*! Union of IARM Bus event, data could be resource type + * or new resolution based on the event type*/ +typedef union _IARM_Bus_EventData_t { + IARM_Bus_ResrcType_t resrcType; /*!< Resource type, which will be valid if event is resource available*/ + IARM_Bus_ResolutionChange_EventData_t resolution; /*!< New resolution, which will be valid if event is resolution change*/ + +} IARM_Bus_EventData_t; + +/*! Data associated with Resolution Post-Change call*/ +typedef struct _IARM_Bus_CommonAPI_ResChange_Param_t{ + int width; /*!< Current resolution width */ + int height; /*!< Current resolution height */ +}IARM_Bus_CommonAPI_ResChange_Param_t; + +/*! Possible power states */ +typedef enum _IARM_Bus_Daemon_PowerState_t { + IARM_BUS_PWRMGR_POWERSTATE_OFF, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state OFF */ + IARM_BUS_PWRMGR_POWERSTATE_STANDBY, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state STANDBY */ + IARM_BUS_PWRMGR_POWERSTATE_ON, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state ON */ + IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state set/get */ + IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state set/get */ +} IARM_Bus_PowerState_t; + +typedef IARM_Bus_PowerState_t IARM_Bus_PWRMgr_PowerState_t; + +/*! Data associated with Power Pre-Change call*/ +typedef struct _IARM_Bus_CommonAPI_PowerPreChange_Param_t{ + IARM_Bus_PWRMgr_PowerState_t newState; /*!< New power state*/ + IARM_Bus_PWRMgr_PowerState_t curState; /*!< Current power state*/ +} IARM_Bus_CommonAPI_PowerPreChange_Param_t; + + +typedef struct _IARM_Bus_PowerPreChange_Param_t{ + IARM_Bus_PWRMgr_PowerState_t newState; /*!< New power state*/ + IARM_Bus_PWRMgr_PowerState_t curState; /*!< Current power state*/ + char owner[IARM_MAX_NAME_LEN]; +} IARM_Bus_PowerPreChange_Param_t; + +/*! Data associated with Release ownership call*/ +typedef struct _IARM_Bus_CommonAPI_ReleaseOwnership_Param_t { + IARM_Bus_ResrcType_t resrcType; /*!< Type of resource to be freed*/ +} IARM_Bus_CommonAPI_ReleaseOwnership_Param_t; + + +/*! Type of Sys modes available*/ +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; + +/*! data associated with Sys mod-change call*/ +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; + + +/** + * @brief Request to grab resource + * + * Ask IARM Daemon to grant resoruce. Upon the success return, the resource is + * available to use. + * + * @param [in] resrcType: Resource type. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_BusDaemon_RequestOwnership(IARM_Bus_ResrcType_t resrcType); + +/** + * @brief Notify IARM Daemon that the resource is released. + * + * Upon success return, this client is no longer the owner of the resource. + * A resource free event will be broadcasted and some other client intereseted in + * freed resource can request the resource now. + * + * @param [in] resrcType: Resource type. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_BusDaemon_ReleaseOwnership(IARM_Bus_ResrcType_t resrcType); + +/** + * @brief Send power pre change command + * + * Command is broadcasted before power change and all those modules implementing + * power prechange function will be called. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_BusDaemon_PowerPrechange(IARM_Bus_CommonAPI_PowerPreChange_Param_t preChangeParam); + +/** + * @brief Send resolution pre change command + * + * Command is broadcasted before resolution change and all those modules implementing + * resolution prechange function will be called. + * + * @param [in] preChangeParam: height, width etc. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_BusDaemon_ResolutionPrechange(IARM_Bus_CommonAPI_ResChange_Param_t preChangeParam); + +/** + * @brief Send resolution post change command + * + * Command is broadcasted after resolution change and all those modules implementing + * resolution postchange handler will be called. + * + * @param [in] postChangeParam: height, width etc. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_BusDaemon_ResolutionPostchange(IARM_Bus_CommonAPI_ResChange_Param_t postChangeParam); + + +/** + * @brief Send Deep Sleep Wakeup command + * + * Command is broadcasted to Deep sleep Manager for wakeup from deep sleep. + * + * @return IARM_Result_t Error Code. + * @retval IARM_RESULT_SUCCESS on success + */ +IARM_Result_t IARM_BusDaemon_DeepSleepWakeup(IARM_Bus_CommonAPI_PowerPreChange_Param_t preChangeParam); + + + +#define IARM_BUS_COMMON_API_ReleaseOwnership "ReleaseOwnership" /*!< This method shall be implemented by all member requests for resources*/ + + +#define IARM_BUS_COMMON_API_PowerPreChange "PowerPreChange" /*!< This method if implemented by a member, will be called before a power change event*/ + +#define IARM_BUS_COMMON_API_DeepSleepWakeup "DeepSleepWakeup" /*!< This method if implemented by a member, will be called to wakeup from Deep Sleep */ + + +#define IARM_BUS_COMMON_API_ResolutionPreChange "ResolutionPreChange" /*!< This method if implemented by a member, will be called before a resolution change*/ + +#define IARM_BUS_COMMON_API_ResolutionPostChange "ResolutionPostChange" /*!< This method if implemented by a member, will be called after a resolution change*/ + + +#define IARM_BUS_COMMON_API_SysModeChange "SysModeChange" /*!< This method if implemented by a member, will be called on a Sys mode change*/ + +#ifdef __cplusplus +} +#endif +#endif + +/* End of IARM_BUS_DAEMON_API doxygen group */ +/** + * @} + */ diff --git a/mocks/mfrApi.h b/mocks/mfrApi.h new file mode 100644 index 0000000..9136c42 --- /dev/null +++ b/mocks/mfrApi.h @@ -0,0 +1,224 @@ +/* + * 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. +*/ + + + +/** +* @defgroup iarmmgrs +* @{ +* @defgroup mfr +* @{ +**/ + + +#ifndef __MFR_API_H__ +#define __MFR_API_H__ +/*-----------------------------------------------------------------*/ +/*------------------------------------------------------------------- + Include Files +-------------------------------------------------------------------*/ +#include "mfrTypes.h" +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned long VL_MFR_DEVICE_HANDLE_t; + +typedef enum _VL_MFR_API_RESULT +{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. + VL_MFR_API_RESULT_SUCCESS = 0, + VL_MFR_API_RESULT_FAILED = 1, + VL_MFR_API_RESULT_NOT_EXISTING = 6, + VL_MFR_API_RESULT_NULL_PARAM = 7, + VL_MFR_API_RESULT_OUT_OF_RANGE = 9, + VL_MFR_API_RESULT_OPEN_FAILED = 10, + VL_MFR_API_RESULT_READ_FAILED = 11, + VL_MFR_API_RESULT_WRITE_FAILED = 12, + VL_MFR_API_RESULT_MALLOC_FAILED = 13, + VL_MFR_API_RESULT_DECRYPTION_FAILED = 15, + VL_MFR_API_RESULT_NULL_KEY = 16, + VL_MFR_API_RESULT_INVALID_KEY_LENGTH = 17, + VL_MFR_API_RESULT_INVALID_BUFFER_LENGTH = 18, + VL_MFR_API_RESULT_SIZE_MISMATCH = 19, + +}VL_MFR_API_RESULT; + + +typedef enum _VL_PLATFORM_VERSION_TYPE +{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. + VL_PLATFORM_VERSION_TYPE_BOARD_VERSION = 0, + VL_PLATFORM_VERSION_TYPE_BOARD_SERIAL_NO = 1, + VL_PLATFORM_VERSION_TYPE_CM_CHIP_VERSION = 2, + VL_PLATFORM_VERSION_TYPE_DECODER_SW_VERSION = 7, + VL_PLATFORM_VERSION_TYPE_OS_KERNEL_VERSION = 8, + VL_PLATFORM_VERSION_TYPE_MFR_LIB_VERSION = 11, + VL_PLATFORM_VERSION_TYPE_FRONT_PANEL_VERSION = 12, + VL_PLATFORM_VERSION_TYPE_SOFTWARE_IMAGE_VERSION = 14, + VL_PLATFORM_VERSION_TYPE_OCHD_VERSION = 16, + VL_PLATFORM_VERSION_TYPE_OCAP_VERSION = 18, + VL_PLATFORM_VERSION_TYPE_BOOT_ROM_VERSION = 20, + VL_PLATFORM_VERSION_TYPE_MODEL_NUMBER = 22, + VL_PLATFORM_VERSION_TYPE_MODEL_SERIAL_NO = 23, + VL_PLATFORM_VERSION_TYPE_VENDOR_NAME = 24, + VL_PLATFORM_VERSION_TYPE_VENDOR_SERIAL_NO = 25, + VL_PLATFORM_VERSION_TYPE_MANUFACTURE_DATE = 26, +} VL_PLATFORM_VERSION_TYPE; + + +typedef enum _VL_NORMAL_NVRAM_DATA_TYPE +{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. + + VL_NORMAL_NVRAM_DATA_BOOT_IMAGE_NAME = 0x70000001,// max: 256 bytes : typically 128 bytes : name of current monolithic image + VL_NORMAL_NVRAM_DATA_BOOT_FIRMWARE_IMAGE_NAME = 0x70000010,// max: 256 bytes : typically 128 bytes : name of current firmware image name + VL_NORMAL_NVRAM_DATA_BOOT_APPLICATION_IMAGE_NAME = 0x70000011,// max: 256 bytes : typically 128 bytes : name of current application image name + VL_NORMAL_NVRAM_DATA_BOOT_DATA_IMAGE_NAME = 0x70000012,// max: 256 bytes : typically 128 bytes : name of current data image name + + VL_NORMAL_NVRAM_DATA_CACP_AuthStatus = 0x70000100,// max: 16 bytes : typically 1 bytes : + VL_NORMAL_NVRAM_DATA_CACP_HostId = 0x70000101,// max: 16 bytes : typically 5 bytes : + VL_NORMAL_NVRAM_DATA_COM_DWNLD_CO_SIGN_NAME = 0x70000211,// max: 256 bytes : typically 128 bytes : Co-Signer Name of the device + VL_NORMAL_NVRAM_DATA_COM_DWNL_VEN_ID = 0x70000212,// max: 16 bytes : typically 3 bytes : Vendor Id of the device which + VL_NORMAL_NVRAM_DATA_COM_DWNL_HW_ID = 0x70000213,// max: 16 bytes : typically 4 bytes : Hardware ID of the dvice which + //VL_NORMAL_NVRAM_DATA_COM_DWNL_CODE_FILE_NAME = 0x70000214,// max: 256 bytes : typically 128 bytes : Current running Code file name of the device, identical to VL_NORMAL_NVRAM_DATA_BOOT_IMAGE_NAME, (not used) + VL_NORMAL_NVRAM_DATA_COM_DWNL_MFR_CODE_ACC_STR_TIME = 0x70000215,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_COM_DWNL_CO_SIGN_CODE_ACC_STR_TIME = 0x70000216,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_COM_DWNL_MFR_CVC_ACC_STR_TIME = 0x70000217,// max: 32 bytes : typically 12 bytes : Manufacturer CVC Access Start Time Register + VL_NORMAL_NVRAM_DATA_COM_DWNL_CO_SIGN_CVC_ACC_STR_TIME = 0x70000218,// max: 32 bytes : typically 12 bytes : Co-Signer CVC Start Time Register + VL_NORMAL_NVRAM_DATA_COM_DWNLD_MGR_STATUS = 0x70000219,// max: 16 bytes : typically 4 bytes : This is the code image down load status maintained by the Common Download Manager + VL_NORMAL_NVRAM_DATA_CDL_MFR_CODE_ACC_UPG_STR_TIME = 0x7000021C,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x7000021D,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + + VL_NORMAL_NVRAM_DATA_CDL_FW_MFR_CODE_ACC_UPG_STR_TIME = 0x70000300,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_FW_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x70000301,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_APP_MFR_CODE_ACC_UPG_STR_TIME = 0x70000302,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_APP_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x70000303,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_DATA_MFR_CODE_ACC_UPG_STR_TIME = 0x70000304,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_DATA_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x70000305,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + + VL_NORMAL_NVRAM_DATA_CDL_FW_MFR_CODE_ACC_BOOT_STR_TIME = 0x70000320,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_FW_CO_SIGN_CODE_ACC_BOOT_STR_TIME = 0x70000321,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_APP_MFR_CODE_ACC_BOOT_STR_TIME = 0x70000322,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_APP_CO_SIGN_CODE_ACC_BOOT_STR_TIME = 0x70000323,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_DATA_MFR_CODE_ACC_BOOT_STR_TIME = 0x70000324,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register + VL_NORMAL_NVRAM_DATA_CDL_DATA_CO_SIGN_CODE_ACC_BOOT_STR_TIME= 0x70000325,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register + + VL_NORMAL_NVRAM_DATA_IEEE1394_DTCP_KEY_TYPE = 0x70000500,// max: 16 bytes : typically 1 bytes : DTCP key type + VL_NORMAL_NVRAM_DATA_IEEE1394_DTCP_KEY_STATUS = 0x70000501,// max: 16 bytes : typically 1 bytes : DTCP key status + +}VL_NORMAL_NVRAM_DATA_TYPE; + + + +typedef enum _VL_SECURE_NVRAM_DATA_TYPE +{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. + // Certificates and Keys for Cable Card Conditional Access and Copy Protection + VL_SECURE_NVRAM_DATA_CACP_HOST_ROOT_CERT = 0x100,// max: 2048 bytes : typically 1024 bytes : Cable Labs Root certificate + VL_SECURE_NVRAM_DATA_CACP_HOST_MFR_CA_CERT = 0x101,// max: 2048 bytes : typically 1024 bytes : Cable Labs Manufacturer CA Certificate + VL_SECURE_NVRAM_DATA_CACP_HOST_DEV_CERT = 0x102,// max: 2048 bytes : typically 1024 bytes : Host Device Certificate + VL_SECURE_NVRAM_DATA_CACP_HOST_DEV_PRIVATE_KEY = 0x103,// max: 2048 bytes : typically 1024 bytes : Host Device Private Key + VL_SECURE_NVRAM_DATA_CACP_DH_B_G1 = 0x104,// max: 256 bytes : typically 128 bytes : Diffie-Hellman base ( g ) + VL_SECURE_NVRAM_DATA_CACP_DH_P_N1 = 0x105,// max: 256 bytes : typically 128 bytes : Diffie-Hellman prime ( n ) + VL_SECURE_NVRAM_DATA_CACP_DHKey = 0x106,// max: 256 bytes : typically 128 bytes : + VL_SECURE_NVRAM_DATA_CACP_AuthKeyH = 0x107,// max: 64 bytes : typically 20 bytes : + //Cable Labs Code Verification Certificates for Common Download + VL_SECURE_NVRAM_DATA_COM_DWNLD_CL_CODE_VER_ROOT_CA = 0x200,// max: 2048 bytes : typically 1024 bytes : Cable Labs Code Verification Root CA + VL_SECURE_NVRAM_DATA_COM_DWNLD_CL_CVC_CA = 0x201,// max: 2048 bytes : typically 1024 bytes : Cable Labs CVC CA + VL_SECURE_NVRAM_DATA_COM_DWNLD_MFR_CVC = 0x202,// max: 2048 bytes : typically 1024 bytes : Manufacturer CVC + + //Common Download ( code image download NV data) + VL_SECURE_NVRAM_DATA_COM_DWNLD_CVC_CA_PUB_KEY = 0x219,// max: 2048 bytes : typically 1024 bytes : CVC CA public Key stored by the host device + + //Cable Labs Application Code verification Certificates + //VL_SECURE_NVRAM_DATA_COM_DWNLD_CL_CODE_VER_ROOT_CA = 0x300,// max: 2048 bytes : typically 1024 bytes : Cable Labs Code Verification Root CA same as above 0x100 + VL_SECURE_NVRAM_DATA_APP_CL_APP_CVC_CA = 0x301,// max: 2048 bytes : typically 1024 bytes : Cable Labs Application CVC CA + VL_SECURE_NVRAM_DATA_APP_MAN_CVC = 0x302,// max: 2048 bytes : typically 1024 bytes : Cable Labs Application Manufacturer CVCs + + VL_SECURE_NVRAM_DATA_SERIAL_NUMBER = 0x400,// max: 32 bytes : typically 16 bytes : + + //Ieee1394 DTCP certificates and Keys + VL_SECURE_NVRAM_DATA_IEEE1394_DTCP_CERT_KEYS = 0x500,// max: 2048 bytes : typically 1024 bytes : DTCP keys for 1394 CP + VL_SECURE_NVRAM_DATA_IEEE1394_DTCP_SRM = 0x501,// max: 4096 bytes : typically 1024 bytes : DTCP SRM + VL_SECURE_NVRAM_DATA_IEEE1394_DTCP_SEED = 0x502,// max: 64 bytes : typically 24 bytes : DTCP SEED + + // VL certificates and Keys + VL_SECURE_NVRAM_DATA_VL_CERT_KEYS = 0x600,// max: 1024 bytes : typically 512 bytes : VividLogic certificates + +}VL_SECURE_NVRAM_DATA_TYPE; + + +typedef enum _VL_STACK_2_MFR_EVENT_TYPE +{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. + + VL_STACK_2_MFR_EVENT_SET_UPGRADE_TO_IMAGE = 0x20000100, + VL_STACK_2_MFR_EVENT_SET_REBOOT_WITH_UPGRADED_IMAGE = 0x20000101, + VL_STACK_2_MFR_EVENT_SET_UPGRADE_IMAGE_NAME = 0x20000102, + VL_STACK_2_MFR_EVENT_SET_UPGRADE_SUCCEEDED = 0x20000103, + VL_STACK_2_MFR_EVENT_SET_UPGRADE_FAILED = 0x20000104, + + VL_STACK_2_MFR_EVENT_get_CONFIG_PATH = 0x20000200, + VL_STACK_2_MFR_EVENT_get_SNMP_ENTERPRISE_ID = 0x20000201, + + VL_STACK_2_MFR_EVENT_get_CALL_DFAST2 = 0x20000301, + + VL_STACK_2_MFR_EVENT_get_PREVIOUS_BOOT_IMAGE_NAME = 0x20000400, + VL_STACK_2_MFR_EVENT_get_CURRENT_BOOT_IMAGE_NAME = 0x20000401, + VL_STACK_2_MFR_EVENT_get_UPGRADE_IMAGE_NAME = 0x20000402, + VL_STACK_2_MFR_EVENT_get_UPGRADE_STATUS = 0x20000403, + + VL_STACK_2_MFR_EVENT_SET_CARD_TYPE = 0x20000700, + VL_STACK_2_MFR_EVENT_SET_FIRMWARE_VERSION_INFO = 0x20000701, + +} VL_STACK_2_MFR_EVENT_TYPE; + +/* +struct VL_NVRAM_DATA +nSize is the size of the data read from the NVRAM. +pData is the data buffer of the data read from the NVRAM. +*/ +typedef struct _VL_NVRAM_DATA +{ // STRUCT member additions are allowed. Insertions, deletions, datatype and name changes are not allowed. + unsigned long nActualBytes; + int nBytes; + unsigned char * pData; +}VL_NVRAM_DATA; + +int MFR_Init (void); +int MFR_Shutdown (void); + + +VL_MFR_API_RESULT HAL_MFR_get_version ( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_PLATFORM_VERSION_TYPE eVersionType, char ** ppString); + +VL_MFR_API_RESULT HAL_MFR_read_normal_nvram ( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_NORMAL_NVRAM_DATA_TYPE eType, VL_NVRAM_DATA * pNvRamData); +VL_MFR_API_RESULT HAL_MFR_write_normal_nvram( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_NORMAL_NVRAM_DATA_TYPE eType, const VL_NVRAM_DATA * pNvRamData); + +VL_MFR_API_RESULT HAL_MFR_read_secure_nvram ( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_SECURE_NVRAM_DATA_TYPE eType, VL_NVRAM_DATA * pNvRamData); +VL_MFR_API_RESULT HAL_MFR_write_secure_nvram( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_SECURE_NVRAM_DATA_TYPE eType, const VL_NVRAM_DATA * pNvRamData); + +VL_MFR_API_RESULT HAL_MFR_set_mfr_data( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_STACK_2_MFR_EVENT_TYPE eEvent, void * _pvData); +VL_MFR_API_RESULT HAL_MFR_get_mfr_data( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_STACK_2_MFR_EVENT_TYPE eEvent, void * _pvData); +/*-----------------------------------------------------------------*/ +#ifdef __cplusplus +} +#endif +/*-----------------------------------------------------------------*/ +#endif //__MFR_API_H__ +/*-----------------------------------------------------------------*/ + + +/** @} */ +/** @} */ diff --git a/mocks/mfrMgr.h b/mocks/mfrMgr.h new file mode 100644 index 0000000..a8edec3 --- /dev/null +++ b/mocks/mfrMgr.h @@ -0,0 +1,218 @@ +/* + * 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. +*/ + +/** +* @file +* +* @brief IARM-Bus MFR Manager Public API. +* +* This API defines the operations for the IARM-Bus MFR Manager interface. +* +* @par Document +* Document reference. +* +* @par Open Issues (in no particular order) +* -# None +* +* @par Assumptions +* -# None +* +* @par Abbreviations +* - BE: ig-Endian. +* - cb: allback function (suffix). +* - DS: Device Settings. +* - FPD: Front-Panel Display. +* - HAL: Hardware Abstraction Layer. +* - LE: Little-Endian. +* - LS: Least Significant. +* - MBZ: Must be zero. +* - MS: Most Significant. +* - RDK: Reference Design Kit. +* - _t: Type (suffix). +* +* @par Implementation Notes +* -# None +* +*/ + +/** @defgroup IARM_BUS IARM-Bus HAL API +* @ingroup IARM_RDK +* +* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows +* applications to communicate with each other by sending Events or invoking Remote +* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is +* independent of the operating system or the underlying IPC mechanism. +* +* Two applications connected to the same instance of IARM-Bus are able to exchange events +* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If +* desired, it is possible to have multiple IARM-Bus instances. However, applications +* connected to different buses will not be able to communicate with each other. +*/ + +/** @defgroup IARM_BUS MFR Manager MFR lib +* @ingroup IARM_RDK +* +*/ + +/** @addtogroup IARM_BUS_MFR_LIB_API IARM-MFR Manager API +* @ingroup IARM_BUS +* +* Described herein are functions and structures exposed by MFR library. +* +* @{ +*/ + + + +/** +* @defgroup iarmmgrs +* @{ +* @defgroup mfr +* @{ +**/ + + +#ifndef _MFR_MGR_H_ +#define _MFR_MGR_H_ + +#include "mfrTypes.h" +#include "mfr_wifi_types.h" +#include "mfr_wifi_api.h" + + +#define IARM_BUS_MFRLIB_NAME "MFRLib" /*!< Well-known Name for MFR libarary */ + +#define IARM_BUS_MFRLIB_API_SetBootLoaderPattern "mfrSetBootloaderPattern" /*!< Sets how the frontpanel LED(s) (and TV backlight on applicable devices) behave when running bootloader.*/ +#define IARM_BUS_MFRLIB_API_GetSecureTime "mfrGetSecureTime" /*!< method to retrive the Secure Time from TEE */ +#define IARM_BUS_MFRLIB_API_SetSecureTime "mfrSetSecureTime" /*!< Method to set Secure Time in TEE */ +#define IARM_BUS_MFRLIB_API_SetFsrFlag "mfrSetFSRflag" /*!< Method to set FSR flag in FLASH */ +#define IARM_BUS_MFRLIB_API_GetFsrFlag "mfrGetFSRflag" /*!< Method to get FSR flag from FLASH */ +#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*/ +#define IARM_BUS_MFRLIB_API_SearchCPUClockSpeeds "mfrDetemineClockSpeeds" /*!< List down all the available CPU frequencies for the device*/ +#define IARM_BUS_MFRLIB_API_SetCPUClockSpeed "mfrSetClockSpeed" /*!< Sets the CPU clock for the device*/ +#define IARM_BUS_MFRLIB_API_GetCPUClockSpeed "mfrGetClockSpeed" /*!< Gets the CPU clock for the device*/ +#define IARM_BUS_MFRLIB_API_GetSerializedData "mfrGetManufacturerData" /*!< Retrives manufacturer specific data from the box*/ +#define IARM_BUS_MFRLIB_API_SetSerializedData "mfrSetManufacturerData" /*!< Retrives manufacturer specific data from the box*/ +#define IARM_BUS_MFRLIB_API_DeletePDRI "mfrDeletePDRI" /*!< delete PDRI image from the box*/ +#define IARM_BUS_MFRLIB_API_ScrubAllBanks "scrubAllBanks" /*!< scrub all banks from the box*/ +#define IARM_BUS_MFRLIB_API_WriteImage "mfrWriteImage" /*!< Validate and Write the image into flash*/ +#define IARM_BUS_MFRLIB_API_WIFI_EraseAllData "mfrWifiEraseAllData" +#define IARM_BUS_MFRLIB_API_WIFI_Credentials "mfrWifiCredentials" +#define IARM_BUS_MFRLIB_COMMON_API_WriteImageCb "WriteImageCb" /*!< This method shall be implemented by the caller calling WriteImage*/ +#define IARM_BUS_MFRLIB_API_validate_image "mfrValidateImage" +#define IARM_BUS_MFRLIB_API_GetPreDownloadSize "mfrGetPreDownloadImageSize" +#define IARM_BUS_MFRLIB_API_MirrorImage "mfrMirrorImage" +#define IARM_BUS_MFRLIB_API_SetBlSplashScreen "mfrSetBlSplashScreen" /*!< Method to flash the BL_OSD splash screen */ +#define IARM_BUS_MFRLIB_API_ClearBlSplashScreen "mfrClearBlSplashScreen" /*!< Method to clear and use the default BL_OSD splash screen */ +/*! Data size management need to be improved */ +#define MAX_SERIALIZED_BUF 2048 +#define MAX_BUF 255 + +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_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 struct _IARM_Bus_MFRLib_ThermalSoCFreq_Param_t{ + uint32_t cpu_rate_Normal; /* !< Normal/Highest CPU clock available */ + uint32_t cpu_rate_Scaled; /* !< Next available scaled CPU clock */ + uint32_t cpu_rate_Minimal; /* !< Lowest CPU clock available */ + uint32_t cpu_clock_speed; /* !< List of available CPU clocks */ +}IARM_Bus_MFRLib_ThermalSoCFreq_Param_t; + +typedef struct _IARM_Bus_MFRLib_GetSerializedData_Param_t{ + mfrSerializedType_t type; /*!< [in] Type of data to be queried*/ + char buffer[MAX_SERIALIZED_BUF]; /*!< [out] On success, this will be pointing to a local memory location having expected data*/ + int bufLen; /*!< [out] Indicates length of buffer pointed by pBuffer */ +}IARM_Bus_MFRLib_GetSerializedData_Param_t; + +typedef struct _IARM_Bus_MFRLib_SetSerializedData_Param_t{ + mfrSerializedType_t type; /*!< [in] Type of data to be queried*/ + char buffer[MAX_SERIALIZED_BUF]; /*!< [out] On success, this will be pointing to a local memory location having expected data*/ + int bufLen; +}IARM_Bus_MFRLib_SetSerializedData_Param_t; + +typedef struct _IARM_Bus_MFRLib_WriteImage_Param_t{ + char name[MAX_BUF]; /*!< [in] the path of the image file in the STB file system. */ + char path[MAX_BUF]; /*!< [in] the filename of the image file. */ + mfrImageType_t type; /*!< [in] the type (e.g. format, signature type) of the image.*/ + char callerModuleName[MAX_BUF]; /*!< [in] Name registered IARMBus by the caller module*/ + int interval; /*!< [in] number of seconds between two callbacks */ + char cbData[MAX_BUF]; /*!< [inout] data that could be passed through this call and returned back through callback*/ +}IARM_Bus_MFRLib_WriteImage_Param_t; + +/*! Data associated with WriteImage callback call*/ +typedef struct _IARM_Bus_MFRLib_CommonAPI_WriteImageCb_Param_t{ + mfrUpgradeStatus_t status; /*! upgrade status, set by WriteImage callback*/ + char cbData[MAX_BUF]; /*! callback data, which was passed through WriteImage call*/ +} IARM_Bus_MFRLib_CommonAPI_WriteImageCb_Param_t; + +typedef enum _MfrMgr_EventId_t { + IARM_BUS_MFRMGR_EVENT_STATUS_UPDATE= 0, /*!< Event to notify status update change */ + IARM_BUS_MFRMGR_EVENT_MAX, /*!< Max event id from this module */ +} IARM_Bus_MfrMgr_EventId_t; + +typedef enum _WifiRequestType +{ + WIFI_GET_CREDENTIALS = 0, + WIFI_SET_CREDENTIALS = 1 +} WifiRequestType_t; +typedef struct _IARM_BUS_MFRLIB_API_WIFI_Credentials_Param_t{ + WIFI_DATA wifiCredentials; + WifiRequestType_t requestType; + WIFI_API_RESULT returnVal; +}IARM_BUS_MFRLIB_API_WIFI_Credentials_Param_t; + +typedef struct _IARM_Bus_MFRLib_SetBLPattern_Param_t{ + mfrBlPattern_t pattern; +} IARM_Bus_MFRLib_SetBLPattern_Param_t; + +/* Splash Screen File path as parameter for apis to set bl osd */ +typedef struct _IARM_Bus_MFRLib_SetBLSplashScreen_Param{ + char path[MAX_BUF]; +} IARM_Bus_MFRLib_SetBLSplashScreen_Param_t; + +typedef unsigned long IARM_Bus_MFRLib_SecureTime_Param; /* UTC time in seconds used as parameter for apis set/get Secure Time*/ + + +typedef bool IARM_Bus_MFRLib_FsrFlag_Param_t; /* Used to set/get the flag for fullSystem reset under the FLASH area */ + + +#endif //_MFR_MGR_H_ + + +/* End of IARM_BUS_MFR_LIB_API doxygen group */ +/** + * @} + */ + + +/** @} */ +/** @} */ diff --git a/mocks/mfrTypes.h b/mocks/mfrTypes.h new file mode 100644 index 0000000..55ef63e --- /dev/null +++ b/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/mocks/mfr_wifi_api.h b/mocks/mfr_wifi_api.h new file mode 100644 index 0000000..41226b1 --- /dev/null +++ b/mocks/mfr_wifi_api.h @@ -0,0 +1,146 @@ +/* + * 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 + * + */ + +/** @addtogroup MFR MFR Module + * @{ + */ +/** @addtogroup MFR_HAL MFR HAL + * @{ + * @par Application API Specification + * MFR HAL provides an interface for wifi data types + */ + +/** @defgroup PLAT_MFR_WIFI_API PLAT MFR WIFI API + * @{ + */ + +/** + * @file mfr_wifi_api.h + * + * @brief Manufacturer Library WIFI Public API. + * + * This API defines the Manufacturer API for the WIFI credentials access + * + * @par Document + * Document reference. + * + * @par Open Issues (in no particular order) + * -# None + * + * @par Assumptions + * -# None + * + * @par Abbreviations + * - WIFI: Wireless Fidelity + * + * @par Implementation Notes + * -# None + * + */ + +#ifndef __MFR_WIFI_API_H__ +#define __MFR_WIFI_API_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "mfr_wifi_types.h" + + +/** + * @brief Retrieves the saved SSID name, password, and security mode from the MFR persistence + * + * @param pData [out] : out parameter to get the saved wifi credentials. @see WIFI_DATA + * + * @return WIFI_API_RESULT - Status + * @retval WIFI_API_RESULT_SUCCESS - Success + * @retval WIFI_API_RESULT_NOT_INITIALIZED - Not initialized + * @retval WIFI_API_RESULT_OPERATION_NOT_SUPPORTED - Operation not supported + * @retval WIFI_API_RESULT_NULL_PARAM - Null param + * @retval WIFI_API_RESULT_READ_WRITE_FAILED - flash operation failed + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return WIFI_API_RESULT_NOT_INITIALIZED. + * @warning This API is NOT thread safe. Caller shall handle the concurrency + * @see WIFI_SetCredentials() + * + */ +WIFI_API_RESULT WIFI_GetCredentials(WIFI_DATA *pData); + +/** + * @brief Sets wifi ssid name, password and the security mode in the MFR persistance storage + * + * @param pData [in] : Sets the ssid credentials. @see WIFI_DATA + * + * @return WIFI_API_RESULT - Status + * @retval WIFI_API_RESULT_SUCCESS - Success + * @retval WIFI_API_RESULT_NOT_INITIALIZED - Not initialized + * @retval WIFI_API_RESULT_OPERATION_NOT_SUPPORTED - Operation not supported + * @retval WIFI_API_RESULT_NULL_PARAM - Null param + * @retval WIFI_API_RESULT_INVALID_PARAM - Invalid param + * @retval WIFI_API_RESULT_READ_WRITE_FAILED - flash operation failed + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return WIFI_API_RESULT_NOT_INITIALIZED. + * @warning This API is NOT thread safe. Caller shall handle the concurrency + * @see WIFI_GetCredentials() + * + */ +WIFI_API_RESULT WIFI_SetCredentials(WIFI_DATA *pData); + +/** + * @brief Clears the wifi credentials saved in the MFR persistance storage @see WIFI_DATA + * + * @return WIFI_API_RESULT - Status + * @retval WIFI_API_RESULT_SUCCESS - Success + * @retval WIFI_API_RESULT_NOT_INITIALIZED - Not initialized + * @retval WIFI_ERR_OPERATION_NOT_SUPPORTED - Operation not supported + * @retval WIFI_API_RESULT_READ_WRITE_FAILED - flash operation failed + * + * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return WIFI_API_RESULT_NOT_INITIALIZED. + * @warning This API is NOT thread safe. Caller shall handle the concurrency + * + */ +WIFI_API_RESULT WIFI_EraseAllData (void); + + +#ifdef __cplusplus +} +#endif + +#endif // __MFR_WIFI_API_H__ + +/** @} */ // End of PLAT_MFR_WIFI_API +/** @} */ // End of MFR_HAL +/** @} */ // End of MFR Module +/** @} */ // End of HPK \ No newline at end of file diff --git a/mocks/mfr_wifi_types.h b/mocks/mfr_wifi_types.h new file mode 100644 index 0000000..3229aa7 --- /dev/null +++ b/mocks/mfr_wifi_types.h @@ -0,0 +1,139 @@ +/* + * 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 + * + */ + +/** @addtogroup MFR MFR Module + * @{ + */ +/** @addtogroup MFR_HAL MFR HAL + * @{ + * @par Application API Specification + * MFR HAL provides an interface for wifi data types + */ + +/** @defgroup PLAT_MFR_WIFI_DATA PLAT MFR WIFI DATA + * @{ + */ + +/** + * @file mfr_wifi_types.h + * + * @brief Manufacturer Library WIFI Public API + * + * This API defines the Types and definitions for WIFI data module + * + * @par Document + * Document reference. + * + * @par Open Issues (in no particular order) + * -# None + * + * @par Assumptions + * -# None + * + * @par Abbreviations + * - WIFI: Wireless Fidelity + * - SSID: Service Set Identifier + * - WEP: Wired Equivalent Privacy + * - WPA: Wi-Fi Protected Access + * - WPA2: Wi-Fi Protected Access Version 2 + * @par Implementation Notes + * -# None + * + */ + +#ifndef __MFR_WIFI_TYPES_H__ +#define __MFR_WIFI_TYPES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + + +#define WIFI_MAX_SSID_LEN 32 //!< Maximum SSID name +#define WIFI_MAX_PASSWORD_LEN 128 //!< Maximum password length + +#define WIFI_DATA_LENGTH 512 + +/** + * @brief WIFI API return status + * + */ +typedef enum _WIFI_API_RESULT +{ + WIFI_API_RESULT_SUCCESS = 0, ///< operation is successful + WIFI_API_RESULT_FAILED, ///< Operation general error. This enum is deprecated + WIFI_API_RESULT_NULL_PARAM, ///< NULL argument is passed to the module + WIFI_API_RESULT_INVALID_PARAM, ///< Invalid argument is passed to the module + WIFI_API_RESULT_NOT_INITIALIZED, ///< module not initialized + WIFI_API_RESULT_OPERATION_NOT_SUPPORTED, ///< operation not supported in the specific platform + WIFI_API_RESULT_READ_WRITE_FAILED, ///< flash read/write failed or crc check failed + WIFI_API_RESULT_MAX ///< Out of range - required to be the last item of the enum + +} WIFI_API_RESULT; + +/** + * @brief WIFI data type + * + * @note: This order needs to correspond to whats in DRI code. + */ +typedef enum _WIFI_DATA_TYPE +{ + WIFI_DATA_UNKNOWN = 0, ///< Unknown error. This enum is deprecated + WIFI_DATA_SSID, ///< SSID type + WIFI_DATA_PASSWORD, ///< Password type + WIFI_DATA_MAX ///< Out of range - required to be the last item of the enum +} WIFI_DATA_TYPE; + +/** + * @brief WIFI credentials data struct + * + */ +typedef struct +{ + char cSSID[WIFI_MAX_SSID_LEN+1]; ///< SSID field. + char cPassword[WIFI_MAX_PASSWORD_LEN+1]; ///< password field + int iSecurityMode; ///< security mode. Platform dependent and caller is responsible to validate it +} WIFI_DATA; + +#ifdef __cplusplus +} +#endif + +#endif //__MFR_WIFI_TYPES_H__ + +/** @} */ // End of PLAT_MFR_WIFI_DATA +/** @} */ // End of MFR_HAL +/** @} */ // End of MFR Module +/** @} */ // End of HPK \ No newline at end of file diff --git a/mocks/mockInternal.cpp b/mocks/mockInternal.cpp new file mode 100644 index 0000000..5ce20e5 --- /dev/null +++ b/mocks/mockInternal.cpp @@ -0,0 +1,210 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2025 RDK +* +* 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 +#include +#include +#include +#include +#include "libIBus.h" +#include "libIARMCore.h" +#include "power_controller.h" + +#ifdef __cplusplus +extern "C" { +#endif + +IARM_Result_t IARM_Bus_Init(const char* name) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Connect() +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RegisterCall(const char* methodName, IARM_BusCall_t handler) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Call_with_IPCTimeout(const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Disconnect(void) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Term(void) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc) +{ + return IARM_RESULT_SUCCESS; +} + +void PowerController_Init() +{ + +} + +void PowerController_Term() +{ + +} + +bool PowerController_IsOperational() +{ + return true; +} + +uint32_t PowerController_Connect() +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_GetPowerState(PowerController_PowerState_t* currentState, PowerController_PowerState_t* previousState) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_SetPowerState(const int keyCode, const PowerController_PowerState_t powerstate, const char* reason) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_PowerModePreChangeComplete(const uint32_t clientId, const int transactionId) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_RegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback, void* userdata) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_UnRegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_AddPowerModePreChangeClient(const char* clientName, uint32_t* clientId) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_RemovePowerModePreChangeClient(const uint32_t clientId) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_DelayPowerModeChangeBy(const uint32_t clientId, const int transactionId, const int delayPeriod) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +#if 0 +WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, RFC_ParamData_t *pstParamData) +{ + return WDMP_SUCCESS; +} + +rdk_Error rdk_logger_init(const char* debugConfigFile) +{ + return 0; +} + +rdk_Error rdk_logger_deinit() +{ + return 0; +} + +rdk_logger_Bool rdk_dbg_enabled(const char *module, + rdk_LogLevel level) +{ + return true; +} + +void RDK_LOG(rdk_LogLevel level, + const char *module, + const char *format, + ...) +{ + char buffer[32 * 1024]; + + std::va_list arguments; + + va_start(arguments, format); + vsnprintf(buffer, sizeof(buffer) - 1, format, arguments); + buffer[sizeof(buffer) - 1] = 0; + va_end(arguments); + + printf("%s\n", buffer); +} +#endif + +#ifdef __cplusplus +} +#endif diff --git a/mocks/power_controller.h b/mocks/power_controller.h new file mode 100644 index 0000000..8739760 --- /dev/null +++ b/mocks/power_controller.h @@ -0,0 +1,415 @@ +/* + * 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 POWERMANAGER_CLIENT_H +#define POWERMANAGER_CLIENT_H + +#include +#include + +#undef EXTERNAL +#if defined(WIN32) || defined(_WINDOWS) || defined (__CYGWIN__) || defined(_WIN64) +#ifdef DEVICEINFO_EXPORTS +#define EXTERNAL __declspec(dllexport) +#else +#define EXTERNAL __declspec(dllimport) +#pragma comment(lib, "deviceinfo.lib") +#endif +#else +#define EXTERNAL __attribute__((visibility("default"))) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum PowerController_PowerState { + POWER_STATE_UNKNOWN = 0 /* UNKNOWN */, + POWER_STATE_OFF = 1 /* OFF */, + POWER_STATE_STANDBY = 2 /* STANDBY */, + POWER_STATE_ON = 3 /* ON */, + POWER_STATE_STANDBY_LIGHT_SLEEP = 4 /* LIGHT_SLEEP */, + POWER_STATE_STANDBY_DEEP_SLEEP = 5 /* DEEP_SLEEP */ +} PowerController_PowerState_t; + +typedef enum PowerController_ThermalTemperature { + THERMAL_TEMPERATURE_UNKNOWN = 0 /* UNKNOWN Thermal Temperature */, + THERMAL_TEMPERATURE_NORMAL = 1 /* Normal Thermal Temperature */, + THERMAL_TEMPERATURE_HIGH = 2 /* High Thermal Temperature */, + THERMAL_TEMPERATURE_CRITICAL = 4 /* Critial Thermal Temperature */ +} PowerController_ThermalTemperature_t; + +typedef enum PowerController_WakeupSrcType { + WAKEUP_SRC_UNKNOWN = 0 /* UNKNOWN */, + WAKEUP_SRC_VOICE = 1 /* VOICE */, + WAKEUP_SRC_PRESENCEDETECTED = 2 /* PRESENCEDETECTED */, + WAKEUP_SRC_BLUETOOTH = 3 /* BLUETOOTH */, + WAKEUP_SRC_WIFI = 4 /* WIFI */, + WAKEUP_SRC_IR = 5 /* IR */, + WAKEUP_SRC_POWERKEY = 6 /* POWERKEY */, + WAKEUP_SRC_TIMER = 7 /* TIMER */, + WAKEUP_SRC_CEC = 8 /* CEC */, + WAKEUP_SRC_LAN = 9 /* LAN */, + WAKEUP_SRC_RF4CE = 10 /* RF4CE */ +} PowerController_WakeupSrcType_t; + +typedef enum PowerController_WakeupReason { + WAKEUP_REASON_UNKNOWN = 0 /* UNKNOWN */, + WAKEUP_REASON_IR = 1 /* IR */, + WAKEUP_REASON_BLUETOOTH = 2 /* BLUETOOTH */, + WAKEUP_REASON_RF4CE = 3 /* RF4CE */, + WAKEUP_REASON_GPIO = 4 /* GPIO */, + WAKEUP_REASON_LAN = 5 /* LAN */, + WAKEUP_REASON_WIFI = 6 /* WIFI */, + WAKEUP_REASON_TIMER = 7 /* TIMER */, + WAKEUP_REASON_FRONTPANEL = 8 /* FRONTPANEL */, + WAKEUP_REASON_WATCHDOG = 9 /* WATCHDOG */, + WAKEUP_REASON_SOFTWARERESET = 10 /* SOFTWARERESET */, + WAKEUP_REASON_THERMALRESET = 11 /* THERMALRESET */, + WAKEUP_REASON_WARMRESET = 12 /* WARMRESET */, + WAKEUP_REASON_COLDBOOT = 13 /* COLDBOOT */, + WAKEUP_REASON_STRAUTHFAIL = 14 /* STR_AUTH_FAIL */, + WAKEUP_REASON_CEC = 15 /* CEC */, + WAKEUP_REASON_PRESENCE = 16 /* PRESENCE */, + WAKEUP_REASON_VOICE = 17 /* VOICE */ +} PowerController_WakeupReason_t; + +typedef enum PowerController_SystemMode { + SYSTEM_MODE_UNKNOWN = 0 /* UNKNOWN */, + SYSTEM_MODE_NORMAL = 1 /* NORMAL */, + SYSTEM_MODE_EAS = 2 /* EAS */, + SYSTEM_MODE_WAREHOUSE = 3 /* WAREHOUSE */ +} PowerController_SystemMode_t; + +#define POWER_CONTROLLER_ERROR_NONE 0 +#define POWER_CONTROLLER_ERROR_GENERAL 1 +#define POWER_CONTROLLER_ERROR_UNAVAILABLE 2 +#define POWER_CONTROLLER_ERROR_NOT_EXIST 43 + +/** + * @brief Initializes the Power Controller. + * + * This function creates an instance of the PowerManager plugin client interface and increments the client instance count. + * + * @details + * - If the Power Controller instance does not already exist, it will be created. + * - The instance count is incremented each time this function is called. + * - After Init, & before making any PowerController request client needs to ensure + * - Power Manager plugin is activated and operational via `PowerController_IsOperational`. + * - If not operational, clients can use this Connect API to establish COM-RPC connection with the Power Manager plugin. + * - If there us any failure in Connect all PowerController requests will fail with `POWER_CONTROLLER_ERROR_UNAVAILABLE` (Except for callback register / unregister APIs). + * + * @see PowerController_Term + */ +EXTERNAL void PowerController_Init(); + +/** + * @brief PowerController attempts to connect to the Power Manager plugin. + * + * This function connects to the Power Manager plugin. + * + * @details + * - This function is used to connect to the Power Manager plugin. + * - Before making any PowerController request client needs to ensure + * - Power Manager plugin is activated and operational via `PowerController_IsOperational`. + * - If not operational, clients can use this Connect API to establish COM-RPC connection with the Power Manager plugin. + * - If there us any failure in Connect all PowerController requests will fail with `POWER_CONTROLLER_ERROR_UNAVAILABLE` (Except for callback register / unregister APIs). + * - In case of failure this API should be called again with brief delay. + * + * @return `POWER_CONTROLLER_ERROR_NONE` on success. + * @return `POWER_CONTROLLER_ERROR_UNAVAILABLE` if Thunder RPC server is not running / error establishing RPC communication channel. + * @return `POWER_CONTROLLER_ERROR_NOT_EXIST` if the PowerManager plugin is not activated yet. + */ +EXTERNAL uint32_t PowerController_Connect(); + +/** + * @brief Terminates the Power Controller. + * + * This function decrements client instance count attempts to delete Power Controller instance + * + * @details + * - If the controller reference count is greater than one, this function only decrements the count. + * - When the reference count reaches zero, the controller instance is destroyed, and all associated resources are released (PowerManager plugin client instance). + * - Ensure that this function is called once for every call to `PowerController_Init`. + * + * @see PowerController_Init + */ +EXTERNAL void PowerController_Term(); + +/** + * @brief Checks if the Power Manager plugin is active & operational + * + * This function determines whether the Power Manager interface is operational and ready to handle requests. + * It can be used to verify the availability of the Power Manager client before initiating operations that depend on it. + * + * IMPORTANT - This is the first function that should be called after `PowerController_Init`. + * + * @return `true` if the Power Manager interface is active and operational, otherwise `false`. + * + * @details + * - Use this function to confirm the operational status of the Power Manager plugin. + * - Calling this function is NOT MANDATORY but optional + * - Clients can register for notifications about state changes using `PowerController_RegisterOperationalStateChangeCallback`. + * - If the Power Manager interface is not active, subsequent Power Manager operations will fail with the error `POWER_CONTROLLER_ERROR_UNAVAILABLE`. + * - Therefore in failure cases, clients can use `PowerController_Connect` to establish COM-RPC connection with the Power Manager plugin. + * + * @see PowerController_RegisterOperationalStateChangeCallback + */ +EXTERNAL bool PowerController_IsOperational(); + +/** Gets the Power State.*/ +// @text getPowerState +// @brief Get Power State +// @param powerState: Get current power state +EXTERNAL uint32_t PowerController_GetPowerState(PowerController_PowerState_t* currentState /* @out */, PowerController_PowerState_t* previousState /* @out */); + +/** Sets Power State . */ +// @text setPowerState +// @brief Set Power State +// @param keyCode: NA for most platfroms, to be depricated +// @param powerState: Set power to this state +// @param reason: null terminated string stating reason for for state change +EXTERNAL uint32_t PowerController_SetPowerState(const int keyCode /* @in */, const PowerController_PowerState_t powerstate /* @in */, const char* reason /* @in */); + +/** Gets the current Thermal state.*/ +// @text getThermalState +// @brief Get Current Thermal State (temperature) +// @param currentTemperature: current temperature +EXTERNAL uint32_t PowerController_GetThermalState(float* currentTemperature /* @out */); + +/** Sets the Temperature Thresholds.*/ +// @text setTemperatureThresholds +// @brief Set Temperature Thresholds +// @param high: high threshold +// @param critical : critical threshold +EXTERNAL uint32_t PowerController_SetTemperatureThresholds(float high /* @in */, float critical /* @in */); + +/** Gets the current Temperature Thresholds.*/ +// @text getTemperatureThresholds +// @brief Get Temperature Thresholds +// @param high: high threshold +// @param critical : critical threshold +EXTERNAL uint32_t PowerController_GetTemperatureThresholds(float* high /* @out */, float* critical /* @out */); + +/** Sets the current Temperature Grace interval.*/ +// @property +// @text PowerController_SetOvertempGraceInterval +// @brief Set Temperature Thresholds +// @param graceInterval: interval in secs? +EXTERNAL uint32_t PowerController_SetOvertempGraceInterval(const int graceInterval /* @in */); + +/** Gets the grace interval for over-temperature.*/ +// @property +// @text PowerController_GetOvertempGraceInterval +// @brief Get Temperature Grace interval +// @param graceInterval: interval in secs? +EXTERNAL uint32_t PowerController_GetOvertempGraceInterval(int* graceInterval /* @out */); + +/** Set Deep Sleep Timer for later wakeup */ +// @property +// @text setDeepSleepTimer +// @brief Set Deep sleep timer for timeOut period +// @param timeOut: deep sleep timeout +EXTERNAL uint32_t PowerController_SetDeepSleepTimer(const int timeOut /* @in */); + +/** Get Last Wakeup reason */ +// @property +// @text getLastWakeupReason +// @brief Get Last Wake up reason +// @param wakeupReason: wake up reason +EXTERNAL uint32_t PowerController_GetLastWakeupReason(PowerController_WakeupReason_t* wakeupReason /* @out */); + +/** Get Last Wakeup key code */ +// @property +// @text getLastWakeupKeyCode +// @brief Get the key code that can be used for wakeup +// @param keycode: Key code for wakeup +EXTERNAL uint32_t PowerController_GetLastWakeupKeyCode(int* keycode /* @out */); + +/** Request Reboot with PowerManager */ +// @text reboot +// @brief Reboot device +// @param rebootRequestor: null terminated string identifier for the entity requesting the reboot. +// @param rebootReasonCustom: custom-defined reason for the reboot, provided as a null terminated string. +// @param rebootReasonOther: null terminated string describing any other reasons for the reboot. +EXTERNAL uint32_t PowerController_Reboot(const char* rebootRequestor /* @in */, const char* rebootReasonCustom /* @in */, const char* rebootReasonOther /* @in */); + +/** Set Network Standby Mode */ +// @property +// @text setNetworkStandbyMode +// @brief Set the standby mode for Network +// @param standbyMode: Network standby mode +EXTERNAL uint32_t PowerController_SetNetworkStandbyMode(const bool standbyMode /* @in */); + +/** Get Network Standby Mode */ +// @text getNetworkStandbyMode +// @brief Get the standby mode for Network +// @param standbyMode: Network standby mode +EXTERNAL uint32_t PowerController_GetNetworkStandbyMode(bool* standbyMode /* @out */); + +/** Set Wakeup source configuration */ +// @text setWakeupSrcConfig +// @brief Set the source configuration for device wakeup +// @param powerMode: power mode +// @param wakeSrcType: source type +// @param config: config +EXTERNAL uint32_t PowerController_SetWakeupSrcConfig(const int powerMode /* @in */, const int wakeSrcType /* @in */, int config /* @in */); + +/** Get Wakeup source configuration */ +// @text getWakeupSrcConfig +// @brief Get the source configuration for device wakeup +// @param powerMode: power mode +// @param srcType: source type +// @param config: config +EXTERNAL uint32_t PowerController_GetWakeupSrcConfig(int* powerMode /* @out */, int* srcType /* @out */, int* config /* @out */); + +/** Initiate System mode change */ +// @text PowerController_SetSystemMode +// @brief System mode change +// @param oldMode: current mode +// @param newMode: new mode +EXTERNAL uint32_t PowerController_SetSystemMode(const PowerController_SystemMode_t currentMode /* @in */, const PowerController_SystemMode_t newMode /* @in */); + +/** Get Power State before last reboot */ +// @text PowerController_GetPowerStateBeforeReboot +// @brief Get Power state before last reboot +// @param powerStateBeforeReboot: power state +EXTERNAL uint32_t PowerController_GetPowerStateBeforeReboot(PowerController_PowerState_t* powerStateBeforeReboot /* @out */); + +/** Engage a client in power mode change operation. */ +// @text PowerController_AddPowerModePreChangeClient +// @brief - Register a client to engage in power mode state changes. +// - When `PowerModePreChange` event is received, then added client should call either +// - `PowerModePreChangeComplete` API to inform power manager that this client has completed its pre-change operation. +// - Or `DelayPowerModeChangeBy` API to delay the power mode change. +// - If the client does not call `PowerModePreChangeComplete` API, the power mode change will complete +// after the maximum delay `stateChangeAfter` seconds (as received in `OnPowerModePreChange` event). +// - Clients are required to re-register if the PowerManager plugin restarts. Therefore, it is essential for clients to register +// for operational state changes using `PowerController_RegisterOperationalStateChangeCallback`. +// +// IMPORTANT: ** IT'S A BUG IF CLIENT `Unregister` FROM `IModePreChangeNotification` BEFORE DISENGAGING ITSELF ** +// always make sure to call `RemovePowerModePreChangeClient` before calling `Unregister` from `IModePreChangeNotification`. +// +// @param clientName: Name of the client as null terminated string +// @param clientId: Unique identifier for the client to be used while acknowledging the pre-change operation (`PowerModePreChangeComplete`) +// or to delay the power mode change (`DelayPowerModeChangeBy`) +EXTERNAL uint32_t PowerController_AddPowerModePreChangeClient(const char *clientName /* @in */, uint32_t* clientId /* @out */); + +/** Disengage a client from the power mode change operation. */ +// @text PowerController_RemovePowerModePreChangeClient +// @brief Removes a registered client from participating in power mode pre-change operations. +// NOTE client will still continue to receive pre-change notifications. +// @param clientId: Unique identifier for the client. See `AddPowerModePreChangeClient` +EXTERNAL uint32_t PowerController_RemovePowerModePreChangeClient(const uint32_t clientId /* @in */); + +/** Power prechange activity completed */ +// @text PowerController_PowerModePreChangeComplete +// @brief Pre power mode handling complete for given client and transation id +// @param clientId: Unique identifier for the client, as received in AddPowerModePreChangeClient +// @param transactionId: transaction id as received in OnPowerModePreChange +EXTERNAL uint32_t PowerController_PowerModePreChangeComplete(const uint32_t clientId /* @in */, const int transactionId /* @in */); + +/** Delay Powermode change by given time */ +// @text PowerController_DelayPowerModeChangeBy +// @brief Delay Powermode change by given time. If different clients provide different values of delay, then the maximum of these values is used. +// @param clientId: Unique identifier for the client, as received in AddPowerModePreChangeClient +// @param transactionId: transaction id as received in OnPowerModePreChange +// @param delayPeriod: delay in seconds +EXTERNAL uint32_t PowerController_DelayPowerModeChangeBy(const uint32_t clientId /* @in */, const int transactionId /* @in */, const int delayPeriod /* @in */); + +/* Callback data types for event notifications from power manager plugin */ +// @brief Operational state changed event +// @param isOperational: true if PowerManager plugin is activated, false otherwise +// @param userdata: opaque data, client can use it to have context to callbacks +typedef void (*PowerController_OperationalStateChangeCb)(bool isOperational, void* userdata); + +// @brief Power mode changed +// @param currentState: Current Power State +// @param newState: New Power State +// @param userdata: opaque data, client can use it to have context to callbacks +typedef void (*PowerController_PowerModeChangedCb)(const PowerController_PowerState_t currentState, const PowerController_PowerState_t newState, void* userdata); + +// @brief Power mode Pre-change event +// @param currentState: Current Power State +// @param newState: Changing power state to this New Power State +// @param transactionId: transactionId to be used when invoking prePowerChangeComplete() / delayPowerModeChangeBy API +// @param stateChangeAfter: seconds after which the actual power mode will be applied. +// @param userdata: opaque data, client can use it to have context to callbacks +typedef void (*PowerController_PowerModePreChangeCb)(const PowerController_PowerState_t currentState, const PowerController_PowerState_t newState, const int transactionId, const int stateChangeAfter, void* userdata); + +// @brief Deep sleep timeout event +// @param wakeupTimeout: Deep sleep wakeup timeout in seconds +// @param userdata: opaque data, client can use it to have context to callbacks +typedef void (*PowerController_DeepSleepTimeoutCb)(const int wakeupTimeout, void* userdata); + +// @brief Network Standby Mode changed event - only on XIone +// @param enabled: network standby enabled or disabled +// @param userdata: opaque data, client can use it to have context to callbacks +typedef void (*PowerController_NetworkStandbyModeChangedCb)(const bool enabled, void* userdata); + +// @brief Thermal Mode changed event +// @param currentThermalLevel: current thermal level +// @param newThermalLevel: new thermal level +// @param currentTemperature: current temperature +// @param userdata: opaque data, client can use it to have context to callbacks +typedef void (*PowerController_ThermalModeChangedCb)(const PowerController_ThermalTemperature_t currentThermalLevel, const PowerController_ThermalTemperature_t newThermalLevel, const float currentTemperature, void* userdata); + +// @brief Reboot begin event +// @param rebootReasonCustom: Reboot reason custom +// @param rebootReasonOther: Reboot reason other +// @param rebootRequestor: Reboot requested by +// @param userdata: opaque data, client can use it to have context to callbacks +typedef void (*PowerController_RebootBeginCb)(const char* rebootReasonCustom, const char* rebootReasonOther, const char* rebootRequestor, void* userdata); + +/* Type defines for callbacks / notifications */ +/* userdata in all callbacks are opaque, clients can use it to have context to callbacks */ + +/** Register for PowerManager plugin operational state change event callback, for initial state use `PowerController_IsOperational` call */ +EXTERNAL uint32_t PowerController_RegisterOperationalStateChangeCallback(PowerController_OperationalStateChangeCb callback, void* userdata); +/** UnRegister (previously registered) PowerManager plugin operational state change event callback */ +EXTERNAL uint32_t PowerController_UnRegisterOperationalStateChangeCallback(PowerController_OperationalStateChangeCb callback); +/** Register for PowerMode changed callback */ +EXTERNAL uint32_t PowerController_RegisterPowerModeChangedCallback(PowerController_PowerModeChangedCb callback, void* userdata); +/** UnRegister (previously registered) PowerMode changed callback */ +EXTERNAL uint32_t PowerController_UnRegisterPowerModeChangedCallback(PowerController_PowerModeChangedCb callback); +/** Register for PowerMode pre-change callback */ +EXTERNAL uint32_t PowerController_RegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback, void* userdata); +/** UnRegister (previously registered) PowerMode pre-change callback */ +EXTERNAL uint32_t PowerController_UnRegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback); +/** Register for PowerMode pre-change callback */ +EXTERNAL uint32_t PowerController_RegisterDeepSleepTimeoutCallback(PowerController_DeepSleepTimeoutCb callback, void* userdata); +/** UnRegister (previously registered) DeepSleep Timeout callback */ +EXTERNAL uint32_t PowerController_UnRegisterDeepSleepTimeoutCallback(PowerController_DeepSleepTimeoutCb callback); +/** Register for Network Standby Mode changed event - only on XIone */ +EXTERNAL uint32_t PowerController_RegisterNetworkStandbyModeChangedCallback(PowerController_NetworkStandbyModeChangedCb callback, void* userdata); +/** UnRegister (previously registered) Network Standby Mode changed callback */ +EXTERNAL uint32_t PowerController_UnRegisterNetworkStandbyModeChangedCallback(PowerController_NetworkStandbyModeChangedCb callback); +/** Register for Thermal Mode changed event callback */ +EXTERNAL uint32_t PowerController_RegisterThermalModeChangedCallback(PowerController_ThermalModeChangedCb callback, void* userdata); +/** UnRegister (previously registered) Thermal Mode changed event callback */ +EXTERNAL uint32_t PowerController_UnRegisterThermalModeChangedCallback(PowerController_ThermalModeChangedCb callback); +/** Register for reboot start event callback */ +EXTERNAL uint32_t PowerController_RegisterRebootBeginCallback(PowerController_RebootBeginCb callback, void* userdata); +/** UnRegister (previously registered) reboot start event callback */ +EXTERNAL uint32_t PowerController_UnRegisterRebootBeginCallback(PowerController_RebootBeginCb callback); + +#ifdef __cplusplus +}; // extern "C" +#endif + +#endif // POWERMANAGER_CLIENT_H diff --git a/mocks/sysMgr.h b/mocks/sysMgr.h new file mode 100644 index 0000000..87f1975 --- /dev/null +++ b/mocks/sysMgr.h @@ -0,0 +1,385 @@ +/* + * 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. +*/ + +/** +* @file sysMgr.h +* +* @brief IARM-Bus Sys Manager Public API. +*/ + +/** + * @defgroup IARMBUS_SYS_MGR Sys Manager + * @ingroup IARM_MGR + * + * Sys Manager is a IARM Manager application which maintains the state of different + * subsystem/components of RDK such as HDMI, Network, RF, Date & Time, Tuner, CA, Mfr information etc. + * It collects the State change and error codes through a common event handler. + * It publishes RPC methods for getting the system state data. + * + * @par Following event handler is registered for receiving events from different components. + * - @b IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE + * @par The Event Data contains + * @code + * IARM_Bus_SYSMgr_EventData_t *sysEventData; // The event data contains stateId, state and error. + * @endcode + * + * @par Sys Manager: Events + * + * - @b IARM_BUS_SYSMGR_EVENT_HDCP_PROFILE_UPDATE + * Event to notify HDCP Profile change: + * + * @par Sys Manager: RPC Methods + * Following RPC Methods are published: + * + * + * - @b IARM_BUS_SYSMGR_API_GetSystemStates + * @n This returns the System State data structure. + * @n Example: + * @code + * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_GetSystemStates, _GetSystemStates); + * @endcode + * + * - @b IARM_BUS_SYSMGR_API_SetHDCPProfile + * @n This Method is called to set the new HDCP Profile. + * @n Example: + * @code + * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_SetHDCPProfile,_SetHDCPProfile); + * @endcode + * + * - @b IARM_BUS_SYSMGR_API_GetHDCPProfile + * @n This Method is called to get the current HDCP Profile. + * @n Example: + * @code + * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_GetHDCPProfile,_GetHDCPProfile); + * @endcode + * + * - @b IARM_BUS_SYSMGR_API_RunScript + * @n This Method is called to run a script through Sys Manager. + * @n Example: + * @code + * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_RunScript, _RunScript); + * @endcode + + */ + + +/** +* @defgroup iarmmgrs +* @{ +* @defgroup sysmgr +* @{ +**/ + + + + +/** +* @defgroup iarmmgrs +* @{ +* @defgroup sysmgr +* @{ +**/ + + +#ifndef _IARM_BUS_SYSMGR_H +#define _IARM_BUS_SYSMGR_H + +#include "libIARM.h" +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define IARM_BUS_SYSMGR_NAME "SYSMgr" /*!< IARM BUS name for Sys manager */ + + +typedef struct _IARM_BUS_SYSMGR_GetXUPNPDeviceInfo_Param_t{ + char *pBuffer; /*!< Shared memory location having expected data*/ + int bufLength; /*!< Length of buffer */ +}IARM_Bus_SYSMGR_GetXUPNPDeviceInfo_Param_t; + + +typedef struct _IARM_BUS_SYSMGR_HDCPProfileInfo_Param_t{ + int HdcpProfile; /*!< HDCP Profile Data */ +}IARM_BUS_SYSMGR_HDCPProfileInfo_Param_t; + +typedef struct _IARM_BUS_SYSMGR_KEYCodeLoggingInfo_Param_t{ + int logStatus; /*!< HDCP Profile Data */ +}IARM_BUS_SYSMGR_KEYCodeLoggingInfo_Param_t; + +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; + +/*! Published Events from sys manager */ +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 */ + 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 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 + // requirement for RDK-19978 and IARM_BUS_SYSMGR_SYSSTATE_FIRMWARE_DWNLD + // are having some mismatches, introduced the new event + IARM_BUS_SYSMGR_SYSSTATE_USB_DETECTED, //44 + IARM_BUS_SYSMGR_SYSSTATE_LOG_UPLOAD, //45 + IARM_BUS_SYSMGR_SYSSTATE_RED_RECOV_UPDATE_STATE, //46 +}IARM_Bus_SYSMgr_SystemState_t; + + +/*! Possible Firmware Download state */ +typedef enum _SYSMgr_CARD_FWDNLDState_t +{ + IARM_BUS_SYSMGR_CARD_FWDNLD_START, + IARM_BUS_SYSMGR_CARD_FWDNLD_COMPLETE, +} IARM_Bus_SYSMGR_FWDNLDState_t; + +/*! Possible Image Download state */ +typedef enum _SYSMgr_IMAGE_FWDNLDState_t +{ + IARM_BUS_SYSMGR_IMAGE_FWDNLD_UNINITIALIZED, + IARM_BUS_SYSMGR_IMAGE_FWDNLD_DOWNLOAD_INPROGRESS, + IARM_BUS_SYSMGR_IMAGE_FWDNLD_DOWNLOAD_COMPLETE, + IARM_BUS_SYSMGR_IMAGE_FWDNLD_DOWNLOAD_FAILED, + IARM_BUS_SYSMGR_IMAGE_FWDNLD_FLASH_INPROGRESS, + IARM_BUS_SYSMGR_IMAGE_FWDNLD_FLASH_COMPLETE, + IARM_BUS_SYSMGR_IMAGE_FWDNLD_FLASH_FAILED +} IARM_Bus_SYSMGR_IMG_FWDNLDState_t; + +/*! Possible Firmware Update States (as per RDK-14100, RDK-19928)*/ +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_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; + + +/*! Event Data associated with Sys Managers */ +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; + struct _USB_DETECT { + int inserted; + char vendor[128]; + char productid[256]; + char devicename[256]; + } usbData; + + } data; +}IARM_Bus_SYSMgr_EventData_t; + +typedef struct _propertyValue +{ + int state; + int error; + char payload[128]; +} state_property; +/* + * Declare RPC API names and their arguments + */ +#define IARM_BUS_SYSMGR_API_GetSystemStates "GetSystemStates" /*!< Gets the states of the system*/ + +/* + * Declare RPC API names for HDCP Profile + */ +#define IARM_BUS_SYSMGR_API_SetHDCPProfile "SetHDCPProfile" +#define IARM_BUS_SYSMGR_API_GetHDCPProfile "GetHDCPProfile" + +/* + * Declare RPC API names for Key Code Logging Status + */ +#define IARM_BUS_SYSMGR_API_GetKeyCodeLoggingPref "GetKeyCodeLoggingPref" +#define IARM_BUS_SYSMGR_API_SetKeyCodeLoggingPref "SetKeyCodeLoggingPref" + +/*! Parameter for Setpowerstate call*/ +typedef struct _IARM_Bus_SYSMgr_GetSystemStates_Param_t { + state_property channel_map; /*!< [in] New powerstate to be set */ + 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 partnerid_changed; + state_property ip_mode; + state_property qam_ready_status; + state_property firmware_update_state; + state_property red_recov_state; +} IARM_Bus_SYSMgr_GetSystemStates_Param_t; + +#define IARM_BUS_SYSMGR_Intrusion_MaxLen 1024 + +/*! Parameter for intrusion detect call*/ +typedef struct _IARM_Bus_SYSMgr_IntrusionData_t{ + char intrusionData[ IARM_BUS_SYSMGR_Intrusion_MaxLen+1 ]; //[in] intrusion detection data +} IARM_Bus_SYSMgr_IntrusionData_t; + + +#ifdef __cplusplus +} +#endif + +#endif + +/* End of IARM_BUS_SYSMGR_API doxygen group */ +/** + * @} + */ + + + +/** @} */ +/** @} */ diff --git a/rdk_build.sh b/rdk_build.sh old mode 100644 new mode 100755 index aa0ed68..b367e19 --- a/rdk_build.sh +++ b/rdk_build.sh @@ -57,6 +57,13 @@ function usage() echo " configure, clean, build (DEFAULT), rebuild, install" } +# options may be followed by one colon to indicate they have a required argument +if ! GETOPT=$(getopt -n "build.sh" -o hvp: -l help,verbose,platform: -- "$@") +then + usage + exit 1 +fi + eval set -- "$GETOPT" while true; do @@ -72,7 +79,6 @@ done ARGS=$@ - # component-specific vars export RDK_PLATFORM_SOC=${RDK_PLATFORM_SOC-broadcom} export PLATFORM_SOC=$RDK_PLATFORM_SOC @@ -82,12 +88,45 @@ export FSROOT=${RDK_FSROOT_PATH} export TOOLCHAIN_DIR=${RDK_TOOLCHAIN_PATH} export BUILDS_DIR=$RDK_PROJECT_ROOT_PATH +function standaloneBuildClean() +{ + pd=`pwd` + CLEAN_BUILD=1 + dnames="$RDK_SCRIPTS_PATH" + for dName in $dnames + do + cd $dName + if [ -f Makefile ]; then + make distclean + fi + rm -f configure + rm -rf aclocal.m4 autom4te.cache config.log config.status libtool + rm -rf install + find . -iname "Makefile.in" -exec rm -f {} \; + find . -iname "Makefile" | xargs rm -f + ls cfg/* | grep -v "Makefile.am" | xargs rm -f + cd $pd + done + find . -iname "*.o" -exec rm -f {} \; +} # functional modules +function standaloneBuildConfigure() +{ + cd $COMBINED_ROOT/sys_mon_tools + aclocal -I cfg + libtoolize --automake + autoheader + automake --foreign --add-missing + rm -f configure + autoconf + ./configure --with-libtool-sysroot=${RDK_FSROOT_PATH} --disable-static --host=$HOST --prefix=${RDK_FSROOT_PATH}/usr/ --enable-standalonebuild + CC_PATH=$COMBINED_ROOT/sys_mon_tools + echo "CC_PATH ---> ${CC_PATH}" +} function configure() { - echo "here" true #use this function to perform any pre-build configuration } @@ -198,7 +237,27 @@ function build() export DFB_LIB=${FSROOT}/vendor/lib export OPENSOURCE_BASE=${FSROOT}/usr export CC="$CROSS_COMPILE-gcc $CFLAGS" - export CXX="$CROSS_COMPILE-g++ $CFLAGS $LDFLAGS" + export CXX="$CROSS_COMPILE-g++ $CFLAGS $LDFLAGS" + elif [ $RDK_PLATFORM_SOC = "standalone" ]; then + export GLIBS='-lglib-2.0 -lz' + export IARM_PATH="`readlink -m .`" + export ROOT_INC="/usr/lib/x86_64-linux-gnu" + export GLIB_INCLUDE_PATH="/usr/include/glib-2.0" + export GLIB_CONFIG_INCLUDE_PATH="${ROOT_INC}/glib-2.0/include" + export DBUS_INCLUDE_PATH="/usr/include/dbus-1.0" + export DBUS_CONFIG_INCLUDE_PATH="${ROOT_INC}/dbus-1.0/include" + export CFLAGS+="-O2 -Wall -fPIC -I./include -I${GLIB_INCLUDE_PATH} -I${GLIB_CONFIG_INCLUDE_PATH} \ + -I${CC_PATH}/mocks \ + -I/usr/include \ + -I${DBUS_INCLUDE_PATH} \ + -I${DBUS_CONFIG_INCLUDE_PATH} \ + -I/usr/include/libsoup-2.4 \ + -I/usr/include/gssdp-1.0" + export LDFLAGS+="-Wl,-rpath, -L/usr/lib" + export OPENSOURCE_BASE=${FSROOT}/usr + export CC="$CROSS_COMPILE-gcc $CFLAGS" + export CXX="$CROSS_COMPILE-g++ $CFLAGS $LDFLAGS" + export USE_IARM_BUS="y" fi if [ -d $IARM_PATH ]; then export USE_IARM_BUS="y" @@ -213,6 +272,13 @@ function build() } +function standaloneBuild() +{ + standaloneBuildClean + standaloneBuildConfigure + build +} + function rebuild() { clean @@ -237,6 +303,9 @@ for i in "$ARGS"; do build) HIT=true; build ;; rebuild) HIT=true; rebuild ;; install) HIT=true; install ;; + standaloneBuildClean) HIT=true; standaloneBuildClean ;; + standaloneBuildConfigure) HIT=true; standaloneBuildConfigure ;; + standalone) HIT=true; standaloneBuild ;; *) #skip unknown ;; From d04d4938b1d7606028c42d1a01d0fca1798114e4 Mon Sep 17 00:00:00 2001 From: Yuvaramachandran Gurusamy Date: Wed, 28 May 2025 02:54:00 +0530 Subject: [PATCH 2/6] RDKEMW-4132: Prepare standalone build for Coverity support Signed-off-by: Yuvaramachandran Gurusamy --- Makefile.am | 24 +- configure.ac | 12 - cov_build.sh | 103 +++ .../IARM_Bus_CheckPowerStatus.c | 8 +- key_simulator/IrInputRemoteKeyCodes.h | 5 - mocks/IrKeyCodes.h | 382 ---------- mocks/libIARM.h | 114 --- mocks/libIARMCore.h | 364 ---------- mocks/libIBus.h | 362 ---------- mocks/libIBusDaemon.h | 270 -------- mocks/mfrApi.h | 224 ------ mocks/mfrMgr.h | 218 ------ mocks/mfrTypes.h | 651 ------------------ mocks/mfr_wifi_api.h | 146 ---- mocks/mfr_wifi_types.h | 139 ---- mocks/mockInternal.cpp | 210 ------ mocks/sysMgr.h | 385 ----------- rdk_build.sh | 75 +- stubs/iarm_stubs.cpp | 73 ++ {mocks => stubs}/power_controller.h | 0 stubs/powerctrl_stubs.cpp | 79 +++ stubs/safec_lib.h | 165 +++++ 22 files changed, 430 insertions(+), 3579 deletions(-) create mode 100755 cov_build.sh delete mode 100644 mocks/IrKeyCodes.h delete mode 100644 mocks/libIARM.h delete mode 100644 mocks/libIARMCore.h delete mode 100644 mocks/libIBus.h delete mode 100644 mocks/libIBusDaemon.h delete mode 100644 mocks/mfrApi.h delete mode 100644 mocks/mfrMgr.h delete mode 100644 mocks/mfrTypes.h delete mode 100644 mocks/mfr_wifi_api.h delete mode 100644 mocks/mfr_wifi_types.h delete mode 100644 mocks/mockInternal.cpp delete mode 100644 mocks/sysMgr.h mode change 100755 => 100644 rdk_build.sh create mode 100644 stubs/iarm_stubs.cpp rename {mocks => stubs}/power_controller.h (100%) create mode 100644 stubs/powerctrl_stubs.cpp create mode 100644 stubs/safec_lib.h diff --git a/Makefile.am b/Makefile.am index d65c966..bd0c328 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,31 +39,17 @@ include_HEADERS = $(top_srcdir)/key_simulator/RDKIrKeyCodes.h bin_PROGRAMS = keySimulator mfr_util QueryPowerState SetPowerState IARM_event_sender mfr_util_SOURCES = mfr-utils/sys_mfr_utils.c +mfr_util_LDADD = -lIARMBus QueryPowerState_SOURCES=iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c -QueryPowerState_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) +QueryPowerState_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -lWPEFrameworkPowerController SetPowerState_SOURCES=iarm_set_powerstate/IARM_BUS_SetPowerStatus.c -SetPowerState_LDADD = -ldbus-1 -lstdc++ -lpthread +SetPowerState_LDADD = -ldbus-1 -lstdc++ -lpthread -lWPEFrameworkPowerController keySimulator_SOURCES=key_simulator/IARM_BUS_UIEventSimulator.c key_simulator/uinput.c -keySimulator_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) +keySimulator_LDADD = $(GLIB_LIBS) -lIARMBus $(DBUS_LIBS) IARM_event_sender_SOURCES = iarm-event-sender/IARM_event_sender.c -IARM_event_sender_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) +IARM_event_sender_LDADD = $(DIRECT_LIBS) $(FUSION_LIBS) $(GLIB_LIBS) -lIARMBus $(DBUS_LIBS) -if STANDALONE_BUILD -AM_CFLAGS += -I$(top_srcdir)/mocks -DSTANDALONE_BUILD -include_HEADERS += $(top_srcdir)/mocks/IrKeyCodes.h -mfr_util_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp -QueryPowerState_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp -SetPowerState_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp -keySimulator_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp -IARM_event_sender_SOURCES += $(top_srcdir)/mocks/mockInternal.cpp -else -mfr_util_LDADD = -lIARMBus -keySimulator_LDADD += -lIARMBus -QueryPowerState_LDADD += -lWPEFrameworkPowerController -SetPowerState_LDADD += -lWPEFrameworkPowerController -IARM_event_sender_LDADD += -lIARMBus -endif diff --git a/configure.ac b/configure.ac index 4b13415..c710172 100644 --- a/configure.ac +++ b/configure.ac @@ -50,18 +50,6 @@ PKG_CHECK_MODULES([DBUS], [dbus-1]) AC_CHECK_LIB(gthread-2.0, g_thread_init) -STANDALONE_BUILD="" -AC_ARG_ENABLE([standalonebuild], - AS_HELP_STRING([--enable-standalonebuild],[This will enable mocks compilation. ]), - [ - case "${enableval}" in - yes) STANDALONE_BUILD=true ;; - *) STANDALONE_BUILD=false echo[Standalone Build is disabled];; - esac - ], - [ STANDALONE_BUILD=false ; echo "Standalone Build not used"]) -AM_CONDITIONAL(STANDALONE_BUILD, test "x$STANDALONE_BUILD" = xtrue) - # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T AC_TYPE_SIZE_T diff --git a/cov_build.sh b/cov_build.sh new file mode 100755 index 0000000..8e3f98c --- /dev/null +++ b/cov_build.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +WORKDIR=`pwd` +export ROOT=/home/rdkv-core/Yuvaram/workspace/downloads +export ROOT=/usr +export INSTALL_DIR=${ROOT}/local +mkdir -p $INSTALL_DIR + +cd $ROOT +rm -rf iarmbus +git clone https://github.com/rdkcentral/iarmbus.git + +cd $ROOT +rm -rf iarmmgrs +git clone https://github.com/rdkcentral/iarmmgrs.git + +export IARMBUS_PATH=$ROOT/iarmbus +export IARMMGRS_PATH=$ROOT/iarmmgrs + +# Build and deploy stubs for IARMBus +echo "Building IARMBus stubs" +cd $WORKDIR +cd ./stubs +g++ -fPIC -shared -o libIARMBus.so iarm_stubs.cpp -I$WORKDIR/stubs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I$IARMBUS_PATH/core -I$IARMBUS_PATH/core/include -fpermissive +g++ -fPIC -shared -o libWPEFrameworkPowerController.so powerctrl_stubs.cpp -I$WORKDIR/stubs -fpermissive + +#cp $IARMBUS_PATH/core/libIARMCore.h /usr/local/include +#cp $IARMBUS_PATH/core/include/libIBus.h /usr/local/include +#cp $IARMBUS_PATH/core/include/libIARM.h /usr/local/include +#cp $IARMBUS_PATH/core/include/libIBusDaemon.h /usr/local/include +#cp $IARMMGRS_PATH/hal/include/comcastIrKeyCodes.h /usr/local/include +#cp $IARMMGRS_PATH/mfr/include/mfr*.h /usr/local/include +#cp $IARMMGRS_PATH/mfr/common/include/mfrApi.h /usr/local/include + +cp libIARMBus.so /usr/local/lib +cp libWPEFrameworkPowerController.so /usr/local/lib/libWPEFrameworkPowerController.so + +function standaloneBuildClean() +{ + pd=`pwd` + CLEAN_BUILD=1 + dnames="$RDK_SCRIPTS_PATH" + for dName in $dnames + do + cd $dName + if [ -f Makefile ]; then + make distclean + fi + rm -f configure + rm -rf aclocal.m4 autom4te.cache config.log config.status libtool + rm -rf install + find . -iname "Makefile.in" -exec rm -f {} \; + find . -iname "Makefile" | xargs rm -f + ls cfg/* | grep -v "Makefile.am" | xargs rm -f + cd $pd + done + find . -iname "*.o" -exec rm -f {} \; +} + +function standaloneBuildConfigure() +{ + aclocal -I cfg + libtoolize --automake + autoheader + automake --foreign --add-missing + rm -f configure + autoconf + ./configure +} + +echo "##### Building sys_mon_tools module" +cd $WORKDIR + +export GLIBS='-lglib-2.0 -lz' +export ROOT_INC="/usr/lib/x86_64-linux-gnu" +export GLIB_INCLUDE_PATH="/usr/include/glib-2.0" +export GLIB_CONFIG_INCLUDE_PATH="${ROOT_INC}/glib-2.0/include" +export DBUS_INCLUDE_PATH="/usr/include/dbus-1.0" +export DBUS_CONFIG_INCLUDE_PATH="${ROOT_INC}/dbus-1.0/include" +export CFLAGS+="-O2 -Wall -fPIC -I./include -I${GLIB_INCLUDE_PATH} -I${GLIB_CONFIG_INCLUDE_PATH} \ + -I/usr/include \ + -I/usr/local/include \ + -I${WORKDIR}/stubs \ + -I${DBUS_INCLUDE_PATH} \ + -I${DBUS_CONFIG_INCLUDE_PATH} \ + -I/usr/include/libsoup-2.4 \ + -I/usr/include/gssdp-1.0" +export LDFLAGS+="-Wl,-rpath, -L/usr/lib" +export CC="gcc $CFLAGS" +export CXX="g++ $CFLAGS $LDFLAGS" +export USE_IARM_BUS="y" + +standaloneBuildClean +standaloneBuildConfigure + +#make +# +#cp $IARMMGRS_PATH/hal/include/comcastIrKeyCodes.h /usr/local/include +#cp $IARMMGRS_PATH/mfr/include/mfr*.h /usr/local/include +#cp $IARMMGRS_PATH/mfr/common/include/mfrApi.h /usr/local/include + +make VERBOSE=1 AM_CPPFLAGS="-I${WORKDIR}/stubs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libsoup-3.0 -I/usr/local/include -I${IARMMGRS_PATH}/sysmgr/include -I${IARMBUS_PATH}/core -I${IARMBUS_PATH}/core/include -I${IARMMGRS_PATH}/hal/include -I${IARMMGRS_PATH}/mfr/include -I${IARMMGRS_PATH}/mfr/common/include" \ +AM_LDFLAGS="-L/usr/local/lib -lIARMBus -lWPEFrameworkPowerController" CXXFLAGS="-fpermissive -I${WORKDIR}/stubs" diff --git a/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c b/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c index c2aa6a0..0550d61 100644 --- a/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c +++ b/iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c @@ -25,9 +25,7 @@ // This include is still required for data types to read cached power status residing in /opt/uimgr_settings.bin // TODO: after IARM PwrMgr logic is moved to PowerManager plugin refactor this code and remove this header file too. -#ifndef STANDALONE_BUILD /*TODO: This check needs to be removed once old PowerManager reference addressed*/ #include "pwrMgr.h" -#endif #include "power_controller.h" @@ -43,9 +41,7 @@ typedef struct _PWRMgr_Settings_t { uint32_t magic; uint32_t version; uint32_t length; -#ifndef STANDALONE_BUILD /*TODO: This check needs to be removed once old PowerManager reference addressed*/ IARM_Bus_PWRMgr_PowerState_t powerState; -#endif /*STANDALONE_BUILD*/ PWRMgr_LED_Settings_t ledSettings; uint32_t deep_sleep_timeout; char padding[PADDING_SIZE]; @@ -126,7 +122,7 @@ int main(int argc, char* argv[]) close(fd); } -#ifndef STANDALONE_BUILD /*TODO: This check needs to be removed once old PowerManager reference addressed*/ + if (ret > 0) { if (IARM_BUS_PWRMGR_POWERSTATE_OFF == pwrSettings.powerState) { printf("OFF"); @@ -144,7 +140,7 @@ int main(int argc, char* argv[]) } else { printf("Error in reading PWRMgr settings File"); } -#endif + printf("\n"); } return 0; diff --git a/key_simulator/IrInputRemoteKeyCodes.h b/key_simulator/IrInputRemoteKeyCodes.h index fa3a432..005017c 100644 --- a/key_simulator/IrInputRemoteKeyCodes.h +++ b/key_simulator/IrInputRemoteKeyCodes.h @@ -45,12 +45,7 @@ #include #include - -#ifdef STANDALONE_BUILD -#include "IrKeyCodes.h" -#else #include "comcastIrKeyCodes.h" -#endif #ifdef __cplusplus extern "C" { diff --git a/mocks/IrKeyCodes.h b/mocks/IrKeyCodes.h deleted file mode 100644 index 5850e50..0000000 --- a/mocks/IrKeyCodes.h +++ /dev/null @@ -1,382 +0,0 @@ -/* - * 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. -*/ - -//@todo : Need to rename this file name to some generic name. ir_manager_keympaps.h - -/** - * @addtogroup HPK HPK - * @{ - * @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. - * - */ - -/** @addtogroup IR_MANAGER_HAL IR MANAGER HAL - * @{ - * @par Application API Specification - * IR HAL provides an interface to register IR events with the low level interfaces, - * which will notify the caller based on received IR Key events. - */ - - -/** @defgroup IrKeyCodes IrKeyCodes - * @{ - */ - - -#ifndef _IR_MANAGER_KEYMAPS_H_ -#define _IR_MANAGER_KEYMAPS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -/** - * @file IrKeyCodes.h - * - * @brief IR key map header - * - * This file contains key definitions used by the IR HAL. - * - * @par Document - * Document reference. - * - * @par Open Issues (in no particular order) - * -# None - * - * @par Assumptions - * -# None - * - * @par Abbreviations - * - XR: Remote type - * - V: Version - * - PIP: Picture in picture - * - WPS: Wi-Fi Protected Setup - * - DMC: @todo what is DMC. - * - OTR: @todo what is OTR. - * - * @par Implementation Notes - * -# None - * - */ - -/*------------------------------------------------------------------- - Defines/Macros - - //@todo : All the definitions should be prefixed with IR_. Will do it in the next phase --------------------------------------------------------------------*/ -///< Represents the mask for delay and repeat. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define DELAY_REPEAT_MASK 0x00000001 -///< Represents the mask for the language selection. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define LANGUAGE_MASK 0x00000010 -///< Represents the mask for the missed key timeout. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define MISSED_KEY_TIMEOUT_MASK 0x00000100 -///< Represents the mask for enabling key repeat. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define REPEAT_KEY_ENABLED_MASK 0x00001000 -///< Represents the mask for the key repeat frequency. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define REPEAT_FREQUENCY_MASK 0x00010000 -///< Represents the mask for reporting modifiers. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define REPORT_MODIFIERS_MASK 0x00100000 -///< Represents the mask for the number of devices. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define NUM_OF_DEVICES_MASK 0x01000000 - -///< Represents the key down event. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KET_KEYDOWN 0x00008000UL -///< Represents the key up event. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KET_KEYUP 0x00008100UL -///< Represents the key repeat event. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KET_KEYREPEAT 0x00008200UL - -/* Numeric keys (common in Remote and Key Board) */ -/* Combination of Key + device type (HID_DEVICES) is unique */ -///< Represents the key "0". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT0 0x00000030UL -///< Represents the key "1". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT1 0x00000031UL -///< Represents the key "2". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT2 0x00000032UL -///< Represents the key "3". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT3 0x00000033UL -///< Represents the key "4". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT4 0x00000034UL -///< Represents the key "5". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT5 0x00000035UL -///< Represents the key "6". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT6 0x00000036UL -///< Represents the key "7". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT7 0x00000037UL -///< Represents the key "8". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT8 0x00000038UL -///< Represents the key "9". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DIGIT9 0x00000039UL -///< Represents the key period (decimal point). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PERIOD 0x00000040UL - -///< Represents the key for discrete power on. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DISCRETE_POWER_ON 0x00000050UL -///< Represents the key for discrete power standby. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DISCRETE_POWER_STANDBY 0x00000051UL - -///< Represents the key for search. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_SEARCH 0x000000CFUL -///< Represents the key for setup. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_SETUP 0x00000052UL - -///< Represents the key for closed captioning. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_CLOSED_CAPTIONING 0x00000060UL -///< Represents the key for language selection. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_LANGUAGE 0x00000061UL -///< Represents the key for voice guidance. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_VOICE_GUIDANCE 0x00000062UL -///< Represents the key for heartbeat. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_HEARTBEAT 0x00000063UL -///< Represents the key for push-to-talk. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PUSH_TO_TALK 0x00000064UL -///< Represents the key for descriptive audio. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DESCRIPTIVE_AUDIO 0x00000065UL -///< Represents the key for volume optimization. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_VOLUME_OPTIMIZE 0x00000066UL -///< Represents the key XR2V3. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -///< @todo how KED_XR2V3 is used?? Is it key or protocol. Seems like XR is platform specific, -///< if so need to remove form generic header. time being keep it in generic it self -//< @todo platform specific key will be deprecated in the next phase. -#define KED_XR2V3 0x00000067UL -///< Represents the key XR5V2. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR5V2 0x00000068UL -///< Represents the key XR11V1. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR11V1 0x00000069UL -///< Represents the key XR11V2. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR11V2 0x0000006AUL -///< Represents the key XR13. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR13 0x0000006BUL -///< Represents the key XR11 notify. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR11_NOTIFY 0x0000006CUL - -///< Represents the key XR15V1 notify. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR15V1_NOTIFY 0x00000070UL -///< Represents the key XR15V1 select. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR15V1_SELECT 0x00000071UL -///< Represents the key XR15V1 push-to-talk. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -//< @todo platform specific key will be deprecated in the next phase -#define KED_XR15V1_PUSH_TO_TALK 0x00000072UL - -///< Represents the key for screen bind notify. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_SCREEN_BIND_NOTIFY 0x00000073UL - -///< Represents the key XR16V1 notify. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_XR16V1_NOTIFY 0x00000074UL -///< Represents the key XR16V1 select. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_XR16V1_SELECT 0x00000075UL -///< Represents the key XR16V1 push-to-talk. Platform specific key code. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_XR16V1_PUSH_TO_TALK 0x00000076UL - -///< Represents the key for RF power. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_RF_POWER 0x0000007FUL -///< Represents the key for power. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_POWER 0x00000080UL -///< Represents the key for FP power. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_FP_POWER KED_POWER -///< Represents the key for arrow up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_ARROWUP 0x00000081UL -///< Represents the key for arrow down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_ARROWDOWN 0x00000082UL -///< Represents the key for arrow left. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_ARROWLEFT 0x00000083UL -///< Represents the key for arrow right. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_ARROWRIGHT 0x00000084UL -///< Represents the key for select. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_SELECT 0x00000085UL -///< Represents the key for enter. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_ENTER 0x00000086UL -///< Represents the key for exit. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_EXIT 0x00000087UL -///< Represents the key for channel up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_CHANNELUP 0x00000088UL -///< Represents the key for channel down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_CHANNELDOWN 0x00000089UL -///< Represents the key for volume up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_VOLUMEUP 0x0000008AUL -///< Represents the key for volume down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_VOLUMEDOWN 0x0000008BUL -///< Represents the key for mute. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_MUTE 0x0000008CUL -///< Represents the key for guide. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_GUIDE 0x0000008DUL -///< Represents the key for viewing guide. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_VIEWINGGUIDE KED_GUIDE -///< Represents the key for info. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_INFO 0x0000008EUL -///< Represents the key for settings. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_SETTINGS 0x0000008FUL -///< Represents the key for page up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PAGEUP 0x00000090UL -///< Represents the key for page down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PAGEDOWN 0x00000091UL -///< Represents the key "A". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEYA 0x00000092UL -///< Represents the key "B". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEYB 0x00000093UL -///< Represents the key "C". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEYC 0x00000094UL -///< Represents the key "D". @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEYD 0x0000009FUL -///< Represents the key for the red circle (Key C). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEY_RED_CIRCLE KED_KEYC //@todo platform specific key will be depricated in the next phase. -///< Represents the key for the green diamond (Key D). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEY_GREEN_DIAMOND KED_KEYD //@todo platform specific key will be depricated in the next phase. -///< Represents the key for the blue square (Key B). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEY_BLUE_SQUARE KED_KEYB //@todo platform specific key will be depricated in the next phase. -///< Represents the key for the yellow triangle (Key A). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_KEY_YELLOW_TRIANGLE KED_KEYA //@todo platform specific key will be depricated in the next phase. -///< Represents the key for the last channel. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_LAST 0x00000095UL -///< Represents the key for favorite. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_FAVORITE 0x00000096UL -///< Represents the key for rewind. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_REWIND 0x00000097UL -///< Represents the key for fast forward. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_FASTFORWARD 0x00000098UL -///< Represents the key for play. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PLAY 0x00000099UL -///< Represents the key for stop. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_STOP 0x0000009AUL -///< Represents the key for pause. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PAUSE 0x0000009BUL -///< Represents the key for record. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_RECORD 0x0000009CUL -///< Represents the key for bypass. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_BYPASS 0x0000009DUL -///< Represents the key for TV/VCR. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_TVVCR 0x0000009EUL - -///< Represents the key for replay. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_REPLAY 0x000000A0UL -///< Represents the key for help. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_HELP 0x000000A1UL -///< Represents the key for recalling favorite 0. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_RECALL_FAVORITE_0 0x000000A2UL -///< Represents the key for clear. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_CLEAR 0x000000A3UL -///< Represents the key for delete. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DELETE 0x000000A4UL -///< Represents the key for start. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_START 0x000000A5UL -///< Represents the key for pound. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_POUND 0x000000A6UL -///< Represents the key for front panel 1. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_FRONTPANEL1 0x000000A7UL -///< Represents the key for front panel 2. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_FRONTPANEL2 0x000000A8UL -///< Represents the key for OK. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_OK 0x000000A9UL -///< Represents the key for star. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_STAR 0x000000AAUL -///< Represents the key for program. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PROGRAM 0x000000ABUL - -///< Represents the key for TV power (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_TVPOWER 0x000000C1UL -///< Represents the key for previous (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PREVIOUS 0x000000C3UL -///< Represents the key for next (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_NEXT 0x000000C4UL -///< Represents the key for menu (alternate remote). @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_MENU 0x000000C0UL -///< Represents the key for input key. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_INPUTKEY 0x000000D0UL -///< Represents the key for live. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_LIVE 0x000000D1UL -///< Represents the key for MyDVR. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_MYDVR 0x000000D2UL -///< Represents the key for on-demand. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_ONDEMAND 0x000000D3UL -///< Represents the key for STB menu. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_STB_MENU 0x000000D4UL -///< Represents the key for audio. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_AUDIO 0x000000D5UL -///< Represents the key for factory. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_FACTORY 0x000000D6UL -///< Represents the key for RF enable. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_RFENABLE 0x000000D7UL -///< Represents the key for list. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_LIST 0x000000D8UL -///< Represents the key for RF pair ghost. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_RF_PAIR_GHOST 0x000000EFUL /* Ghost code to implement auto pairing in RF remotes */ -///< Represents the key for WPS. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_WPS 0x000000F0UL /* Key to initiate WiFi WPS pairing */ -///< Key to initiate deepsleep wakeup. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DEEPSLEEP_WAKEUP 0x000000F1UL /* Key to initiate deepsleep wakeup */ -///< Signals a battery set was replaced. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_NEW_BATTERIES_INSERTED 0x000000F2UL /* Signals a battery set was replaced */ -///< Signals an external power supply device is shutting down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_GRACEFUL_SHUTDOWN 0x000000F3UL /* Signals an external power supply device is shutting down */ -///< Use for keys not defined here. Pass raw code as well. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_UNDEFINEDKEY 0x000000FEUL /* Use for keys not defined here. Pass raw code as well. */ - - -///< Represents the key for back. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_BACK 0x100000FEUL -///< Represents the key for display swap. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DISPLAY_SWAP 0x300000FEUL -///< Represents the key for PIP move. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PINP_MOVE 0x400000FEUL -///< Represents the key for PIP toggle. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PINP_TOGGLE 0x500000FEUL -///< Represents the key for PIP channel down. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PINP_CHDOWN 0x600000FEUL -///< Represents the key for PIP channel up. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_PINP_CHUP 0x700000FEUL -///< Represents the key for DMC activate. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DMC_ACTIVATE 0x800000FEUL -///< Represents the key for DMC deactivate. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DMC_DEACTIVATE 0x900000FEUL -///< Represents the key for DMC query. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_DMC_QUERY 0xA00000FEUL -///< Represents the key for OTR start. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_OTR_START 0xB00000FEUL -///< Represents the key for OTR stop. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_OTR_STOP 0xC00000FEUL -///< Represents the key for test. @todo : All the definitions should be prefixed with IR_. Will do it in the next phase -#define KED_TEST 0xD00000FEUL - -#ifdef __cplusplus -} -#endif - -#endif /* _IR_KEYCODES_H_ */ - - -/** @} */ // End of IrKeyCodes -/** @} */ // End of IR_MANAGER_HAL -/** @} */ // End of HPK diff --git a/mocks/libIARM.h b/mocks/libIARM.h deleted file mode 100644 index bb7e601..0000000 --- a/mocks/libIARM.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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. -*/ - -/** -* @file libIARM.h -* -* @brief IARM-Bus IARM core library API. -* -* This API defines the core constants for IARM -* -* @par Document -* Document reference. -* -* @par Open Issues (in no particular order) -* -# None -* -* @par Assumptions -* -# None -* -* @par Abbreviations -* - BE: ig-Endian. -* - cb: allback function (suffix). -* - DS: Device Settings. -* - FPD: Front-Panel Display. -* - HAL: Hardware Abstraction Layer. -* - LE: Little-Endian. -* - LS: Least Significant. -* - MBZ: Must be zero. -* - MS: Most Significant. -* - RDK: Reference Design Kit. -* - _t: Type (suffix). -* -* @par Implementation Notes -* -# None -* -*/ - -/** @defgroup IARM_BUS IARM_BUS -* @ingroup IARM_BUS -* -* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows -* applications to communicate with each other by sending Events or invoking Remote -* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is -* independent of the operating system or the underlying IPC mechanism. -* -* Two applications connected to the same instance of IARM-Bus are able to exchange events -* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If -* desired, it is possible to have multiple IARM-Bus instances. However, applications -* connected to different buses will not be able to communicate with each other. -*/ - -/** @addtogroup IARM_BUS_IARM_CORE_API IARM-Core library. -* @ingroup IARM_BUS -* -* Described herein are the constants declarations that are part of the -* IARM Core library. -* -* @{ -*/ - - -#ifndef _LIB_IARM_H -#define _LIB_IARM_H - -#ifdef __cplusplus -extern "C" -{ -#endif -#include - - -#define IARM_BUS_NAME "com.comcast.rdk.iarm.bus" /*!< Well-known Bus Name */ -#define IARM_MAX_NAME_LEN 64 /*!< Maximum string length of names in IARM, including the null terminator */ - -typedef int IARM_EventId_t; - -typedef enum _IARM_Result_t -{ - IARM_RESULT_SUCCESS, - IARM_RESULT_INVALID_PARAM, /*!< Invalid input parameter */ - IARM_RESULT_INVALID_STATE, /*!< Invalid state encountered */ - IARM_RESULT_IPCCORE_FAIL, /*!< Underlying IPC failure */ - IARM_RESULT_OOM, /*!< Memory allocation failure */ - -} IARM_Result_t; - -#define IARM_METHOD_IPC_TIMEOUT_DEFAULT (-1) -#define IARM_METHOD_IPC_TIMEOUT_INFINITE ((int) 0x7fffffff) - -#ifdef __cplusplus -} -#endif -#endif - -/* End of IARM_BUS_IARM_CORE_API doxygen group */ -/** - * @} - */ diff --git a/mocks/libIARMCore.h b/mocks/libIARMCore.h deleted file mode 100644 index 175b5b8..0000000 --- a/mocks/libIARMCore.h +++ /dev/null @@ -1,364 +0,0 @@ -/* - * 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. -*/ - -/** -* @file libIARMCore.h -* -* @brief IARM-Bus IARM core library API. -* -* This API defines the core operations for IARM -* -* @par Document -* Document reference. -* -* @par Open Issues (in no particular order) -* -# None -* -* @par Assumptions -* -# None -* -* @par Abbreviations -* - BE: ig-Endian. -* - cb: allback function (suffix). -* - DS: Device Settings. -* - FPD: Front-Panel Display. -* - HAL: Hardware Abstraction Layer. -* - LE: Little-Endian. -* - LS: Least Significant. -* - MBZ: Must be zero. -* - MS: Most Significant. -* - RDK: Reference Design Kit. -* - _t: Type (suffix). -* -* @par Implementation Notes -* -# None -* -*/ - -/** @defgroup IARM_BUS IARM_BUS -* @ingroup IARM_BUS -* -* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows -* applications to communicate with each other by sending Events or invoking Remote -* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is -* independent of the operating system or the underlying IPC mechanism. -* -* Two applications connected to the same instance of IARM-Bus are able to exchange events -* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If -* desired, it is possible to have multiple IARM-Bus instances. However, applications -* connected to different buses will not be able to communicate with each other. -*/ - -/** @addtogroup IARM_BUS_IARM_CORE_API IARM-Core library. -* @ingroup IARM_BUS -* -* Described herein are the functions that are part of the -* IARM Core library. -* -* @{ -*/ - -#ifndef _LIB_IARMCORE_H -#define _LIB_IARMCORE_H - -#include "libIARM.h" - -#ifdef __cplusplus -extern "C" -{ -#endif -#include -#define IARM_ASSERT(cond) while(!(cond)) \ -{ \ - printf("IARM_ASSERT Failed at [%s @ %d]\r\n", __func__, __LINE__);\ - break; \ -}\ - -/*! IARM Event data*/ -typedef struct _IARM_EventData_t { - char owner[IARM_MAX_NAME_LEN]; /*!< Owner of the event*/ - IARM_EventId_t id; /*!< Event id*/ - size_t len; /*!< Size of event data*/ - char data[]; /*!< Event data*/ -} IARM_EventData_t; - -typedef enum _IARM_MemType_t -{ - IARM_MEMTYPE_THREADLOCAL = 1, /*!< Thread local memory */ - IARM_MEMTYPE_PROCESSLOCAL, /*!< Process local memory */ - IARM_MEMTYPE_PROCESSSHARE, /*!< Process shared memory */ -} IARM_MemType_t; - -/** - * @brief Callback prototype for IARM RPC Call. - * - */ -typedef void (*IARM_Call_t) (void *ctx, unsigned long methodID, void *arg, void *magic); - -/** - * @brief Callback prototype for IARM listener interface. - * - */ -typedef void (*IARM_Listener_t) (void *ctx, void *arg); - -/** - * @brief Initialize the IARM module for the calling process. - * - * This API is used to initialize the IARM module for the calling process, and regisers the calling process to - * be visible to other processes that it wishes to communicate to. The registered process is uniquely identified - * by (groupName, memberName). - * - * @param [in] groupName The IPC group this process wishes to participate. - * @param [in] memberName The name of the calling process. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_Init(const char *groupName, const char *memberName); - -/** - * @brief Allocate memory for IARM member processes. - * - * This API allows IARM member process to allocate local memory or shared memory. - * There are two types of local memory: Process local and thread local. Local memory - * is only accessible by the process who allocates. - * - * Shared memory, is accessible by all processes within the same group as the process that - * allocates the memory. - * - * For example, RPC call arguments of complicated structures should be allocated from shared - * memory so the RPC invocation can access these arguments from a different process. - * - * @param [in] type Thread-Local, Process-Local or Shared memory. - * @param [in] size Number of bytes to allocate. - * @param [out] ptr Return allocated memory. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr); - -/** - * @brief Free memory allocated by IARM member processes. - * - * This API allows IARM member process to free local memory or shared memory. - * The type specified in the free() API must match that specified in the malloc() - * call. - * - * @param [in] type Thread-Local, Process-Local or Shared memory. This must match the type of the allocated memory. - * @param [in] alloc Points to the allocated memory to be freed. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc); - - -/** - * @brief Register a RPC call so other processes can call. - * - * A process publishes a RPC function using this API. The RPC call, uniquely - * identified by (groupName, memberName, callName), can be invoked using the - * three names together. - * - * A RPC function implemented by one process must publish it first before other - * process can make a RPC call. Otherwise, the caller will be blocked until - * the RPC call is published. - * - * @param [in] ownerName The name of this member process that implements the Call. - * @param [in] callName The name of the function that this member offers as RPC-Call. - * @param [in] handler The function that can be called by (ownerName, callName) - * @param [in] ctx Local context to passed in when the function is called. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_RegisterCall(const char *ownerName, const char *callName, IARM_Call_t handler, void *ctx); - -/** - * @brief Make a RPC call - * - * Invoke the RPC function by specifying its names. This call will block until - * the specified RPC function is published. - * - * @param [in] ownerName The name of member process implementing the RPC call. - * @param [in] funcName The name of the function to call. - * @param [in] arg Supply the argument to be used by the RPC call. - * @param [out] ret Returns the return value of the RPC call. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_Call(const char *ownerName, const char *funcName, void *arg, int *ret); - -/** - * @brief Make a RPC call with Timeout - * - * Invoke the RPC function by specifying its names. This call will block until - * the specified RPC function is published. - * - * @param [in] ownerName The name of member process implementing the RPC call. - * @param [in] funcName The name of the function to call. - * @param [in] arg Supply the argument to be used by the RPC call. - * @param [in] timeout millisecond time interval to be used for the RPC call. - * @param [out] ret Returns the return value of the RPC call. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_CallWithTimeout(const char *ownerName, const char *funcName, void *arg, int timeout, int *ret); - -/** - * @brief Check whether a RPC call is registered or not. - * - * RPC calls should be registered so that other processes can call. - * - * @param [in] ownerName The name of owner process implementing the RPC call. - * @param [in] callName The name of the function to be checked. - * @param [out] isRegistered returns the status whether the RPC call is registered. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_IsCallRegistered(const char *ownerName, const char *callName, int *isRegistered); - -#if 1 -/** - * @brief Explicitly mark the return/finish of a RPC-Call - * - * This API must be called by the implementation of the RPC-Call to submit the return value to the caller. - * Otherwise the caller will be blocked forever waiting for the return value. - * - * This API does not need to be called at the end of the RPC invokation. It can be called anytime by anybody - * after the RPC call is requested, to unblocked the caller. - * - * @param [in] ownerName The name of owner process implementing the RPC call. - * @param [in] funcName The name of the function to call. - * @param [in] ret return value of the executed RPC-Call. - * @param [in] callMsg must match the "serial" passed in when the RPC implementation is executed. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_CallReturn(const char *ownerName, const char *funcName, void *arg, int ret, void *callMsg); - -#else -/** - * @brief Explicitly mark the return/finish of a RPC-Call - * - * This API must be called by the implementation of the RPC-Call to submit the return value to the caller. - * Otherwise the caller will be blocked forever waiting for the return value. - * - * This API does not need to be called at the end of the RPC invokation. It can be called anytime by anybody - * after the RPC call is requested, to unblocked the caller. - * - * @param [in] ownerName The name of owner process implementing the RPC call. - * @param [in] funcName The name of the function to call. - * @param [in] ret return value of the executed RPC-Call. - * @param [in] serial a number that must match the "serial" passed in when the RPC implementation is executed. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ - -IARM_Result_t IARM_CallReturn(const char *ownerName, const char *funcName, int ret, int serial); -#endif -/** - * @brief Register a event that can be listened to by other processes. - * - * All events published within a process group are uniquely identified by an eventId. - * A process uses this API to publish an event so this event can be listened by - * other processes. - * - * An event must be published before it can be "notified" - * - * @param [in] ownerName The name of the member process that owns the event. - * @param [in] eventId The ID of the event. This ID is unique across all processes. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_RegisterEvent(const char *ownerName, IARM_EventId_t eventId); - -/** - * @brief Notify listeners of event - * - * This API is used to notify all listeners of a certain event. - * - * @param [in] ownerName The name of the member process that owns the event. - * @param [in] eventId The ID of the event. - * @param [in] arg Argument to be passed to the listeners. Note that this arg must be allocated from shared memory - * via IARM_Malloc(IARM_MEMTYPE_PROCESSSHARE). IARM Module will free this memor once all listeners are - * notified. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_NotifyEvent(const char *ownerName, IARM_EventId_t eventId, void *arg); - -/** - * @brief Register to listen for an event. - * - * This API is used to register the calling process for a certain event. - * If the event is not yet published, this call be be blocked until the event - * is published. - * - * @param [in] ownerName The name of the member process that owns the event. - * @param [in] eventId The ID of the event. - * @param [in] listener Callback function when the event is received. - * @param [in] ctx Local context used when calling the listener's callback function. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_RegisterListner(const char *ownerName, IARM_EventId_t eventId, IARM_Listener_t listener, void *ctx); - -/** - * @brief UnRegister to listen for an event. - * - * This API is used to unregister the calling process for a certain event. - * - * @param [in] ownerName The name of the member process that owns the event. - * @param [in] eventId The ID of the event. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_UnRegisterListner(const char *ownerName, IARM_EventId_t eventId); - -/** - * @brief Terminate the IARM module for the calling process. - * - * This API is used to terminate the IARM module for the calling process, and cleanup resources - * used by MAF. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_Term(void); - -#ifdef __cplusplus -} -#endif -#endif - -/* End of IARM_BUS_IARM_CORE_API doxygen group */ -/** - * @} - */ diff --git a/mocks/libIBus.h b/mocks/libIBus.h deleted file mode 100644 index 9b72b22..0000000 --- a/mocks/libIBus.h +++ /dev/null @@ -1,362 +0,0 @@ - -/* - * 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. -*/ - -/** -* @file libIBus.h -* -* @brief RDK IARM-Bus API Declarations. -* -* @defgroup IARMBUS_API IARM Bus API -* @ingroup IARMBUS -* Application should use the APIs declared in this file to access -* services provided by IARM-Bus. Basically services provided by -* these APIs include: -*
1) Library Initialization and termination. -*
2) Connection to IARM-Bus. -*
3) Send and Receive Events. -*
4) Declared and Invoke RPC Methods. -* -* @par Document -* Document reference. -* -* @par Open Issues (in no particular order) -* -# None -* -* @par Assumptions -* -# None -* -* @par Abbreviations -* - BE: ig-Endian. -* - cb: allback function (suffix). -* - DS: Device Settings. -* - FPD: Front-Panel Display. -* - HAL: Hardware Abstraction Layer. -* - LE: Little-Endian. -* - LS: Least Significant. -* - MBZ: Must be zero. -* - MS: Most Significant. -* - RDK: Reference Design Kit. -* - _t: Type (suffix). -* -* @par Implementation Notes -* -# None -* -*/ - -/** @defgroup IARMBUS IARM Bus -* -* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows -* applications to communicate with each other by sending Events or invoking Remote -* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is -* independent of the operating system or the underlying IPC mechanism. -* -* Two applications connected to the same instance of IARM-Bus are able to exchange events -* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If -* desired, it is possible to have multiple IARM-Bus instances. However, applications -* connected to different buses will not be able to communicate with each other. -* -* @par Capabilities -*
    -*
  1. Invoke methods in other processes via Remote Procedure Call (RPC). -*
  2. Send interprocess messages. -*
  3. Manage shared memory and exclusive access to resources. -*
  4. Register for event notification. -*
  5. Publish event notification to registered listeners. -*
-*/ - -#ifndef _LIB_IARM_BUS_H -#define _LIB_IARM_BUS_H - - - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include "libIARM.h" - -/** - * @brief Function signature for RPC Methods. - * - * All IARM RPC Methods must use IARM_BusCall_t as their function signature. - * Important Note: The argument structure cannot have pointers. The sizeof() operator applied - * on the @p arg must equal to the actual memory allocated. Internally an equivalent of - * memcpy() is used to dispatch parameters its target. If a pointer is used in the parameters, - * the pointer, not the content it points to, is sent to the destination. - * - * @param arg is the composite carrying all input and output parameters of the RPC Method. - * - */ -typedef IARM_Result_t (*IARM_BusCall_t) (void *arg); -/** - * @brief Function signature for event handlers. - * - * All IARM Event handlers must use IARM_EventHandler_t as their function signature. - * Important Note: The event data structure cannot have pointers. The sizeof() operator applied - * on the @p data must equal to the actual memory allocated. Internally an equivalent of - * memcpy() is used to dispatch event data to its target. If a pointer is used in the event data, - * the pointer, not the content it points to, is sent to the destination. - * - * @param owner is well-known name of the application sending the event. - * @param eventID is the integer uniquely identifying the event within the sending application. - * @param data is the composite carrying all input and output parameters of event. - * @param len is the result of sizeof() applied on the event data data structure. - * - * @return None - */ -typedef void (*IARM_EventHandler_t)(const char *owner, IARM_EventId_t eventId, void *data, size_t len); - -/** - * @addtogroup IARMBUS_API - * @{ - */ - -/** - * @brief This API is used to initialize the IARM-Bus library. - * - * The registered IARM client is uniquely identified by the given name in the IARM_Bus_Init() function. - * The application is not yet connected to the bus until IARM_Bus_Connect() is called. - * - * After the library is initialized, the application is ready to access events and RPC methods - * using the bus. - * - * @param[in] name A well-known name of the IARM client. The registered IARM client - * should be uniquely identified by (groupName, memberName) - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates the call was unsuccessful because the bus is - * already initialised and connected. - */ -IARM_Result_t IARM_Bus_Init(const char *name); - -/** - * @brief This API is used to terminate the IARM-Bus library. - * - * This function releases resources allocated by the IARM Bus Library. After it is called, - * the library returns to the state prior to IARM_Bus_Init function is called. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates the call was unsuccessful because the bus is - * not initialised. - */ -IARM_Result_t IARM_Bus_Term(void); - -/** - * @brief This API is used to connect application to the IARM bus daemon. - * After connected, the application can send/receive IARM events and invoke IARM RPC calls. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_STATE Indicates the call was unsuccessful. - */ -IARM_Result_t IARM_Bus_Connect(void); - -/** - * @brief This API disconnect Application from IARM Bus so the application will not receive - * any IARM event or RPC calls. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_STATE Indicates the call was unsuccessful. - */ -IARM_Result_t IARM_Bus_Disconnect(void); - -/** - * @brief Returns group context of the calling member - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_Bus_GetContext(void **context); - -/** - * @brief This API is used to publish an Asynchronous event to all IARM client registered for this - * perticular event. Upon returns of this function, all the listeners are notified of the event. - * - * @param[in] ownerName The IARM client that publishes/owns the broadcast event. - * @param[in] eventId The event id to publish. - * @param[in] data Data carried by this event. - * @param[in] len Length of the data parameter. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_STATE Indicates the call was unsuccessful because the bus is either - * not initialised nor connected. - * @retval IARM_RESULT_INVALID_PARAM Indicates invalid parameter. - */ -IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *data, size_t len); - -/** - * @brief This API is used to check if the current process is registered with IARM. - * - * @param[in] memberName IARMBUS member whose registration status has to be checked. - * @param[out] isRegistered True if the specified process is still registered. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter. - * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. - */ -IARM_Result_t IARM_Bus_IsConnected(const char *memberName, int *isRegistered); - -/** - * @brief This API register to listen to event and provide the callback function for event notification. - * Execution of the handler will not block the process sending the event. - * - * The API checks for duplicate handlers so a same handler for same event and owner name will not be registered twice - * NULL handler is not allowed. - * - * @param[in] ownerName The well-known name of the IARM client. - * @param[in] eventId The event to listen for. - * @param[in] handler The hander function to be called for event notification. - * - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameters. - * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus is either not initialised nor connected. - * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. - * @retval IARM_RESULT_OOM Indicates memory allocation failure. - * @see IARM_Bus_BroadcastEvent() - * @see IARM_EventHandler_t - */ -IARM_Result_t IARM_Bus_RegisterEventHandler(const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler); - -/** - * @brief This API is used to Remove ALL handlers registered for the given event. - * This API remove the all the event handlers. This API is not used to unregister a specific handler.. - - * @param[in] eventId The event whose listener to be removed. - * @param[in] ownerName The well-known name of the application. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter was passed. - * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus is either not initialised nor connected. - * @retval IARM_RESULT_IPCCORE_FAIL Indicates underlying IPC failure. - * @retval IARM_RESULT_OOM Indicates memory allocation failure. - */ -IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char *ownerName, IARM_EventId_t eventId); - -/** - * @brief Remove specific handler registered for the given event. - * - * This API remove the specific handlers. - * @param[in] ownerName The well-known name of the application. - * @param [in] eventId The event whose listener to remove. - * @param [in] handler The event handler to remove. - * - * @return IARM_Result_t Error Code. - */ -IARM_Result_t IARM_Bus_RemoveEventHandler(const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler); - - - -/** - * @brief This API is used to register an RPC method that can be invoked by other applications. - * - * The parameter methodName is the string name used to invoke the RPC method and the parameter handler - * is the implementation of the RPC method. When other application invokes the method via its string name, - * the function pointed to by the handler is executed. - * - * @param[in] methodName The name used to invoke the RPC method. - * @param[in] handler A pointer to RPC method implementation. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates invalid parameter. - * @retval IARM_RESULT_INVALID_STATE Indicates IARM_Bus is either not initialised nor connected. - * @retval IARM_RESULT_OOM Indicates memory allocation failure. - */ -IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler); - -/** - * @brief This API is used to Invoke RPC method by its application name and method name. - * - * @param[in] ownerName well-known name of the application that publish the RPC call. - * @param[in] methodName well-known name of the RPC method. - * @param[in] arg It is the data structure holding input & output parameters of the invocation. - * @param[in] argLen The size of the data pointed by arg parameter. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter. - * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus was either not initialised nor connected. - * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. - * @retval IARM_RESULT_OOM Indicates failure to allocate memory. - */ -IARM_Result_t IARM_Bus_Call(const char *ownerName, const char *methodName, void *arg, size_t argLen); - -/** - * @brief This API is used to Invoke RPC method by its application name and method - * name with specified timeout to wait for response. - * - * @param[in] ownerName well-known name of the application that publish the RPC call. - * @param[in] methodName well-known name of the RPC method. - * @param[in] arg It is the data structure holding input & output parameters of the invocation. - * @param[in] argLen The size of the data pointed by arg parameter. - * @param[in] timeout in millisecond for the RPC method. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_PARAM Indicates invalid input parameter. - * @retval IARM_RESULT_INVALID_STATE Indicates the IARM_Bus was either not initialised nor connected. - * @retval IARM_RESULT_IPCCORE_FAIL Indicates failure of the underlying IPC. - * @retval IARM_RESULT_OOM Indicates failure to allocate memory. - */ -IARM_Result_t IARM_Bus_Call_with_IPCTimeout(const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout); - -/** - * @brief This API is used to register all the events that are published by the application. - * - * An application can publish multiple events and these events must have an enumeration value - * defined in the public header file of the HAL. - * It registers all events whose enum value is less than maxEventId. - * - * @param[in] maxEventId The maximum number of events that can be registered. - * - * @return Error Code. - * @retval IARM_RESULT_SUCCESS Indicates the call was successful. - * @retval IARM_RESULT_INVALID_STATE Indicates the IARM Bus is either not initialised nor connected. - */ -IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId); - -/** - * @brief Write PID file - * - * This API allows Daemon to write PID file - * - * @param full pathname to pidfile to write - */ -void IARM_Bus_WritePIDFile(const char *path); - - -/* End of IARM_BUS_IARM_CORE_API doxygen group */ -/** - * @} - */ - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mocks/libIBusDaemon.h b/mocks/libIBusDaemon.h deleted file mode 100644 index d711773..0000000 --- a/mocks/libIBusDaemon.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - * 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. -*/ - -/** -* @file libIBusDaemon.h -* -* @brief IARM-Bus Daemon API -* -* This API defines the public operations for IARM bus Daemon. -* -* @par Document -* Document reference. -* -* @par Open Issues (in no particular order) -* -# None -* -* @par Assumptions -* -# None -* -* @par Abbreviations -* - BE: ig-Endian. -* - cb: allback function (suffix). -* - DS: Device Settings. -* - FPD: Front-Panel Display. -* - HAL: Hardware Abstraction Layer. -* - LE: Little-Endian. -* - LS: Least Significant. -* - MBZ: Must be zero. -* - MS: Most Significant. -* - RDK: Reference Design Kit. -* - _t: Type (suffix). -* -* @par Implementation Notes -* -# None -* -*/ - -/** @defgroup IARM_BUS IARM-Bus Daemon -* @ingroup IARM_RDK -* -* -*/ - -/** @addtogroup IARM_BUS_DAEMON_API IARM-BUS Daemon API. -* @ingroup IARM_BUS -* -* Described herein are the IARM Bus daemon types and functions. -* This includes -*
1) Calls and data structures for requesting and releasing resources through IARM -*
2) PreChange calls for power and resolution changes, which needs -* to be implemented by members if it requires some action to be done -* before these changes. -* -* -* @{ -*/ - -#ifndef _IARM_BUS_DAEMON_H -#define _IARM_BUS_DAEMON_H - - -#ifdef __cplusplus -extern "C" -{ -#endif -#define IARM_BUS_DAEMON_NAME "Daemon" /*!< IARM bus name for Daemon */ - -/*! Daemon events enumeration */ -typedef enum _IARM_Bus_Daemon_EventId_t { - IARM_BUS_EVENT_RESOURCEAVAILABLE, /*!< Resource available event */ - IARM_BUS_EVENT_RESOLUTIONCHANGE, /*!< Resolution change event */ - IARM_BUS_SIGNAL_MAX, /*!< Maximum value for IARM daemon event */ -} IARM_Bus_EventId_t; - -/*! Type of resources acknowledge through on Resource available event */ -typedef enum _IARM_Bus_Daemon_ResrcType_t { - IARM_BUS_RESOURCE_FOCUS = 0, - IARM_BUS_RESOURCE_DECODER_0, - IARM_BUS_RESOURCE_DECODER_1, - IARM_BUS_RESOURCE_PLANE_0, - IARM_BUS_RESOURCE_PLANE_1, - IARM_BUS_RESOURCE_POWER, - IARM_BUS_RESOURCE_RESOLUTION, - - IARM_BUS_RESOURCE_MAX -} IARM_Bus_ResrcType_t; - -/*! Data assosiated with Resolution change */ -typedef struct _IARM_Bus_ResolutionChange_EventData_t{ - - int width; /*!< new width after resoution change */ - int height; /*!< new height after resoution change */ - -} IARM_Bus_ResolutionChange_EventData_t; - -/*! Union of IARM Bus event, data could be resource type - * or new resolution based on the event type*/ -typedef union _IARM_Bus_EventData_t { - IARM_Bus_ResrcType_t resrcType; /*!< Resource type, which will be valid if event is resource available*/ - IARM_Bus_ResolutionChange_EventData_t resolution; /*!< New resolution, which will be valid if event is resolution change*/ - -} IARM_Bus_EventData_t; - -/*! Data associated with Resolution Post-Change call*/ -typedef struct _IARM_Bus_CommonAPI_ResChange_Param_t{ - int width; /*!< Current resolution width */ - int height; /*!< Current resolution height */ -}IARM_Bus_CommonAPI_ResChange_Param_t; - -/*! Possible power states */ -typedef enum _IARM_Bus_Daemon_PowerState_t { - IARM_BUS_PWRMGR_POWERSTATE_OFF, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state OFF */ - IARM_BUS_PWRMGR_POWERSTATE_STANDBY, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state STANDBY */ - IARM_BUS_PWRMGR_POWERSTATE_ON, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state ON */ - IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP, /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state set/get */ - IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP /*!< Used for both IARM Bus Daemon Power pre change and Power manager Power state set/get */ -} IARM_Bus_PowerState_t; - -typedef IARM_Bus_PowerState_t IARM_Bus_PWRMgr_PowerState_t; - -/*! Data associated with Power Pre-Change call*/ -typedef struct _IARM_Bus_CommonAPI_PowerPreChange_Param_t{ - IARM_Bus_PWRMgr_PowerState_t newState; /*!< New power state*/ - IARM_Bus_PWRMgr_PowerState_t curState; /*!< Current power state*/ -} IARM_Bus_CommonAPI_PowerPreChange_Param_t; - - -typedef struct _IARM_Bus_PowerPreChange_Param_t{ - IARM_Bus_PWRMgr_PowerState_t newState; /*!< New power state*/ - IARM_Bus_PWRMgr_PowerState_t curState; /*!< Current power state*/ - char owner[IARM_MAX_NAME_LEN]; -} IARM_Bus_PowerPreChange_Param_t; - -/*! Data associated with Release ownership call*/ -typedef struct _IARM_Bus_CommonAPI_ReleaseOwnership_Param_t { - IARM_Bus_ResrcType_t resrcType; /*!< Type of resource to be freed*/ -} IARM_Bus_CommonAPI_ReleaseOwnership_Param_t; - - -/*! Type of Sys modes available*/ -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; - -/*! data associated with Sys mod-change call*/ -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; - - -/** - * @brief Request to grab resource - * - * Ask IARM Daemon to grant resoruce. Upon the success return, the resource is - * available to use. - * - * @param [in] resrcType: Resource type. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_BusDaemon_RequestOwnership(IARM_Bus_ResrcType_t resrcType); - -/** - * @brief Notify IARM Daemon that the resource is released. - * - * Upon success return, this client is no longer the owner of the resource. - * A resource free event will be broadcasted and some other client intereseted in - * freed resource can request the resource now. - * - * @param [in] resrcType: Resource type. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_BusDaemon_ReleaseOwnership(IARM_Bus_ResrcType_t resrcType); - -/** - * @brief Send power pre change command - * - * Command is broadcasted before power change and all those modules implementing - * power prechange function will be called. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_BusDaemon_PowerPrechange(IARM_Bus_CommonAPI_PowerPreChange_Param_t preChangeParam); - -/** - * @brief Send resolution pre change command - * - * Command is broadcasted before resolution change and all those modules implementing - * resolution prechange function will be called. - * - * @param [in] preChangeParam: height, width etc. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_BusDaemon_ResolutionPrechange(IARM_Bus_CommonAPI_ResChange_Param_t preChangeParam); - -/** - * @brief Send resolution post change command - * - * Command is broadcasted after resolution change and all those modules implementing - * resolution postchange handler will be called. - * - * @param [in] postChangeParam: height, width etc. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_BusDaemon_ResolutionPostchange(IARM_Bus_CommonAPI_ResChange_Param_t postChangeParam); - - -/** - * @brief Send Deep Sleep Wakeup command - * - * Command is broadcasted to Deep sleep Manager for wakeup from deep sleep. - * - * @return IARM_Result_t Error Code. - * @retval IARM_RESULT_SUCCESS on success - */ -IARM_Result_t IARM_BusDaemon_DeepSleepWakeup(IARM_Bus_CommonAPI_PowerPreChange_Param_t preChangeParam); - - - -#define IARM_BUS_COMMON_API_ReleaseOwnership "ReleaseOwnership" /*!< This method shall be implemented by all member requests for resources*/ - - -#define IARM_BUS_COMMON_API_PowerPreChange "PowerPreChange" /*!< This method if implemented by a member, will be called before a power change event*/ - -#define IARM_BUS_COMMON_API_DeepSleepWakeup "DeepSleepWakeup" /*!< This method if implemented by a member, will be called to wakeup from Deep Sleep */ - - -#define IARM_BUS_COMMON_API_ResolutionPreChange "ResolutionPreChange" /*!< This method if implemented by a member, will be called before a resolution change*/ - -#define IARM_BUS_COMMON_API_ResolutionPostChange "ResolutionPostChange" /*!< This method if implemented by a member, will be called after a resolution change*/ - - -#define IARM_BUS_COMMON_API_SysModeChange "SysModeChange" /*!< This method if implemented by a member, will be called on a Sys mode change*/ - -#ifdef __cplusplus -} -#endif -#endif - -/* End of IARM_BUS_DAEMON_API doxygen group */ -/** - * @} - */ diff --git a/mocks/mfrApi.h b/mocks/mfrApi.h deleted file mode 100644 index 9136c42..0000000 --- a/mocks/mfrApi.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * 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. -*/ - - - -/** -* @defgroup iarmmgrs -* @{ -* @defgroup mfr -* @{ -**/ - - -#ifndef __MFR_API_H__ -#define __MFR_API_H__ -/*-----------------------------------------------------------------*/ -/*------------------------------------------------------------------- - Include Files --------------------------------------------------------------------*/ -#include "mfrTypes.h" -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned long VL_MFR_DEVICE_HANDLE_t; - -typedef enum _VL_MFR_API_RESULT -{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. - VL_MFR_API_RESULT_SUCCESS = 0, - VL_MFR_API_RESULT_FAILED = 1, - VL_MFR_API_RESULT_NOT_EXISTING = 6, - VL_MFR_API_RESULT_NULL_PARAM = 7, - VL_MFR_API_RESULT_OUT_OF_RANGE = 9, - VL_MFR_API_RESULT_OPEN_FAILED = 10, - VL_MFR_API_RESULT_READ_FAILED = 11, - VL_MFR_API_RESULT_WRITE_FAILED = 12, - VL_MFR_API_RESULT_MALLOC_FAILED = 13, - VL_MFR_API_RESULT_DECRYPTION_FAILED = 15, - VL_MFR_API_RESULT_NULL_KEY = 16, - VL_MFR_API_RESULT_INVALID_KEY_LENGTH = 17, - VL_MFR_API_RESULT_INVALID_BUFFER_LENGTH = 18, - VL_MFR_API_RESULT_SIZE_MISMATCH = 19, - -}VL_MFR_API_RESULT; - - -typedef enum _VL_PLATFORM_VERSION_TYPE -{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. - VL_PLATFORM_VERSION_TYPE_BOARD_VERSION = 0, - VL_PLATFORM_VERSION_TYPE_BOARD_SERIAL_NO = 1, - VL_PLATFORM_VERSION_TYPE_CM_CHIP_VERSION = 2, - VL_PLATFORM_VERSION_TYPE_DECODER_SW_VERSION = 7, - VL_PLATFORM_VERSION_TYPE_OS_KERNEL_VERSION = 8, - VL_PLATFORM_VERSION_TYPE_MFR_LIB_VERSION = 11, - VL_PLATFORM_VERSION_TYPE_FRONT_PANEL_VERSION = 12, - VL_PLATFORM_VERSION_TYPE_SOFTWARE_IMAGE_VERSION = 14, - VL_PLATFORM_VERSION_TYPE_OCHD_VERSION = 16, - VL_PLATFORM_VERSION_TYPE_OCAP_VERSION = 18, - VL_PLATFORM_VERSION_TYPE_BOOT_ROM_VERSION = 20, - VL_PLATFORM_VERSION_TYPE_MODEL_NUMBER = 22, - VL_PLATFORM_VERSION_TYPE_MODEL_SERIAL_NO = 23, - VL_PLATFORM_VERSION_TYPE_VENDOR_NAME = 24, - VL_PLATFORM_VERSION_TYPE_VENDOR_SERIAL_NO = 25, - VL_PLATFORM_VERSION_TYPE_MANUFACTURE_DATE = 26, -} VL_PLATFORM_VERSION_TYPE; - - -typedef enum _VL_NORMAL_NVRAM_DATA_TYPE -{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. - - VL_NORMAL_NVRAM_DATA_BOOT_IMAGE_NAME = 0x70000001,// max: 256 bytes : typically 128 bytes : name of current monolithic image - VL_NORMAL_NVRAM_DATA_BOOT_FIRMWARE_IMAGE_NAME = 0x70000010,// max: 256 bytes : typically 128 bytes : name of current firmware image name - VL_NORMAL_NVRAM_DATA_BOOT_APPLICATION_IMAGE_NAME = 0x70000011,// max: 256 bytes : typically 128 bytes : name of current application image name - VL_NORMAL_NVRAM_DATA_BOOT_DATA_IMAGE_NAME = 0x70000012,// max: 256 bytes : typically 128 bytes : name of current data image name - - VL_NORMAL_NVRAM_DATA_CACP_AuthStatus = 0x70000100,// max: 16 bytes : typically 1 bytes : - VL_NORMAL_NVRAM_DATA_CACP_HostId = 0x70000101,// max: 16 bytes : typically 5 bytes : - VL_NORMAL_NVRAM_DATA_COM_DWNLD_CO_SIGN_NAME = 0x70000211,// max: 256 bytes : typically 128 bytes : Co-Signer Name of the device - VL_NORMAL_NVRAM_DATA_COM_DWNL_VEN_ID = 0x70000212,// max: 16 bytes : typically 3 bytes : Vendor Id of the device which - VL_NORMAL_NVRAM_DATA_COM_DWNL_HW_ID = 0x70000213,// max: 16 bytes : typically 4 bytes : Hardware ID of the dvice which - //VL_NORMAL_NVRAM_DATA_COM_DWNL_CODE_FILE_NAME = 0x70000214,// max: 256 bytes : typically 128 bytes : Current running Code file name of the device, identical to VL_NORMAL_NVRAM_DATA_BOOT_IMAGE_NAME, (not used) - VL_NORMAL_NVRAM_DATA_COM_DWNL_MFR_CODE_ACC_STR_TIME = 0x70000215,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_COM_DWNL_CO_SIGN_CODE_ACC_STR_TIME = 0x70000216,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_COM_DWNL_MFR_CVC_ACC_STR_TIME = 0x70000217,// max: 32 bytes : typically 12 bytes : Manufacturer CVC Access Start Time Register - VL_NORMAL_NVRAM_DATA_COM_DWNL_CO_SIGN_CVC_ACC_STR_TIME = 0x70000218,// max: 32 bytes : typically 12 bytes : Co-Signer CVC Start Time Register - VL_NORMAL_NVRAM_DATA_COM_DWNLD_MGR_STATUS = 0x70000219,// max: 16 bytes : typically 4 bytes : This is the code image down load status maintained by the Common Download Manager - VL_NORMAL_NVRAM_DATA_CDL_MFR_CODE_ACC_UPG_STR_TIME = 0x7000021C,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x7000021D,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - - VL_NORMAL_NVRAM_DATA_CDL_FW_MFR_CODE_ACC_UPG_STR_TIME = 0x70000300,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_FW_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x70000301,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_APP_MFR_CODE_ACC_UPG_STR_TIME = 0x70000302,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_APP_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x70000303,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_DATA_MFR_CODE_ACC_UPG_STR_TIME = 0x70000304,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_DATA_CO_SIGN_CODE_ACC_UPG_STR_TIME = 0x70000305,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - - VL_NORMAL_NVRAM_DATA_CDL_FW_MFR_CODE_ACC_BOOT_STR_TIME = 0x70000320,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_FW_CO_SIGN_CODE_ACC_BOOT_STR_TIME = 0x70000321,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_APP_MFR_CODE_ACC_BOOT_STR_TIME = 0x70000322,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_APP_CO_SIGN_CODE_ACC_BOOT_STR_TIME = 0x70000323,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_DATA_MFR_CODE_ACC_BOOT_STR_TIME = 0x70000324,// max: 32 bytes : typically 12 bytes : Manufacturer Code Access Start Time Register - VL_NORMAL_NVRAM_DATA_CDL_DATA_CO_SIGN_CODE_ACC_BOOT_STR_TIME= 0x70000325,// max: 32 bytes : typically 12 bytes : Co-Signer Code Access Start Time Register - - VL_NORMAL_NVRAM_DATA_IEEE1394_DTCP_KEY_TYPE = 0x70000500,// max: 16 bytes : typically 1 bytes : DTCP key type - VL_NORMAL_NVRAM_DATA_IEEE1394_DTCP_KEY_STATUS = 0x70000501,// max: 16 bytes : typically 1 bytes : DTCP key status - -}VL_NORMAL_NVRAM_DATA_TYPE; - - - -typedef enum _VL_SECURE_NVRAM_DATA_TYPE -{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. - // Certificates and Keys for Cable Card Conditional Access and Copy Protection - VL_SECURE_NVRAM_DATA_CACP_HOST_ROOT_CERT = 0x100,// max: 2048 bytes : typically 1024 bytes : Cable Labs Root certificate - VL_SECURE_NVRAM_DATA_CACP_HOST_MFR_CA_CERT = 0x101,// max: 2048 bytes : typically 1024 bytes : Cable Labs Manufacturer CA Certificate - VL_SECURE_NVRAM_DATA_CACP_HOST_DEV_CERT = 0x102,// max: 2048 bytes : typically 1024 bytes : Host Device Certificate - VL_SECURE_NVRAM_DATA_CACP_HOST_DEV_PRIVATE_KEY = 0x103,// max: 2048 bytes : typically 1024 bytes : Host Device Private Key - VL_SECURE_NVRAM_DATA_CACP_DH_B_G1 = 0x104,// max: 256 bytes : typically 128 bytes : Diffie-Hellman base ( g ) - VL_SECURE_NVRAM_DATA_CACP_DH_P_N1 = 0x105,// max: 256 bytes : typically 128 bytes : Diffie-Hellman prime ( n ) - VL_SECURE_NVRAM_DATA_CACP_DHKey = 0x106,// max: 256 bytes : typically 128 bytes : - VL_SECURE_NVRAM_DATA_CACP_AuthKeyH = 0x107,// max: 64 bytes : typically 20 bytes : - //Cable Labs Code Verification Certificates for Common Download - VL_SECURE_NVRAM_DATA_COM_DWNLD_CL_CODE_VER_ROOT_CA = 0x200,// max: 2048 bytes : typically 1024 bytes : Cable Labs Code Verification Root CA - VL_SECURE_NVRAM_DATA_COM_DWNLD_CL_CVC_CA = 0x201,// max: 2048 bytes : typically 1024 bytes : Cable Labs CVC CA - VL_SECURE_NVRAM_DATA_COM_DWNLD_MFR_CVC = 0x202,// max: 2048 bytes : typically 1024 bytes : Manufacturer CVC - - //Common Download ( code image download NV data) - VL_SECURE_NVRAM_DATA_COM_DWNLD_CVC_CA_PUB_KEY = 0x219,// max: 2048 bytes : typically 1024 bytes : CVC CA public Key stored by the host device - - //Cable Labs Application Code verification Certificates - //VL_SECURE_NVRAM_DATA_COM_DWNLD_CL_CODE_VER_ROOT_CA = 0x300,// max: 2048 bytes : typically 1024 bytes : Cable Labs Code Verification Root CA same as above 0x100 - VL_SECURE_NVRAM_DATA_APP_CL_APP_CVC_CA = 0x301,// max: 2048 bytes : typically 1024 bytes : Cable Labs Application CVC CA - VL_SECURE_NVRAM_DATA_APP_MAN_CVC = 0x302,// max: 2048 bytes : typically 1024 bytes : Cable Labs Application Manufacturer CVCs - - VL_SECURE_NVRAM_DATA_SERIAL_NUMBER = 0x400,// max: 32 bytes : typically 16 bytes : - - //Ieee1394 DTCP certificates and Keys - VL_SECURE_NVRAM_DATA_IEEE1394_DTCP_CERT_KEYS = 0x500,// max: 2048 bytes : typically 1024 bytes : DTCP keys for 1394 CP - VL_SECURE_NVRAM_DATA_IEEE1394_DTCP_SRM = 0x501,// max: 4096 bytes : typically 1024 bytes : DTCP SRM - VL_SECURE_NVRAM_DATA_IEEE1394_DTCP_SEED = 0x502,// max: 64 bytes : typically 24 bytes : DTCP SEED - - // VL certificates and Keys - VL_SECURE_NVRAM_DATA_VL_CERT_KEYS = 0x600,// max: 1024 bytes : typically 512 bytes : VividLogic certificates - -}VL_SECURE_NVRAM_DATA_TYPE; - - -typedef enum _VL_STACK_2_MFR_EVENT_TYPE -{ // ENUM additions are allowed. Insertions, deletions and value changes are not allowed. - - VL_STACK_2_MFR_EVENT_SET_UPGRADE_TO_IMAGE = 0x20000100, - VL_STACK_2_MFR_EVENT_SET_REBOOT_WITH_UPGRADED_IMAGE = 0x20000101, - VL_STACK_2_MFR_EVENT_SET_UPGRADE_IMAGE_NAME = 0x20000102, - VL_STACK_2_MFR_EVENT_SET_UPGRADE_SUCCEEDED = 0x20000103, - VL_STACK_2_MFR_EVENT_SET_UPGRADE_FAILED = 0x20000104, - - VL_STACK_2_MFR_EVENT_get_CONFIG_PATH = 0x20000200, - VL_STACK_2_MFR_EVENT_get_SNMP_ENTERPRISE_ID = 0x20000201, - - VL_STACK_2_MFR_EVENT_get_CALL_DFAST2 = 0x20000301, - - VL_STACK_2_MFR_EVENT_get_PREVIOUS_BOOT_IMAGE_NAME = 0x20000400, - VL_STACK_2_MFR_EVENT_get_CURRENT_BOOT_IMAGE_NAME = 0x20000401, - VL_STACK_2_MFR_EVENT_get_UPGRADE_IMAGE_NAME = 0x20000402, - VL_STACK_2_MFR_EVENT_get_UPGRADE_STATUS = 0x20000403, - - VL_STACK_2_MFR_EVENT_SET_CARD_TYPE = 0x20000700, - VL_STACK_2_MFR_EVENT_SET_FIRMWARE_VERSION_INFO = 0x20000701, - -} VL_STACK_2_MFR_EVENT_TYPE; - -/* -struct VL_NVRAM_DATA -nSize is the size of the data read from the NVRAM. -pData is the data buffer of the data read from the NVRAM. -*/ -typedef struct _VL_NVRAM_DATA -{ // STRUCT member additions are allowed. Insertions, deletions, datatype and name changes are not allowed. - unsigned long nActualBytes; - int nBytes; - unsigned char * pData; -}VL_NVRAM_DATA; - -int MFR_Init (void); -int MFR_Shutdown (void); - - -VL_MFR_API_RESULT HAL_MFR_get_version ( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_PLATFORM_VERSION_TYPE eVersionType, char ** ppString); - -VL_MFR_API_RESULT HAL_MFR_read_normal_nvram ( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_NORMAL_NVRAM_DATA_TYPE eType, VL_NVRAM_DATA * pNvRamData); -VL_MFR_API_RESULT HAL_MFR_write_normal_nvram( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_NORMAL_NVRAM_DATA_TYPE eType, const VL_NVRAM_DATA * pNvRamData); - -VL_MFR_API_RESULT HAL_MFR_read_secure_nvram ( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_SECURE_NVRAM_DATA_TYPE eType, VL_NVRAM_DATA * pNvRamData); -VL_MFR_API_RESULT HAL_MFR_write_secure_nvram( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_SECURE_NVRAM_DATA_TYPE eType, const VL_NVRAM_DATA * pNvRamData); - -VL_MFR_API_RESULT HAL_MFR_set_mfr_data( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_STACK_2_MFR_EVENT_TYPE eEvent, void * _pvData); -VL_MFR_API_RESULT HAL_MFR_get_mfr_data( VL_MFR_DEVICE_HANDLE_t hMFRHandle, VL_STACK_2_MFR_EVENT_TYPE eEvent, void * _pvData); -/*-----------------------------------------------------------------*/ -#ifdef __cplusplus -} -#endif -/*-----------------------------------------------------------------*/ -#endif //__MFR_API_H__ -/*-----------------------------------------------------------------*/ - - -/** @} */ -/** @} */ diff --git a/mocks/mfrMgr.h b/mocks/mfrMgr.h deleted file mode 100644 index a8edec3..0000000 --- a/mocks/mfrMgr.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 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. -*/ - -/** -* @file -* -* @brief IARM-Bus MFR Manager Public API. -* -* This API defines the operations for the IARM-Bus MFR Manager interface. -* -* @par Document -* Document reference. -* -* @par Open Issues (in no particular order) -* -# None -* -* @par Assumptions -* -# None -* -* @par Abbreviations -* - BE: ig-Endian. -* - cb: allback function (suffix). -* - DS: Device Settings. -* - FPD: Front-Panel Display. -* - HAL: Hardware Abstraction Layer. -* - LE: Little-Endian. -* - LS: Least Significant. -* - MBZ: Must be zero. -* - MS: Most Significant. -* - RDK: Reference Design Kit. -* - _t: Type (suffix). -* -* @par Implementation Notes -* -# None -* -*/ - -/** @defgroup IARM_BUS IARM-Bus HAL API -* @ingroup IARM_RDK -* -* IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows -* applications to communicate with each other by sending Events or invoking Remote -* Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is -* independent of the operating system or the underlying IPC mechanism. -* -* Two applications connected to the same instance of IARM-Bus are able to exchange events -* or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If -* desired, it is possible to have multiple IARM-Bus instances. However, applications -* connected to different buses will not be able to communicate with each other. -*/ - -/** @defgroup IARM_BUS MFR Manager MFR lib -* @ingroup IARM_RDK -* -*/ - -/** @addtogroup IARM_BUS_MFR_LIB_API IARM-MFR Manager API -* @ingroup IARM_BUS -* -* Described herein are functions and structures exposed by MFR library. -* -* @{ -*/ - - - -/** -* @defgroup iarmmgrs -* @{ -* @defgroup mfr -* @{ -**/ - - -#ifndef _MFR_MGR_H_ -#define _MFR_MGR_H_ - -#include "mfrTypes.h" -#include "mfr_wifi_types.h" -#include "mfr_wifi_api.h" - - -#define IARM_BUS_MFRLIB_NAME "MFRLib" /*!< Well-known Name for MFR libarary */ - -#define IARM_BUS_MFRLIB_API_SetBootLoaderPattern "mfrSetBootloaderPattern" /*!< Sets how the frontpanel LED(s) (and TV backlight on applicable devices) behave when running bootloader.*/ -#define IARM_BUS_MFRLIB_API_GetSecureTime "mfrGetSecureTime" /*!< method to retrive the Secure Time from TEE */ -#define IARM_BUS_MFRLIB_API_SetSecureTime "mfrSetSecureTime" /*!< Method to set Secure Time in TEE */ -#define IARM_BUS_MFRLIB_API_SetFsrFlag "mfrSetFSRflag" /*!< Method to set FSR flag in FLASH */ -#define IARM_BUS_MFRLIB_API_GetFsrFlag "mfrGetFSRflag" /*!< Method to get FSR flag from FLASH */ -#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*/ -#define IARM_BUS_MFRLIB_API_SearchCPUClockSpeeds "mfrDetemineClockSpeeds" /*!< List down all the available CPU frequencies for the device*/ -#define IARM_BUS_MFRLIB_API_SetCPUClockSpeed "mfrSetClockSpeed" /*!< Sets the CPU clock for the device*/ -#define IARM_BUS_MFRLIB_API_GetCPUClockSpeed "mfrGetClockSpeed" /*!< Gets the CPU clock for the device*/ -#define IARM_BUS_MFRLIB_API_GetSerializedData "mfrGetManufacturerData" /*!< Retrives manufacturer specific data from the box*/ -#define IARM_BUS_MFRLIB_API_SetSerializedData "mfrSetManufacturerData" /*!< Retrives manufacturer specific data from the box*/ -#define IARM_BUS_MFRLIB_API_DeletePDRI "mfrDeletePDRI" /*!< delete PDRI image from the box*/ -#define IARM_BUS_MFRLIB_API_ScrubAllBanks "scrubAllBanks" /*!< scrub all banks from the box*/ -#define IARM_BUS_MFRLIB_API_WriteImage "mfrWriteImage" /*!< Validate and Write the image into flash*/ -#define IARM_BUS_MFRLIB_API_WIFI_EraseAllData "mfrWifiEraseAllData" -#define IARM_BUS_MFRLIB_API_WIFI_Credentials "mfrWifiCredentials" -#define IARM_BUS_MFRLIB_COMMON_API_WriteImageCb "WriteImageCb" /*!< This method shall be implemented by the caller calling WriteImage*/ -#define IARM_BUS_MFRLIB_API_validate_image "mfrValidateImage" -#define IARM_BUS_MFRLIB_API_GetPreDownloadSize "mfrGetPreDownloadImageSize" -#define IARM_BUS_MFRLIB_API_MirrorImage "mfrMirrorImage" -#define IARM_BUS_MFRLIB_API_SetBlSplashScreen "mfrSetBlSplashScreen" /*!< Method to flash the BL_OSD splash screen */ -#define IARM_BUS_MFRLIB_API_ClearBlSplashScreen "mfrClearBlSplashScreen" /*!< Method to clear and use the default BL_OSD splash screen */ -/*! Data size management need to be improved */ -#define MAX_SERIALIZED_BUF 2048 -#define MAX_BUF 255 - -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_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 struct _IARM_Bus_MFRLib_ThermalSoCFreq_Param_t{ - uint32_t cpu_rate_Normal; /* !< Normal/Highest CPU clock available */ - uint32_t cpu_rate_Scaled; /* !< Next available scaled CPU clock */ - uint32_t cpu_rate_Minimal; /* !< Lowest CPU clock available */ - uint32_t cpu_clock_speed; /* !< List of available CPU clocks */ -}IARM_Bus_MFRLib_ThermalSoCFreq_Param_t; - -typedef struct _IARM_Bus_MFRLib_GetSerializedData_Param_t{ - mfrSerializedType_t type; /*!< [in] Type of data to be queried*/ - char buffer[MAX_SERIALIZED_BUF]; /*!< [out] On success, this will be pointing to a local memory location having expected data*/ - int bufLen; /*!< [out] Indicates length of buffer pointed by pBuffer */ -}IARM_Bus_MFRLib_GetSerializedData_Param_t; - -typedef struct _IARM_Bus_MFRLib_SetSerializedData_Param_t{ - mfrSerializedType_t type; /*!< [in] Type of data to be queried*/ - char buffer[MAX_SERIALIZED_BUF]; /*!< [out] On success, this will be pointing to a local memory location having expected data*/ - int bufLen; -}IARM_Bus_MFRLib_SetSerializedData_Param_t; - -typedef struct _IARM_Bus_MFRLib_WriteImage_Param_t{ - char name[MAX_BUF]; /*!< [in] the path of the image file in the STB file system. */ - char path[MAX_BUF]; /*!< [in] the filename of the image file. */ - mfrImageType_t type; /*!< [in] the type (e.g. format, signature type) of the image.*/ - char callerModuleName[MAX_BUF]; /*!< [in] Name registered IARMBus by the caller module*/ - int interval; /*!< [in] number of seconds between two callbacks */ - char cbData[MAX_BUF]; /*!< [inout] data that could be passed through this call and returned back through callback*/ -}IARM_Bus_MFRLib_WriteImage_Param_t; - -/*! Data associated with WriteImage callback call*/ -typedef struct _IARM_Bus_MFRLib_CommonAPI_WriteImageCb_Param_t{ - mfrUpgradeStatus_t status; /*! upgrade status, set by WriteImage callback*/ - char cbData[MAX_BUF]; /*! callback data, which was passed through WriteImage call*/ -} IARM_Bus_MFRLib_CommonAPI_WriteImageCb_Param_t; - -typedef enum _MfrMgr_EventId_t { - IARM_BUS_MFRMGR_EVENT_STATUS_UPDATE= 0, /*!< Event to notify status update change */ - IARM_BUS_MFRMGR_EVENT_MAX, /*!< Max event id from this module */ -} IARM_Bus_MfrMgr_EventId_t; - -typedef enum _WifiRequestType -{ - WIFI_GET_CREDENTIALS = 0, - WIFI_SET_CREDENTIALS = 1 -} WifiRequestType_t; -typedef struct _IARM_BUS_MFRLIB_API_WIFI_Credentials_Param_t{ - WIFI_DATA wifiCredentials; - WifiRequestType_t requestType; - WIFI_API_RESULT returnVal; -}IARM_BUS_MFRLIB_API_WIFI_Credentials_Param_t; - -typedef struct _IARM_Bus_MFRLib_SetBLPattern_Param_t{ - mfrBlPattern_t pattern; -} IARM_Bus_MFRLib_SetBLPattern_Param_t; - -/* Splash Screen File path as parameter for apis to set bl osd */ -typedef struct _IARM_Bus_MFRLib_SetBLSplashScreen_Param{ - char path[MAX_BUF]; -} IARM_Bus_MFRLib_SetBLSplashScreen_Param_t; - -typedef unsigned long IARM_Bus_MFRLib_SecureTime_Param; /* UTC time in seconds used as parameter for apis set/get Secure Time*/ - - -typedef bool IARM_Bus_MFRLib_FsrFlag_Param_t; /* Used to set/get the flag for fullSystem reset under the FLASH area */ - - -#endif //_MFR_MGR_H_ - - -/* End of IARM_BUS_MFR_LIB_API doxygen group */ -/** - * @} - */ - - -/** @} */ -/** @} */ diff --git a/mocks/mfrTypes.h b/mocks/mfrTypes.h deleted file mode 100644 index 55ef63e..0000000 --- a/mocks/mfrTypes.h +++ /dev/null @@ -1,651 +0,0 @@ -/* - * 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/mocks/mfr_wifi_api.h b/mocks/mfr_wifi_api.h deleted file mode 100644 index 41226b1..0000000 --- a/mocks/mfr_wifi_api.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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 - * - */ - -/** @addtogroup MFR MFR Module - * @{ - */ -/** @addtogroup MFR_HAL MFR HAL - * @{ - * @par Application API Specification - * MFR HAL provides an interface for wifi data types - */ - -/** @defgroup PLAT_MFR_WIFI_API PLAT MFR WIFI API - * @{ - */ - -/** - * @file mfr_wifi_api.h - * - * @brief Manufacturer Library WIFI Public API. - * - * This API defines the Manufacturer API for the WIFI credentials access - * - * @par Document - * Document reference. - * - * @par Open Issues (in no particular order) - * -# None - * - * @par Assumptions - * -# None - * - * @par Abbreviations - * - WIFI: Wireless Fidelity - * - * @par Implementation Notes - * -# None - * - */ - -#ifndef __MFR_WIFI_API_H__ -#define __MFR_WIFI_API_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include "mfr_wifi_types.h" - - -/** - * @brief Retrieves the saved SSID name, password, and security mode from the MFR persistence - * - * @param pData [out] : out parameter to get the saved wifi credentials. @see WIFI_DATA - * - * @return WIFI_API_RESULT - Status - * @retval WIFI_API_RESULT_SUCCESS - Success - * @retval WIFI_API_RESULT_NOT_INITIALIZED - Not initialized - * @retval WIFI_API_RESULT_OPERATION_NOT_SUPPORTED - Operation not supported - * @retval WIFI_API_RESULT_NULL_PARAM - Null param - * @retval WIFI_API_RESULT_READ_WRITE_FAILED - flash operation failed - * - * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return WIFI_API_RESULT_NOT_INITIALIZED. - * @warning This API is NOT thread safe. Caller shall handle the concurrency - * @see WIFI_SetCredentials() - * - */ -WIFI_API_RESULT WIFI_GetCredentials(WIFI_DATA *pData); - -/** - * @brief Sets wifi ssid name, password and the security mode in the MFR persistance storage - * - * @param pData [in] : Sets the ssid credentials. @see WIFI_DATA - * - * @return WIFI_API_RESULT - Status - * @retval WIFI_API_RESULT_SUCCESS - Success - * @retval WIFI_API_RESULT_NOT_INITIALIZED - Not initialized - * @retval WIFI_API_RESULT_OPERATION_NOT_SUPPORTED - Operation not supported - * @retval WIFI_API_RESULT_NULL_PARAM - Null param - * @retval WIFI_API_RESULT_INVALID_PARAM - Invalid param - * @retval WIFI_API_RESULT_READ_WRITE_FAILED - flash operation failed - * - * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return WIFI_API_RESULT_NOT_INITIALIZED. - * @warning This API is NOT thread safe. Caller shall handle the concurrency - * @see WIFI_GetCredentials() - * - */ -WIFI_API_RESULT WIFI_SetCredentials(WIFI_DATA *pData); - -/** - * @brief Clears the wifi credentials saved in the MFR persistance storage @see WIFI_DATA - * - * @return WIFI_API_RESULT - Status - * @retval WIFI_API_RESULT_SUCCESS - Success - * @retval WIFI_API_RESULT_NOT_INITIALIZED - Not initialized - * @retval WIFI_ERR_OPERATION_NOT_SUPPORTED - Operation not supported - * @retval WIFI_API_RESULT_READ_WRITE_FAILED - flash operation failed - * - * @pre mfr_init() should be called before calling this API. If this precondition is not met, the API will return WIFI_API_RESULT_NOT_INITIALIZED. - * @warning This API is NOT thread safe. Caller shall handle the concurrency - * - */ -WIFI_API_RESULT WIFI_EraseAllData (void); - - -#ifdef __cplusplus -} -#endif - -#endif // __MFR_WIFI_API_H__ - -/** @} */ // End of PLAT_MFR_WIFI_API -/** @} */ // End of MFR_HAL -/** @} */ // End of MFR Module -/** @} */ // End of HPK \ No newline at end of file diff --git a/mocks/mfr_wifi_types.h b/mocks/mfr_wifi_types.h deleted file mode 100644 index 3229aa7..0000000 --- a/mocks/mfr_wifi_types.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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 - * - */ - -/** @addtogroup MFR MFR Module - * @{ - */ -/** @addtogroup MFR_HAL MFR HAL - * @{ - * @par Application API Specification - * MFR HAL provides an interface for wifi data types - */ - -/** @defgroup PLAT_MFR_WIFI_DATA PLAT MFR WIFI DATA - * @{ - */ - -/** - * @file mfr_wifi_types.h - * - * @brief Manufacturer Library WIFI Public API - * - * This API defines the Types and definitions for WIFI data module - * - * @par Document - * Document reference. - * - * @par Open Issues (in no particular order) - * -# None - * - * @par Assumptions - * -# None - * - * @par Abbreviations - * - WIFI: Wireless Fidelity - * - SSID: Service Set Identifier - * - WEP: Wired Equivalent Privacy - * - WPA: Wi-Fi Protected Access - * - WPA2: Wi-Fi Protected Access Version 2 - * @par Implementation Notes - * -# None - * - */ - -#ifndef __MFR_WIFI_TYPES_H__ -#define __MFR_WIFI_TYPES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - - - -#define WIFI_MAX_SSID_LEN 32 //!< Maximum SSID name -#define WIFI_MAX_PASSWORD_LEN 128 //!< Maximum password length - -#define WIFI_DATA_LENGTH 512 - -/** - * @brief WIFI API return status - * - */ -typedef enum _WIFI_API_RESULT -{ - WIFI_API_RESULT_SUCCESS = 0, ///< operation is successful - WIFI_API_RESULT_FAILED, ///< Operation general error. This enum is deprecated - WIFI_API_RESULT_NULL_PARAM, ///< NULL argument is passed to the module - WIFI_API_RESULT_INVALID_PARAM, ///< Invalid argument is passed to the module - WIFI_API_RESULT_NOT_INITIALIZED, ///< module not initialized - WIFI_API_RESULT_OPERATION_NOT_SUPPORTED, ///< operation not supported in the specific platform - WIFI_API_RESULT_READ_WRITE_FAILED, ///< flash read/write failed or crc check failed - WIFI_API_RESULT_MAX ///< Out of range - required to be the last item of the enum - -} WIFI_API_RESULT; - -/** - * @brief WIFI data type - * - * @note: This order needs to correspond to whats in DRI code. - */ -typedef enum _WIFI_DATA_TYPE -{ - WIFI_DATA_UNKNOWN = 0, ///< Unknown error. This enum is deprecated - WIFI_DATA_SSID, ///< SSID type - WIFI_DATA_PASSWORD, ///< Password type - WIFI_DATA_MAX ///< Out of range - required to be the last item of the enum -} WIFI_DATA_TYPE; - -/** - * @brief WIFI credentials data struct - * - */ -typedef struct -{ - char cSSID[WIFI_MAX_SSID_LEN+1]; ///< SSID field. - char cPassword[WIFI_MAX_PASSWORD_LEN+1]; ///< password field - int iSecurityMode; ///< security mode. Platform dependent and caller is responsible to validate it -} WIFI_DATA; - -#ifdef __cplusplus -} -#endif - -#endif //__MFR_WIFI_TYPES_H__ - -/** @} */ // End of PLAT_MFR_WIFI_DATA -/** @} */ // End of MFR_HAL -/** @} */ // End of MFR Module -/** @} */ // End of HPK \ No newline at end of file diff --git a/mocks/mockInternal.cpp b/mocks/mockInternal.cpp deleted file mode 100644 index 5ce20e5..0000000 --- a/mocks/mockInternal.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/** -* If not stated otherwise in this file or this component's LICENSE -* file the following copyright and licenses apply: -* -* Copyright 2025 RDK -* -* 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 -#include -#include -#include -#include -#include "libIBus.h" -#include "libIARMCore.h" -#include "power_controller.h" - -#ifdef __cplusplus -extern "C" { -#endif - -IARM_Result_t IARM_Bus_Init(const char* name) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_Connect() -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_RegisterCall(const char* methodName, IARM_BusCall_t handler) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_Call_with_IPCTimeout(const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_Disconnect(void) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Bus_Term(void) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr) -{ - return IARM_RESULT_SUCCESS; -} - -IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc) -{ - return IARM_RESULT_SUCCESS; -} - -void PowerController_Init() -{ - -} - -void PowerController_Term() -{ - -} - -bool PowerController_IsOperational() -{ - return true; -} - -uint32_t PowerController_Connect() -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_GetPowerState(PowerController_PowerState_t* currentState, PowerController_PowerState_t* previousState) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_SetPowerState(const int keyCode, const PowerController_PowerState_t powerstate, const char* reason) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_PowerModePreChangeComplete(const uint32_t clientId, const int transactionId) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_RegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback, void* userdata) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_UnRegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_AddPowerModePreChangeClient(const char* clientName, uint32_t* clientId) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_RemovePowerModePreChangeClient(const uint32_t clientId) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -uint32_t PowerController_DelayPowerModeChangeBy(const uint32_t clientId, const int transactionId, const int delayPeriod) -{ - return POWER_CONTROLLER_ERROR_NONE; -} - -#if 0 -WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, RFC_ParamData_t *pstParamData) -{ - return WDMP_SUCCESS; -} - -rdk_Error rdk_logger_init(const char* debugConfigFile) -{ - return 0; -} - -rdk_Error rdk_logger_deinit() -{ - return 0; -} - -rdk_logger_Bool rdk_dbg_enabled(const char *module, - rdk_LogLevel level) -{ - return true; -} - -void RDK_LOG(rdk_LogLevel level, - const char *module, - const char *format, - ...) -{ - char buffer[32 * 1024]; - - std::va_list arguments; - - va_start(arguments, format); - vsnprintf(buffer, sizeof(buffer) - 1, format, arguments); - buffer[sizeof(buffer) - 1] = 0; - va_end(arguments); - - printf("%s\n", buffer); -} -#endif - -#ifdef __cplusplus -} -#endif diff --git a/mocks/sysMgr.h b/mocks/sysMgr.h deleted file mode 100644 index 87f1975..0000000 --- a/mocks/sysMgr.h +++ /dev/null @@ -1,385 +0,0 @@ -/* - * 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. -*/ - -/** -* @file sysMgr.h -* -* @brief IARM-Bus Sys Manager Public API. -*/ - -/** - * @defgroup IARMBUS_SYS_MGR Sys Manager - * @ingroup IARM_MGR - * - * Sys Manager is a IARM Manager application which maintains the state of different - * subsystem/components of RDK such as HDMI, Network, RF, Date & Time, Tuner, CA, Mfr information etc. - * It collects the State change and error codes through a common event handler. - * It publishes RPC methods for getting the system state data. - * - * @par Following event handler is registered for receiving events from different components. - * - @b IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE - * @par The Event Data contains - * @code - * IARM_Bus_SYSMgr_EventData_t *sysEventData; // The event data contains stateId, state and error. - * @endcode - * - * @par Sys Manager: Events - * - * - @b IARM_BUS_SYSMGR_EVENT_HDCP_PROFILE_UPDATE - * Event to notify HDCP Profile change: - * - * @par Sys Manager: RPC Methods - * Following RPC Methods are published: - * - * - * - @b IARM_BUS_SYSMGR_API_GetSystemStates - * @n This returns the System State data structure. - * @n Example: - * @code - * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_GetSystemStates, _GetSystemStates); - * @endcode - * - * - @b IARM_BUS_SYSMGR_API_SetHDCPProfile - * @n This Method is called to set the new HDCP Profile. - * @n Example: - * @code - * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_SetHDCPProfile,_SetHDCPProfile); - * @endcode - * - * - @b IARM_BUS_SYSMGR_API_GetHDCPProfile - * @n This Method is called to get the current HDCP Profile. - * @n Example: - * @code - * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_GetHDCPProfile,_GetHDCPProfile); - * @endcode - * - * - @b IARM_BUS_SYSMGR_API_RunScript - * @n This Method is called to run a script through Sys Manager. - * @n Example: - * @code - * IARM_Bus_RegisterCall(IARM_BUS_SYSMGR_API_RunScript, _RunScript); - * @endcode - - */ - - -/** -* @defgroup iarmmgrs -* @{ -* @defgroup sysmgr -* @{ -**/ - - - - -/** -* @defgroup iarmmgrs -* @{ -* @defgroup sysmgr -* @{ -**/ - - -#ifndef _IARM_BUS_SYSMGR_H -#define _IARM_BUS_SYSMGR_H - -#include "libIARM.h" -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -#define IARM_BUS_SYSMGR_NAME "SYSMgr" /*!< IARM BUS name for Sys manager */ - - -typedef struct _IARM_BUS_SYSMGR_GetXUPNPDeviceInfo_Param_t{ - char *pBuffer; /*!< Shared memory location having expected data*/ - int bufLength; /*!< Length of buffer */ -}IARM_Bus_SYSMGR_GetXUPNPDeviceInfo_Param_t; - - -typedef struct _IARM_BUS_SYSMGR_HDCPProfileInfo_Param_t{ - int HdcpProfile; /*!< HDCP Profile Data */ -}IARM_BUS_SYSMGR_HDCPProfileInfo_Param_t; - -typedef struct _IARM_BUS_SYSMGR_KEYCodeLoggingInfo_Param_t{ - int logStatus; /*!< HDCP Profile Data */ -}IARM_BUS_SYSMGR_KEYCodeLoggingInfo_Param_t; - -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; - -/*! Published Events from sys manager */ -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 */ - 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 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 - // requirement for RDK-19978 and IARM_BUS_SYSMGR_SYSSTATE_FIRMWARE_DWNLD - // are having some mismatches, introduced the new event - IARM_BUS_SYSMGR_SYSSTATE_USB_DETECTED, //44 - IARM_BUS_SYSMGR_SYSSTATE_LOG_UPLOAD, //45 - IARM_BUS_SYSMGR_SYSSTATE_RED_RECOV_UPDATE_STATE, //46 -}IARM_Bus_SYSMgr_SystemState_t; - - -/*! Possible Firmware Download state */ -typedef enum _SYSMgr_CARD_FWDNLDState_t -{ - IARM_BUS_SYSMGR_CARD_FWDNLD_START, - IARM_BUS_SYSMGR_CARD_FWDNLD_COMPLETE, -} IARM_Bus_SYSMGR_FWDNLDState_t; - -/*! Possible Image Download state */ -typedef enum _SYSMgr_IMAGE_FWDNLDState_t -{ - IARM_BUS_SYSMGR_IMAGE_FWDNLD_UNINITIALIZED, - IARM_BUS_SYSMGR_IMAGE_FWDNLD_DOWNLOAD_INPROGRESS, - IARM_BUS_SYSMGR_IMAGE_FWDNLD_DOWNLOAD_COMPLETE, - IARM_BUS_SYSMGR_IMAGE_FWDNLD_DOWNLOAD_FAILED, - IARM_BUS_SYSMGR_IMAGE_FWDNLD_FLASH_INPROGRESS, - IARM_BUS_SYSMGR_IMAGE_FWDNLD_FLASH_COMPLETE, - IARM_BUS_SYSMGR_IMAGE_FWDNLD_FLASH_FAILED -} IARM_Bus_SYSMGR_IMG_FWDNLDState_t; - -/*! Possible Firmware Update States (as per RDK-14100, RDK-19928)*/ -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_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; - - -/*! Event Data associated with Sys Managers */ -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; - struct _USB_DETECT { - int inserted; - char vendor[128]; - char productid[256]; - char devicename[256]; - } usbData; - - } data; -}IARM_Bus_SYSMgr_EventData_t; - -typedef struct _propertyValue -{ - int state; - int error; - char payload[128]; -} state_property; -/* - * Declare RPC API names and their arguments - */ -#define IARM_BUS_SYSMGR_API_GetSystemStates "GetSystemStates" /*!< Gets the states of the system*/ - -/* - * Declare RPC API names for HDCP Profile - */ -#define IARM_BUS_SYSMGR_API_SetHDCPProfile "SetHDCPProfile" -#define IARM_BUS_SYSMGR_API_GetHDCPProfile "GetHDCPProfile" - -/* - * Declare RPC API names for Key Code Logging Status - */ -#define IARM_BUS_SYSMGR_API_GetKeyCodeLoggingPref "GetKeyCodeLoggingPref" -#define IARM_BUS_SYSMGR_API_SetKeyCodeLoggingPref "SetKeyCodeLoggingPref" - -/*! Parameter for Setpowerstate call*/ -typedef struct _IARM_Bus_SYSMgr_GetSystemStates_Param_t { - state_property channel_map; /*!< [in] New powerstate to be set */ - 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 partnerid_changed; - state_property ip_mode; - state_property qam_ready_status; - state_property firmware_update_state; - state_property red_recov_state; -} IARM_Bus_SYSMgr_GetSystemStates_Param_t; - -#define IARM_BUS_SYSMGR_Intrusion_MaxLen 1024 - -/*! Parameter for intrusion detect call*/ -typedef struct _IARM_Bus_SYSMgr_IntrusionData_t{ - char intrusionData[ IARM_BUS_SYSMGR_Intrusion_MaxLen+1 ]; //[in] intrusion detection data -} IARM_Bus_SYSMgr_IntrusionData_t; - - -#ifdef __cplusplus -} -#endif - -#endif - -/* End of IARM_BUS_SYSMGR_API doxygen group */ -/** - * @} - */ - - - -/** @} */ -/** @} */ diff --git a/rdk_build.sh b/rdk_build.sh old mode 100755 new mode 100644 index b367e19..aa0ed68 --- a/rdk_build.sh +++ b/rdk_build.sh @@ -57,13 +57,6 @@ function usage() echo " configure, clean, build (DEFAULT), rebuild, install" } -# options may be followed by one colon to indicate they have a required argument -if ! GETOPT=$(getopt -n "build.sh" -o hvp: -l help,verbose,platform: -- "$@") -then - usage - exit 1 -fi - eval set -- "$GETOPT" while true; do @@ -79,6 +72,7 @@ done ARGS=$@ + # component-specific vars export RDK_PLATFORM_SOC=${RDK_PLATFORM_SOC-broadcom} export PLATFORM_SOC=$RDK_PLATFORM_SOC @@ -88,45 +82,12 @@ export FSROOT=${RDK_FSROOT_PATH} export TOOLCHAIN_DIR=${RDK_TOOLCHAIN_PATH} export BUILDS_DIR=$RDK_PROJECT_ROOT_PATH -function standaloneBuildClean() -{ - pd=`pwd` - CLEAN_BUILD=1 - dnames="$RDK_SCRIPTS_PATH" - for dName in $dnames - do - cd $dName - if [ -f Makefile ]; then - make distclean - fi - rm -f configure - rm -rf aclocal.m4 autom4te.cache config.log config.status libtool - rm -rf install - find . -iname "Makefile.in" -exec rm -f {} \; - find . -iname "Makefile" | xargs rm -f - ls cfg/* | grep -v "Makefile.am" | xargs rm -f - cd $pd - done - find . -iname "*.o" -exec rm -f {} \; -} # functional modules -function standaloneBuildConfigure() -{ - cd $COMBINED_ROOT/sys_mon_tools - aclocal -I cfg - libtoolize --automake - autoheader - automake --foreign --add-missing - rm -f configure - autoconf - ./configure --with-libtool-sysroot=${RDK_FSROOT_PATH} --disable-static --host=$HOST --prefix=${RDK_FSROOT_PATH}/usr/ --enable-standalonebuild - CC_PATH=$COMBINED_ROOT/sys_mon_tools - echo "CC_PATH ---> ${CC_PATH}" -} function configure() { + echo "here" true #use this function to perform any pre-build configuration } @@ -237,27 +198,7 @@ function build() export DFB_LIB=${FSROOT}/vendor/lib export OPENSOURCE_BASE=${FSROOT}/usr export CC="$CROSS_COMPILE-gcc $CFLAGS" - export CXX="$CROSS_COMPILE-g++ $CFLAGS $LDFLAGS" - elif [ $RDK_PLATFORM_SOC = "standalone" ]; then - export GLIBS='-lglib-2.0 -lz' - export IARM_PATH="`readlink -m .`" - export ROOT_INC="/usr/lib/x86_64-linux-gnu" - export GLIB_INCLUDE_PATH="/usr/include/glib-2.0" - export GLIB_CONFIG_INCLUDE_PATH="${ROOT_INC}/glib-2.0/include" - export DBUS_INCLUDE_PATH="/usr/include/dbus-1.0" - export DBUS_CONFIG_INCLUDE_PATH="${ROOT_INC}/dbus-1.0/include" - export CFLAGS+="-O2 -Wall -fPIC -I./include -I${GLIB_INCLUDE_PATH} -I${GLIB_CONFIG_INCLUDE_PATH} \ - -I${CC_PATH}/mocks \ - -I/usr/include \ - -I${DBUS_INCLUDE_PATH} \ - -I${DBUS_CONFIG_INCLUDE_PATH} \ - -I/usr/include/libsoup-2.4 \ - -I/usr/include/gssdp-1.0" - export LDFLAGS+="-Wl,-rpath, -L/usr/lib" - export OPENSOURCE_BASE=${FSROOT}/usr - export CC="$CROSS_COMPILE-gcc $CFLAGS" - export CXX="$CROSS_COMPILE-g++ $CFLAGS $LDFLAGS" - export USE_IARM_BUS="y" + export CXX="$CROSS_COMPILE-g++ $CFLAGS $LDFLAGS" fi if [ -d $IARM_PATH ]; then export USE_IARM_BUS="y" @@ -272,13 +213,6 @@ function build() } -function standaloneBuild() -{ - standaloneBuildClean - standaloneBuildConfigure - build -} - function rebuild() { clean @@ -303,9 +237,6 @@ for i in "$ARGS"; do build) HIT=true; build ;; rebuild) HIT=true; rebuild ;; install) HIT=true; install ;; - standaloneBuildClean) HIT=true; standaloneBuildClean ;; - standaloneBuildConfigure) HIT=true; standaloneBuildConfigure ;; - standalone) HIT=true; standaloneBuild ;; *) #skip unknown ;; diff --git a/stubs/iarm_stubs.cpp b/stubs/iarm_stubs.cpp new file mode 100644 index 0000000..a3ed949 --- /dev/null +++ b/stubs/iarm_stubs.cpp @@ -0,0 +1,73 @@ +#include "libIBus.h" +#include "libIARMCore.h" +#include +using namespace std; + +IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr) +{ + return IARM_RESULT_SUCCESS; +} + +int main() +{ +} + +IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Init(const char* name) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Connect() +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Term(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Disconnect(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} diff --git a/mocks/power_controller.h b/stubs/power_controller.h similarity index 100% rename from mocks/power_controller.h rename to stubs/power_controller.h diff --git a/stubs/powerctrl_stubs.cpp b/stubs/powerctrl_stubs.cpp new file mode 100644 index 0000000..df538e8 --- /dev/null +++ b/stubs/powerctrl_stubs.cpp @@ -0,0 +1,79 @@ +/* + * Copyright 2025 Comcast Cable Communications Management, LLC + * + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "power_controller.h" + +void PowerController_Init() +{ + +} + +void PowerController_Term() +{ + +} + +bool PowerController_IsOperational() +{ + return true; +} + +uint32_t PowerController_Connect() +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_GetPowerState(PowerController_PowerState_t* currentState, PowerController_PowerState_t* previousState) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_SetPowerState(const int keyCode, const PowerController_PowerState_t powerstate, const char* reason) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_PowerModePreChangeComplete(const uint32_t clientId, const int transactionId) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_RegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback, void* userdata) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_UnRegisterPowerModePreChangeCallback(PowerController_PowerModePreChangeCb callback) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_AddPowerModePreChangeClient(const char* clientName, uint32_t* clientId) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_RemovePowerModePreChangeClient(const uint32_t clientId) +{ + return POWER_CONTROLLER_ERROR_NONE; +} + +uint32_t PowerController_DelayPowerModeChangeBy(const uint32_t clientId, const int transactionId, const int delayPeriod) +{ + return POWER_CONTROLLER_ERROR_NONE; +} diff --git a/stubs/safec_lib.h b/stubs/safec_lib.h new file mode 100644 index 0000000..49924ae --- /dev/null +++ b/stubs/safec_lib.h @@ -0,0 +1,165 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 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. +*/ + +#define SAFEC_DUMMY_API 1 +#ifndef SAFEC_DUMMY_API +#include "safe_str_lib.h" +#include "safe_mem_lib.h" + +/* Macro is defined for non clobbering of the safec secure string API strcpy_s & memcpy_s function*/ +/* strcpy_s overwrites the old value and nulls the dest when encounters an error*/ +#ifndef STRCPY_S_NOCLOBBER + #define STRCPY_S_NOCLOBBER(dst,dmax,src) ((src != NULL) ? (strlen(src) < dmax ? strcpy_s(dst,dmax,src) : ESNOSPC):ESNULLP) +#endif +#define MEMCPY_S_NOCLOBBER(dst,dmax,src,len) ((src != NULL) ? (len <= dmax ? memcpy_s(dst,dmax,src,len) : ESNOSPC):ESNULLP) +#endif + +#define STRCPY_S(dest,size,source) \ + { \ + errno_t rc=-1; \ + rc=strcpy_s(dest, size, source); \ + if(rc!=EOK) \ + { \ + RDK_SAFECLIB_ERR(rc); \ + }\ +} +#define MEMCPY_S(dest,dsize,source,ssize) \ + { \ + errno_t safec_rc=-1; \ + safec_rc=memcpy_s(dest, dsize, source, ssize); \ + if(safec_rc!=EOK) \ + { \ + RDK_SAFECLIB_ERR(safec_rc); \ + }\ +} + +/* + * SAFECLIB Error Handling Logging APIs + */ +#define RDK_SAFECLIB_ERR(rc) printf("safeclib error at rc - %d %s %s:%d", rc, __FILE__, __FUNCTION__, __LINE__) + +#define ERR_CHK(rc) \ + if(rc !=EOK) { \ + RDK_SAFECLIB_ERR(rc); \ + } + +#ifdef SAFEC_DUMMY_API +#include +#include +#include +typedef int errno_t; +#define EOK 0 +#define ESNULLP 400 /* null ptr */ +#define ESLEMAX 403 /* length exceeds RSIZE_MAX */ +#define ESNOSPC 406 /* not enough space for s2 */ + +#define strcpy_s(dst,max,src) (src != NULL)?((max > strlen(src))?EOK:ESLEMAX):ESNULLP; \ + if((src != NULL) && (max > strlen(src))) strcpy(dst,src); + +#define strncpy_s(dst,max,src,len) (src != NULL)?((len <= max)?EOK:ESLEMAX):ESNULLP; \ + if((src != NULL) && (len <= max)) strncpy(dst,src,len); + +#define memset_s(dst,max_1,c,max) EOK; \ + memset(dst,c,max); + +#define strcat_s(dst,max,src) (src != NULL)?((max > strlen(src))?EOK:ESLEMAX):ESNULLP; \ + if((src != NULL) && (max > strlen(src))) strcat(dst,src); + +#define strncat_s(dst,max,src,len) (src != NULL)?((len <= max)?EOK:ESLEMAX):ESNULLP; \ + if((src != NULL) && (len <= max)) strncat(dst,src,len); + +#define memcpy_s(dst,max,src,len) EOK; \ + memcpy(dst,src,len); + +#ifndef STRCPY_S_NOCLOBBER + #define STRCPY_S_NOCLOBBER(dst,max,src) (src != NULL)?((max > strlen(src))?EOK:ESLEMAX):ESNULLP; \ + if((src != NULL) && (strlen(src) < max)) strcpy(dst, src); +#endif + +#define MEMCPY_S_NOCLOBBER(dst,max,src,len) (src != NULL) ? ((len <= max)?EOK:ESLEMAX):ESNULLP; \ + if((src != NULL) && (len <= max)) memcpy(dst, src, len); + +#define strtok_s(dest, dmax, delim, ptr) strtok_r(dest, delim, ptr) + +#define sprintf_s( dst, max, fmt, ... ) (parseFormat(dst, max, fmt, ##__VA_ARGS__) == 0) ? -ESNULLP : sprintf( dst, fmt, ##__VA_ARGS__) + +#define STRCPY_S(dest,size,source) \ + { \ + errno_t rc=-1; \ + rc=strcpy_s(dest, size, source); \ + if(rc!=EOK) \ + { \ + RDK_SAFECLIB_ERR(rc); \ + }\ +} +#define MEMCPY_S(dest,dsize,source,ssize) \ + { \ + errno_t safec_rc=-1; \ + safec_rc=memcpy_s(dest, dsize, source, ssize); \ + if(safec_rc!=EOK) \ + { \ + RDK_SAFECLIB_ERR(safec_rc); \ + }\ +} + +static inline int parseFormat(const char *dst, int max, const char *fmt, ...) +{ + va_list argp; + int len = 0; + + if((fmt == NULL) || (dst == NULL) || (max == 0)) + { + return 0; + } + + va_start(argp, fmt); + + len = vsnprintf((char *)dst, (size_t)max, fmt, argp); + + va_end(argp); + + return (max > len) ? 1 : 0; +} + +static inline int strcmp_s(const char *dst, int dmax, const char *src, int *r) { + if((src == NULL) || (dst == NULL) || (dmax == 0)) + return ESNULLP; + + *r = strcmp(dst, src); + return EOK; +} + +static inline int strcasecmp_s(const char *dst, int dmax, const char *src, int *r) { + if((src == NULL) || (dst == NULL) || (dmax == 0)) + return ESNULLP; + + *r = strcasecmp(dst, src); + return EOK; +} + +static inline int memcmp_s(const void *dst, int dmax, const void *src, int len, int *r) { + if((src == NULL) || (dst == NULL) || (dmax == 0)) + return ESNULLP; + if(len > dmax) + return ESNOSPC; + + *r = memcmp(dst, src,len); + return EOK; +} +#endif From f0d705667cbfcc8ad15ca883ff74f33ed7d56e76 Mon Sep 17 00:00:00 2001 From: agampa263 Date: Wed, 28 May 2025 17:24:37 +0000 Subject: [PATCH 3/6] test --- .github/workflows/native_full_build.yml | 24 ++++++++++++++++++++++++ cov_build.sh | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/native_full_build.yml diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml new file mode 100644 index 0000000..9e2ff0e --- /dev/null +++ b/.github/workflows/native_full_build.yml @@ -0,0 +1,24 @@ +name: Build Component in Native Environment + +on: + push: + branches: [ main, 'sprint/**', 'release/**', develop ] + pull_request: + branches: [ main, 'sprint/**', 'release/**', topic/RDK*, develop ] + +jobs: + build-entservices-on-pr: + name: Build entservices-mediaanddrm component in github rdkcentral + runs-on: ubuntu-latest + container: + image: ghcr.io/rdkcentral/docker-rdk-ci:latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: native build + run: | + sh -e cov_build.sh + env: + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} \ No newline at end of file diff --git a/cov_build.sh b/cov_build.sh index 8e3f98c..9de983f 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -x +set -e WORKDIR=`pwd` export ROOT=/home/rdkv-core/Yuvaram/workspace/downloads From e096b2520fcdd7d55c776a96a9f275ad52a23d8c Mon Sep 17 00:00:00 2001 From: agampa263 Date: Wed, 28 May 2025 17:31:06 +0000 Subject: [PATCH 4/6] test --- .github/workflows/native_full_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 9e2ff0e..2b4bfa9 100644 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -19,6 +19,6 @@ jobs: - name: native build run: | - sh -e cov_build.sh + sh -x cov_build.sh env: GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} \ No newline at end of file From bb58b57180bca9badda2ccb99ca2ae9dcfdeed95 Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Thu, 29 May 2025 15:59:13 +0530 Subject: [PATCH 5/6] Update native_full_build.yml --- .github/workflows/native_full_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 2b4bfa9..11ef474 100644 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -19,6 +19,6 @@ jobs: - name: native build run: | - sh -x cov_build.sh + ./cov_build.sh env: - GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} From 7039052030913054fc2dad5a152fab7c042650a2 Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Thu, 29 May 2025 16:13:14 +0530 Subject: [PATCH 6/6] Update cov_build.sh --- cov_build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cov_build.sh b/cov_build.sh index 9de983f..2926cab 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -8,6 +8,9 @@ export ROOT=/usr export INSTALL_DIR=${ROOT}/local mkdir -p $INSTALL_DIR +apt update +apt install -y libdbus-1-dev + cd $ROOT rm -rf iarmbus git clone https://github.com/rdkcentral/iarmbus.git