Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDKTV-35484 L1 test case for Add deviceIdentification plugin details into deviceinfo #6115

Open
wants to merge 22 commits into
base: sprint/25Q1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
41c1e41
RDKTV-35484 Add deviceIdentification plugin details into deviceinfo
ramkumarpraba Mar 3, 2025
1cba801
Merge branch 'sprint/25Q1' into sprint/25Q1_RDKTV-35484
ramkumarpraba Mar 4, 2025
d3c0de5
RDKTV-35484 Add deviceIdentification plugin details into deviceinfo
ramkumarpraba Mar 4, 2025
627c3fa
RDKTV-35484 Add deviceIdentification plugin details into deviceinfo
ramkumarpraba Mar 4, 2025
b5a462a
RDKTV-35484 Add deviceIdentification plugin details into deviceinfo
ramkumarpraba Mar 4, 2025
50b63f4
Merge branch 'sprint/25Q1_RDKTV-35484_L1' of https://github.com/ramku…
ramkumarpraba Mar 4, 2025
188fdee
Update L1-tests.yml
ramkumarpraba Mar 4, 2025
51f3495
Update test_DeviceInfoJsonRpc.cpp
ramkumarpraba Mar 4, 2025
8cbf128
Update test_DeviceInfoJsonRpc.cpp
ramkumarpraba Mar 5, 2025
12bec01
Update test_DeviceInfoJsonRpc.cpp
ramkumarpraba Mar 5, 2025
9451383
Update DeviceInfo.cpp
ramkumarpraba Mar 5, 2025
294f846
Update DeviceInfo.cpp
ramkumarpraba Mar 5, 2025
d23e021
Update DeviceInfo.cpp
ramkumarpraba Mar 5, 2025
ca480c7
Update DeviceInfo.cpp
ramkumarpraba Mar 5, 2025
57f5976
Update DeviceInfo.cpp
ramkumarpraba Mar 5, 2025
982c518
Update DeviceInfo.cpp
ramkumarpraba Mar 5, 2025
772ff0a
Update test_DeviceInfoJsonRpc.cpp
ramkumarpraba Mar 5, 2025
15c85b0
Update test_DeviceIdentification.cpp
ramkumarpraba Mar 5, 2025
f09a611
testing
ramkumarpraba Mar 5, 2025
79e4123
testing
ramkumarpraba Mar 5, 2025
be99adf
Update test_DeviceInfoDeviceIdentification.cpp
ramkumarpraba Mar 5, 2025
9d5a05f
Update test_DeviceInfoDeviceIdentification.cpp
ramkumarpraba Mar 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/L1-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ jobs:
path: ThunderInterfaces
ref: ${{env.INTERFACES_REF}}

- name: Apply patches ThunderInterfaces
- name: Apply patches ThunderInterfaces
run: |
cd ThunderInterfaces
patch -p1 < ${{github.workspace}}/rdkservices/Tests/L2Tests/patches/0001-DELIA-66976-SystemAudioPlayer-interface.patch
patch -p1 < ${{github.workspace}}/rdkservices/Tests/L2Tests/patches/0002-DELIA-66976-specially-for-comcast-bring-back-the-old.patch
patch -p1 < ${{github.workspace}}/rdkservices/Tests/L2Tests/patches/DeviceInfo_brand.patch
patch -p1 < ${{github.workspace}}/rdkservices/Tests/L2Tests/patches/RDKTV-35484-DeviceIdentification2.patch
cd ..

- name: Build ThunderInterfaces
Expand Down
76 changes: 76 additions & 0 deletions DeviceInfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,26 @@
set(PLUGIN_NAME DeviceInfo)
set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME})

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

set(PLUGIN_DEVICEINFO_MODE "Off" CACHE STRING "Controls if the plugin should run in its own process, in process or remote")
set(PLUGIN_DEVICEINFO_STARTUPORDER "" CACHE STRING "Start-up order for DeviceInfo plugin")
set(PLUGIN_DEVICEIDENTIFICATION_INTERFACE_NAME "eth0" CACHE STRING "Ethernet Card name which has to be associated for the Raw Device Id creation")
option(PLUGIN_DEVICEIDENTIFICATION_USE_MFR "Get device identification details using MFR library" OFF)

if (DEVICE_IDENTIFICATION_CHIPSET_INFO)
add_definitions (-DDEVICE_IDENTIFICATION_CHIPSET_INFO=\"${DEVICE_IDENTIFICATION_CHIPSET_INFO}\")
endif (DEVICE_IDENTIFICATION_CHIPSET_INFO)

find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)
find_package(CompileSettingsDebug CONFIG REQUIRED)
find_package(RFC)
find_package(DS)
find_package(IARMBus)
find_package(NEXUS QUIET)
find_package(BCM_HOST QUIET)
find_package(MFRFWLibs QUIET)

add_library(${MODULE_NAME} SHARED
DeviceInfo.cpp
Expand All @@ -37,10 +48,75 @@ add_library(${MODULE_NAME} SHARED
Implementation/DeviceInfo.cpp
Module.cpp)

if (PLUGIN_DEVICEIDENTIFICATION_USE_MFR AND MFRFWLIBS_FOUND)
target_sources(${MODULE_NAME}
PRIVATE
Implementation/MFR/MFR.cpp)
target_link_libraries(${MODULE_NAME}
PRIVATE
MFRFWLibs::MFRFWLibs)
elseif (BUILD_BROADCOM)
target_sources(${MODULE_NAME}
PRIVATE
Implementation/Broadcom/Broadcom.cpp)
elseif (NEXUS_FOUND)
find_package(NXCLIENT REQUIRED)
target_link_libraries(${MODULE_NAME}
PRIVATE
NEXUS::NEXUS
NXCLIENT::NXCLIENT)
if (DEVICEIDENTIFICATION_IMPLEMENTATION_PATH)
target_sources(${MODULE_NAME}
PRIVATE
${DEVICEIDENTIFICATION_IMPLEMENTATION_PATH}/Nexus.cpp)
else()
include(GetExternalCode)
set(DEVICEIDENTIFICATION_IMPLEMENTATION_VERSION "master" CACHE STRING "DeviceIdentification implementation version")
set(DEVICEIDENTIFICATION_IMPLEMENTATION_REPOSITORY "https://code.rdkcentral.com/r/soc/broadcom/components/rdkcentral/thundernanoservices/DeviceIdentification" CACHE STRING "DeviceIdentification implementation repository")
GetExternalCode(
GIT_REPOSITORY ${DEVICEIDENTIFICATION_IMPLEMENTATION_REPOSITORY}
GIT_TAG ${DEVICEIDENTIFICATION_IMPLEMENTATION_VERSION}
SOURCE_DIR "Implementation/Nexus"
)
target_sources(${MODULE_NAME}
PRIVATE
Implementation/Nexus/Nexus.cpp)
endif()
elseif (BCM_HOST_FOUND)
target_sources(${MODULE_NAME}
PRIVATE
Implementation/RPI/RPI.cpp)
target_link_libraries(${MODULE_NAME}
PRIVATE
BCM_HOST::BCM_HOST)
elseif (BUILD_AMLOGIC)
target_sources(${MODULE_NAME}
PRIVATE
Implementation/Amlogic/Amlogic.cpp)
target_compile_definitions(${MODULE_NAME}
PRIVATE
DISABLE_DEVICEID_CONTROL=1)
elseif (BUILD_REALTEK)
target_sources(${MODULE_NAME}
PRIVATE
Implementation/Realtek/Realtek.cpp)
elseif(UNIX AND NOT APPLE)
target_sources(${MODULE_NAME}
PRIVATE
Implementation/Linux/Linux.cpp)
set(GENERIC_DEVICEIDENTIFIATION ON)
else ()
message(FATAL_ERROR "There is no platform backend for device identifier plugin")
endif()

set_target_properties(${MODULE_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES)

target_include_directories(${MODULE_NAME}
PRIVATE
${CMAKE_CURRENT_LIST_DIR})

target_include_directories(${MODULE_NAME} PRIVATE
${RFC_INCLUDE_DIRS}
${DS_INCLUDE_DIRS}
Expand Down
4 changes: 4 additions & 0 deletions DeviceInfo/DeviceInfo.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ startuporder = "@PLUGIN_DEVICEINFO_STARTUPORDER@"

configuration = JSON()

if boolean("@GENERIC_DEVICEIDENTIFIATION@"):
if boolean("@PLUGIN_DEVICEIDENTIFICATION_INTERFACE_NAME@"):
configuration.add("interface", @PLUGIN_DEVICEIDENTIFICATION_INTERFACE_NAME@)

rootobject = JSON()
rootobject.add("mode", "@PLUGIN_DEVICEINFO_MODE@")
configuration.add("root", rootobject)
6 changes: 6 additions & 0 deletions DeviceInfo/DeviceInfo.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ set (startuporder ${PLUGIN_DEVICEINFO_STARTUPORDER})
endif()

map()
if(GENERIC_DEVICEIDENTIFIATION)
if(PLUGIN_DEVICEIDENTIFICATION_INTERFACE_NAME)
kv(interface ${PLUGIN_DEVICEIDENTIFICATION_INTERFACE_NAME})
endif()
endif()

key(root)
map()
kv(mode ${PLUGIN_DEVICEINFO_MODE})
Expand Down
141 changes: 136 additions & 5 deletions DeviceInfo/DeviceInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
*/

#include "DeviceInfo.h"
#include <interfaces/IConfiguration.h>
#include <interfaces/IDeviceIdentification2.h>
#include "tracing/Logging.h"
#include "UtilsJsonRpc.h"
#include "UtilsController.h"
#include <time.h>


#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 1
#define API_VERSION_NUMBER_PATCH 0
Expand All @@ -30,11 +36,19 @@ namespace {
// Version (Major, Minor, Patch)
API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH,
// Preconditions
#ifdef DISABLE_DEVICEID_CONTROL
{ PluginHost::ISubSystem::IDENTIFIER },
#else
{},
#endif
// Terminations
{},
// Controls
#ifdef DISABLE_DEVICEID_CONTROL
{}
#else
{ PluginHost::ISubSystem::IDENTIFIER }
#endif
);
}

Expand All @@ -46,9 +60,10 @@ namespace Plugin {

/* virtual */ const string DeviceInfo::Initialize(PluginHost::IShell* service)
{
std::cout<< "RamTest addresses DeviceInfo::Initialize start" <<std::endl;
ASSERT(_service == nullptr);
ASSERT(service != nullptr);

ASSERT(_identifier == nullptr);
ASSERT(_subSystem == nullptr);

_skipURL = static_cast<uint8_t>(service->WebPrefix().length());
Expand All @@ -57,35 +72,82 @@ namespace Plugin {

ASSERT(_subSystem != nullptr);

std::cout<< "RamTest addresses DeviceInfo::Initialize before _deviceInfo" <<std::endl;
_deviceInfo = service->Root<Exchange::IDeviceInfo>(_connectionId, 2000, _T("DeviceInfoImplementation"));
_deviceAudioCapabilities = service->Root<Exchange::IDeviceAudioCapabilities>(_connectionId, 2000, _T("DeviceAudioCapabilities"));
_deviceVideoCapabilities = service->Root<Exchange::IDeviceVideoCapabilities>(_connectionId, 2000, _T("DeviceVideoCapabilities"));
_firmwareVersion = service->Root<Exchange::IFirmwareVersion>(_connectionId, 2000, _T("FirmwareVersion"));

std::cout<< "RamTest addresses DeviceInfo::Initialize before _device" <<std::endl;
_device = service->Root<Exchange::IDeviceIdentification2>(_connectionId, 2000, _T("DeviceImplementation"));
//_device = nullptr ;
std::cout<< "RamTest addresses DeviceInfo::Initialize after _device" <<std::endl;
if (_device != nullptr) {
std::cout<< "RamTest addresses DeviceInfo::Initialize inside _device is not nullptr " <<std::endl;
Exchange::IConfiguration* configure = _device->QueryInterface<Exchange::IConfiguration>();
if (configure != nullptr) {
std::cout<< "RamTest addresses DeviceInfo::Initialize inside configure is not nullptr " <<std::endl;
configure->Configure(service);
configure->Release();
}
std::cout<< "RamTest addresses DeviceInfo::Initialize before _identifier" <<std::endl;
_identifier = _device->QueryInterface<PluginHost::ISubSystem::IIdentifier>();
std::cout<< "RamTest addresses DeviceInfo::Initialize after _identifier" <<std::endl;
if (_identifier == nullptr) {
std::cout<< "RamTest addresses DeviceInfo::Initialize _identifier == nullptr " <<std::endl;
_device->Release();
_device = nullptr;
} else {
std::cout<< "RamTest addresses DeviceInfo::Initialize _identifier != nullptr " <<std::endl;
_deviceId = GetDeviceId();
std::cout<< "RamTest addresses DeviceInfo::Initialize after GetDeviceId " <<std::endl;
if (_deviceId.empty() != true) {
std::cout<< "RamTest addresses DeviceInfo::Initialize not _deviceId.empt " <<std::endl;
#ifndef DISABLE_DEVICEID_CONTROL
std::cout<< "RamTest addresses DeviceInfo::Initialize DISABLE_DEVICEID_CONTROL GetDeviceId " <<std::endl;
service->SubSystems()->Set(PluginHost::ISubSystem::IDENTIFIER, _identifier);
#endif
}
}
}
ASSERT(_deviceInfo != nullptr);
ASSERT(_deviceAudioCapabilities != nullptr);
ASSERT(_deviceVideoCapabilities != nullptr);
ASSERT(_firmwareVersion != nullptr);

//ASSERT(_device != nullptr);
std::cout<< "RamTest addresses DeviceInfo::Initialize after asset check " <<std::endl;

// On success return empty, to indicate there is no error text.

// && (_device != nullptr)
return ((_subSystem != nullptr)
&& (_deviceInfo != nullptr)
&& (_deviceAudioCapabilities != nullptr)
&& (_deviceVideoCapabilities != nullptr)
&& (_deviceVideoCapabilities != nullptr)
&& (_firmwareVersion != nullptr))
? EMPTY_STRING
: _T("Could not retrieve System Information.");
std::cout<< "RamTest addresses DeviceInfo::Initialize end " <<std::endl;
}

/* virtual */ void DeviceInfo::Deinitialize(PluginHost::IShell* service)
{
ASSERT(_service == service);

if (_identifier != nullptr) {
if (_deviceId.empty() != true) {
#ifndef DISABLE_DEVICEID_CONTROL
service->SubSystems()->Set(PluginHost::ISubSystem::IDENTIFIER, nullptr);
#endif
_deviceId.clear();
}
_identifier->Release();
_identifier = nullptr;
}

_deviceInfo->Release();
_deviceAudioCapabilities->Release();
_deviceVideoCapabilities->Release();
_firmwareVersion->Release();
_device->Release();

if (_subSystem != nullptr) {
_subSystem->Release();
Expand Down Expand Up @@ -221,5 +283,74 @@ namespace Plugin {
socketPortInfo.Runs = Core::ResourceMonitor::Instance().Runs();
}

string DeviceInfo::RetrieveSerialNumberThroughCOMRPC() const
{
std::string Number;
if (_service)
{
if(_deviceInfo)
{
_deviceInfo->SerialNumber(Number);
}
else
{
LOGERR("Failed to create DeviceInfo object\n");
}
}
return Number;
}
string DeviceInfo::GetDeviceId() const
{
string result;
string serial;
#ifndef DISABLE_DEVICEID_CONTROL
ASSERT(_identifier != nullptr);

if (_identifier != nullptr) {
uint8_t myBuffer[64];

myBuffer[0] = _identifier->Identifier(sizeof(myBuffer) - 1, &(myBuffer[1]));

if (myBuffer[0] != 0) {
result = Core::SystemInfo::Instance().Id(myBuffer, ~0);
}
else
{
serial = RetrieveSerialNumberThroughCOMRPC();

if (!serial.empty()) {
uint8_t ret = serial.length();

if (ret > (sizeof(myBuffer) - 1)){
ret = sizeof(myBuffer) - 1;
}
myBuffer[0] = ret;
::memcpy(&(myBuffer[1]), serial.c_str(), ret);

if(myBuffer[0] != 0){
result = Core::SystemInfo::Instance().Id(myBuffer, ~0);
}
}
}

}
#else
// extract DeviceId set by Thunder
if (_service->SubSystems()->IsActive(PluginHost::ISubSystem::IDENTIFIER) == true) {

const PluginHost::ISubSystem::IIdentifier* identifier(_service->SubSystems()->Get<PluginHost::ISubSystem::IIdentifier>());

if (identifier != nullptr) {
uint8_t myBuffer[64];

if ((myBuffer[0] = identifier->Identifier(sizeof(myBuffer) - 1, &(myBuffer[1]))) != 0) {
result = Core::SystemInfo::Instance().Id(myBuffer, ~0);
}
identifier->Release();
}
}
#endif
return result;
}
} // namespace Plugin
} // namespace WPEFramework
Loading
Loading