|
| 1 | +/* |
| 2 | +* If not stated otherwise in this file or this component's LICENSE file the |
| 3 | +* following copyright and licenses apply: |
| 4 | +* |
| 5 | +* Copyright 2026 RDK Management |
| 6 | +* |
| 7 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +* you may not use this file except in compliance with the License. |
| 9 | +* You may obtain a copy of the License at |
| 10 | +* |
| 11 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +* |
| 13 | +* Unless required by applicable law or agreed to in writing, software |
| 14 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +* See the License for the specific language governing permissions and |
| 17 | +* limitations under the License. |
| 18 | +*/ |
| 19 | + |
| 20 | +#pragma once |
| 21 | + |
| 22 | +#include "Module.h" |
| 23 | + |
| 24 | +// @stubgen:include <com/IIteratorType.h> |
| 25 | + |
| 26 | +namespace WPEFramework { |
| 27 | +namespace Exchange { |
| 28 | + |
| 29 | + // @json 1.0.0 @text:keep |
| 30 | + struct EXTERNAL IGoogleCast : virtual public Core::IUnknown { |
| 31 | + enum { ID = ID_GOOGLE_CAST }; |
| 32 | + |
| 33 | + using IStringIterator = RPC::IIteratorType<string, RPC::ID_STRINGITERATOR>; |
| 34 | + |
| 35 | + // @json 1.0.0 @text:keep |
| 36 | + struct EXTERNAL IRuntimeManagerDelegate : virtual public Core::IUnknown { |
| 37 | + enum { ID = ID_GOOGLE_CAST_RM_DELEGATE }; |
| 38 | + |
| 39 | + enum IntentAction : uint8_t { |
| 40 | + // @text launch |
| 41 | + LAUNCH, // Launch the runtime and bring it to the foreground on the screen. |
| 42 | + // @text close |
| 43 | + CLOSE, // Send the runtime to the background off the screen. |
| 44 | + // @text destroy |
| 45 | + DESTROY // Destroy the runtime instance. |
| 46 | + }; |
| 47 | + |
| 48 | + struct IntentContext { |
| 49 | + // @brief Source of the intent. |
| 50 | + string source; |
| 51 | + }; |
| 52 | + |
| 53 | + struct Intent { |
| 54 | + // @brief Specifies the intent action to launch, close or destroy the app runtime instance. |
| 55 | + IntentAction action; |
| 56 | + // @brief Intent context. |
| 57 | + IntentContext context; |
| 58 | + // @opaque |
| 59 | + // @brief An array of launch arguments to forward to app runtime instance as is. |
| 60 | + string data; |
| 61 | + }; |
| 62 | + |
| 63 | + // @event |
| 64 | + struct EXTERNAL INotification : virtual public Core::IUnknown { |
| 65 | + enum { ID = ID_GOOGLE_CAST_RM_DELEGATE_NOTIFICATION }; |
| 66 | + |
| 67 | + // @text onIntentChanged |
| 68 | + // @brief Notifies about GoogleCast intent to launch/close/destroy cast application runtime. |
| 69 | + // @param appId: Durable application id. |
| 70 | + // @param inactive: Indicates pre-launch(off screen) request. |
| 71 | + // @param intent: A Firebolt compliant navigation intent. |
| 72 | + virtual void OnIntentChanged( |
| 73 | + const string& appId, |
| 74 | + const bool inactive, |
| 75 | + const Intent& intent) { |
| 76 | + } |
| 77 | + }; |
| 78 | + virtual Core::hresult Register(IRuntimeManagerDelegate::INotification* sink) = 0; |
| 79 | + virtual Core::hresult Unregister(IRuntimeManagerDelegate::INotification* sink) = 0; |
| 80 | + |
| 81 | + // @json:omit |
| 82 | + // @brief Starts the runtime and brings it to the foreground on the screen. |
| 83 | + // @brief Emits onIntentChanged with launch action and args passed in intent data field. |
| 84 | + // @param appId: Durable application id of cast web runtime or cast settings. |
| 85 | + // @param args: A list of arguments to forward to app runtime. |
| 86 | + // @param prelaunch: Indicates if runtimes should be started in background. |
| 87 | + // @retval Core::ERROR_NOT_SUPPORTED: Pre-launch is not supported. |
| 88 | + // @retval Core::ERROR_NONE: Successfully delegated launch request. |
| 89 | + virtual Core::hresult StartRuntime(const string& appId, IStringIterator *const args, bool prelaunch) = 0; |
| 90 | + |
| 91 | + // @json:omit |
| 92 | + // @brief Stops the runtime. |
| 93 | + // @brief Emits onIntentChanged with destroy action. |
| 94 | + // @param appId: Durable application id of cast web runtime or cast settings. |
| 95 | + // @retval Core::ERROR_NONE: Successfully delegated destroy request. |
| 96 | + virtual Core::hresult StopRuntime(const string& appId) = 0; |
| 97 | + |
| 98 | + // @json:omit |
| 99 | + // @brief Sends the runtime to the background off-screen. |
| 100 | + // @brief Emits onIntentChanged with close action. |
| 101 | + // @param appId: Durable application id of cast web runtime or cast settings. |
| 102 | + // @retval Core::ERROR_NONE: Successfully delegated the request. |
| 103 | + virtual Core::hresult SendToBackground(const string& appId) = 0; |
| 104 | + }; |
| 105 | + |
| 106 | + enum CastState : uint8_t { |
| 107 | + UNKNOWN, // Cast shell is unconnected and current state is unknown. Cast is NOT functional. |
| 108 | + STARTING, // Cast shell is starting and the connection to cast control is being established. Cast is NOT functional. |
| 109 | + NOT_SETUP, // Started. But not setup yet - tos not accepted. Cast is NOT functional. |
| 110 | + OFFLINE, // Started and setup. But network is not connected. Cast is NOT functional. |
| 111 | + FORCED_UPDATE, // Started and setup and network connected. But forced update is in progress. Cast is NOT functional. |
| 112 | + SUSPENDED, // Started and setup. But suspended by caller. Cast is NOT functional. |
| 113 | + READY_TO_CAST // Ready to cast. Cast is functional. |
| 114 | + }; |
| 115 | + |
| 116 | + // @json |
| 117 | + // @brief Status of Cast shell. |
| 118 | + struct EXTERNAL CastStatus { |
| 119 | + // @brief Build number of the currently running Cast shell. |
| 120 | + // @text cast_build_number |
| 121 | + string castBuildNumber; |
| 122 | + |
| 123 | + // @brief Current cast shell state. |
| 124 | + // @text cast_state |
| 125 | + CastState castState; |
| 126 | + }; |
| 127 | + |
| 128 | + // @event |
| 129 | + struct EXTERNAL INotification : virtual public Core::IUnknown { |
| 130 | + enum { ID = ID_GOOGLE_CAST_NOTIFICATION }; |
| 131 | + |
| 132 | + // @brief Notifies that the GoogleCast status changed. |
| 133 | + // @text onStatusChanged |
| 134 | + // @alt onStatusChange |
| 135 | + virtual void OnStatusChanged() { |
| 136 | + } |
| 137 | + }; |
| 138 | + virtual Core::hresult Register(IGoogleCast::INotification* sink) = 0; |
| 139 | + virtual Core::hresult Unregister(IGoogleCast::INotification* sink) = 0; |
| 140 | + |
| 141 | + // @property @text getCastStatus @alt cast_status |
| 142 | + // @brief Status of cast shell interfacing via Cast control API. |
| 143 | + // @retval Core::ERROR_NONE: Indicates successful retrieval of cast status. |
| 144 | + virtual Core::hresult GetCastStatus(CastStatus& status /* @out */) const = 0; |
| 145 | + }; |
| 146 | + |
| 147 | +} |
| 148 | +} |
0 commit comments