|
26 | 26 |
|
27 | 27 | namespace WPEFramework {
|
28 | 28 | namespace Exchange {
|
| 29 | + /* @json 1.0.0 @text:keep */ |
29 | 30 | struct EXTERNAL IXCast : virtual public Core::IUnknown {
|
30 | 31 | enum { ID = ID_XCAST };
|
31 | 32 |
|
32 |
| - struct ApplicationInfo { |
33 |
| - string appName; |
34 |
| - string prefixes; |
35 |
| - string cors; |
36 |
| - string query; |
37 |
| - string payload; |
38 |
| - int allowStop; |
| 33 | + enum State : uint8_t { |
| 34 | + RUNNING = 0 /* @text running */, |
| 35 | + STOPPED = 1/* @text stopped */, |
| 36 | + HIDDEN = 2 /* @text suspended */ |
| 37 | + }; |
| 38 | + |
| 39 | + enum StandbyBehavior : uint8_t { |
| 40 | + ACTIVE = 0 /* @text active */, |
| 41 | + INACTIVE = 1 /* @text inactive */ |
| 42 | + }; |
| 43 | + |
| 44 | + enum ErrorCode : uint16_t { |
| 45 | + NONE = 200 /* @text none */ , |
| 46 | + FORBIDDEN = 403 /* @text forbidden */ , |
| 47 | + UNAVAILABLE = 404 /* @text unavailable */ , |
| 48 | + INVALID = 400 /* @text invalid */, |
| 49 | + INTERNAL = 500 /* @text internal */ |
| 50 | + }; |
| 51 | + |
| 52 | + struct EXTERNAL XCastSuccess { |
| 53 | + bool success /* @text success */ /* @brief true if the request was successful, false otherwise */; |
| 54 | + }; |
| 55 | + |
| 56 | + struct EXTERNAL ApplicationInfo { |
| 57 | + string appName /* @text name */ /* @brief Application name in request URI must have exact match to one of the names. Otherwise, matching prefix is needed. If the application name in request URI does not match any names or prefixes, then the request shall fail */; |
| 58 | + string prefixes /* @text prefix */ /* @brief If the application name in request URI does not match the appname given here, it must contain some prefix.If the application name in request URI does not match the appnames or prefix, then the request shall fail */; |
| 59 | + string cors /* @text cors */ /* @brief origin allowed for the application. This must not be empty */; |
| 60 | + string query /* @text query */ /* @brief query string that need to be appended in launch request */; |
| 61 | + string payload /* @text payload */ /* @brief optional payload string that need to be appended in launch request */; |
| 62 | + int allowStop /* @text allowStop */ /* @brief is the application (matching name list or prefix list) allowed to stop (no PID presence) after launched */; |
39 | 63 | };
|
40 | 64 |
|
41 | 65 | using IApplicationInfoIterator = RPC::IIteratorType<ApplicationInfo,ID_XCAST_APPLICATION_INFO_ITERATOR>;
|
| 66 | + using IStringIterator = RPC::IIteratorType<string, RPC::ID_STRINGITERATOR>; |
42 | 67 |
|
43 |
| - struct INotification : virtual public Core::IUnknown { |
| 68 | + //@event |
| 69 | + struct EXTERNAL INotification : virtual public Core::IUnknown { |
44 | 70 | enum { ID = ID_XCAST_NOTIFICATION };
|
45 | 71 |
|
46 |
| - ~INotification() override = default; |
47 |
| - |
48 |
| - virtual void onApplicationLaunchRequestWithLaunchParam(const string& appName, const string& strPayLoad, const string& strQuery, const string& strAddDataUrl) = 0; |
49 |
| - virtual void onApplicationLaunchRequest(const string& appName, const string& parameter) = 0; |
50 |
| - virtual void onApplicationStopRequest(const string& appName, const string& appID) = 0; |
51 |
| - virtual void onApplicationHideRequest(const string& appName, const string& appID) = 0; |
52 |
| - virtual void onApplicationStateRequest(const string& appName, const string& appID) = 0; |
53 |
| - virtual void onApplicationResumeRequest(const string& appName, const string& appID) = 0; |
54 |
| - virtual void onUpdatePowerStateRequest(const string& powerState) = 0; |
| 72 | + // @text onApplicationLaunchRequest |
| 73 | + // @brief Triggered when the cast service receives a launch request from a client with launch params |
| 74 | + // @param applicationName: Registered application name |
| 75 | + // @param strPayLoad: Payload string to be passed to the application |
| 76 | + // @param strQuery: Query string to be appended in launch request |
| 77 | + // @param strAddDataUrl: Additional data URL to be passed to the application |
| 78 | + virtual void OnApplicationLaunchRequestWithParam(const string& appName /* @text applicationName */ , const string& strPayLoad /* @text strPayLoad */, const string& strQuery /* @text strQuery */, const string& strAddDataUrl /* @text strAddDataUrl */) {}; |
| 79 | + // @text onApplicationLaunchRequest |
| 80 | + // @brief Triggered when the cast service receives a launch request from a client with launch params |
| 81 | + // @param applicationName: Registered application name |
| 82 | + // @param parameter: Application launch string |
| 83 | + virtual void OnApplicationLaunchRequest(const string& appName /* @text applicationName */ , const string& parameter /* @text parameter */ ) {}; |
| 84 | + // @text onApplicationStopRequest |
| 85 | + // @brief Triggered when the cast service receives a stop request from a client |
| 86 | + // @param applicationName: Registered application name |
| 87 | + // @param applicationId: Application instance ID |
| 88 | + virtual void OnApplicationStopRequest(const string& appName /* @text applicationName */, const string& appID /* @text applicationId */) {}; |
| 89 | + // @text onApplicationHideRequest |
| 90 | + // @brief Triggered when the cast service receives a hide request from a client |
| 91 | + // @param applicationName: Registered application name |
| 92 | + // @param applicationId: Application instance ID |
| 93 | + virtual void OnApplicationHideRequest(const string& appName /* @text applicationName */ , const string& appID /* @text applicationId */ ) {}; |
| 94 | + // @text onApplicationStateRequest |
| 95 | + // @brief Triggered when the cast service needs an update of the application state |
| 96 | + // @param applicationName: Registered application name |
| 97 | + // @param applicationId: Application instance ID |
| 98 | + virtual void OnApplicationStateRequest(const string& appName /* @text applicationName */ , const string& appID /* @text applicationId */ ) {}; |
| 99 | + // @text onApplicationResumeRequest |
| 100 | + // @brief Triggered when the cast service receives a resume request from a client |
| 101 | + // @param applicationName: Registered application name |
| 102 | + // @param applicationId: Application instance ID |
| 103 | + virtual void OnApplicationResumeRequest(const string& appName /* @text applicationName */ , const string& appID /* @text applicationId */) {}; |
55 | 104 | };
|
56 | 105 |
|
57 |
| - ~IXCast() override = default; |
| 106 | + virtual Core::hresult Register(IXCast::INotification* sink ) = 0; |
| 107 | + virtual Core::hresult Unregister(IXCast::INotification* sink) = 0; |
| 108 | + |
| 109 | + /****************************************SetApplicationState()*****************************/ |
| 110 | + // @text setApplicationState |
| 111 | + // @brief Triggered when the cast service receives an application state change notification from a client |
| 112 | + // @param applicationName: Registered application name |
| 113 | + // @param state: Application state |
| 114 | + // @param applicationId: Application instance ID |
| 115 | + // @param error: Error string, if any |
| 116 | + // @param success: Whether the request succeeded |
| 117 | + virtual Core::hresult SetApplicationState(const string& applicationName /* @text applicationName */, const State& state /* @text state */, const string& applicationId /* @text applicationId */, const ErrorCode& error /* @text error */, XCastSuccess& success /* @out */) = 0; |
| 118 | + /****************************************SetApplicationState()*****************************/ |
| 119 | + |
| 120 | + /****************************************getProtocolVersion()**********************************/ |
| 121 | + // @text getProtocolVersion |
| 122 | + // @brief Returns the DIAL protocol version supported by the server |
| 123 | + // @param version: DIAL protocol version |
| 124 | + // @param success: Whether the request succeeded |
| 125 | + virtual Core::hresult GetProtocolVersion(string &protocolVersion /* @out @text version */, bool &success /* @out */) = 0; |
| 126 | + /***************************************** getProtocolVersion() **********************************/ |
| 127 | + |
| 128 | + /****************************************setManufacturerName()**********************************/ |
| 129 | + // @text setManufacturerName |
| 130 | + // @brief Sets the manufacturer name of the device |
| 131 | + // @param manufacturer: The Manufacturer name of the device which used to update in dd.xml |
| 132 | + // @param success: Whether the request succeeded |
| 133 | + virtual Core::hresult SetManufacturerName(const string &manufacturername /* @text manufacturer */, XCastSuccess& success /* @out */) = 0; |
| 134 | + /***************************************** setManufacturerName() **********************************/ |
| 135 | + |
| 136 | + /****************************************getManufacturerName()**********************************/ |
| 137 | + // @text getManufacturerName |
| 138 | + // @brief Returns the manufacturer name set by setManufacturerName API |
| 139 | + // @param manufacturer: The Manufacturer name of the device which used to update in dd.xml |
| 140 | + // @param success: Whether the request succeeded |
| 141 | + virtual Core::hresult GetManufacturerName(string &manufacturername /* @out @text manufacturer */, bool &success /* @out */) = 0; |
| 142 | + /***************************************** getManufacturerName() *********************************/ |
| 143 | + |
| 144 | + /****************************************setModelName()**********************************/ |
| 145 | + // @text setModelName |
| 146 | + // @brief Sets the model name of the device |
| 147 | + // @param model: The Model name of the device which used to update in dd.xml |
| 148 | + // @param success: Whether the request succeeded |
| 149 | + virtual Core::hresult SetModelName(const string &modelname /* @text model */, XCastSuccess& success /* @out */) = 0; |
| 150 | + /***************************************** setModelName() **********************************/ |
| 151 | + |
| 152 | + /****************************************getModelName()**********************************/ |
| 153 | + // @text getModelName |
| 154 | + // @brief Returns the model name set by setModelName API |
| 155 | + // @param model: The Model name of the device which used to update in dd.xml |
| 156 | + // @param success: Whether the request succeeded |
| 157 | + virtual Core::hresult GetModelName(string &modelname /* @out @text model */, bool &success /* @out */) = 0; |
| 158 | + /***************************************** getModelName() *********************************/ |
| 159 | + |
| 160 | + /****************************************setEnabled()**********************************/ |
| 161 | + // @text setEnabled |
| 162 | + // @brief Enable or disable XCAST service |
| 163 | + // @parm enabled: true for enabled or false for disabled |
| 164 | + // @param success: Whether the request succeeded |
| 165 | + virtual Core::hresult SetEnabled(const bool& enabled /* @text enabled */, XCastSuccess& success /* @out */) = 0; |
| 166 | + /***************************************** setEnabled() **********************************/ |
| 167 | + |
| 168 | + /****************************************getEnabled()**********************************/ |
| 169 | + // @text getEnabled |
| 170 | + // @brief Reports whether xcast plugin is enabled or disabled |
| 171 | + // @param enabled: true for enabled or false for disabled |
| 172 | + // @param success: Whether the request succeeded |
| 173 | + virtual Core::hresult GetEnabled(bool &enabled /* @out @text enabled */, bool &success /* @out */) = 0; |
| 174 | + /***************************************** getEnabled() **********************************/ |
| 175 | + |
| 176 | + /****************************************setStandbyBehavior()**********************************/ |
| 177 | + // @text setStandbyBehavior |
| 178 | + // @brief Sets the expected xcast behavior in standby mode |
| 179 | + // @param standbybehavior: whether to remain active or inactive during standby mode (must be one of the following: active, inactive) |
| 180 | + // @param success: Whether the request succeeded |
| 181 | + virtual Core::hresult SetStandbyBehavior(const StandbyBehavior &standbybehavior /* @text standbybehavior */, XCastSuccess& success /* @out */) = 0; |
| 182 | + /***************************************** setStandbyBehavior() *********************************/ |
| 183 | + |
| 184 | + /****************************************getStandbyBehavior()**********************************/ |
| 185 | + // @text getStandbyBehavior |
| 186 | + // @brief Return current standby behavior option string set uisng setStandbyBehavior or default value |
| 187 | + // @param standbybehavior: whether to remain active or inactive during standby mode (must be one of the following: active, inactive) |
| 188 | + // @param success: Whether the request succeeded |
| 189 | + virtual Core::hresult GetStandbyBehavior(StandbyBehavior &standbybehavior /* @out @text standbybehavior */, bool &success /* @out */) = 0; |
| 190 | + /***************************************** getStandbyBehavior() *********************************/ |
| 191 | + |
| 192 | + /****************************************setFriendlyName()**********************************/ |
| 193 | + // @text setFriendlyName |
| 194 | + // @brief Sets the friendly name of the device |
| 195 | + // @param friendlyname: The friendly name of the device which used to display on the client device list |
| 196 | + // @param success: Whether the request succeeded |
| 197 | + virtual Core::hresult SetFriendlyName(const string &friendlyname /* @text friendlyname */, XCastSuccess& success /* @out */) = 0; |
| 198 | + /***************************************** setFriendlyName() **********************************/ |
| 199 | + |
| 200 | + /****************************************getFriendlyName()**********************************/ |
| 201 | + // @text getFriendlyName |
| 202 | + // @brief Returns the friendly name set by setFriendlyName API |
| 203 | + // @param friendlyname: The friendly name of the device which used to display on the client device list |
| 204 | + // @param success: Whether the request succeeded |
| 205 | + virtual Core::hresult GetFriendlyName(string &friendlyname /* @out @text friendlyname */, bool &success /* @out */) = 0; |
| 206 | + /***************************************** getFriendlyName() *********************************/ |
58 | 207 |
|
59 |
| - virtual void Register(IXCast::INotification* sink) = 0; |
60 |
| - virtual void Unregister(IXCast::INotification* sink) = 0; |
| 208 | + /****************************************registerApplications()**********************************/ |
| 209 | + // @text registerApplications |
| 210 | + // @brief Registers an application |
| 211 | + // @param applications: Json array with one or more application details to register |
| 212 | + // @param success: Whether the request succeeded |
| 213 | + virtual Core::hresult RegisterApplications(IApplicationInfoIterator* const appInfoList /* @text applications */ , XCastSuccess& success /* @out */) = 0; |
| 214 | + /****************************************registerApplications()**********************************/ |
61 | 215 |
|
62 |
| - virtual uint32_t Initialize(bool networkStandbyMode) = 0; |
63 |
| - virtual void Deinitialize(void) = 0; |
| 216 | + /****************************************unregisterApplications()**********************************/ |
| 217 | + // @text unregisterApplications |
| 218 | + // @brief Unregisters an application |
| 219 | + // @param applications: One or more application name to unregister |
| 220 | + // @param success: Whether the request succeeded |
| 221 | + virtual Core::hresult UnregisterApplications(IStringIterator* const applications /* @text applications */, XCastSuccess& success /* @out */) = 0; |
| 222 | + /****************************************unregisterApplications()**********************************/ |
| 223 | + |
64 | 224 |
|
65 |
| - virtual uint32_t applicationStateChanged(const string& applicationName, const string& state, const string& applicationId, const string& error) const = 0; |
66 |
| - virtual uint32_t enableCastService(string friendlyname,bool enableService) const = 0; |
67 |
| - virtual uint32_t getProtocolVersion(string &protocolVersion /* @out */ ) const = 0; |
68 |
| - virtual uint32_t registerApplications(IApplicationInfoIterator * const appInfoList /* @in */ ) = 0; |
69 |
| - virtual uint32_t setNetworkStandbyMode(bool networkStandbyMode) = 0; |
70 |
| - virtual uint32_t setManufacturerName(string manufacturername) const = 0; |
71 |
| - virtual uint32_t getManufacturerName(string &manufacturername /* @out */ ) const = 0; |
72 |
| - virtual uint32_t setModelName(string modelname) const = 0; |
73 |
| - virtual uint32_t getModelName(string &modelname /* @out */ ) const = 0; |
74 | 225 | };
|
75 | 226 |
|
76 | 227 | } // Exchange
|
|
0 commit comments