From 4d86f688f164fe1ecacc69e6620d86b1805c2e10 Mon Sep 17 00:00:00 2001 From: HaseenaSainul Date: Tue, 5 Nov 2024 04:37:11 -0500 Subject: [PATCH] Json meta to IDL changes in progress --- definitions/CMakeLists.txt | 2 +- interfaces/IDeviceInfo.h | 193 ++++++++++++++++++++++--------------- interfaces/IStateControl.h | 50 ++++++++++ interfaces/Ids.h | 5 + 4 files changed, 172 insertions(+), 78 deletions(-) create mode 100644 interfaces/IStateControl.h diff --git a/definitions/CMakeLists.txt b/definitions/CMakeLists.txt index 98be2070..62433aae 100644 --- a/definitions/CMakeLists.txt +++ b/definitions/CMakeLists.txt @@ -41,7 +41,7 @@ if(NOT ENABLE_LEGACY_INTERFACE_SUPPORT) "${CMAKE_SOURCE_DIR}/jsonrpc/Monitor.json" "${CMAKE_SOURCE_DIR}/jsonrpc/OCDM.json" "${CMAKE_SOURCE_DIR}/jsonrpc/SecurityAgent.json" - "${CMAKE_SOURCE_DIR}/jsonrpc/StateControl.json" + "${CMAKE_SOURCE_DIR}/jsonrpc/StateControl.json" ) endif() diff --git a/interfaces/IDeviceInfo.h b/interfaces/IDeviceInfo.h index 286dda8b..d6e515b1 100644 --- a/interfaces/IDeviceInfo.h +++ b/interfaces/IDeviceInfo.h @@ -29,83 +29,6 @@ namespace Exchange { struct EXTERNAL IDeviceInfo : virtual public Core::IUnknown { enum { ID = ID_DEVICE_INFO }; - struct FirmwareInfo { - enum Yocto : uint8_t { - dunfell, - morty, - daisy, - kirkstone - }; - - string imageName /* @brief Name of firmware image */; - string sdk /* @brief SDK version string */; - string mediarite /* @brief Mediarite value */; - Yocto yocto /* @brief Yocto version */; - }; - struct Device { - string deviceType /* @brief Device type */; - string distributorId /* @brief Partner ID or distributor ID for device */; - string friendlyName /* @brief Friendly name */; - string make /* @brief Device manufacturer */; - string modelName /* @brief Model Name */; - uint16_t modelYear /* @brief Model Year */; - string platformName /* @brief Platform name */; - string serialNumber /* Device serial number */; - string sku /* Device model number or SKU */; - }; - struct System { - struct CPULoadAvgs { - uint64_t avg1min /* @brief 1min cpuload average */; - uint64_t avg5min /* @brief 5min cpuload average */; - uint64_t avg15min /* @brief 15min cpuload average */; - }; - string version /* @brief Software version (in form *version#hashtag*) */; - uint64_t uptime /* @brief System uptime (in seconds) */; - uint64_t totalRAM /* @brief Total installed system RAM memory (in bytes) */; - uint64_t freeRAM /* @brief Free system RAM memory (in bytes) */; - uint64_t totalSwap /* @brief Total swap space (in bytes) */; - uint64_t freeSwap /* @brief Swap space still available (in bytes) */; - string deviceName /* @brief Host name */; - string cpuLoad /* @brief Current CPU load (percentage) */; - CPULoadAvgs cpuLoadAvg /* @brief CPU load average */; - string serialNumber /* @brief Device serial number */; - string time /* @brief Current system date and time */; - }; - struct Socket { - uint32_t total /* @brief Number of total */; - uint32_t open /* @brief Number of open */; - uint32_t link /* @brief Number of link */; - uint32_t exception /* @brief Number of exception */; - uint32_t shutdown /* @brief Number of shutdown */; - uint32_t runs /* @brief Number of runs */; - }; - - struct Address { - string name /* @brief Interface name */; - string mac /* @brief Interface MAC address */; - string /* @opaque */ ip /* @brief An array of Interface IP address */; - }; - using IAddressIterator = RPC::IIteratorType; - - // @property - // @brief Retrieves Firware Information - virtual Core::hresult FirmwareVersion(FirmwareInfo& value /* @out */) const = 0; - // @property - // @brief Retrieves Device Info - virtual Core::hresult DeviceData(Device& value /* @out */) const = 0; - // @property - // @brief Retrieves SystemInfo - virtual Core::hresult SystemInfo(System& value /* @out */) const = 0; - // @property - // @brief Retrieves SocketInfo - virtual Core::hresult SocketInfo(Socket& value /* @out */) const = 0; - - // @brief Retrieves AddressInfo - // @param addresses: An array of Interface address - virtual Core::hresult AddressInfo(IAddressIterator*& ip /* @out */) const = 0; - - /* @json:omit */ - virtual Core::hresult Configure(const PluginHost::IShell* service) = 0; // @property // @brief Retrieves Serial Number virtual Core::hresult SerialNumber(string& value /* @out */) const = 0; @@ -291,5 +214,121 @@ namespace Exchange { bool& hdr /* @out */, bool& atmos /* @out */, bool& cec /* @out */, IVideoOutputCapsIterator*& videoOutputCaps /* @out */) const = 0; }; + + /* @json 1.0.0 */ + struct IDeviceMetadata : virtual Core::IUnknown { + enum { ID = ID_DEVICE_METADATA }; + + virtual ~IDeviceMetadata() override = default; + + struct Device { + string deviceType /* @brief Device type */; + string distributorId /* @brief Partner ID or distributor ID for device */; + string friendlyName /* @brief Friendly name */; + string make /* @brief Device manufacturer */; + string modelName /* @brief Model Name */; + uint16_t modelYear /* @brief Model Year */; + string platformName /* @brief Platform name */; + string serialNumber /* Device serial number */; + string sku /* Device model number or SKU */; + }; + + // @property + // @brief Retrieves Device Info + virtual Core::hresult DeviceData(Device& device /* @out */) const = 0; + }; + + /* @json 1.0.0 */ + struct IImageMetadata : virtual Core::IUnknown { + enum { ID = ID_IMAGE_METADATA }; + + virtual ~IImageMetadata() override = default; + + struct Firmware { + enum Yocto : uint8_t { + dunfell, + morty, + daisy, + kirkstone + }; + + string imageName /* @brief Name of firmware image */; + string sdk /* @brief SDK version string */; + string mediarite /* @brief Mediarite value */; + Yocto yocto /* @brief Yocto version */; + }; + + // @property + // @brief Retrieves Firware Information + virtual Core::hresult FirmwareInfo(Firmware& firmware /* @out */) const = 0; + }; + + /* @json 1.0.0 */ + struct ISystemMetadata : virtual Core::IUnknown { + enum { ID = ID_SYSTEM_METADATA }; + + virtual ~ISystemMetadata() override = default; + + struct System { + struct CPULoadAvgs { + uint64_t avg1min /* @brief 1min cpuload average */; + uint64_t avg5min /* @brief 5min cpuload average */; + uint64_t avg15min /* @brief 15min cpuload average */; + }; + string version /* @brief Software version (in form *version#hashtag*) */; + uint64_t uptime /* @brief System uptime (in seconds) */; + uint64_t totalRAM /* @brief Total installed system RAM memory (in bytes) */; + uint64_t freeRAM /* @brief Free system RAM memory (in bytes) */; + uint64_t totalSwap /* @brief Total swap space (in bytes) */; + uint64_t freeSwap /* @brief Swap space still available (in bytes) */; + string deviceName /* @brief Host name */; + string cpuLoad /* @brief Current CPU load (percentage) */; + CPULoadAvgs cpuLoadAvg /* @brief CPU load average */; + string serialNumber /* @brief Device serial number */; + string time /* @brief Current system date and time */; + }; + + // @property + // @brief Retrieves SystemInfo + virtual Core::hresult SystemInfo(System& system /* @out */) const = 0; + }; + + /* @json 1.0.0 */ + struct ISocketMetadata : virtual Core::IUnknown { + enum { ID = ID_SOCKET_METADATA }; + + virtual ~ISocketMetadata() override = default; + + struct Socket { + uint32_t total /* @brief Number of total */; + uint32_t open /* @brief Number of open */; + uint32_t link /* @brief Number of link */; + uint32_t exception /* @brief Number of exception */; + uint32_t shutdown /* @brief Number of shutdown */; + uint32_t runs /* @brief Number of runs */; + }; + + // @property + // @brief Retrieves SocketInfo + virtual Core::hresult SocketInfo(Socket& socket /* @out */) const = 0; + }; + + /* @json 1.0.0 */ + struct IAddressMetadata : virtual Core::IUnknown { + enum { ID = ID_ADDRESS_METADATA }; + + virtual ~IAddressMetadata() override = default; + + struct Address { + string name /* @brief Interface name */; + string mac /* @brief Interface MAC address */; + string /* @opaque */ ip /* @brief An array of Interface IP address */; + }; + using IAddressIterator = RPC::IIteratorType; + + // @brief Retrieves AddressInfo + // @param addresses: An array of Interface address + virtual Core::hresult AddressInfo(IAddressIterator*& ip /* @out */) const = 0; + }; } } diff --git a/interfaces/IStateControl.h b/interfaces/IStateControl.h new file mode 100644 index 00000000..68b0805e --- /dev/null +++ b/interfaces/IStateControl.h @@ -0,0 +1,50 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2024 Metrological + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "Module.h" + +namespace Thunder { + +namespace Exchange { + + namespace JSONRPC { + + // @json 1.0.0 + struct EXTERNAL IStateControl { + + virtual ~IStateControl() = default; + + enum StateType : uint8_t { + RESUMED = 0 /* @text:resumed */, + SUSPENDED = 1 /* @text:suspended */ + }; + + // @property + // @brief State: Running state of the service + virtual Core::hresult State(StateType& state /* @out */) const = 0; + virtual Core::hresult State(const StateType state) = 0; + }; + + } // namespace JSONRPC + +} // namespace Exchange + +} diff --git a/interfaces/Ids.h b/interfaces/Ids.h index e54880f6..c06f8508 100644 --- a/interfaces/Ids.h +++ b/interfaces/Ids.h @@ -254,6 +254,11 @@ namespace Exchange { ID_DEVICE_CAPABILITIES_AUDIO_OUTPUT = ID_DEVICE_INFO + 3, ID_DEVICE_CAPABILITIES_VIDEO = ID_DEVICE_INFO + 4, ID_DEVICE_CAPABILITIES_VIDEO_OUTPUT = ID_DEVICE_INFO + 5, + ID_ADDRESS_METADATA = ID_DEVICE_INFO + 6, + ID_DEVICE_METADATA = ID_DEVICE_INFO + 7, + ID_IMAGE_METADATA = ID_DEVICE_INFO + 8, + ID_SYSTEM_METADATA = ID_DEVICE_INFO + 9, + ID_SOCKET_METADATA = ID_DEVICE_INFO + 10, ID_DIALSERVER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x380, ID_DIALSERVER_APPLICATION = ID_DIALSERVER + 1,