Skip to content

Commit 2a2a6e0

Browse files
authored
Merge pull request #261 from rdkcentral/feature/RDKEMW-1017_1018_miracast_comrpc_support
RDKEMW-1017 RDKEMW-1018: Miracast COMRPC support
2 parents 29d6cb7 + 0bc8efa commit 2a2a6e0

File tree

3 files changed

+311
-1
lines changed

3 files changed

+311
-1
lines changed

apis/Ids.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,13 @@ namespace Exchange {
290290
ID_HDMI_CEC_SINK = ID_ENTOS_OFFSET + 0x3C0,
291291
ID_HDMI_CEC_SINK_ACTIVE_PATH_ITERATOR = ID_HDMI_CEC_SINK + 1,
292292
ID_HDMI_CEC_SINK_DEVICE_LIST_ITERATOR = ID_HDMI_CEC_SINK + 2,
293-
ID_HDMI_CEC_SINK_NOTIFICATION = ID_HDMI_CEC_SINK + 3
293+
ID_HDMI_CEC_SINK_NOTIFICATION = ID_HDMI_CEC_SINK + 3,
294+
295+
ID_MIRACAST_SERVICE = ID_ENTOS_OFFSET + 0x3D0,
296+
ID_MIRACAST_SERVICE_NOTIFICATION = ID_MIRACAST_SERVICE + 1,
297+
ID_MIRACAST_PLAYER = ID_MIRACAST_SERVICE + 2,
298+
ID_MIRACAST_PLAYER_NOTIFICATION = ID_MIRACAST_SERVICE + 3,
299+
ID_MIRACAST_PLAYER_ENV_ARGUMENTS_ITERATOR = ID_MIRACAST_SERVICE + 4
294300
};
295301
}
296302
}

apis/Miracast/IMiracastPlayer.h

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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

apis/Miracast/IMiracastService.h

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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+
namespace WPEFramework
25+
{
26+
namespace Exchange
27+
{
28+
// @json @text:keep
29+
struct EXTERNAL IMiracastService : virtual public Core::IUnknown
30+
{
31+
enum { ID = ID_MIRACAST_SERVICE };
32+
33+
enum ReasonCode : uint8_t
34+
{
35+
REASON_CODE_SUCCESS = 100 /* @text SUCCESS */,
36+
REASON_CODE_P2P_CONNECT_FAILURE = 101 /* @text P2P_CONNECT_FAILURE */,
37+
REASON_CODE_P2P_GROUP_NEGOTIATION_FAILURE = 102 /* @text P2P_GROUP_NEGOTIATION_FAILURE */,
38+
REASON_CODE_P2P_GROUP_FORMATION_FAILURE = 103 /* @text P2P_GROUP_FORMATION_FAILURE */,
39+
REASON_CODE_GENERIC_FAILURE = 104 /* @text GENERIC_FAILURE */
40+
};
41+
42+
enum PlayerState : uint8_t
43+
{
44+
PLAYER_STATE_IDLE = 0 /* @text IDLE */,
45+
PLAYER_STATE_INITIATED = 1 /* @text INITIATED */,
46+
PLAYER_STATE_INPROGRESS = 2 /* @text INPROGRESS */,
47+
PLAYER_STATE_PLAYING = 3 /* @text PLAYING */,
48+
PLAYER_STATE_STOPPED = 4 /* @text STOPPED */
49+
};
50+
51+
enum PlayerReasonCode : uint8_t
52+
{
53+
PLAYER_REASON_CODE_SUCCESS = 200 /* @text SUCCESS */,
54+
PLAYER_REASON_CODE_APP_REQ_TO_STOP = 201 /* @text APP_REQ_TO_STOP */,
55+
PLAYER_REASON_CODE_SRC_DEV_REQ_TO_STOP = 202 /* @text SRC_DEV_REQ_TO_STOP */,
56+
PLAYER_REASON_CODE_RTSP_ERROR = 203 /* @text RTSP_FAILURE */,
57+
PLAYER_REASON_CODE_RTSP_TIMEOUT = 204 /* @text RTSP_TIMEOUT */,
58+
PLAYER_REASON_CODE_RTSP_METHOD_NOT_SUPPORTED = 205 /* @text RTSP_NOT_SUPPORTED */,
59+
PLAYER_REASON_CODE_GST_ERROR = 206 /* @text GST_FAILURE */,
60+
PLAYER_REASON_CODE_INT_FAILURE = 207 /* @text INTERNAL_FAILURE */,
61+
PLAYER_REASON_CODE_NEW_SRC_DEV_CONNECT_REQ = 208 /* @text NEW_SRC_DEV_CONNECT_REQ */,
62+
};
63+
64+
struct EXTERNAL DeviceParameters
65+
{
66+
string sourceDeviceIP /* @text source_dev_ip */ /* @brief IP Address of Source Device */;
67+
string sourceDeviceMac /* @text source_dev_mac */ /* @brief MAC Address of Source Device */;
68+
string sourceDeviceName /* @text source_dev_name */ /* @brief Name of Source Device */;
69+
string sinkDeviceIP /* @text sink_dev_ip */ /* @brief IP Address of Sink Device */;
70+
};
71+
72+
struct EXTERNAL Result
73+
{
74+
string message /* @text message */ /* @brief reason for success or failure */;
75+
bool success;
76+
};
77+
78+
// @event
79+
struct EXTERNAL INotification : virtual public Core::IUnknown
80+
{
81+
enum { ID = ID_MIRACAST_SERVICE_NOTIFICATION };
82+
83+
// @brief Triggered when the Miracast Service plugin receives a new connection request from a client
84+
// @text onClientConnectionRequest
85+
// @param clientMac: MacAddress of the client device
86+
// @param clientName: Name of the client device
87+
virtual void OnClientConnectionRequest(const string &clientMac /* @text mac */, const string &clientName /* @text name */) {};
88+
89+
// @brief It is triggered when the Miracast Service plugin failed to connect with the source streaming device due to some error, like P2P related errors during activation or while streaming
90+
// @text onClientConnectionError
91+
// @param clientMac: MacAddress of the client device
92+
// @param clientName: Name of the client device
93+
// @param errorCode: Error code for the connection failure
94+
// @param reason: Reason for the connection failure
95+
virtual void OnClientConnectionError(const string &clientMac /* @text mac */, const string &clientName /* @text name */, const string &reasonCode /* @text error_code */, const ReasonCode reasonDescription /* @text reason */) {};
96+
97+
// @brief Miracast Service Plugin raises this Event to request RA or MiracastWidget to launch the Miracast Player
98+
// @text onLaunchRequest
99+
// @param DeviceParameters: Contains Source and Sink Device related properties
100+
virtual void OnLaunchRequest(const DeviceParameters &deviceParameters/* @text device_parameters*/) {};
101+
};
102+
103+
// @json:omit
104+
virtual Core::hresult Register(Exchange::IMiracastService::INotification *notification) = 0;
105+
// @json:omit
106+
virtual Core::hresult Unregister(Exchange::IMiracastService::INotification *notification) = 0;
107+
108+
// @brief To enable or disable the Miracast feature
109+
// @text setEnable
110+
// @param enabled: Is the MiracastService discovery enabled or not
111+
// @param success: Is the operation successful or not
112+
virtual Core::hresult SetEnabled(const bool enabled /* @text enabled */, Result &result /* @out */) = 0;
113+
114+
// @brief To get the enable status of the Miracast feature
115+
// @text getEnable
116+
// @param enabled: Is the MiracastService discovery enabled or not
117+
// @param success: Is the operation successful or not
118+
virtual Core::hresult GetEnabled(bool &enabled /* @out @text enabled */, bool &success /* @out */) = 0;
119+
120+
// @brief To accept or reject new client connection requests for the Miracast feature
121+
// @text acceptClientConnection
122+
// @param requestStatus: It should be "Accept" or "Reject"
123+
// @param success: Is the operation successful or not
124+
virtual Core::hresult AcceptClientConnection(const string &requestStatus /* @text requestStatus */, Result &result /* @out */) = 0;
125+
126+
// @brief To abort the ongoing connection after accepted connection request
127+
// @text stopClientConnection
128+
// @param clientMac: MacAddress of the client device
129+
// @param clientName: Name of the client device
130+
// @param success: Is the operation successful or not
131+
virtual Core::hresult StopClientConnection(const string &clientMac /* @text mac */, const string &clientName /* @text name */, Result &result /* @out */) = 0;
132+
133+
// @brief Update the Miracast Player State to the Miracast Service Plugin
134+
// @text updatePlayerState
135+
// @param clientMac: MacAddress of the client device
136+
// @param playerState: Player state to be updated
137+
// @param reasonCode: Reason code for the player state update
138+
// @param reason: Reason for the player state update
139+
// @param success: Is the operation successful or not
140+
virtual Core::hresult UpdatePlayerState(const string &clientMac /* @text mac */, const PlayerState playerState /* @text state */, const int reasonCode /* @text reason_code */, Result &result /* @out */) = 0;
141+
142+
// @brief Sets the status of the MiracastService backend discovery
143+
// @text setP2PBackendDiscovery
144+
// @param enabled: Is the MiracastService backend discovery enabled or not
145+
// @param success: Is the operation successful or not
146+
virtual Core::hresult SetP2PBackendDiscovery(const bool enabled /* @text enabled */, Result &result /* @out */) = 0;
147+
};
148+
} // namespace Exchange
149+
} // namespace WPEFramework

0 commit comments

Comments
 (0)