From 258448fb4ff423ba9437371826b7bf2590f36b7d Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Fri, 14 Mar 2025 19:38:03 +0200 Subject: [PATCH 01/24] RDK-56460 : Fix camel case (#425) Reason for change: Depending on version it's converted to lowercase. Test Procedure: None Risks: None Signed-off-by: Nikita Poltorapavlo --- interfaces/IContentProtection.h | 43 +++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/interfaces/IContentProtection.h b/interfaces/IContentProtection.h index 83724133..44068b6c 100644 --- a/interfaces/IContentProtection.h +++ b/interfaces/IContentProtection.h @@ -57,14 +57,17 @@ namespace Exchange { State state; // @brief same as that returned by the SecManager + // @text failureReason int32_t failureReason; }; // @alt onWatermarkStatusChanged // @param sessionId session id for the content protection session // @param appId application that should receive the notification - virtual void WatermarkStatusChanged(uint32_t sessionId, - const string& appId, const Status& status) + virtual void WatermarkStatusChanged( + uint32_t sessionId /* @text:sessionId */, + const string& appId /* @text:appId */, + const Status& status) = 0; }; @@ -78,18 +81,21 @@ namespace Exchange { // @param initData video platform specific init data // @param sessionId generated by SecManager to track sessions // @param response video platform specific response data - virtual uint32_t OpenDrmSession(const string& clientId, - const string& appId, - KeySystem keySystem, const string& licenseRequest, - const string& initData /* @opaque */, - uint32_t& sessionId /* @out */, + virtual uint32_t OpenDrmSession( + const string& clientId /* @text:clientId */, + const string& appId /* @text:appId */, + KeySystem keySystem /* @text:keySystem */, + const string& licenseRequest /* @text:licenseRequest */, + const string& initData /* @text:initData @opaque */, + uint32_t& sessionId /* @text:sessionId @out */, string& response /* @text:openSessionResponse @opaque @out */) = 0; // @alt setDrmSessionState // @param sessionId sec manager generated playback session id - virtual uint32_t SetDrmSessionState(uint32_t sessionId, - State sessionState) + virtual uint32_t SetDrmSessionState( + uint32_t sessionId /* @text:sessionId */, + State sessionState /* @text:sessionState */) = 0; // @alt updateDrmSession @@ -97,29 +103,34 @@ namespace Exchange { // @param licenseRequest base64-encoded DRM license request // @param initData video platform specific init data // @param response video platform specific response data - virtual uint32_t UpdateDrmSession(uint32_t sessionId, - const string& licenseRequest, - const string& initData /* @opaque */, + virtual uint32_t UpdateDrmSession( + uint32_t sessionId /* @text:sessionId */, + const string& licenseRequest /* @text:licenseRequest */, + const string& initData /* @text:initData @opaque */, string& response /* @text:updateSessionResponse @opaque @out */) = 0; // @alt closeDrmSession // @param sessionId sec manager generated playback session id - virtual uint32_t CloseDrmSession(uint32_t sessionId) = 0; + virtual uint32_t CloseDrmSession( + uint32_t sessionId /* @text:sessionId */) + = 0; // @alt showWatermark // @param sessionId id returned on a call to openDrmSession // @param show true when watermark has to be presented - virtual uint32_t ShowWatermark(uint32_t sessionId, + virtual uint32_t ShowWatermark( + uint32_t sessionId /* @text:sessionId */, bool show, - const uint8_t opacityLevel /* @restrict:0..100 */) + const uint8_t opacityLevel /* @text:opacityLevel @restrict:0..100 */) = 0; // @alt setPlaybackPosition // @param sessionId sec manager generated playback session id // @param speed current playback speed // @param position current playback position - virtual uint32_t SetPlaybackPosition(uint32_t sessionId, + virtual uint32_t SetPlaybackPosition( + uint32_t sessionId /* @text:sessionId */, int32_t speed, long position) = 0; }; From 16d1459ae85940fa71d6836301dc2b4288e9f3b4 Mon Sep 17 00:00:00 2001 From: Pierre Wielders Date: Mon, 17 Mar 2025 17:55:13 +0100 Subject: [PATCH 02/24] [IGRAPHICSBUFFER] As the ICompositionBuffer is a misleading name for its purpose, introduce the IGraphicsBuffer (#429) --- interfaces/IGraphicsBuffer.h | 106 +++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 interfaces/IGraphicsBuffer.h diff --git a/interfaces/IGraphicsBuffer.h b/interfaces/IGraphicsBuffer.h new file mode 100644 index 00000000..88668718 --- /dev/null +++ b/interfaces/IGraphicsBuffer.h @@ -0,0 +1,106 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 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 { + + // The IGraphicsBuffer is an interface definition to communicate across + // process boundaries between two actors, the Client and the Compositor. + // Client: Producing content in the buffer + // Compositor: Consuming the content (move to another Buffer) + // + // From a Client perspective: + // 1) IGraphicsBuffer::Acquire(50) + // Locks the planes so the Compositor can not and will not use this + // buffer in the process of creating a new composition. + // 2) IIterator::Plane::Accessor() + // Write anything the client likes onto the buffer + // 3) IGraphicsBuffer::Relinquish() + // Unlock the planes, the Compositor can use/consume what is on the + // buffer and move it to wherever the compositor likes. + // + // From a Compositor perspective: + // 1) a screen update is requested, iterate over all Buffers available + // in the Compositor and call IGraphicsBuffer::Acquire(0), no need + // to wait cause if the producer (Client) is working on the buffer we + // do not want to consume it. + // 2) IIterator::Plane::Accessor() + // Read anything from the buffer the client has written on it and move it + // to a new buffer. + // 3) IGraphicsBuffer::Relinquish() + // Unlock the planes, the Client can use/produce new contents on the + // buffer. The content how it was is now copied to a new location. + + // NOTE: + // -------------------------------------------------------------------------- + // This is delibratly *NOT* a COMRPC interface as the communication and the + // exchange over the process boundaries must be done with OS native features + // to enforce the best performance! + + // @stubgen:omit + struct EXTERNAL IGraphicsBuffer { + virtual ~IGraphicsBuffer() = default; + + /** + * @brief frame buffer interface with hardware optimisation in mind + */ + enum DataType : uint8_t { + TYPE_INVALID = 0x00, // Invalid buffer + TYPE_DMA = 0x01, // DMA buffer + TYPE_RAW = 0x02 // Raw buffer + }; + + struct IIterator { + virtual ~IIterator() = default; + + virtual bool IsValid() const = 0; + virtual void Reset() = 0; + virtual bool Next() = 0; + + virtual int Descriptor() const = 0; // Access to the actual data. + + virtual uint32_t Stride() const = 0; // Bytes per row for a plane [(bit-per-pixel/8) * width] + virtual uint32_t Offset() const = 0; // Offset of the plane from where the pixel data starts in the buffer. + }; + + // Acquire (lock) the planes (Compositor or Client), the + // other user (Client or Compositor) of this object (process + // agnostic) can now not access the planes, they have to + // wait till they become availabe again..... + virtual IIterator* Acquire(const uint32_t timeoutMs) = 0; + + // Relinquish (unlock) the Planes. End lifetime of the IIterator + // received from Planes() + virtual void Relinquish() = 0; + + virtual uint32_t Width() const = 0; // Width of the allocated buffer in pixels + virtual uint32_t Height() const = 0; // Height of the allocated buffer in pixels + virtual uint32_t Format() const = 0; // Layout of a pixel according the fourcc format + virtual uint64_t Modifier() const = 0; // Pixel arrangement in the buffer, used to optimize for hardware + + virtual DataType Type() const = 0; + }; // struct IGraphicsBuffer + +} // namespace Exchange + +} // namespace Thunder From 70047510012113d066ff96783d6ff56e664bb42a Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Mon, 24 Mar 2025 11:34:49 +0100 Subject: [PATCH 03/24] [TimeSync] Update with JSON-RPC interface (#430) * Initial changes to the existing ITimeSync interface * Adjust the interface, add a separate ISource to ITimeSync * Adjust the Windows files * Add a param desc and an example --- definitions/Definitions.vcxproj | 20 +- definitions/Definitions.vcxproj.filters | 373 ++++++------------------ interfaces/ITimeSync.h | 74 ++++- interfaces/Ids.h | 2 + jsonrpc/TimeSync.json | 77 ----- 5 files changed, 166 insertions(+), 380 deletions(-) delete mode 100644 jsonrpc/TimeSync.json diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index 1dfe654c..019fd7fe 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -54,7 +54,6 @@ - @@ -104,7 +103,7 @@ $(ProjectDir)../interfaces/json/JLocationSync.h $(ProjectDir)../interfaces/json/JLocationSync.h $(ProjectDir)../interfaces/json/JLocationSync.h - + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force @@ -147,6 +146,20 @@ $(ProjectDir)../interfaces/json/JOpenCDM.h $(ProjectDir)../interfaces/json/JOpenCDM.h + + ClInclude + ClInclude + ClInclude + ClInclude + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + $(ProjectDir)../interfaces/json/JTimeSync.h + $(ProjectDir)../interfaces/json/JTimeSync.h + $(ProjectDir)../interfaces/json/JTimeSync.h + $(ProjectDir)../interfaces/json/JTimeSync.h + $(ProjectDir)../interfaces/json/JMath.h @@ -362,9 +375,6 @@ Document - - Document - Document diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index 25236887..fd016285 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -1,297 +1,98 @@  - - {6975244d-cb23-4d09-a334-80cf1e1b4845} - - - {3c5d92bc-9901-475e-bb35-643cd2f2296b} - - - {c5ebb452-1dd1-4410-9a69-da3188dc9cd5} - - - {832f72b9-f988-4a91-98b6-0a6e62b7ca87} - - - {cd531e85-d48e-4490-989c-8353fa16792e} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - Source Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - + + + - - Header Files - - - Header Files - - - Header Files - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - Contracts - - - Contracts - - - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Contracts - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - - - Interfaces - + + \ No newline at end of file diff --git a/interfaces/ITimeSync.h b/interfaces/ITimeSync.h index 3c98bae1..2ba12966 100644 --- a/interfaces/ITimeSync.h +++ b/interfaces/ITimeSync.h @@ -18,32 +18,82 @@ */ #pragma once -#include "Module.h" +#include "Module.h" namespace Thunder { + namespace Exchange { - // @stubgen:omit - // This interface gives direct access to a time synchronize / update + // @json 1.0.0 @text:legacy_lowercase struct EXTERNAL ITimeSync : virtual public Core::IUnknown { + + // This interface gives direct access to a time synchronize / update + struct EXTERNAL ISource : virtual public Core::IUnknown { + + enum { ID = ID_TIMESYNC_ISOURCE }; + + struct EXTERNAL INotification : virtual public Core::IUnknown { + + enum { ID = ID_TIMESYNC_ISOURCE_NOTIFICATION }; + + // Some change happened with respect to the Network.. + virtual void Completed() = 0; + }; + + virtual void Register(INotification* notification) = 0; + virtual void Unregister(INotification* notification) = 0; + + virtual uint32_t Synchronize() = 0; + virtual void Cancel() = 0; + virtual string Source() const = 0; + virtual uint64_t SyncTime() const = 0; + }; + enum { ID = ID_TIMESYNC }; + struct TimeInfo { + Core::Time time /* @brief Synchronized time (in ISO8601 format); empty string if the time has never been synchronized (e.g. 2019-05-07T07:20:26Z) */; + Core::OptionalType source /* @brief The synchronization source like an NTP server (e.g. ntp://example.com) */; + }; + + // @event struct EXTERNAL INotification : virtual public Core::IUnknown { + enum { ID = ID_TIMESYNC_NOTIFICATION }; - // Some change happened with respect to the Network.. - virtual void Completed() = 0; + // @brief Signals a time change + // @alt:deprecated timechange + // @description Some change happened with respect to the Network + virtual void TimeChanged() = 0; }; - virtual void Register(INotification* notification) = 0; - virtual void Unregister(INotification* notification) = 0; + virtual Core::hresult Register(INotification* const notification) = 0; + virtual Core::hresult Unregister(const INotification* const notification) = 0; + + // @brief Synchronizes time + // @deprecated + // @description Use this method to synchronize the system time with the currently configured time source. If automatic time synchronization is initially disabled or canceled, it will be restarted + // @retval ERROR_INPROGRESS: Returned when the method is called while previously triggered synchronization is in progress + // @retval ERROR_INCOMPLETE_CONFIG: Returned when the source configuration is missing or invalid + DEPRECATED virtual Core::hresult Synchronize() = 0; + + // @property + // @brief Time of the most recent synchronization + // @retval ERROR_UNAVAILABLE: There has not been any successful time synchronization yet + virtual Core::hresult SyncTime(TimeInfo& info /* @out */) const = 0; + + // @property + // @brief Current system time + // @description Upon setting this property automatic time synchronization will be stopped. Usage of this property is deprecated and the SubSystem control plugin can be used as an alternative to achieve the same + // @param time: System time in ISO8601 format (e.g. 2019-05-07T07:20:26Z) + // @retval ERROR_BAD_REQUEST: The time is invalid + virtual Core::hresult Time(Core::Time& time /* @out */) const = 0; + // @deprecated + DEPRECATED virtual Core::hresult Time(const Core::Time& time) = 0; - virtual uint32_t Synchronize() = 0; - virtual void Cancel() = 0; - virtual string Source() const = 0; - virtual uint64_t SyncTime() const = 0; }; } // namespace Exchange -} // namespace Thunder + +} diff --git a/interfaces/Ids.h b/interfaces/Ids.h index 07949489..ca763406 100644 --- a/interfaces/Ids.h +++ b/interfaces/Ids.h @@ -103,6 +103,8 @@ namespace Exchange { ID_TIMESYNC = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x0D0, ID_TIMESYNC_NOTIFICATION = ID_TIMESYNC + 1, + ID_TIMESYNC_ISOURCE = ID_TIMESYNC + 2, + ID_TIMESYNC_ISOURCE_NOTIFICATION = ID_TIMESYNC + 3, ID_IPNETWORK = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x0E0, ID_IPNETWORK_DNSSERVER = ID_IPNETWORK + 1, diff --git a/jsonrpc/TimeSync.json b/jsonrpc/TimeSync.json deleted file mode 100644 index 41e57dc5..00000000 --- a/jsonrpc/TimeSync.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "Time Sync API", - "class": "TimeSync", - "format": "uncompliant-extended", - "description": "TimeSync JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "methods": { - "synchronize": { - "summary": "Synchronizes time", - "description": "Use this method to synchronize the system time with the currently configured time source. If automatic time synchronization is initially disabled or stopped, it will be restarted.", - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "Returned when the method is called while previously triggered synchronization is in progress.", - "$ref": "#/common/errors/inprogress" - }, - { - "description": "Returned when the source configuration is missing or invalid.", - "$ref": "#/common/errors/incompleteconfig" - } - ] - } - }, - "properties": { - "synctime": { - "summary": "Most recent synchronized time", - "readonly": true, - "params": { - "type": "object", - "properties": { - "time": { - "description": "Synchronized time (in ISO8601 format); empty string if the time has never been synchronized", - "example": "2019-05-07T07:20:26Z", - "type": "string" - }, - "source": { - "description": "The synchronization source e.g. an NTP server", - "example": "ntp://example.com", - "type": "string" - } - }, - "required": [ - "time" - ] - } - }, - "time": { - "summary": "Current system time", - "description": "Upon setting this property automatic time synchronization will be stopped. Usage of this property is deprecated and the SubSystem control plugin can be used as an alternative to achieve the same", - "params": { - "description": "System time (in ISO8601 format)", - "example": "2019-05-07T07:20:26Z", - "type": "string" - }, - "errors": [ - { - "description": "The time is invalid", - "$ref": "#/common/errors/badrequest" - } - ] - } - }, - "events": { - "timechange": { - "summary": "Signals a time change" - } - } -} From bff399d93703a69514dfcc3354b052bbfc3239be Mon Sep 17 00:00:00 2001 From: Pierre Wielders Date: Wed, 2 Apr 2025 08:02:08 +0200 Subject: [PATCH 04/24] [IWifiControl] Aded for windows build and stored files in subsections. (#431) --- definitions/Definitions.vcxproj | 11 + definitions/Definitions.vcxproj.filters | 368 ++++++++++++++++++------ 2 files changed, 292 insertions(+), 87 deletions(-) diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index 019fd7fe..fc9f8183 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -58,6 +58,7 @@ + @@ -160,6 +161,16 @@ $(ProjectDir)../interfaces/json/JTimeSync.h $(ProjectDir)../interfaces/json/JTimeSync.h + + ClInclude + ClInclude + ClInclude + ClInclude + $(ProjectDir)../interfaces/json/JWifiControl.h + $(ProjectDir)../interfaces/json/JWifiControl.h + $(ProjectDir)../interfaces/json/JWifiControl.h + $(ProjectDir)../interfaces/json/JWifiControl.h + $(ProjectDir)../interfaces/json/JMath.h diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index fd016285..37ba829c 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -1,98 +1,292 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Source Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + + + Generated Files + - - - + + Source Files + + + Source Files + + + Source Files + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + Interface Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + JSON Files + + + Interface Files + - - + + JSON Files + + + JSON Files + + + + + {5083385d-c0f4-4e2b-838a-f4aa51d2a951} + + + {81d0a068-8151-4a4b-95df-340981e3e0b3} + + + {dbf3aff7-6d8c-4b9d-81db-40120a86bec7} + + + {59dae841-dc89-457c-b9f5-7f097f7f7906} + \ No newline at end of file From d80672d8d0df499d1b321be15cb812146bcbbfc9 Mon Sep 17 00:00:00 2001 From: nxtum <94901881+nxtum@users.noreply.github.com> Date: Mon, 7 Apr 2025 09:44:08 +0200 Subject: [PATCH 05/24] Make certain configs optional (#417) Co-authored-by: Pierre Wielders --- interfaces/IWifiControl.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/interfaces/IWifiControl.h b/interfaces/IWifiControl.h index 40302c30..99fc1bdb 100644 --- a/interfaces/IWifiControl.h +++ b/interfaces/IWifiControl.h @@ -54,28 +54,28 @@ namespace Exchange { }; Security method /* @brief Security method */; - Key keys /* @encode:bitmask @brief Security Keys */; + Core::OptionalType keys /* @encode:bitmask @brief Security Keys */; }; using ISecurityIterator = RPC::IIteratorType; struct NetworkInfo { - string ssid /* @brief SSID of the network */; - uint64_t bssid /* @brief BSSID of the network */; - uint32_t frequency /* @brief Frequency used */; - int32_t signal /* @brief Signal strength */; - Security security /* @encode:bitmask @brief Security method */; + Core::OptionalType ssid /* @brief SSID of the network */; + uint64_t bssid /* @brief BSSID of the network */; + uint32_t frequency /* @brief Frequency used */; + int32_t signal /* @brief Signal strength */; + Security security /* @encode:bitmask @brief Security method */; }; using INetworkInfoIterator = RPC::IIteratorType; using IStringIterator = RPC::IIteratorType; struct ConfigInfo { - bool hidden /* @brief Visibility of the router (hidden or visible) */; - bool accesspoint /* @brief Accesspoint or not */; - string ssid /* @brief SSID of the router/ap */; - string secret /* @brief Secret key used */; - string identity /* @brief Identity */; - Security method /* @brief Security method */; - SecurityInfo::Key key /* @brief Security Info: method and keys */; + bool hidden /* @brief Visibility of the router (hidden or visible) */; + bool accesspoint /* @brief Accesspoint or not */; + Core::OptionalType ssid /* @brief SSID of the router/ap */; + Core::OptionalType secret /* @brief Secret key used */; + Core::OptionalType identity /* @brief Identity */; + Security method /* @brief Security method */; + Core::OptionalType key /* @brief Security Info: method and keys */; }; // @event From a384932a090b6a5ab47b52dd38b66330c42c28b2 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:24:41 +0200 Subject: [PATCH 06/24] [ISystemCommands] Update with JSON-RPC interface (#423) * Make ISystemCommands jsonrpc compatible and remove the .json file * Adjust the Windows files * Remove the json enum file that is no longer needed * Revert "Adjust the Windows files" This reverts commit d54a177bbe1a0f4c8ba6a46d7664dc5d79278248. * Revert "Remove the json enum file that is no longer needed" This reverts commit 474bcbf5084e7e847040d7c2c68ac1862d1afc84. * Adjust the Windows files after merging * Remove an unnecessary generated file from the Windows project --- definitions/Definitions.vcxproj | 18 ++++++++--- definitions/Definitions.vcxproj.filters | 9 ++---- interfaces/ISystemCommands.h | 13 ++++++-- jsonrpc/SystemCommands.json | 42 ------------------------- 4 files changed, 27 insertions(+), 55 deletions(-) delete mode 100644 jsonrpc/SystemCommands.json diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index fc9f8183..5c4f6f0b 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -53,7 +53,6 @@ - @@ -171,6 +170,20 @@ $(ProjectDir)../interfaces/json/JWifiControl.h $(ProjectDir)../interfaces/json/JWifiControl.h + + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + ClInclude + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + ClInclude + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + ClInclude + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + ClInclude + $(ProjectDir)../interfaces/json/JSystemCommands.h + $(ProjectDir)../interfaces/json/JSystemCommands.h + $(ProjectDir)../interfaces/json/JSystemCommands.h + $(ProjectDir)../interfaces/json/JSystemCommands.h + $(ProjectDir)../interfaces/json/JMath.h @@ -383,9 +396,6 @@ Document - - Document - Document diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index 37ba829c..f5856505 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -106,9 +106,6 @@ Generated Files - - Generated Files - Generated Files @@ -260,12 +257,12 @@ JSON Files - - JSON Files - Interface Files + + Interface Files + diff --git a/interfaces/ISystemCommands.h b/interfaces/ISystemCommands.h index 0b39ab9f..a3e2d0f0 100644 --- a/interfaces/ISystemCommands.h +++ b/interfaces/ISystemCommands.h @@ -18,17 +18,24 @@ */ #pragma once -#include "Module.h" +#include "Module.h" namespace Thunder { + namespace Exchange { - // @stubgen:omit + // @json 1.0.0 @text:legacy_lowercase struct EXTERNAL ISystemCommands : virtual public Core::IUnknown { + enum { ID = ID_SYSTEMCOMMAND }; - virtual uint32_t USBReset(const string& device) = 0; + // @brief Resets a USB device + // @description With this method a USB device can be reset using USBFS_RESET ioctl command + // @param device: USB device to reset (e.g. /dev/usb/001) + // @retval ERROR_GENERAL Failed to reset USB device + // @retval ERROR_UNAVAILABLE Unknown USB device + virtual Core::hresult USBReset(const string& device) = 0; }; } } diff --git a/jsonrpc/SystemCommands.json b/jsonrpc/SystemCommands.json deleted file mode 100644 index f0d32cc1..00000000 --- a/jsonrpc/SystemCommands.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "System Commands API", - "class": "SystemCommands", - "description": "System Commands JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "methods": { - "usbreset": { - "summary": "Resets a USB device", - "description": "With this method a USB device can be reset using USBFS_RESET ioctl command.", - "params": { - "type": "object", - "properties": { - "device": { - "description": "USB device to reset", - "type": "string", - "default": "/dev/usb/001" - } - } - }, - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "Failed to reset the USB device", - "$ref": "#/common/errors/general" - }, - { - "description": "Unknown USB device", - "$ref": "#/common/errors/unavailable" - } - ] - } - } -} From 2ad31092ac2af8e0912e89a4c4d89e1aaf32608a Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 10 Apr 2025 10:04:40 +0200 Subject: [PATCH 07/24] [Power] Update with JSON-RPC interface (#427) * Generate JSON-RPC from IPower, remove the ,json file * Adjust the Windows files * Add @text:keep to the PCState enum --------- Co-authored-by: Pierre Wielders --- definitions/Definitions.cpp | 9 ---- definitions/Definitions.vcxproj | 22 +++++--- interfaces/IPower.h | 38 +++++++++++--- jsonrpc/Power.json | 93 --------------------------------- 4 files changed, 46 insertions(+), 116 deletions(-) delete mode 100644 jsonrpc/Power.json diff --git a/definitions/Definitions.cpp b/definitions/Definitions.cpp index ef2d0143..9b690c39 100644 --- a/definitions/Definitions.cpp +++ b/definitions/Definitions.cpp @@ -153,15 +153,6 @@ ENUM_CONVERSION_BEGIN(Exchange::IStream::state) { Exchange::IStream::state::Error, _TXT(_T("Error")) }, ENUM_CONVERSION_END(Exchange::IStream::state) -ENUM_CONVERSION_BEGIN(Exchange::IPower::PCState) - { Exchange::IPower::On, _TXT(_T("on")) }, - { Exchange::IPower::ActiveStandby, _TXT(_T("active")) }, - { Exchange::IPower::PassiveStandby, _TXT(_T("passive")) }, - { Exchange::IPower::SuspendToRAM, _TXT(_T("suspended")) }, - { Exchange::IPower::Hibernate, _TXT(_T("hibernate")) }, - { Exchange::IPower::PowerOff, _TXT(_T("off")) }, -ENUM_CONVERSION_END(Exchange::IPower::PCState) - ENUM_CONVERSION_BEGIN(Exchange::External::Metadata::protocol) { Exchange::External::Metadata::protocol::I2C, _TXT(_T("I2C")) }, { Exchange::External::Metadata::protocol::ONEWIRE, _TXT(_T("1W")) }, diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index 5c4f6f0b..52e9a202 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -45,7 +45,6 @@ - @@ -151,15 +150,25 @@ ClInclude ClInclude ClInclude - python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force - python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force - python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force - python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force $(ProjectDir)../interfaces/json/JTimeSync.h $(ProjectDir)../interfaces/json/JTimeSync.h $(ProjectDir)../interfaces/json/JTimeSync.h $(ProjectDir)../interfaces/json/JTimeSync.h + + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + $(ProjectDir)../interfaces/json/JPower.h + ClInclude + $(ProjectDir)../interfaces/json/JPower.h + ClInclude + $(ProjectDir)../interfaces/json/JPower.h + ClInclude + $(ProjectDir)../interfaces/json/JPower.h + ClInclude + ClInclude ClInclude @@ -378,9 +387,6 @@ Document - - Document - Document diff --git a/interfaces/IPower.h b/interfaces/IPower.h index 275faaee..34b7ab20 100644 --- a/interfaces/IPower.h +++ b/interfaces/IPower.h @@ -18,14 +18,19 @@ */ #pragma once + #include "Module.h" namespace Thunder { + namespace Exchange { + // @json 1.0.0 @text:legacy_lowercase struct EXTERNAL IPower : virtual public Core::IUnknown { + enum { ID = ID_POWER }; + // @text:keep enum PCState : uint8_t { On = 1, // S0. ActiveStandby = 2, // S1. @@ -40,19 +45,40 @@ namespace Exchange { After = 2 }; + // @event struct EXTERNAL INotification : virtual public Core::IUnknown { + enum { ID = ID_POWER_NOTIFICATION }; - virtual void StateChange(const PCState origin, const PCState destination, const PCPhase phase) = 0; + // @brief Signals a change in the power state + // @param origin: The state the device is transitioning from (e.g. ActiveStandby) + // @param destination: The state the device is transitioning to (e.g. SuspendToRAM) + // @param phase: The phase of the transition (e.g. After) + virtual Core::hresult StateChange(const PCState origin, const PCState destination, const PCPhase phase) = 0; }; - virtual void Register(IPower::INotification* sink) = 0; - virtual void Unregister(IPower::INotification* sink) = 0; + virtual Core::hresult Register(INotification* const sink) = 0; + virtual Core::hresult Unregister(const INotification* const sink) = 0; + + // @property + // @brief Get the current power state + // @param state: The current power state (e.g. PassiveStandby) + virtual Core::hresult GetState(PCState& state /* @out */) const = 0; - virtual PCState GetState() const = 0; - virtual uint32_t SetState(const PCState, const uint32_t) = 0; + // @brief Set the power state + // @param state: The power state to set (e.g. Hibernate) + // @param waitTime: The time to wait for the power state to be set in seconds (e.g. 10) + // @retval ERROR_GENERAL: General failure + // @retval ERROR_DUPLICATE_KEY: Trying to set the same power mode + // @retval ERROR_ILLEGAL_STATE: Power state is not supported + // @retval ERROR_BAD_REQUEST: Invalid Power state or Bad JSON param data format + virtual Core::hresult SetState(const PCState& state, const uint32_t waitTime) = 0; + + // @json:omit virtual void PowerKey() = 0; }; -} + +} // namespace Exchange + } diff --git a/jsonrpc/Power.json b/jsonrpc/Power.json deleted file mode 100644 index e94c6c03..00000000 --- a/jsonrpc/Power.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "Power API", - "class": "Power", - "description": "Power JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "definitions": { - "state":{ - "type": "string", - "enum": [ - "on", - "activestandby", - "passivestandby", - "suspendtoram", - "hibernate", - "poweroff" - ], - "enumvalues": [ - 1, - 2, - 3, - 4, - 5, - 6 - ], - "enumtyped": false, - "description": "Power state", - "example": "on" - }, - "power":{ - "type": "object", - "properties": { - "powerstate": { - "$ref": "#/definitions/state" - }, - "timeout": { - "description": "Time to wait for power state change", - "type": "number", - "size": 32, - "example": 0 - } - }, - "required": [ - "powerstate", - "timeout" - ] - } - }, - "properties": { - "state": { - "summary": "Power state", - "readonly": true, - "params": { - "$ref": "#/definitions/state" - } - } - }, - "methods": { - "set": { - "summary": "Sets power state", - "params": { - "$ref": "#/definitions/power" - }, - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "General failure", - "$ref": "#/common/errors/general" - }, - { - "description": "Trying to set the same power mode", - "$ref": "#/common/errors/duplicatekey" - }, - { - "description": "Power state is not supported", - "$ref": "#/common/errors/illegalstate" - }, - { - "description": "Invalid Power state or Bad JSON param data format", - "$ref": "#/common/errors/badrequest" - } - ] - } - } -} From 9ab6329811160ed8d1f0f93c58b22aafdf465986 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Fri, 11 Apr 2025 07:37:52 +0200 Subject: [PATCH 08/24] [IOConnector] Update with JSON-RPC interface (#426) * Make IOConnector interface and remove the old .json file * Make sure that the new interface builds on Windows * Add an example to a param * Revert "Make sure that the new interface builds on Windows" This reverts commit 9504a85cc7c0e9b93a787f4615d4fe7cbb14419d. * Adjust the Windows files * Index should be an int and not a string * Revert "Adjust the Windows files" This reverts commit e6c2e868ef1dca4137dde6c64d6e719a5ff516e4. * Adjust the Windows files after merging * Revert "Adjust the Windows files after merging" This reverts commit 6ae8b6e83040e910704a2f684c768e68bf5a0c7c. * Fix the Windows files to make sure it builds * Revert "Fix the Windows files to make sure it builds" This reverts commit b2f93c037b9f8abb04481fa9f41678cabf08bee8. * Make sure Windows has no conflicts --------- Co-authored-by: Pierre Wielders --- definitions/Definitions.vcxproj | 18 +- definitions/Definitions.vcxproj.filters | 9 +- interfaces/IIOConnector.h | 60 +++ interfaces/Ids.h | 9 +- interfaces/Interfaces.vcxproj | 1 + interfaces/Interfaces.vcxproj.filters | 565 ++++++------------------ jsonrpc/IOConnector.json | 61 --- 7 files changed, 222 insertions(+), 501 deletions(-) create mode 100644 interfaces/IIOConnector.h delete mode 100644 jsonrpc/IOConnector.json diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index 52e9a202..aa5b652b 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -35,7 +35,6 @@ - @@ -193,6 +192,20 @@ $(ProjectDir)../interfaces/json/JSystemCommands.h $(ProjectDir)../interfaces/json/JSystemCommands.h + + ClInclude + ClInclude + ClInclude + ClInclude + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + $(ProjectDir)../interfaces/json/JIOConnector.h + $(ProjectDir)../interfaces/json/JIOConnector.h + $(ProjectDir)../interfaces/json/JIOConnector.h + $(ProjectDir)../interfaces/json/JIOConnector.h + $(ProjectDir)../interfaces/json/JMath.h @@ -372,9 +385,6 @@ Document - - Document - Document diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index f5856505..54122634 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -52,9 +52,6 @@ Generated Files - - Generated Files - Generated Files @@ -221,9 +218,6 @@ JSON Files - - JSON Files - JSON Files @@ -263,6 +257,9 @@ Interface Files + + Interface Files + diff --git a/interfaces/IIOConnector.h b/interfaces/IIOConnector.h new file mode 100644 index 00000000..240f1cc9 --- /dev/null +++ b/interfaces/IIOConnector.h @@ -0,0 +1,60 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2021 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 { + + // @json 1.0.0 @text:legacy_lowercase + struct EXTERNAL IIOConnector : virtual public Core::IUnknown { + + enum { ID = ID_IOCONNECTOR }; + + // @event + struct EXTERNAL INotification : virtual public Core::IUnknown { + + enum { ID = ID_IOCONNECTOR_NOTIFICATION }; + + // @brief Notifies about GPIO pin activity + // @description Register to this event to be notified about pin value changes + // @param id: pin ID (e.g. 189) + // @param value: value of the pin (e.g. 1) + virtual void Activity(const uint16_t id /* @index */, const int32_t value) = 0; + }; + + virtual Core::hresult Register(const uint16_t id, INotification* const notification) = 0; + virtual Core::hresult Unregister(const uint16_t id, const INotification* const notification) = 0; + + // @property + // @brief GPIO pin value + // @param id: pin ID (e.g. 189) + // @param value: value of the pin (e.g. 1) + // @retval ERROR_UNKNOWN_KEY Unknown pin ID given + virtual Core::hresult Pin(const uint16_t id /* @index */, const int32_t value) = 0; + virtual Core::hresult Pin(const uint16_t id /* @index */, int32_t& value /* @out */) const = 0; + + }; + +} // namespace Exchange + +} diff --git a/interfaces/Ids.h b/interfaces/Ids.h index ca763406..f367d646 100644 --- a/interfaces/Ids.h +++ b/interfaces/Ids.h @@ -400,12 +400,15 @@ namespace Exchange { ID_DEVICEIDENTIFICATION = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x540, ID_SECURITYAGENT = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x550, - + ID_LOCATIONSYNC = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x560, ID_LOCATIONSYNC_NOTIFICATION = ID_LOCATIONSYNC + 1, - + ID_MEMORY_MONITOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x570, - ID_MEMORY_MONITOR_NOTIFICATION = ID_MEMORY_MONITOR + 1 + ID_MEMORY_MONITOR_NOTIFICATION = ID_MEMORY_MONITOR + 1, + + ID_IOCONNECTOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x580, + ID_IOCONNECTOR_NOTIFICATION = ID_IOCONNECTOR + 1 }; } } diff --git a/interfaces/Interfaces.vcxproj b/interfaces/Interfaces.vcxproj index fd1b924e..dd8d5522 100644 --- a/interfaces/Interfaces.vcxproj +++ b/interfaces/Interfaces.vcxproj @@ -125,6 +125,7 @@ + diff --git a/interfaces/Interfaces.vcxproj.filters b/interfaces/Interfaces.vcxproj.filters index 6e81a224..2b6fda8c 100644 --- a/interfaces/Interfaces.vcxproj.filters +++ b/interfaces/Interfaces.vcxproj.filters @@ -1,436 +1,147 @@  - - Source Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - {08108e2f-1ffd-48e0-89d9-23f5409dc0eb} - - - {4ee0c8e4-3ba3-4683-8c6f-23463d09d9d7} - - - {379b5f39-b7a5-466c-bd91-4f42b78a78bb} - - - {94509df5-c439-4303-be5b-8d14fd112d48} - - - - - Header Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Header Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Interface Files - - - Interface Files - - - Interface Files - - - Interface Files - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jsonrpc/IOConnector.json b/jsonrpc/IOConnector.json deleted file mode 100644 index 0a27fea3..00000000 --- a/jsonrpc/IOConnector.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "IO Connector API", - "class": "IOConnector", - "format": "uncompliant-extended", - "description": "IO Connector JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "definitions": { - "pinvalue": { - "type": "number", - "signed": true, - "description": "Value of the pin", - "example": "1" - } - }, - "properties": { - "pin": { - "summary": "GPIO pin value", - "events": [ - "activity" - ], - "index": { - "name": "pin ID", - "example": "189" - }, - "params": { - "$ref": "#/definitions/pinvalue" - }, - "errors": [ - { - "description": "Unknown pin ID given", - "$ref": "#/common/errors/unknownkey" - } - ] - } - }, - "events": { - "activity": { - "summary": "Notifies about GPIO pin activity", - "description": "Register to this event to be notified about pin value changes", - "id": { - "name": "pin ID", - "example": "189" - }, - "params": { - "type": "object", - "properties": { - "value": { - "$ref": "#/definitions/pinvalue" - } - } - } - } - } -} From 795557f64dc494f50fd3183802c897e236a4bb74 Mon Sep 17 00:00:00 2001 From: Bram Oosterhuis Date: Mon, 14 Apr 2025 14:51:00 +0200 Subject: [PATCH 09/24] Remove ICompositionBuffer interface definition in favour of IGraphicsBuffer --- interfaces/ICompositionBuffer.h | 105 -------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 interfaces/ICompositionBuffer.h diff --git a/interfaces/ICompositionBuffer.h b/interfaces/ICompositionBuffer.h deleted file mode 100644 index e7d42ec8..00000000 --- a/interfaces/ICompositionBuffer.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * If not stated otherwise in this file or this component's LICENSE file the - * following copyright and licenses apply: - * - * Copyright 2020 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 { - - // The ICompositionBuffer is an interface definition to communicate across - // process boundaries between two actors, the Client and the Compositor. - // Client: Producing content in the buffer - // Compositor: Consuming the content (move to another Buffer) - // - // From a Client perspective: - // 1) ICompositionBuffer::Acquire(50) - // Locks the planes so the Compositor can not and will not use this - // buffer in the process of creating a new composition. - // 2) IIterator::Plane::Accessor() - // Write anything the client likes onto the buffer - // 3) ICompositionBuffer::Relinquish() - // Unlock the planes, the Compositor can use/consume what is on the - // buffer and move it to wherever the compositor likes. - // - // From a Compositor perspective: - // 1) a screen update is requested, iterate over all Buffers available - // in the Compositor and call ICompositionBuffer::Acquire(0), no need - // to wait cause if the producer (Client) is working on the buffer we - // do not want to consume it. - // 2) IIterator::Plane::Accessor() - // Read anything from the buffer the client has written on it and move it - // to a new buffer. - // 3) ICompositionBuffer::Relinquish() - // Unlock the planes, the Client can use/produce new contents on the - // buffer. The content how it was is now copied to a new location. - - // NOTE: - // -------------------------------------------------------------------------- - // This is delibratly *NOT* a COMRPC interface as the communication and the - // exchange over the process boundaries must be done with OS native features - // to enforce the best performance! - - // @stubgen:omit - struct EXTERNAL ICompositionBuffer { - virtual ~ICompositionBuffer() = default; - - /** - * @brief frame buffer interface with hardware optimisation in mind - */ - enum DataType : uint8_t { - TYPE_INVALID = 0x00, // Invalid buffer - TYPE_DMA = 0x01, // DMA buffer - TYPE_RAW = 0x02 // Raw buffer - }; - - struct IIterator { - virtual ~IIterator() = default; - - virtual bool IsValid() const = 0; - virtual void Reset() = 0; - virtual bool Next() = 0; - - virtual int Descriptor() const = 0; // Access to the actual data. - - virtual uint32_t Stride() const = 0; // Bytes per row for a plane [(bit-per-pixel/8) * width] - virtual uint32_t Offset() const = 0; // Offset of the plane from where the pixel data starts in the buffer. - }; - - // Acquire (lock) the planes (Compositor or Client), the - // other user (Client or Compositor) of this object (process - // agnostic) can now not access the planes, they have to - // wait till they become availabe again..... - virtual IIterator* Acquire(const uint32_t timeoutMs) = 0; - // Relinquish (unlock) the Planes. End lifetime of the IIterator - // received from Planes() - virtual void Relinquish() = 0; - - virtual uint32_t Width() const = 0; // Width of the allocated buffer in pixels - virtual uint32_t Height() const = 0; // Height of the allocated buffer in pixels - virtual uint32_t Format() const = 0; // Layout of a pixel according the fourcc format - virtual uint64_t Modifier() const = 0; // Pixel arrangement in the buffer, used to optimize for hardware - - virtual DataType Type() const = 0; - }; // struct IPlainBuffer - -} // namespace Exchange - -} // namespace Thunder From 0ff3793fbf74960e2effc8a7bace9ee9ecdc2aea Mon Sep 17 00:00:00 2001 From: Volkan Date: Tue, 22 Apr 2025 10:56:02 +0200 Subject: [PATCH 10/24] Missing param names are added! --- interfaces/ISecurityAgent.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/ISecurityAgent.h b/interfaces/ISecurityAgent.h index be9b04dd..3bc12283 100644 --- a/interfaces/ISecurityAgent.h +++ b/interfaces/ISecurityAgent.h @@ -32,11 +32,11 @@ namespace Exchange { // @brief Validates a token // @description Checks whether the token is valid and properly signed - // @param Token that will be validated (e.g. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9) - // @param Tells whether token's signature is correct + // @param token Token that will be validated (e.g. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9) + // @param valid Tells whether token's signature is correct virtual Core::hresult Validate(const string& token, bool& valid /* @out */) const = 0; }; } // namespace Exchange -} \ No newline at end of file +} From cb7f52142094eb8a5d116f625904c027288604b1 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Fri, 16 May 2025 09:28:57 +0200 Subject: [PATCH 11/24] Automatically remove the generated files during Clean in Visual Studio (#439) --- interfaces/Interfaces.vcxproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/interfaces/Interfaces.vcxproj b/interfaces/Interfaces.vcxproj index dd8d5522..d06c74a7 100644 --- a/interfaces/Interfaces.vcxproj +++ b/interfaces/Interfaces.vcxproj @@ -387,4 +387,13 @@ + + + + + + + + + \ No newline at end of file From d952300df81e43f15e53927373c662445b28c60c Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 22 May 2025 08:12:42 +0200 Subject: [PATCH 12/24] [ISubsystemControl] Update with JSON-RPC interface (#441) * Create a json-rpc compatible interface * Remove Deactivate completely as it is no longer allowed to disable a subsystem * Adjust the Windows files --- definitions/Definitions.vcxproj | 17 +++++- definitions/Definitions.vcxproj.filters | 13 ++--- interfaces/ISubsystemControl.h | 46 +++++++++++++++ interfaces/Ids.h | 4 +- interfaces/Interfaces.vcxproj | 1 + interfaces/Interfaces.vcxproj.filters | 1 + jsonrpc/SubsystemControl.json | 76 ------------------------- 7 files changed, 69 insertions(+), 89 deletions(-) create mode 100644 interfaces/ISubsystemControl.h delete mode 100644 jsonrpc/SubsystemControl.json diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index aa5b652b..4fff291e 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -206,6 +206,20 @@ $(ProjectDir)../interfaces/json/JIOConnector.h $(ProjectDir)../interfaces/json/JIOConnector.h + + ClInclude + ClInclude + ClInclude + ClInclude + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + $(ProjectDir)../interfaces/json/JSubsystemControl.h + $(ProjectDir)../interfaces/json/JSubsystemControl.h + $(ProjectDir)../interfaces/json/JSubsystemControl.h + $(ProjectDir)../interfaces/json/JSubsystemControl.h + $(ProjectDir)../interfaces/json/JMath.h @@ -412,9 +426,6 @@ Document - - Document - diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index 54122634..88e26df6 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -79,9 +79,6 @@ Generated Files - - Generated Files - Generated Files @@ -230,9 +227,6 @@ JSON Files - - JSON Files - JSON Files @@ -248,9 +242,6 @@ JSON Files - - JSON Files - Interface Files @@ -260,6 +251,10 @@ Interface Files + + + Interface Files + diff --git a/interfaces/ISubsystemControl.h b/interfaces/ISubsystemControl.h new file mode 100644 index 00000000..49154479 --- /dev/null +++ b/interfaces/ISubsystemControl.h @@ -0,0 +1,46 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply: +* +* Copyright 2021 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" + +// @stubgen:include + +namespace Thunder { + +namespace Exchange { + + // @json 1.0.0 @text:legacy_lowercase + struct EXTERNAL ISubsystemControl : virtual public Core::IUnknown { + + enum { ID = ID_SUBSYSTEM_CONTROL }; + + // @brief Activates a subsystem + // @description This method allows a subsystem to be activated from the outside. This is usefull in case Thunder can not determine the availability of a subsystem but it needs to be triggered from the outside. + // @param subsystem: Subsystem to activate (e.g. network) + // @param configuration: A JSON string that holds the information applicable to the subsystem to be activated + // @retval ERROR_BAD_REQUEST: Setting a subsystem to disabled is not supported + virtual Core::hresult Activate(const PluginHost::ISubSystem::subsystem subsystem, const Core::OptionalType& configuration /* @opaque */) = 0; + + }; + +} // namespace Exchange + +} \ No newline at end of file diff --git a/interfaces/Ids.h b/interfaces/Ids.h index f367d646..ccf72f16 100644 --- a/interfaces/Ids.h +++ b/interfaces/Ids.h @@ -408,7 +408,9 @@ namespace Exchange { ID_MEMORY_MONITOR_NOTIFICATION = ID_MEMORY_MONITOR + 1, ID_IOCONNECTOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x580, - ID_IOCONNECTOR_NOTIFICATION = ID_IOCONNECTOR + 1 + ID_IOCONNECTOR_NOTIFICATION = ID_IOCONNECTOR + 1, + + ID_SUBSYSTEM_CONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x590 }; } } diff --git a/interfaces/Interfaces.vcxproj b/interfaces/Interfaces.vcxproj index d06c74a7..9b13b63a 100644 --- a/interfaces/Interfaces.vcxproj +++ b/interfaces/Interfaces.vcxproj @@ -151,6 +151,7 @@ + diff --git a/interfaces/Interfaces.vcxproj.filters b/interfaces/Interfaces.vcxproj.filters index 2b6fda8c..46169342 100644 --- a/interfaces/Interfaces.vcxproj.filters +++ b/interfaces/Interfaces.vcxproj.filters @@ -142,6 +142,7 @@ + diff --git a/jsonrpc/SubsystemControl.json b/jsonrpc/SubsystemControl.json deleted file mode 100644 index e3d28961..00000000 --- a/jsonrpc/SubsystemControl.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "Subsystem Control API", - "class": "SubsystemControl", - "format": "uncompliant-collapsed", - "description": "SubsystemControl JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "definitions": { - "subsystem": { - "type": "string", - "enum": [ - "platform", - "network", - "internet", - "time", - "security", - "location", - "identifier", - "provisioning", - "decryption", - "bluetooth", - "websource", - "graphics", - "streaming", - "cryptography", - "installation" - ], - "description": "The subsystem that needs to be controller", - "example": "network" - } - }, - "methods": { - "activate": { - "summary": "Activates a subsystem", - "description": "This method allows a subsystem to be activated from the outside. This is usefull in case Thunder can not determine the availability of a subsystem but it needs to be triggered from the outside.", - "params": { - "type": "object", - "properties": { - "system": { - "description": "Subsystem to activate", - "$ref": "#/definitions/subsystem" - }, - "configuration": { - "type": "string", - "description": "A JSON string that holds the information applicable to the subsystem to be activated" - } - }, - "required": [ - "system" - ] - }, - "result": { - "type": "number", - "description": "The result of the activating anythin unequal to 0 means somthing failed", - "size": 32 - } - }, - "deactivate": { - "summary": "Deactivates a subsystem", - "description": "This method allows a subsystem to be deactivated from the outside. This is usefull in case Thunder can not determine the availability of a subsystem but it needs to be triggered from the outside.", - "params": { - "description": "Subsystem to deactivate", - "$ref": "#/definitions/subsystem" - }, - "result": { - "$ref": "#/common/results/void" - } - } - } -} From 9b1a233daf06f6235c5f4af9214e04d6815dd2ca Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Thu, 29 May 2025 18:21:29 +0300 Subject: [PATCH 13/24] DELIA-68186 : Update interface to have closeSessionResponse parameter Reason for change: align with the HLA Test Procedure: None Risks: None Signed-off-by: Nikita Poltorapavlo --- interfaces/IContentProtection.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interfaces/IContentProtection.h b/interfaces/IContentProtection.h index 44068b6c..9f9efea5 100644 --- a/interfaces/IContentProtection.h +++ b/interfaces/IContentProtection.h @@ -112,8 +112,10 @@ namespace Exchange { // @alt closeDrmSession // @param sessionId sec manager generated playback session id + // @param response video platform specific response data virtual uint32_t CloseDrmSession( - uint32_t sessionId /* @text:sessionId */) + uint32_t sessionId /* @text:sessionId */, + string& response /* @text:closeSessionResponse @out */) = 0; // @alt showWatermark From f95a4958b6c83608cb7f49dc50e15932e0fbc0d7 Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Thu, 22 May 2025 15:46:29 +0300 Subject: [PATCH 14/24] DELIA-68125 : Update interface to have representative examples Reason for change: Update the thunder documentation for content protection service Test Procedure: None Risks: None Signed-off-by: Nikita Poltorapavlo --- interfaces/IContentProtection.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/interfaces/IContentProtection.h b/interfaces/IContentProtection.h index 9f9efea5..0bfe2c53 100644 --- a/interfaces/IContentProtection.h +++ b/interfaces/IContentProtection.h @@ -55,14 +55,17 @@ namespace Exchange { FAILED = 4 /* @text:FAILED */, }; + // (e.g. NOT_REQUIRED) State state; - // @brief same as that returned by the SecManager + // @brief same as that returned by the SecManager. + // For other cases greater than 20000 (e.g. 2) // @text failureReason int32_t failureReason; }; // @alt onWatermarkStatusChanged // @param sessionId session id for the content protection session + // (e.g. 930762523) // @param appId application that should receive the notification virtual void WatermarkStatusChanged( uint32_t sessionId /* @text:sessionId */, @@ -76,23 +79,29 @@ namespace Exchange { // @alt openDrmSession // @param clientId client that establishes the playback session + // (e.g. "com.comcast.vipa:1") // @param appId application requesting the new watermarking session // @param licenseRequest base64-encoded DRM license request // @param initData video platform specific init data + // (e.g. "{\"sessionConfiguration\":{\"distributedTraceId\":\"...\"},\"accessToken\":\"...\",\"contentMetadata\":\"...\"}") // @param sessionId generated by SecManager to track sessions + // (e.g. 930762523) // @param response video platform specific response data + // (e.g. "{\"license\":\"...\",\"refreshDuration\":0}") virtual uint32_t OpenDrmSession( const string& clientId /* @text:clientId */, const string& appId /* @text:appId */, KeySystem keySystem /* @text:keySystem */, const string& licenseRequest /* @text:licenseRequest */, - const string& initData /* @text:initData @opaque */, + const string& initData /* @text:initData */, uint32_t& sessionId /* @text:sessionId @out */, - string& response /* @text:openSessionResponse @opaque @out */) + string& response /* @text:openSessionResponse @out */) = 0; // @alt setDrmSessionState // @param sessionId sec manager generated playback session id + // (e.g. 930762523) + // @retval ERROR_ILLEGAL_STATE Invalid sessionId virtual uint32_t SetDrmSessionState( uint32_t sessionId /* @text:sessionId */, State sessionState /* @text:sessionState */) @@ -100,19 +109,25 @@ namespace Exchange { // @alt updateDrmSession // @param sessionId sec manager generated playback session id + // (e.g. 930762523) // @param licenseRequest base64-encoded DRM license request // @param initData video platform specific init data + // (e.g. "{\"sessionConfiguration\":{\"distributedTraceId\":\"...\"},\"accessToken\":\"...\",\"contentMetadata\":\"...\"}") // @param response video platform specific response data + // (e.g. "{\"license\":\"...\",\"refreshDuration\":0}") + // @retval ERROR_ILLEGAL_STATE Invalid sessionId virtual uint32_t UpdateDrmSession( uint32_t sessionId /* @text:sessionId */, const string& licenseRequest /* @text:licenseRequest */, - const string& initData /* @text:initData @opaque */, - string& response /* @text:updateSessionResponse @opaque @out */) + const string& initData /* @text:initData */, + string& response /* @text:updateSessionResponse @out */) = 0; // @alt closeDrmSession // @param sessionId sec manager generated playback session id + // (e.g. 930762523) // @param response video platform specific response data + // @retval ERROR_ILLEGAL_STATE Invalid sessionId virtual uint32_t CloseDrmSession( uint32_t sessionId /* @text:sessionId */, string& response /* @text:closeSessionResponse @out */) @@ -120,6 +135,7 @@ namespace Exchange { // @alt showWatermark // @param sessionId id returned on a call to openDrmSession + // (e.g. 930762523) // @param show true when watermark has to be presented virtual uint32_t ShowWatermark( uint32_t sessionId /* @text:sessionId */, @@ -129,6 +145,7 @@ namespace Exchange { // @alt setPlaybackPosition // @param sessionId sec manager generated playback session id + // (e.g. 930762523) // @param speed current playback speed // @param position current playback position virtual uint32_t SetPlaybackPosition( From eaffb6e8e6878d33bf58e3fb0753f48eab07c794 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:23:38 +0200 Subject: [PATCH 15/24] Make the IPower interface backwards compatible (#447) --- interfaces/IPower.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interfaces/IPower.h b/interfaces/IPower.h index 34b7ab20..d6cefaba 100644 --- a/interfaces/IPower.h +++ b/interfaces/IPower.h @@ -61,11 +61,13 @@ namespace Exchange { virtual Core::hresult Unregister(const INotification* const sink) = 0; // @property + // @alt:deprecated state // @brief Get the current power state // @param state: The current power state (e.g. PassiveStandby) virtual Core::hresult GetState(PCState& state /* @out */) const = 0; // @brief Set the power state + // @alt:deprecated set // @param state: The power state to set (e.g. Hibernate) // @param waitTime: The time to wait for the power state to be set in seconds (e.g. 10) // @retval ERROR_GENERAL: General failure From 6c73c1efcbfe1084c3da32caa55eb050227b7115 Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Wed, 18 Jun 2025 16:16:07 +0300 Subject: [PATCH 16/24] DELIA-68254 : Update the interface for handling the specified errors (#446) Reason for change: Update the thunder documentation for content protection service Test Procedure: None Risks: None Signed-off-by: Nikita Poltorapavlo Co-authored-by: Anand Kandasamy <37086488+anand-ky@users.noreply.github.com> --- interfaces/IContentProtection.h | 48 ++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/interfaces/IContentProtection.h b/interfaces/IContentProtection.h index 0bfe2c53..720aa323 100644 --- a/interfaces/IContentProtection.h +++ b/interfaces/IContentProtection.h @@ -88,6 +88,27 @@ namespace Exchange { // (e.g. 930762523) // @param response video platform specific response data // (e.g. "{\"license\":\"...\",\"refreshDuration\":0}") + // @retval 21003 Invalid key system + // @retval 21004 Invalid license request + // @retval 21005 Invalid content metadata + // @retval 21006 Invalid media usage + // @retval 21007 Invalid access token + // @retval 21008 Invalid access attributes + // @retval 21009 Invalid session id + // @retval 21012 Invalid client id + // @retval 21014 Invalid watermarking system + // @retval 21015 Invalid content attributes + // @retval 22001 DRM general failure + // @retval 22003 DRM license timeout + // @retval 22004 DRM license network failure + // @retval 22008 DRM access token expired + // @retval 22011 DRM MAC token not provisioned + // @retval 22012 DRM memory allocation error + // @retval 22013 DRM SecAPI usage failure + // @retval 22016 DRM entitlement error + // @retval 23001 Watermark general failure + // @retval 23003 Watermark request timeout + // @retval 23012 Watermark memory allocation error virtual uint32_t OpenDrmSession( const string& clientId /* @text:clientId */, const string& appId /* @text:appId */, @@ -101,7 +122,7 @@ namespace Exchange { // @alt setDrmSessionState // @param sessionId sec manager generated playback session id // (e.g. 930762523) - // @retval ERROR_ILLEGAL_STATE Invalid sessionId + // @retval 21009 Invalid session id virtual uint32_t SetDrmSessionState( uint32_t sessionId /* @text:sessionId */, State sessionState /* @text:sessionState */) @@ -115,7 +136,27 @@ namespace Exchange { // (e.g. "{\"sessionConfiguration\":{\"distributedTraceId\":\"...\"},\"accessToken\":\"...\",\"contentMetadata\":\"...\"}") // @param response video platform specific response data // (e.g. "{\"license\":\"...\",\"refreshDuration\":0}") - // @retval ERROR_ILLEGAL_STATE Invalid sessionId + // @retval 21003 Invalid key system + // @retval 21004 Invalid license request + // @retval 21005 Invalid content metadata + // @retval 21006 Invalid media usage + // @retval 21007 Invalid access token + // @retval 21008 Invalid access attributes + // @retval 21009 Invalid session id + // @retval 21012 Invalid client id + // @retval 21014 Invalid watermarking system + // @retval 21015 Invalid content attributes + // @retval 22001 DRM general failure + // @retval 22003 DRM license timeout + // @retval 22004 DRM license network failure + // @retval 22008 DRM access token expired + // @retval 22011 DRM MAC token not provisioned + // @retval 22012 DRM memory allocation error + // @retval 22013 DRM SecAPI usage failure + // @retval 22016 DRM entitlement error + // @retval 23001 Watermark general failure + // @retval 23003 Watermark request timeout + // @retval 23012 Watermark memory allocation error virtual uint32_t UpdateDrmSession( uint32_t sessionId /* @text:sessionId */, const string& licenseRequest /* @text:licenseRequest */, @@ -127,7 +168,8 @@ namespace Exchange { // @param sessionId sec manager generated playback session id // (e.g. 930762523) // @param response video platform specific response data - // @retval ERROR_ILLEGAL_STATE Invalid sessionId + // @retval 21009 Invalid session id + // @retval 21012 Invalid client id virtual uint32_t CloseDrmSession( uint32_t sessionId /* @text:sessionId */, string& response /* @text:closeSessionResponse @out */) From f54adedb28e39c78dde864bc46a168c4df2d3562 Mon Sep 17 00:00:00 2001 From: sebaszm Date: Tue, 1 Jul 2025 10:56:19 +0200 Subject: [PATCH 17/24] Add stubgen includes --- interfaces/IButler.h | 2 +- interfaces/IContentDecryption.h | 2 ++ interfaces/IInputSwitch.h | 2 ++ interfaces/IProvisioning.h | 2 ++ interfaces/IStream.h | 2 ++ interfaces/ITextToSpeech.h | 2 ++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/interfaces/IButler.h b/interfaces/IButler.h index c530a6e6..e600c165 100644 --- a/interfaces/IButler.h +++ b/interfaces/IButler.h @@ -23,7 +23,7 @@ #include #include -// @stubgen:include +// @stubgen:include namespace Thunder { namespace Exchange { diff --git a/interfaces/IContentDecryption.h b/interfaces/IContentDecryption.h index 9c2b7b49..6ca1b509 100644 --- a/interfaces/IContentDecryption.h +++ b/interfaces/IContentDecryption.h @@ -22,6 +22,8 @@ #include "Module.h" #include "IDRM.h" +// @insert + namespace Thunder { namespace Exchange { diff --git a/interfaces/IInputSwitch.h b/interfaces/IInputSwitch.h index e9aa3e91..c48df090 100644 --- a/interfaces/IInputSwitch.h +++ b/interfaces/IInputSwitch.h @@ -20,6 +20,8 @@ #pragma once #include "Module.h" +// @insert + namespace Thunder { namespace Exchange { diff --git a/interfaces/IProvisioning.h b/interfaces/IProvisioning.h index fda20c40..4c86af7c 100644 --- a/interfaces/IProvisioning.h +++ b/interfaces/IProvisioning.h @@ -20,6 +20,8 @@ #pragma once #include "Module.h" +// @insert + namespace Thunder { namespace Exchange { diff --git a/interfaces/IStream.h b/interfaces/IStream.h index 37df8030..915c82d4 100644 --- a/interfaces/IStream.h +++ b/interfaces/IStream.h @@ -20,6 +20,8 @@ #pragma once #include "Module.h" +// @insert + #define WPEPLAYER_PROCESS_NODE_ID "/tmp/player" namespace Thunder { diff --git a/interfaces/ITextToSpeech.h b/interfaces/ITextToSpeech.h index 3768af21..c509d0be 100644 --- a/interfaces/ITextToSpeech.h +++ b/interfaces/ITextToSpeech.h @@ -1,6 +1,8 @@ #ifndef __ITEXTTOSPEECH_H #define __ITEXTTOSPEECH_H +// @insert + #include "Module.h" namespace Thunder { From 3b15bb3431be278795d8e625f2b7c5186be2f06b Mon Sep 17 00:00:00 2001 From: MFransen69 <39826971+MFransen69@users.noreply.github.com> Date: Tue, 1 Jul 2025 15:18:21 +0200 Subject: [PATCH 18/24] introduce PluginAsyncStateControl interface (#450) * [PluginInitializerServcice] add interface * [PluginAsyncStateControl] add error code documentation * [PluginAsyncStateControl] more comments --- definitions/Definitions.cpp | 1 + definitions/Definitions.vcxproj | 5 + definitions/Definitions.vcxproj.filters | 3 + interfaces/IPluginAsyncStateControl.h | 64 ++++++++ interfaces/Ids.h | 199 ++++++++++++------------ interfaces/Interfaces.vcxproj | 10 +- interfaces/Interfaces.vcxproj.filters | 2 + 7 files changed, 183 insertions(+), 101 deletions(-) create mode 100644 interfaces/IPluginAsyncStateControl.h diff --git a/definitions/Definitions.cpp b/definitions/Definitions.cpp index 9b690c39..1410442c 100644 --- a/definitions/Definitions.cpp +++ b/definitions/Definitions.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index 4fff291e..1f3f6a24 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -220,6 +220,11 @@ $(ProjectDir)../interfaces/json/JSubsystemControl.h $(ProjectDir)../interfaces/json/JSubsystemControl.h + + $(ProjectDir)../interfaces/json/JPluginAsyncStateControl.h + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + ClInclude + $(ProjectDir)../interfaces/json/JMath.h diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index 88e26df6..b7cf283f 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -255,6 +255,9 @@ Interface Files + + Interface Files + diff --git a/interfaces/IPluginAsyncStateControl.h b/interfaces/IPluginAsyncStateControl.h new file mode 100644 index 00000000..72826db1 --- /dev/null +++ b/interfaces/IPluginAsyncStateControl.h @@ -0,0 +1,64 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2025 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 { + + struct EXTERNAL IPluginAsyncStateControl : virtual public Core::IUnknown { + + enum { ID = ID_PLUGINASYNCSTATECONTROL }; + + ~IPluginAsyncStateControl() override = default; + + struct EXTERNAL IActivationCallback : virtual public Core::IUnknown { + enum { ID = ID_PLUGINASYNCSTATECONTROL_ACTIVATIONCALLBACK }; + ~IActivationCallback() override = default; + + enum class state : uint8_t { + SUCCESS, + FAILURE, + ABORTED + }; + + // @brief callback called when an activation request has finished. Note this can be called while the Activate call has not yet returned + // @param state result state of the activation request (ABORTED when AbortActivate was called AND the plugin did not reach activated state yet before the request was aborted, otherwise SUCCESS will be reported as a result of an AbortActivate request) + // @param numberofretries Number of retries that happened the moment this callback was called + virtual void Finished(const string& callsign, const state state, const uint8_t numberofretries) = 0; + }; + + // @brief Activate a plugin. Passed callbcak will be called on failure or success + // @param callsign: callsign of plugin to activate + // @param maxnumberretries: maximum number of retries to initialize the plugin (default used when not specified) + // @param delay: delay to be used (in ms) between initialization retries (default used when not specified) + // @param cb: callback interface called on success or failure + // @retval ERROR_INPROGRESS Activation request is already in progress for this callsign + // @retval ERROR_ILLEGAL_STATE Plugin with this callsign is in an invalid state for it to be able to be started (e.g. DESTROYED or UNAVAILABLE) + // @retval ERROR_NOT_EXIST Plugin is unknown to Thunder (at this moment in case of Dynamic plugins) + virtual Core::hresult Activate(const string& callsign, const Core::OptionalType& maxnumberretries, const Core::OptionalType& delay, IActivationCallback* const cb) = 0; + + // @brief Abort a previously started Activate request + // @retval ERROR_NOT_EXIST There is no ongoing activation request + virtual Core::hresult AbortActivate(const string& callsign) = 0; + + }; +} +} diff --git a/interfaces/Ids.h b/interfaces/Ids.h index ccf72f16..3ff8beb2 100644 --- a/interfaces/Ids.h +++ b/interfaces/Ids.h @@ -314,103 +314,108 @@ namespace Exchange { ID_STORE = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x440, ID_STORE_NOTIFICATION = ID_STORE + 1, - ID_STORE_CACHE = ID_STORE + 2, - ID_STORE2 = ID_STORE + 3, - ID_STORE2_NOTIFICATION = ID_STORE + 4, - ID_STORE_INSPECTOR = ID_STORE + 5, - ID_STORE_INSPECTOR_NAMESPACE_SIZE_ITERATOR = ID_STORE + 6, - ID_STORE_LIMIT = ID_STORE + 7, - - ID_LISA = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x450, - ID_LISA_NOTIFICATION = ID_LISA + 1, - ID_LISA_APP_VERSION = ID_LISA + 2, - ID_LISA_APP_VERSION_ITERATOR = ID_LISA + 3, - ID_LISA_APP = ID_LISA + 4, - ID_LISA_APP_ITERATOR = ID_LISA + 5, - ID_LISA_APPS_PAYLOAD = ID_LISA + 6, - ID_LISA_STORAGE = ID_LISA + 7, - ID_LISA_STORAGE_PAYLOAD = ID_LISA + 8, - ID_LISA_PROGRESS = ID_LISA + 9, - ID_LISA_KEY_VALUE = ID_LISA + 10, - ID_LISA_KEY_VALUE_ITERATOR = ID_LISA + 11, - ID_LISA_METADATA_PAYLOAD = ID_LISA + 12, - ID_LISA_LOCK_INFO = ID_LISA + 13, - ID_LISA_HANDLE_RESULT = ID_LISA + 14, - - ID_PACKAGEMANAGER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x460, - ID_PACKAGEMANAGER_KEY_VALUE_ITERATOR = ID_PACKAGEMANAGER + 1, - ID_PACKAGEMANAGER_NOTIFICATION = ID_PACKAGEMANAGER + 2, - ID_PACKAGEMANAGER_PACKAGE_KEY_ITERATOR = ID_PACKAGEMANAGER + 3, - ID_PACKAGEMANAGER_BROKER = ID_PACKAGEMANAGER + 4, - ID_PACKAGEMANAGER_CALLBACK = ID_PACKAGEMANAGER + 5, - - ID_RUST_BRIDGE = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x470, - ID_RUST_BRIDGE_NOTIFICATION = ID_RUST_BRIDGE + 1, - - ID_WIFICONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x480, - ID_WIFICONTROL_NOTIFICATION = ID_WIFICONTROL + 1, - ID_WIFICONTROL_NETWORK_INFO_ITERATOR = ID_WIFICONTROL + 2, - ID_WIFICONTROL_SECURITY_INFO_ITERATOR = ID_WIFICONTROL + 3, - - ID_NETWORKCONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x490, - ID_NETWORKCONTROL_NOTIFICATION = ID_NETWORKCONTROL + 1, - ID_NETWORKCONTROL_NETWORK_INFO_ITERATOR = ID_NETWORKCONTROL + 2, - - ID_WATCHDOG = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4A0, - - ID_SCRIPT_ENGINE = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4B0, - ID_SCRIPT_ENGINE_NOTIFICATION = ID_SCRIPT_ENGINE + 1, - - ID_TEXT_TO_SPEECH = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4C0, - ID_TEXT_TO_SPEECH_NOTIFICATION = ID_TEXT_TO_SPEECH + 1, - - ID_CRYPTOGRAPHY = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4D0, - ID_CRYPTOGRAPHY_VAULT = ID_CRYPTOGRAPHY + 1, - ID_CRYPTOGRAPHY_HASH = ID_CRYPTOGRAPHY + 2, - ID_CRYPTOGRAPHY_CIPHER = ID_CRYPTOGRAPHY + 3, - ID_CRYPTOGRAPHY_DIFFIEHELLMAN = ID_CRYPTOGRAPHY + 4, - ID_CRYPTOGRAPHY_PERSISTENT = ID_CRYPTOGRAPHY + 5, - ID_CRYPTOGRAPHY_RANDOM = ID_CRYPTOGRAPHY + 6, - ID_CRYPTOGRAPHY_DEVICEOBJECTS = ID_CRYPTOGRAPHY + 7, - - ID_DNS_SERVER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4E0, - ID_DNS_ZONE = ID_DNS_SERVER + 1, - ID_DNS_RECORD = ID_DNS_SERVER + 2, - - ID_USB_HUB = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4F0, - ID_USB_HUB_NOTIFICATION = ID_USB_HUB + 1, - ID_USB_DEVICE = ID_USB_HUB + 2, - - ID_TESTAUTOMATIONMEMORY = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x9F0, - ID_TESTAUTOMATIONCOMRPC = ID_TESTAUTOMATIONMEMORY + 1, - ID_TESTAUTOMATIONCOMRPCINTERNAL = ID_TESTAUTOMATIONMEMORY + 2, - - ID_CONTENTPROTECTION = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x500, - ID_CONTENTPROTECTION_NOTIFICATION = ID_CONTENTPROTECTION + 1, - - ID_WATERMARK = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x510, - ID_WATERMARK_NOTIFICATION = ID_WATERMARK + 2, - - ID_SYSTEMAUDIOPLAYER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x520, - ID_SYSTEMAUDIOPLAYER_NOTIFICATION = ID_SYSTEMAUDIOPLAYER + 1, - - ID_BLUETOOTHREMOTECONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x530, - ID_BLUETOOTHREMOTECONTROL_NOTIFICATION = ID_BLUETOOTHREMOTECONTROL + 1, - - ID_DEVICEIDENTIFICATION = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x540, - - ID_SECURITYAGENT = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x550, - - ID_LOCATIONSYNC = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x560, - ID_LOCATIONSYNC_NOTIFICATION = ID_LOCATIONSYNC + 1, - - ID_MEMORY_MONITOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x570, - ID_MEMORY_MONITOR_NOTIFICATION = ID_MEMORY_MONITOR + 1, - - ID_IOCONNECTOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x580, - ID_IOCONNECTOR_NOTIFICATION = ID_IOCONNECTOR + 1, - - ID_SUBSYSTEM_CONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x590 + ID_STORE_CACHE = ID_STORE + 2, + ID_STORE2 = ID_STORE + 3, + ID_STORE2_NOTIFICATION = ID_STORE + 4, + ID_STORE_INSPECTOR = ID_STORE + 5, + ID_STORE_INSPECTOR_NAMESPACE_SIZE_ITERATOR = ID_STORE + 6, + ID_STORE_LIMIT = ID_STORE + 7, + + ID_LISA = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x450, + ID_LISA_NOTIFICATION = ID_LISA + 1, + ID_LISA_APP_VERSION = ID_LISA + 2, + ID_LISA_APP_VERSION_ITERATOR = ID_LISA + 3, + ID_LISA_APP = ID_LISA + 4, + ID_LISA_APP_ITERATOR = ID_LISA + 5, + ID_LISA_APPS_PAYLOAD = ID_LISA + 6, + ID_LISA_STORAGE = ID_LISA + 7, + ID_LISA_STORAGE_PAYLOAD = ID_LISA + 8, + ID_LISA_PROGRESS = ID_LISA + 9, + ID_LISA_KEY_VALUE = ID_LISA + 10, + ID_LISA_KEY_VALUE_ITERATOR = ID_LISA + 11, + ID_LISA_METADATA_PAYLOAD = ID_LISA + 12, + ID_LISA_LOCK_INFO = ID_LISA + 13, + ID_LISA_HANDLE_RESULT = ID_LISA + 14, + + ID_PACKAGEMANAGER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x460, + ID_PACKAGEMANAGER_KEY_VALUE_ITERATOR = ID_PACKAGEMANAGER + 1, + ID_PACKAGEMANAGER_NOTIFICATION = ID_PACKAGEMANAGER + 2, + ID_PACKAGEMANAGER_PACKAGE_KEY_ITERATOR = ID_PACKAGEMANAGER + 3, + ID_PACKAGEMANAGER_BROKER = ID_PACKAGEMANAGER + 4, + ID_PACKAGEMANAGER_CALLBACK = ID_PACKAGEMANAGER + 5, + + ID_RUST_BRIDGE = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x470, + ID_RUST_BRIDGE_NOTIFICATION = ID_RUST_BRIDGE + 1, + + ID_WIFICONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x480, + ID_WIFICONTROL_NOTIFICATION = ID_WIFICONTROL + 1, + ID_WIFICONTROL_NETWORK_INFO_ITERATOR = ID_WIFICONTROL + 2, + ID_WIFICONTROL_SECURITY_INFO_ITERATOR = ID_WIFICONTROL + 3, + + ID_NETWORKCONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x490, + ID_NETWORKCONTROL_NOTIFICATION = ID_NETWORKCONTROL + 1, + ID_NETWORKCONTROL_NETWORK_INFO_ITERATOR = ID_NETWORKCONTROL + 2, + + ID_WATCHDOG = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4A0, + + ID_SCRIPT_ENGINE = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4B0, + ID_SCRIPT_ENGINE_NOTIFICATION = ID_SCRIPT_ENGINE + 1, + + ID_TEXT_TO_SPEECH = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4C0, + ID_TEXT_TO_SPEECH_NOTIFICATION = ID_TEXT_TO_SPEECH + 1, + + ID_CRYPTOGRAPHY = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4D0, + ID_CRYPTOGRAPHY_VAULT = ID_CRYPTOGRAPHY + 1, + ID_CRYPTOGRAPHY_HASH = ID_CRYPTOGRAPHY + 2, + ID_CRYPTOGRAPHY_CIPHER = ID_CRYPTOGRAPHY + 3, + ID_CRYPTOGRAPHY_DIFFIEHELLMAN = ID_CRYPTOGRAPHY + 4, + ID_CRYPTOGRAPHY_PERSISTENT = ID_CRYPTOGRAPHY + 5, + ID_CRYPTOGRAPHY_RANDOM = ID_CRYPTOGRAPHY + 6, + ID_CRYPTOGRAPHY_DEVICEOBJECTS = ID_CRYPTOGRAPHY + 7, + + ID_DNS_SERVER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4E0, + ID_DNS_ZONE = ID_DNS_SERVER + 1, + ID_DNS_RECORD = ID_DNS_SERVER + 2, + + ID_USB_HUB = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4F0, + ID_USB_HUB_NOTIFICATION = ID_USB_HUB + 1, + ID_USB_DEVICE = ID_USB_HUB + 2, + + ID_TESTAUTOMATIONMEMORY = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x9F0, + ID_TESTAUTOMATIONCOMRPC = ID_TESTAUTOMATIONMEMORY + 1, + ID_TESTAUTOMATIONCOMRPCINTERNAL = ID_TESTAUTOMATIONMEMORY + 2, + + ID_CONTENTPROTECTION = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x500, + ID_CONTENTPROTECTION_NOTIFICATION = ID_CONTENTPROTECTION + 1, + + ID_WATERMARK = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x510, + ID_WATERMARK_NOTIFICATION = ID_WATERMARK + 2, + + ID_SYSTEMAUDIOPLAYER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x520, + ID_SYSTEMAUDIOPLAYER_NOTIFICATION = ID_SYSTEMAUDIOPLAYER + 1, + + ID_BLUETOOTHREMOTECONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x530, + ID_BLUETOOTHREMOTECONTROL_NOTIFICATION = ID_BLUETOOTHREMOTECONTROL + 1, + + ID_DEVICEIDENTIFICATION = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x540, + + ID_SECURITYAGENT = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x550, + + ID_LOCATIONSYNC = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x560, + ID_LOCATIONSYNC_NOTIFICATION = ID_LOCATIONSYNC + 1, + ID_SAMPLEITERATOR = ID_LOCATIONSYNC + 2, + ID_SAMPLEITERATOR2 = ID_LOCATIONSYNC + 3, + + ID_MEMORY_MONITOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x570, + ID_MEMORY_MONITOR_NOTIFICATION = ID_MEMORY_MONITOR + 1, + + ID_IOCONNECTOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x580, + ID_IOCONNECTOR_NOTIFICATION = ID_IOCONNECTOR + 1, + + ID_SUBSYSTEM_CONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x590, + + ID_PLUGINASYNCSTATECONTROL = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x5A0, + ID_PLUGINASYNCSTATECONTROL_ACTIVATIONCALLBACK = ID_PLUGINASYNCSTATECONTROL + 1 }; } } diff --git a/interfaces/Interfaces.vcxproj b/interfaces/Interfaces.vcxproj index 9b13b63a..487190f6 100644 --- a/interfaces/Interfaces.vcxproj +++ b/interfaces/Interfaces.vcxproj @@ -69,6 +69,7 @@ + @@ -141,6 +142,7 @@ + @@ -390,10 +392,10 @@ - - - - + + + + diff --git a/interfaces/Interfaces.vcxproj.filters b/interfaces/Interfaces.vcxproj.filters index 46169342..75d6ce4d 100644 --- a/interfaces/Interfaces.vcxproj.filters +++ b/interfaces/Interfaces.vcxproj.filters @@ -73,6 +73,7 @@ + @@ -143,6 +144,7 @@ + From 034dc10514692ef4f613701d94e73b9ff8e5fa51 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Fri, 4 Jul 2025 15:15:54 +0200 Subject: [PATCH 19/24] Add the Windows specific generator options to all build variants, not just Debug64 (#451) --- definitions/Definitions.vcxproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index 1f3f6a24..3056aedd 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -224,6 +224,15 @@ $(ProjectDir)../interfaces/json/JPluginAsyncStateControl.h python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force ClInclude + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + $(ProjectDir)../interfaces/json/JPluginAsyncStateControl.h + $(ProjectDir)../interfaces/json/JPluginAsyncStateControl.h + $(ProjectDir)../interfaces/json/JPluginAsyncStateControl.h + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + ClInclude + ClInclude + ClInclude From 06d9004a99a26cf6dbddcd0cbe4f8594f33e6008 Mon Sep 17 00:00:00 2001 From: rdkcmf Date: Tue, 19 Aug 2025 13:13:08 +0100 Subject: [PATCH 20/24] Deploy cla action (#454) * Deploy cla action * Add premissions --------- Co-authored-by: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> --- .github/workflows/cla.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/cla.yml diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml new file mode 100644 index 00000000..7e3d9d6b --- /dev/null +++ b/.github/workflows/cla.yml @@ -0,0 +1,17 @@ +name: "CLA" +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened,closed,synchronize] + +permissions: + contents: read + pull-requests: write + +jobs: + CLA-Lite: + name: "Signature" + uses: rdkcentral/cmf-actions/.github/workflows/cla.yml@main + secrets: + PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ASSISTANT }} From 865e3f1d4567891beea7ebd02f6b896c38039167 Mon Sep 17 00:00:00 2001 From: LE COZ Cedric <12274523+cedriclecoz@users.noreply.github.com> Date: Wed, 20 Aug 2025 06:59:37 +0100 Subject: [PATCH 21/24] Update cla.yml (#458) Copilot auto fix which was missing permissions on action / status. --- .github/workflows/cla.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 7e3d9d6b..92a65e2e 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -8,6 +8,8 @@ on: permissions: contents: read pull-requests: write + actions: write + statuses: write jobs: CLA-Lite: From c4590c0af0b943b24b841e9c07865579802ea0d6 Mon Sep 17 00:00:00 2001 From: sivarajappan-siva Date: Mon, 1 Sep 2025 08:38:39 +0000 Subject: [PATCH 22/24] Metrol 1145:move lookup and async example to master (#457) * Creation of sample interfaces * Added Id's to sample interfaces * Removed IMath related changes * Removed debug messages * Removed IMath changes * clean up * Renaming Sample interfaces to examples * Clean ip * Modified destination folder * Renamed examples to example interfaces --- CMakeLists.txt | 1 + definitions/CMakeLists.txt | 16 ++ definitions/Definitions.cpp | 4 + example_interfaces/CMakeLists.txt | 81 ++++++++ example_interfaces/ExampleIds.h | 71 +++++++ example_interfaces/ISimpleAsync.h | 199 ++++++++++++++++++++ example_interfaces/ISimpleCustomObjects.h | 91 +++++++++ example_interfaces/ISimpleInstanceObjects.h | 102 ++++++++++ example_interfaces/Module.cpp | 30 +++ example_interfaces/Module.h | 33 ++++ example_interfaces/definitions.h | 24 +++ 11 files changed, 652 insertions(+) create mode 100644 example_interfaces/CMakeLists.txt create mode 100644 example_interfaces/ExampleIds.h create mode 100644 example_interfaces/ISimpleAsync.h create mode 100644 example_interfaces/ISimpleCustomObjects.h create mode 100644 example_interfaces/ISimpleInstanceObjects.h create mode 100644 example_interfaces/Module.cpp create mode 100644 example_interfaces/Module.h create mode 100644 example_interfaces/definitions.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 984e9764..62c190bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,5 +48,6 @@ if (BUILD_REFERENCE) endif() add_subdirectory(interfaces) +add_subdirectory(example_interfaces) add_subdirectory(qa_interfaces) add_subdirectory(definitions) diff --git a/definitions/CMakeLists.txt b/definitions/CMakeLists.txt index d2a15c56..7e780b75 100644 --- a/definitions/CMakeLists.txt +++ b/definitions/CMakeLists.txt @@ -50,6 +50,11 @@ set(WORKING_VARIABLE ${INTERFACES_PATTERNS}) list(TRANSFORM WORKING_VARIABLE PREPEND "${CMAKE_SOURCE_DIR}/qa_interfaces/") file(GLOB QA_INTERFACE_FILE ${WORKING_VARIABLE}) +separate_arguments(INTERFACES_PATTERNS) +set(WORKING_VARIABLE ${INTERFACES_PATTERNS}) +list(TRANSFORM WORKING_VARIABLE PREPEND "${CMAKE_SOURCE_DIR}/example_interfaces/") +file(GLOB EXAMPLE_INTERFACE_FILE ${WORKING_VARIABLE}) + set(PUBLIC_HEADERS "definitions.h" "ValuePoint.h" "Module.h") if(NOT GENERATOR_SEARCH_PATH) @@ -60,6 +65,7 @@ JsonGenerator(CODE INPUT ${JSON_FILE} OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/genera JsonGenerator(CODE INPUT ${QA_JSON_FILE} OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/qa_generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../jsonrpc/" CPPIFDIR "${CMAKE_CURRENT_SOURCE_DIR}/../qa_interfaces/" IFDIR "${CMAKE_CURRENT_SOURCE_DIR}/../jsonrpc/" CPP_INTERFACE_PATH "qa_interfaces" JSON_INTERFACE_PATH "qa_interfaces/json") JsonGenerator(CODE INPUT ${INTERFACE_FILE} OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH}) JsonGenerator(CODE NAMESPACE Thunder::QualityAssurance INPUT ${QA_INTERFACE_FILE} OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/qa_generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH} CPP_INTERFACE_PATH "qa_interfaces" JSON_INTERFACE_PATH "qa_interfaces/json" ) +JsonGenerator(CODE NAMESPACE Thunder::Example INPUT ${EXAMPLE_INTERFACE_FILE} OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/example_generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH} CPP_INTERFACE_PATH "example_interfaces" JSON_INTERFACE_PATH "example_interfaces/json") file(GLOB JSON_ENUM_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/generated/JsonEnum*.cpp") file(GLOB JSON_LINK_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/generated/J*.h") @@ -67,14 +73,19 @@ file(GLOB JSON_LINK_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/generated/J*.h") file(GLOB QA_JSON_ENUM_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/qa_generated/JsonEnum*.cpp") file(GLOB QA_JSON_LINK_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/qa_generated/J*.h") +file(GLOB EXAMPLE_JSON_ENUM_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/example_generated/JsonEnum*.cpp") +file(GLOB EXAMPLE_JSON_LINK_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/example_generated/J*.h") + list(APPEND JSON_LINK_HEADERS "Module.h") list(APPEND QA_JSON_LINK_HEADERS "Module.h") +list(APPEND EXAMPLE_JSON_LINK_HEADERS "Module.h") add_library(${Target} SHARED Definitions.cpp Module.cpp ${JSON_ENUM_SOURCES} ${QA_JSON_ENUM_SOURCES} + ${EXAMPLE_JSON_ENUM_SOURCES} ) target_link_libraries(${Target} @@ -122,6 +133,11 @@ install( DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/qa_interfaces/json COMPONENT ${NAMESPACE}_Test_Development ) +install( + FILES ${EXAMPLE_JSON_LINK_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/example_interfaces/json COMPONENT ${NAMESPACE}_Example_Development +) + InstallPackageConfig( TARGETS ${Target} DESCRIPTION "${PROJECT_DESCRIPTION}" diff --git a/definitions/Definitions.cpp b/definitions/Definitions.cpp index 1410442c..80b456e4 100644 --- a/definitions/Definitions.cpp +++ b/definitions/Definitions.cpp @@ -96,6 +96,10 @@ #include #include #include + +#include +#include +#include #endif namespace Thunder { diff --git a/example_interfaces/CMakeLists.txt b/example_interfaces/CMakeLists.txt new file mode 100644 index 00000000..3087d0d1 --- /dev/null +++ b/example_interfaces/CMakeLists.txt @@ -0,0 +1,81 @@ +# 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. + +cmake_minimum_required(VERSION 3.15) + +project(ExampleMarshalling + VERSION 5.0.0 + DESCRIPTION "Component that abstracts the logic to transfer and receive COM-RPC objects" + LANGUAGES CXX) + +find_package(Thunder) + +find_package(CompileSettingsDebug REQUIRED) +find_package(ProxyStubGenerator REQUIRED) +find_package(${NAMESPACE}Core REQUIRED) +find_package(${NAMESPACE}COM REQUIRED) + +set(Target ${NAMESPACE}${PROJECT_NAME}) + +if(NOT GENERATOR_SEARCH_PATH) + set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}) +endif() + +separate_arguments(INTERFACES_PATTERNS) +file(GLOB EXAMPLE_INTERFACES_HEADERS ${INTERFACES_PATTERNS}) + +ProxyStubGenerator(NAMESPACE "Thunder::Example" INPUT "${EXAMPLE_INTERFACE_HEADERS}" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/example_generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH}) + +list(APPEND EXAMPLE_INTERFACES_HEADERS Module.h ExampleIds.h) + +file(GLOB EXAMPLE_PROXY_STUB_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/example_generated/ProxyStubs*.cpp") +add_library(${Target} SHARED + Module.cpp + ${EXAMPLE_PROXY_STUB_SOURCES} + ) + +target_include_directories(${Target} PRIVATE $ $/..) + +target_link_libraries(${Target} + PRIVATE + ${NAMESPACE}Core::${NAMESPACE}Core + ${NAMESPACE}COM::${NAMESPACE}COM + CompileSettingsDebug::CompileSettingsDebug + ) + +set_target_properties(${Target} PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED YES + FRAMEWORK FALSE + SOVERSION ${PROJECT_VERSION_MAJOR} + ) + +if(HUMAN_VERSIONED_BINARIES) +set_target_properties(${Target} PROPERTIES VERSION ${PROJECT_VERSION}) +endif() + +string(TOLOWER ${NAMESPACE} NAMESPACE_LIB) + +install( + TARGETS ${Target} EXPORT ${Target}Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/proxystubs COMPONENT ${NAMESPACE}_Test NAMELINK_COMPONENT ${NAMESPACE}_Example_Development +) + +install( + FILES ${EXAMPLE_INTERFACES_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/example_interfaces COMPONENT ${NAMESPACE}_Example_Development +) diff --git a/example_interfaces/ExampleIds.h b/example_interfaces/ExampleIds.h new file mode 100644 index 00000000..19ade9c0 --- /dev/null +++ b/example_interfaces/ExampleIds.h @@ -0,0 +1,71 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 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 + +// This file holds all the identifiers (uint32_t) used to identify a EXAMPLE interface. From this +// identifier, the comrpc framework can find the proper proxy/stub in case of communicating +// over a process boundary. +// Some users do not "fully" rebuild the system in case of changes. If this means that the +// Proxy/Stub code is not always rebuild in case of new releases, the identifier associated +// with an interface becomes as important as the interface syntax and as interfaces are not +// allowed to be changed, the ID associated with the interface should also not be changed +// and thus should be "fixed". + +// So if you extend this file by defining a new EXAMPLE interface ID make sure it is defined (has +// an actual value) and once the enum label has a value, never change it again. + +// As some interfaces might be grouped, the first ID of the group is assigned a value, the +// other interfaces belonging to this group use the enum value of label that has an assigned +// value and just increment that label by the proper amount. + +// Using this system, all interfaces will have an assigned number. If numbers overlap, the +// compiler, your best friend, will start complaining. Time to reassign the value, before we +// deploy. + +// NOTE: Default the gap between each group of interface is 16. If you need more and the new +// addition is add the end, write a comment with your interface that you might need more +// than 16 interface in that group so that the next ID is indeed elevated (and rounded +// up to a multiple of 16) if the next entry is made in the future. + +// @insert + +namespace Thunder { + +namespace Example { + + enum IDS : uint32_t { + + ID_SIMPLEASYNC = RPC::IDS::ID_EXTERNAL_EXAMPLE_INTERFACE_OFFSET + 0x010, + ID_CALLBACK = ID_SIMPLEASYNC + 1, + ID_ASYNC_NOTIFICATION = ID_SIMPLEASYNC + 2, + ID_BIND_NOTIFICATION = ID_SIMPLEASYNC + 3, + + + ID_SIMPLEINSTANCEOBJECTS = RPC::IDS::ID_EXTERNAL_EXAMPLE_INTERFACE_OFFSET + 0x020, + ID_DEVICE = ID_SIMPLEINSTANCEOBJECTS + 1, + ID_INSTANCE_NOTIFICATION = ID_SIMPLEINSTANCEOBJECTS + 2, + + ID_SIMPLECUSTOMOBJECTS = RPC::IDS::ID_EXTERNAL_EXAMPLE_INTERFACE_OFFSET + 0x030, + ID_ACCESSORY = ID_SIMPLECUSTOMOBJECTS + 1, + ID_CUSTOM_NOTIFICATION = ID_SIMPLECUSTOMOBJECTS + 2, + + }; +} +} diff --git a/example_interfaces/ISimpleAsync.h b/example_interfaces/ISimpleAsync.h new file mode 100644 index 00000000..9168318b --- /dev/null +++ b/example_interfaces/ISimpleAsync.h @@ -0,0 +1,199 @@ +/* + * 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" + +// @insert + +namespace Thunder { + +namespace Example { + + // @json 1.0.0 + struct ISimpleAsync : public virtual Core::IUnknown { + + enum { ID = ID_SIMPLEASYNC }; + + enum state : uint8_t { + DISCONNECTED, + CONNECTING, + CONNECTED, + CONNECTING_FAILED, + CONNECTING_TIMED_OUT, + CONNECTING_ABORTED + }; + + struct ICallback : public virtual Core::IUnknown { + + enum { ID = ID_CALLBACK }; + + // Generator will create its implementation of this interface + // and supply the object to the called async method. The + // implementation of the completion method will issue a JSON-RPC + // event. + // + // @brief Signals completion of the Connect method + // @param address Device address (e.g. aa:bb:cc:dd:ee:ff) + // @param state Result of pairing operation (e.g. CONNECTING_ABORTED) + virtual void Complete(const Core::OptionalType>& address /* @encode:mac @restrict:6..6 */, const state state) = 0; + }; + + // @async + // + // Asynchronous method. Its result will be delivered via notification. + // It is expected that async method has one input interface parameter + // and this interface has a single method that will be used to signal + // completion. The prototype or name of the signalling method is not + // predefined. On JSON-RPC level the interface parameter will be replaced + // with client ID string, that will allow the client to match the call + // with the async result. It is required that the callback is eventually + // always called, whether it's success, failure or timeout. + // + // @brief Connects to a server + // @param address Device address (e.g. aa:bb:cc:dd:ee:ff) + // @param timeout Maximum time allowed for connecting in milliseconds + // @retval ERROR_INPROGRESS Currently connecting + // @retval ERROR_ALREADY_CONNECTED Already connected to server + virtual Core::hresult Connect(const Core::OptionalType>& address /* @encode:mac @restrict:6..6 */, const Core::OptionalType& timeout /* @default:1000 */, ICallback* const cb) = 0; + + // @brief Aborts connecting to a server + // @retval ERROR_ILLEGAL_STATE There is no ongoing connection + virtual Core::hresult Abort() = 0; + + // @brief Disconnects from the server + // @retval ERROR_INPROGRESS Connecting in progress, abort first + // @retval ERROR_ALREADY_RELEASED Not connected to server + virtual Core::hresult Disconnect() = 0; + + // @property + // @brief Connection status + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult Connected(const std::vector& address /* @index @encode:mac @restrict:6..6 */, bool& result /* @out */) const = 0; + + + // BY ARRAY ----------- + + // @brief Links a device + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult Link(const uint8_t address[6] /* @encode:base64 */) = 0; + + // @brief Unlinks a device + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult Unlink(const uint8_t address[6] /* @encode:base64 */) = 0; + + // @property + // @brief Linked device + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult LinkedDevice(uint8_t address[6] /* @encode:base64 @out */) const = 0; + + // @event + struct INotification : public virtual Core::IUnknown { + + enum { ID = ID_ASYNC_NOTIFICATION }; + + // @brief Signals completion of the Connect method + // @param address Device address (e.g. [11,22] ) + // @param linked Denotes if device is linked + virtual void StatusChanged(const uint8_t address[6], const bool linked) = 0; + }; + + virtual Core::hresult Register(INotification* const notification) = 0; + virtual Core::hresult Unregister(const INotification* const notification) = 0; + + // @property + // @brief Device metadata + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult Metadata(const uint8_t address[6] /* @index @encode:base64 */, const string& metadata) = 0; + virtual Core::hresult Metadata(const uint8_t address[6] /* @index @encode:base64 */, string& metadata /* @out */) const = 0; + + // BY MACADDRESS ------------------------- + + // @brief Binds a device + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult Bind(const Core::MACAddress& address) = 0; + + // @brief Unlinks a device + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult Unbind(const Core::MACAddress& address) = 0; + + // @property + virtual Core::hresult BoundDevice(Core::MACAddress& address /* @out */) const = 0; + + // @property + // @brief Device metadata + // @param address Device address (e.g. 11:22:33:44:55:66) + virtual Core::hresult Type(const Core::MACAddress& address /* @index */, const string& value) = 0; + virtual Core::hresult Type(const Core::MACAddress& address /* @index */, string& value /* @out */) const = 0; + + // @event + struct IBindNotification : public virtual Core::IUnknown { + + enum { ID = ID_BIND_NOTIFICATION }; + + // @brief Signals completion of the Connect method + // @param address Device address (e.g. [11,22] ) + // @param linked Denotes if device is linked + virtual void BindingChanged(const Core::MACAddress& address/* @index */, const bool bound) = 0; + }; + + virtual Core::hresult Register(IBindNotification* const notification) = 0; + virtual Core::hresult Unregister(const IBindNotification* const notification) = 0; + + + // Vector, iterator + + struct SmallRecord { + string param0; + bool param1; + }; + + struct Record { + string param0; + std::vector param1 /* @restrict:10 */; + std::vector param2 /* @restrict:10 */; + Core::OptionalType> param3 /* @restrict:10 */; + Core::OptionalType> param4 /* @restrict:10 */; + SmallRecord param5; + Core::OptionalType param6; + }; + + struct Record2 { + Core::OptionalType> param3 /* @restrict:10 */; + Core::OptionalType> param4 /* @restrict:10 */; + }; + + virtual Core::hresult Tables(const bool fill, std::vector& stringTables /* @out @restrict:10 */) = 0; + virtual Core::hresult Tables2(const bool fill, std::vector& stringTables /* @out @restrict:10 */, std::vector& intTables /* @out */) = 0; + virtual Core::hresult Tables3(const bool fill, Core::OptionalType>& stringTables /* @out @restrict:10 */) = 0; + virtual Core::hresult Tables4(const bool fill, RPC::IStringIterator*& stringTables /* @out */) = 0; + virtual Core::hresult Tables5(const bool fill, RPC::IStringIterator*& stringTables /* @out */, RPC::IValueIterator*& intTables /* @out */) = 0; + virtual Core::hresult Tables6(const bool fill, Record& pod /* @out */) = 0; + virtual Core::hresult Tables7(const bool fill, Core::OptionalType& pod /* @out */) = 0; + virtual Core::hresult Tables8(const bool fill, Core::OptionalType& pod /* @out */) = 0; + virtual Core::hresult Tables9(const bool fill, Record2& pod /* @out */) = 0; + + virtual Core::hresult OptionalResult(const bool fill, Core::OptionalType& result /* @out */) = 0; + + }; + +} // namespace Example + +} diff --git a/example_interfaces/ISimpleCustomObjects.h b/example_interfaces/ISimpleCustomObjects.h new file mode 100644 index 00000000..9637f05a --- /dev/null +++ b/example_interfaces/ISimpleCustomObjects.h @@ -0,0 +1,91 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2025 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 Example { + + // @json 1.0.0 + struct ISimpleCustomObjects : virtual public Core::IUnknown { + + enum { ID = ID_SIMPLECUSTOMOBJECTS }; + + // @json @encode:lookup + struct IAccessory: virtual public Core::IUnknown { + + enum { ID = ID_ACCESSORY }; + + // @event + struct INotification : public Core::IUnknown { + + enum { ID = ID_CUSTOM_NOTIFICATION }; + + // @statuslistener + // @brief Signals addition of a accessory + // @param name Name of the accessory (e.g. "mouse") + virtual void NameChanged(const string& name) = 0; + }; + + virtual Core::hresult Register(INotification* const notification) = 0; + virtual Core::hresult Unregister(const INotification* const notification) = 0; + + // @property + // @brief Name of the accessory + // @param name Name of the accessory (e.g. "mouse") + virtual Core::hresult Name(string& name /* @out */) const = 0; + virtual Core::hresult Name(const string& name) = 0; + + // @property + // @brief Pin state + virtual Core::hresult Pin(const uint8_t pin /* @index */, const bool value) = 0; + virtual Core::hresult Pin(const uint8_t pin /* @index */, bool& value /* @out */) const = 0; + }; + + // @event + struct INotification : public Core::IUnknown { + + enum { ID = ID_CUSTOM_NOTIFICATION }; + + // @statuslistener + // @brief Signals addition of a accessory + // @param accessory Accessory instance + virtual void Added(IAccessory* const accessory) = 0; + + // @brief Signals removal of a accessory + // @param accessory Accessory instance + virtual void Removed(IAccessory* const accessory) = 0; + }; + + virtual Core::hresult Register(INotification* const notification) = 0; + virtual Core::hresult Unregister(const INotification* const notification) = 0; + + // @property + // @brief Accessory by name + // @param name Name of the accessory to look for (e.g. "mouse") + // @param accessory Accessory instance + virtual Core::hresult Accessory(const string& name /* @index */, IAccessory*& accessory /* @out */) const = 0; + }; + +} // namespace Example + +} diff --git a/example_interfaces/ISimpleInstanceObjects.h b/example_interfaces/ISimpleInstanceObjects.h new file mode 100644 index 00000000..53616899 --- /dev/null +++ b/example_interfaces/ISimpleInstanceObjects.h @@ -0,0 +1,102 @@ +/* + * 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 Example { + + // @json 1.0.0 + struct ISimpleInstanceObjects : virtual public Core::IUnknown { + + enum { ID = ID_SIMPLEINSTANCEOBJECTS }; + + enum state : uint8_t { + ENABLED, + DISABLED + }; + + // @json @encode:autolookup + struct IDevice : virtual public Core::IUnknown { + + enum { ID = ID_DEVICE }; + + // @event + // A notification per instance of device + struct INotification : virtual public Core::IUnknown { + + enum { ID = ID_INSTANCE_NOTIFICATION }; + + // @brief Signals device name changes + // @param state New name of the device + virtual void NameChanged(const string& state) = 0; + + // @statuslistener + // @brief Signals device state changes + // @param state New state of the device + virtual void StateChanged(const state state) = 0; + + // @statuslistener + // @brief Signals pin state changes + virtual void PinChanged(const uint8_t pin /* @index */, const bool high) = 0; + }; + + virtual Core::hresult Register(INotification* const notification) = 0; + virtual Core::hresult Unregister(const INotification* const notificaiton) = 0; + + // @property + // @brief Name of the device + // @param name Name of the device (e.g. "usb") + virtual Core::hresult Name(string& name /* @out */) const = 0; + virtual Core::hresult Name(const string& name) = 0; + + // @brief Enable the device + // @retval ERROR_ALREADY_CONNECTED The device is already enabled + virtual Core::hresult Enable() = 0; + + // @brief Disable the device + // @retval ERROR_ALREADY_RELEASED The device is not enabled + virtual Core::hresult Disable() = 0; + + // @property + // @brief A pin + // @param pin Pin number + // @retval ERROR_UNAVAILABLE Unknown pin number + virtual Core::hresult Pin(const uint8_t pin /* @index */ , const bool high) = 0; + virtual Core::hresult Pin(const uint8_t pin /* @index */, bool& high /* @out */) const = 0; + }; + + // @brief Acquires a device + // @param name Name of the device to acquire (e.g. "usb") + // @param device Instance of the acquired device + // @retval ERROR_UNAVAILABLE The device is not available + virtual Core::hresult Acquire(const string& name, IDevice*& device /* @out */) = 0; + + // @brief Relinquishes a device + // @param device Device instance to relinquish + // @retval ERROR_UNKNOWN_KEY The device is not acquired + virtual Core::hresult Relinquish(IDevice* const device) = 0; + }; + +} // namespace Example + +} diff --git a/example_interfaces/Module.cpp b/example_interfaces/Module.cpp new file mode 100644 index 00000000..bf440b59 --- /dev/null +++ b/example_interfaces/Module.cpp @@ -0,0 +1,30 @@ + /* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 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. + */ + +#include "Module.h" + +#ifdef __WINDOWS__ + +// ProxyStub code needs the definitions on windows for the default +// Contstructor/Destructor implementations, generated EXTERNAL. +#include + +#endif + +MODULE_NAME_DECLARATION(BUILD_REFERENCE) diff --git a/example_interfaces/Module.h b/example_interfaces/Module.h new file mode 100644 index 00000000..0af0f067 --- /dev/null +++ b/example_interfaces/Module.h @@ -0,0 +1,33 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2024 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 + +#ifndef MODULE_NAME +#define MODULE_NAME example_interfaces +#endif + +#include + +#include +#include +#include +#include + +#include "ExampleIds.h" diff --git a/example_interfaces/definitions.h b/example_interfaces/definitions.h new file mode 100644 index 00000000..dd805d1f --- /dev/null +++ b/example_interfaces/definitions.h @@ -0,0 +1,24 @@ +/* + * 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" + +// To satisfy the generated code.. From 359f8f6f183decebca17cbe46b559c65b0e6eb8d Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:24:12 +0200 Subject: [PATCH 23/24] [Actions] Resolve ocassional errors from the package install step, optimize the process (#460) * Enhance package installation and update steps Refactor package installation steps and add retry logic for apt commands. * Update workflow templates to use development branch * Update workflow to use master branch for templates --- .github/workflows/Linux build template.yml | 59 ++++++++++++++++------ 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/.github/workflows/Linux build template.yml b/.github/workflows/Linux build template.yml index 9f3c0ebd..ca16bc08 100644 --- a/.github/workflows/Linux build template.yml +++ b/.github/workflows/Linux build template.yml @@ -16,22 +16,49 @@ jobs: # ----- Packages & artifacts ----- name: Build type - ${{matrix.build_type}}${{matrix.architecture == '32' && ' x86' || ''}} steps: - - name: Install necessary packages - uses: nick-fields/retry@v3 - with: - timeout_minutes: 10 - max_attempts: 10 - command: | - sudo gem install apt-spy2 - sudo apt-spy2 fix --commit --launchpad --country=US - echo "deb http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list - echo "deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list - sudo dpkg --add-architecture i386 - sudo apt-get update - sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev ${{matrix.architecture == '32' && 'zlib1g-dev:i386 libssl-dev:i386 gcc-13-multilib g++-13-multilib' || 'zlib1g-dev libssl-dev'}} - python3 -m venv venv - source venv/bin/activate - pip install jsonref + - name: Prepare apt (add i386 if needed) + if: ${{ matrix.architecture == '32' }} + run: | + sudo dpkg --add-architecture i386 + + - name: Update apt indices (with retries) + shell: bash + run: | + set -euo pipefail + for attempt in {1..5}; do + if sudo apt-get update -o Acquire::Retries=5 -o Acquire::http::Timeout=30; then + break + fi + echo "apt-get update failed (attempt $attempt), retrying..." + sleep $((attempt*10)) + done + + - name: Install system dependencies + shell: bash + run: | + set -euo pipefail + export DEBIAN_FRONTEND=noninteractive + PKGS="python3-venv python3-pip build-essential cmake ninja-build libusb-1.0-0-dev" + if [ "${{ matrix.architecture }}" = "32" ]; then + PKGS="$PKGS zlib1g-dev:i386 libssl-dev:i386 libsbc-dev:i386 gcc-13-multilib g++-13-multilib" + else + PKGS="$PKGS zlib1g-dev libssl-dev libsbc-dev" + fi + for attempt in {1..4}; do + if sudo apt-get install -y --no-install-recommends $PKGS; then + break + fi + echo "apt-get install failed (attempt $attempt), cleaning up & retrying..." + sudo apt-get clean + sleep $((attempt*15)) + done + + - name: Set up Python environment + run: | + python3 -m venv venv + source venv/bin/activate + pip install --upgrade pip + pip install jsonref - name: Download artifacts uses: actions/download-artifact@v4 From da8edb4ee4da8404c317557c54e5f017eb661701 Mon Sep 17 00:00:00 2001 From: sebaszm <45654185+sebaszm@users.noreply.github.com> Date: Tue, 9 Sep 2025 10:03:53 +0200 Subject: [PATCH 24/24] [examples] std::vector requires restrict (#461) --- example_interfaces/ISimpleAsync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_interfaces/ISimpleAsync.h b/example_interfaces/ISimpleAsync.h index 9168318b..ffe71216 100644 --- a/example_interfaces/ISimpleAsync.h +++ b/example_interfaces/ISimpleAsync.h @@ -181,7 +181,7 @@ namespace Example { }; virtual Core::hresult Tables(const bool fill, std::vector& stringTables /* @out @restrict:10 */) = 0; - virtual Core::hresult Tables2(const bool fill, std::vector& stringTables /* @out @restrict:10 */, std::vector& intTables /* @out */) = 0; + virtual Core::hresult Tables2(const bool fill, std::vector& stringTables /* @out @restrict:10 */, std::vector& intTables /* @out @restrict:10 */) = 0; virtual Core::hresult Tables3(const bool fill, Core::OptionalType>& stringTables /* @out @restrict:10 */) = 0; virtual Core::hresult Tables4(const bool fill, RPC::IStringIterator*& stringTables /* @out */) = 0; virtual Core::hresult Tables5(const bool fill, RPC::IStringIterator*& stringTables /* @out */, RPC::IValueIterator*& intTables /* @out */) = 0;