@@ -90,27 +90,67 @@ - (MCCastingPlayer * _Nonnull)castingPlayer
90
90
- (MCCluster * _Nullable)clusterForType : (MCEndpointClusterType)type
91
91
{
92
92
switch (type) {
93
- case MCEndpointClusterTypeApplicationBasic:
94
- return [[MCApplicationBasicCluster alloc ] initWithCppCluster: _cppEndpoint->GetCluster<matter: :casting: :clusters: :application_basic: :ApplicationBasicCluster>()] ;
95
-
96
- case MCEndpointClusterTypeApplicationLauncher:
97
- return [[MCApplicationLauncherCluster alloc ] initWithCppCluster: _cppEndpoint->GetCluster< matter: : casting: : clusters: : application_launcher: :ApplicationLauncherCluster>()] ;
98
-
99
- case MCEndpointClusterTypeContentLauncher:
100
- return [[MCContentLauncherCluster alloc ] initWithCppCluster: _cppEndpoint->GetCluster< matter: : casting: : clusters: : content_launcher: :ContentLauncherCluster>()];
93
+ case MCEndpointClusterTypeApplicationBasic: {
94
+ auto cppCluster = _cppEndpoint->GetCluster <matter::casting::clusters::application_basic::ApplicationBasicCluster>();
95
+ if (cppCluster == nullptr ) {
96
+ ChipLogError (AppServer, " MCEndpoint::clusterForType() MCEndpointClusterTypeApplicationBasic, GetCluster() returned nullptr " );
97
+ return nil ;
98
+ }
99
+ return [[MCApplicationBasicCluster alloc ] initWithCppCluster: cppCluster];
100
+ }
101
101
102
- case MCEndpointClusterTypeKeypadInput:
103
- return [[MCKeypadInputCluster alloc ] initWithCppCluster: _cppEndpoint->GetCluster<matter: :casting: :clusters: :keypad_input: :KeypadInputCluster>()];
102
+ case MCEndpointClusterTypeApplicationLauncher: {
103
+ auto cppCluster = _cppEndpoint->GetCluster <matter::casting::clusters::application_launcher::ApplicationLauncherCluster>();
104
+ if (cppCluster == nullptr ) {
105
+ ChipLogError (AppServer, " MCEndpoint::clusterForType() MCEndpointClusterTypeApplicationLauncher GetCluster() returned nullptr" );
106
+ return nil ;
107
+ }
108
+ return [[MCApplicationLauncherCluster alloc ] initWithCppCluster: cppCluster];
109
+ }
104
110
105
- case MCEndpointClusterTypeMediaPlayback:
106
- return [[MCMediaPlaybackCluster alloc ] initWithCppCluster: _cppEndpoint->GetCluster<matter: :casting: :clusters: :media_playback: :MediaPlaybackCluster>()];
111
+ case MCEndpointClusterTypeContentLauncher: {
112
+ auto cppCluster = _cppEndpoint->GetCluster <matter::casting::clusters::content_launcher::ContentLauncherCluster>();
113
+ if (cppCluster == nullptr ) {
114
+ ChipLogError (AppServer, " MCEndpoint::clusterForType() MCEndpointClusterTypeContentLauncher GetCluster() returned nullptr" );
115
+ return nil ;
116
+ }
117
+ return [[MCContentLauncherCluster alloc ] initWithCppCluster: cppCluster];
118
+ }
107
119
108
- case MCEndpointClusterTypeOnOff:
109
- return [[MCOnOffCluster alloc ] initWithCppCluster: _cppEndpoint->GetCluster<matter: :casting: :clusters: :on_off: :OnOffCluster>()];
120
+ case MCEndpointClusterTypeKeypadInput: {
121
+ auto cppCluster = _cppEndpoint->GetCluster <matter::casting::clusters::keypad_input::KeypadInputCluster>();
122
+ if (cppCluster == nullptr ) {
123
+ ChipLogError (AppServer, " MCEndpoint::clusterForType() MCEndpointClusterTypeKeypadInput GetCluster() returned nullptr" );
124
+ return nil ;
125
+ }
126
+ return [[MCKeypadInputCluster alloc ] initWithCppCluster: cppCluster];
127
+ }
110
128
111
- case MCEndpointClusterTypeTargetNavigator:
112
- return [[MCTargetNavigatorCluster alloc ] initWithCppCluster: _cppEndpoint->GetCluster<matter: :casting: :clusters: :target_navigator: :TargetNavigatorCluster>()];
129
+ case MCEndpointClusterTypeMediaPlayback: {
130
+ auto cppCluster = _cppEndpoint->GetCluster <matter::casting::clusters::media_playback::MediaPlaybackCluster>();
131
+ if (cppCluster == nullptr ) {
132
+ ChipLogError (AppServer, " MCEndpoint::clusterForType() MCEndpointClusterTypeMediaPlayback GetCluster() returned nullptr" );
133
+ return nil ;
134
+ }
135
+ return [[MCMediaPlaybackCluster alloc ] initWithCppCluster: cppCluster];
136
+ }
113
137
138
+ case MCEndpointClusterTypeOnOff: {
139
+ auto cppCluster = _cppEndpoint->GetCluster <matter::casting::clusters::on_off::OnOffCluster>();
140
+ if (cppCluster == nullptr ) {
141
+ ChipLogError (AppServer, " MCEndpoint::clusterForType() MCEndpointClusterTypeOnOff GetCluster() returned nullptr" );
142
+ return nil ;
143
+ }
144
+ return [[MCOnOffCluster alloc ] initWithCppCluster: cppCluster];
145
+ }
146
+ case MCEndpointClusterTypeTargetNavigator: {
147
+ auto cppCluster = _cppEndpoint->GetCluster <matter::casting::clusters::target_navigator::TargetNavigatorCluster>();
148
+ if (cppCluster == nullptr ) {
149
+ ChipLogError (AppServer, " MCEndpoint::clusterForType() MCEndpointClusterTypeTargetNavigator GetCluster() returned nullptr" );
150
+ return nil ;
151
+ }
152
+ return [[MCTargetNavigatorCluster alloc ] initWithCppCluster: cppCluster];
153
+ }
114
154
default :
115
155
ChipLogError (AppServer, " MCEndpointClusterType not found" );
116
156
break ;
0 commit comments