19
19
#pragma once
20
20
21
21
#include " ApplicationLauncher.h"
22
+ #include " Channel.h"
22
23
#include " ContentLauncher.h"
23
24
#include " KeypadInput.h"
24
25
#include " LevelControl.h"
27
28
#include " TargetNavigator.h"
28
29
#include " TargetVideoPlayerInfo.h"
29
30
31
+ #include < app-common/zap-generated/cluster-objects.h>
30
32
#include < app/server/Server.h>
31
33
#include < controller/CHIPCommissionableNodeController.h>
32
34
#include < functional>
35
+ #include < tv-casting-app/zap-generated/CHIPClientCallbacks.h>
33
36
#include < zap-generated/CHIPClusters.h>
34
37
35
38
constexpr chip::System::Clock::Seconds16 kCommissioningWindowTimeout = chip::System::Clock::Seconds16(3 * 60 );
@@ -73,35 +76,170 @@ class CastingServer
73
76
chip::FabricIndex CurrentFabricIndex () { return mTargetVideoPlayerInfo .GetFabricIndex (); }
74
77
void SetDefaultFabricIndex ();
75
78
79
+ /* *
80
+ * @brief Content Launcher cluster
81
+ */
76
82
CHIP_ERROR ContentLauncher_LaunchURL (
77
83
const char * contentUrl, const char * contentDisplayStr,
78
84
chip::Optional<chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type> brandingInformation,
79
85
std::function<void (CHIP_ERROR)> responseCallback);
80
86
CHIP_ERROR ContentLauncher_LaunchContent (chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type search,
81
87
bool autoPlay, chip::Optional<chip::CharSpan> data,
82
88
std::function<void (CHIP_ERROR)> responseCallback);
89
+
90
+ /* *
91
+ * @brief Level Control cluster
92
+ */
83
93
CHIP_ERROR LevelControl_Step (chip::app::Clusters::LevelControl::StepMode stepMode, uint8_t stepSize, uint16_t transitionTime,
84
94
uint8_t optionMask, uint8_t optionOverride, std::function<void (CHIP_ERROR)> responseCallback);
85
95
CHIP_ERROR LevelControl_MoveToLevel (uint8_t level, uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride,
86
96
std::function<void (CHIP_ERROR)> responseCallback);
97
+
98
+ CHIP_ERROR
99
+ LevelControl_SubscribeToCurrentLevel (
100
+ void * context,
101
+ chip::Controller::ReadResponseSuccessCallback<
102
+ chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::DecodableArgType>
103
+ successFn,
104
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
105
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
106
+ CHIP_ERROR
107
+ LevelControl_SubscribeToMinLevel (void * context,
108
+ chip::Controller::ReadResponseSuccessCallback<
109
+ chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::DecodableArgType>
110
+ successFn,
111
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval,
112
+ uint16_t maxInterval,
113
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
114
+ CHIP_ERROR
115
+ LevelControl_SubscribeToMaxLevel (void * context,
116
+ chip::Controller::ReadResponseSuccessCallback<
117
+ chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::DecodableArgType>
118
+ successFn,
119
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval,
120
+ uint16_t maxInterval,
121
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
122
+
123
+ /* *
124
+ * @brief Media Playback cluster
125
+ */
87
126
CHIP_ERROR MediaPlayback_Play (std::function<void (CHIP_ERROR)> responseCallback);
88
127
CHIP_ERROR MediaPlayback_Pause (std::function<void (CHIP_ERROR)> responseCallback);
89
128
CHIP_ERROR MediaPlayback_StopPlayback (std::function<void (CHIP_ERROR)> responseCallback);
90
129
CHIP_ERROR MediaPlayback_Next (std::function<void (CHIP_ERROR)> responseCallback);
91
130
CHIP_ERROR MediaPlayback_Seek (uint64_t position, std::function<void (CHIP_ERROR)> responseCallback);
92
131
CHIP_ERROR MediaPlayback_SkipForward (uint64_t deltaPositionMilliseconds, std::function<void (CHIP_ERROR)> responseCallback);
93
132
CHIP_ERROR MediaPlayback_SkipBackward (uint64_t deltaPositionMilliseconds, std::function<void (CHIP_ERROR)> responseCallback);
133
+
134
+ CHIP_ERROR MediaPlayback_SubscribeToCurrentState (
135
+ void * context,
136
+ chip::Controller::ReadResponseSuccessCallback<
137
+ chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableArgType>
138
+ successFn,
139
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
140
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
141
+ CHIP_ERROR
142
+ MediaPlayback_SubscribeToStartTime (void * context,
143
+ chip::Controller::ReadResponseSuccessCallback<
144
+ chip::app::Clusters::MediaPlayback::Attributes::StartTime::TypeInfo::DecodableArgType>
145
+ successFn,
146
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval,
147
+ uint16_t maxInterval,
148
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
149
+ CHIP_ERROR
150
+ MediaPlayback_SubscribeToDuration (void * context,
151
+ chip::Controller::ReadResponseSuccessCallback<
152
+ chip::app::Clusters::MediaPlayback::Attributes::Duration ::TypeInfo::DecodableArgType>
153
+ successFn,
154
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval,
155
+ uint16_t maxInterval,
156
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
157
+ CHIP_ERROR MediaPlayback_SubscribeToSampledPosition (
158
+ void * context,
159
+ chip::Controller::ReadResponseSuccessCallback<
160
+ chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableArgType>
161
+ successFn,
162
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
163
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
164
+ CHIP_ERROR MediaPlayback_SubscribeToPlaybackSpeed (
165
+ void * context,
166
+ chip::Controller::ReadResponseSuccessCallback<
167
+ chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableArgType>
168
+ successFn,
169
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
170
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
171
+ CHIP_ERROR MediaPlayback_SubscribeToSeekRangeEnd (
172
+ void * context,
173
+ chip::Controller::ReadResponseSuccessCallback<
174
+ chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableArgType>
175
+ successFn,
176
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
177
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
178
+ CHIP_ERROR MediaPlayback_SubscribeToSeekRangeStart (
179
+ void * context,
180
+ chip::Controller::ReadResponseSuccessCallback<
181
+ chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableArgType>
182
+ successFn,
183
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
184
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
185
+
186
+ /* *
187
+ * @brief Application Launcher cluster
188
+ */
94
189
CHIP_ERROR ApplicationLauncher_LaunchApp (chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
95
190
chip::Optional<chip::ByteSpan> data, std::function<void (CHIP_ERROR)> responseCallback);
96
191
CHIP_ERROR ApplicationLauncher_StopApp (chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
97
192
std::function<void (CHIP_ERROR)> responseCallback);
98
193
CHIP_ERROR ApplicationLauncher_HideApp (chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
99
194
std::function<void (CHIP_ERROR)> responseCallback);
195
+
196
+ CHIP_ERROR
197
+ ApplicationLauncher_SubscribeToCurrentApp (
198
+ void * context,
199
+ chip::Controller::ReadResponseSuccessCallback<
200
+ chip::app::Clusters::ApplicationLauncher::Attributes::CurrentApp::TypeInfo::DecodableArgType>
201
+ successFn,
202
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
203
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
204
+
205
+ /* *
206
+ * @brief Target Navigator cluster
207
+ */
100
208
CHIP_ERROR TargetNavigator_NavigateTarget (const uint8_t target, const chip::Optional<chip::CharSpan> data,
101
209
std::function<void (CHIP_ERROR)> responseCallback);
210
+
211
+ CHIP_ERROR TargetNavigator_SubscribeToTargetList (
212
+ void * context,
213
+ chip::Controller::ReadResponseSuccessCallback<
214
+ chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableArgType>
215
+ successFn,
216
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
217
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
218
+ CHIP_ERROR TargetNavigator_SubscribeToCurrentTarget (
219
+ void * context,
220
+ chip::Controller::ReadResponseSuccessCallback<
221
+ chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableArgType>
222
+ successFn,
223
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
224
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
225
+
226
+ /* *
227
+ * @brief Keypad Input cluster
228
+ */
102
229
CHIP_ERROR KeypadInput_SendKey (const chip::app::Clusters::KeypadInput::CecKeyCode keyCode,
103
230
std::function<void (CHIP_ERROR)> responseCallback);
104
231
232
+ /* *
233
+ * @brief Channel cluster
234
+ */
235
+ CHIP_ERROR Channel_ChangeChannelCommand (const chip::CharSpan & match, std::function<void (CHIP_ERROR)> responseCallback);
236
+ CHIP_ERROR Channel_SubscribeToLineup (
237
+ void * context,
238
+ chip::Controller::ReadResponseSuccessCallback<chip::app::Clusters::Channel::Attributes::Lineup::TypeInfo::DecodableArgType>
239
+ successFn,
240
+ chip::Controller::ReadResponseFailureCallback failureFn, uint16_t minInterval, uint16_t maxInterval,
241
+ chip::Controller::SubscriptionEstablishedCallback onSubscriptionEstablished);
242
+
105
243
private:
106
244
CHIP_ERROR InitBindingHandlers ();
107
245
static void DeviceEventCallback (const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
@@ -127,6 +265,10 @@ class CastingServer
127
265
StepCommand mStepCommand ;
128
266
MoveToLevelCommand mMoveToLevelCommand ;
129
267
268
+ CurrentLevelSubscriber mCurrentLevelSubscriber ;
269
+ MinLevelSubscriber mMinLevelSubscriber ;
270
+ MaxLevelSubscriber mMaxLevelSubscriber ;
271
+
130
272
/* *
131
273
* @brief Media Playback cluster
132
274
*/
@@ -138,20 +280,40 @@ class CastingServer
138
280
SkipForwardCommand mSkipForwardCommand ;
139
281
SkipBackwardCommand mSkipBackwardCommand ;
140
282
283
+ CurrentStateSubscriber mCurrentStateSubscriber ;
284
+ StartTimeSubscriber mStartTimeSubscriber ;
285
+ DurationSubscriber mDurationSubscriber ;
286
+ SampledPositionSubscriber mSampledPositionSubscriber ;
287
+ PlaybackSpeedSubscriber mPlaybackSpeedSubscriber ;
288
+ SeekRangeEndSubscriber mSeekRangeEndSubscriber ;
289
+ SeekRangeStartSubscriber mSeekRangeStartSubscriber ;
290
+
141
291
/* *
142
292
* @brief Application Launcher cluster
143
293
*/
144
294
LaunchAppCommand mLaunchAppCommand ;
145
295
StopAppCommand mStopAppCommand ;
146
296
HideAppCommand mHideAppCommand ;
147
297
298
+ CurrentAppSubscriber mCurrentAppSubscriber ;
299
+
148
300
/* *
149
301
* @brief Target Navigator cluster
150
302
*/
151
303
NavigateTargetCommand mNavigateTargetCommand ;
152
304
305
+ TargetListSubscriber mTargetListSubscriber ;
306
+ CurrentTargetSubscriber mCurrentTargetSubscriber ;
307
+
153
308
/* *
154
309
* @brief Keypad Input cluster
155
310
*/
156
311
SendKeyCommand mSendKeyCommand ;
312
+
313
+ /* *
314
+ * @brief Channel cluster
315
+ */
316
+ ChangeChannelCommand mChangeChannelCommand ;
317
+
318
+ LineupSubscriber mLineupSubscriber ;
157
319
};
0 commit comments