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 2025 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
+ {
28
+ namespace Exchange
29
+ {
30
+ // @json @text:keep
31
+ struct EXTERNAL IMiracastPlayer : virtual public Core::IUnknown
32
+ {
33
+ enum { ID = ID_MIRACAST_PLAYER };
34
+
35
+ enum State : uint8_t
36
+ {
37
+ STATE_IDLE = 0 /* @text IDLE */ ,
38
+ STATE_INITIATED = 1 /* @text INITIATED */ ,
39
+ STATE_INPROGRESS = 2 /* @text INPROGRESS */ ,
40
+ STATE_PLAYING = 3 /* @text PLAYING */ ,
41
+ STATE_STOPPED = 4 /* @text STOPPED */ ,
42
+ STATE_PAUSED = 5 /* @text PAUSED */
43
+ };
44
+
45
+ enum ReasonCode : uint8_t
46
+ {
47
+ REASON_CODE_SUCCESS = 200 /* @text SUCCESS */ ,
48
+ REASON_CODE_APP_REQ_TO_STOP = 201 /* @text APP_REQ_TO_STOP */ ,
49
+ REASON_CODE_SRC_DEV_REQ_TO_STOP = 202 /* @text SRC_DEV_REQ_TO_STOP */ ,
50
+ REASON_CODE_RTSP_ERROR = 203 /* @text RTSP_FAILURE */ ,
51
+ REASON_CODE_RTSP_TIMEOUT = 204 /* @text RTSP_TIMEOUT */ ,
52
+ REASON_CODE_RTSP_METHOD_NOT_SUPPORTED = 205 /* @text RTSP_NOT_SUPPORTED */ ,
53
+ REASON_CODE_GST_ERROR = 206 /* @text GST_FAILURE */ ,
54
+ REASON_CODE_INT_FAILURE = 207 /* @text INTERNAL_FAILURE */ ,
55
+ REASON_CODE_NEW_SRC_DEV_CONNECT_REQ = 208 /* @text NEW_SRC_DEV_CONNECT_REQ */ ,
56
+ };
57
+
58
+ struct EXTERNAL DeviceParameters
59
+ {
60
+ string sourceDeviceIP /* @text source_dev_ip */ /* @brief IP Address of Source Device */ ;
61
+ string sourceDeviceMac /* @text source_dev_mac */ /* @brief MAC Address of Source Device */ ;
62
+ string sourceDeviceName /* @text source_dev_name */ /* @brief Name of Source Device */ ;
63
+ string sinkDeviceIP /* @text sink_dev_ip */ /* @brief IP Address of Sink Device */ ;
64
+ };
65
+
66
+ struct EXTERNAL VideoRectangle
67
+ {
68
+ int startX /* @text X */ /* @brief X coordinate of the rectangle */ ;
69
+ int startY /* @text Y */ /* @brief Y coordinate of the rectangle */ ;
70
+ int width /* @text W */ /* @brief Width of the rectangle */ ;
71
+ int height /* @text H */ /* @brief Height of the rectangle */ ;
72
+ };
73
+
74
+ struct EXTERNAL Result
75
+ {
76
+ string message /* @text message */ /* @brief reason for success or failure */ ;
77
+ bool success;
78
+ };
79
+
80
+ struct EXTERNAL EnvArguments
81
+ {
82
+ string argName /* @text argName */ /* @brief environment argument name */ ;
83
+ string argValue /* @text argValue */ /* @brief environment argument value */ ;
84
+ };
85
+ using IEnvArgumentsIterator = RPC::IIteratorType<EnvArguments, ID_MIRACAST_PLAYER_ENV_ARGUMENTS_ITERATOR>;
86
+
87
+ // @event
88
+ struct EXTERNAL INotification : virtual public Core::IUnknown
89
+ {
90
+ enum { ID = ID_MIRACAST_PLAYER_NOTIFICATION };
91
+
92
+ // @brief Notifies when a Miracast source device wants to connect
93
+ // @text onStateChange
94
+ // @param clientName: Name of the client device
95
+ // @param clientMac: MacAddress of the client device
96
+ // @param playerState: Current state of the player (e.g., INITIATED | INPROGRESS | PLAYING | STOPPED/IDLE(Default State).)
97
+ // @param reasonCode: Reason code for the player state update
98
+ // @param reason: reason code Decription
99
+ virtual void OnStateChange (const string &clientName /* @text name */ , const string &clientMac /* @text mac */ , const State playerState /* @text state */ , const string &reasonCode /* @text reason_code */ , const ReasonCode reasonDescription /* @text reason */ ) {};
100
+ };
101
+
102
+ // @json:omit
103
+ virtual Core::hresult Register (Exchange::IMiracastPlayer::INotification *notification) = 0;
104
+ // @json:omit
105
+ virtual Core::hresult Unregister (Exchange::IMiracastPlayer::INotification *notification) = 0;
106
+
107
+ // @brief To set the Miracast Player State to Play after the Miracast session like RTSP communication and GStreamer Playback
108
+ // @text playRequest
109
+ // @param deviceParam: Contains Source and Sink Device related properties
110
+ // @param videoRect: Video rectangle to be used for Miracast playback (x, y, width, height)
111
+ // @param success: Is the operation successful or not
112
+ virtual Core::hresult PlayRequest (const DeviceParameters &deviceParam /* @text device_parameters */ , const VideoRectangle videoRect /* @text video_rectangle */ , Result &result /* @out */ ) = 0;
113
+
114
+ // @brief To stop the Miracast Player to tear down the RTSP communication, stop/close the GStreamer pipeline, clean up, and reset the player state
115
+ // @text stopRequest
116
+ // @param clientMac: MacAddress of the client device
117
+ // @param clientName: Name of the client device
118
+ // @param reasonCode: Reason code for the player stop request
119
+ // @param reason: Reason for the player stop request
120
+ // @param success: Is the operation successful or not
121
+ virtual Core::hresult StopRequest (const string &clientMac /* @text mac */ , const string &clientName /* @text name */ , const int reasonCode /* @text reason_code */ , Result &result /* @out */ ) = 0;
122
+
123
+ // @brief Set the Video Rectangle.
124
+ // @text setVideoRectangle
125
+ // @param startX: X coordinate of the rectangle
126
+ // @param startY: Y coordinate of the rectangle
127
+ // @param width: Width of the rectangle
128
+ // @param height: Height of the rectangle
129
+ // @param success: Is the operation successful or not
130
+ virtual Core::hresult SetVideoRectangle (const int startX /* @text X */ , const int startY /* @text Y */ , const int width /* @text W */ , const int height /* @text H */ , Result &result /* @out */ ) = 0;
131
+
132
+ // @brief To configure the westeros environment arguments for the Miracast Player. This will be deprecated and SetEnvArguments will be used instead.
133
+ // @text setWesterosEnvironment
134
+ // @param westerosArgs: Westeros environment arguments to be set
135
+ // @param success: Is the operation successful or not
136
+ virtual Core::hresult SetWesterosEnvironment ( IEnvArgumentsIterator * const westerosArgs /* @text westerosArgs */ , Result &result /* @out */ ) = 0;
137
+
138
+ // @brief To reset the westeros environment arguments for the Miracast Player. This will be deprecated and UnsetEnvArguments will be used instead.
139
+ // @text unsetWesterosEnvironment
140
+ // @param success: Is the operation successful or not
141
+ virtual Core::hresult UnsetWesterosEnvironment (Result &result /* @out */ ) = 0;
142
+
143
+ // @brief To configure the environment arguments for the Miracast Player
144
+ // @text setEnvArguments
145
+ // @param envArgs: environment arguments to be set
146
+ // @param success: Is the operation successful or not
147
+ virtual Core::hresult SetEnvArguments ( IEnvArgumentsIterator * const envArgs /* @text envArgs */ , Result &result /* @out */ ) = 0;
148
+
149
+ // @brief To reset the environment arguments for the Miracast Player
150
+ // @text unsetEnvArguments
151
+ // @param success: Is the operation successful or not
152
+ virtual Core::hresult UnsetEnvArguments (Result &result /* @out */ ) = 0;
153
+ };
154
+ } // namespace Exchange
155
+ } // namespace WPEFramework
0 commit comments