forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux tv-casting-app: simplified Endpoints APIs and post-connection f…
…low (project-chip#30940)
- Loading branch information
1 parent
e818d35
commit 48891d5
Showing
19 changed files
with
1,181 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
examples/tv-casting-app/tv-casting-common/clusters/ContentLauncherCluster.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "core/Endpoint.h" | ||
#include "core/Types.h" | ||
|
||
#include "lib/support/logging/CHIPLogging.h" | ||
|
||
namespace matter { | ||
namespace casting { | ||
namespace clusters { | ||
|
||
class ContentLauncherCluster : public core::BaseCluster | ||
{ | ||
private: | ||
protected: | ||
public: | ||
ContentLauncherCluster(memory::Weak<core::Endpoint> endpoint) : core::BaseCluster(endpoint) {} | ||
|
||
// TODO: | ||
// LaunchURL(const char * contentUrl, const char * contentDisplayStr, | ||
// chip::Optional<chip::app::Clusters::ContentLauncher::Structs::BrandingInformationStruct::Type> brandingInformation); | ||
}; | ||
|
||
}; // namespace clusters | ||
}; // namespace casting | ||
}; // namespace matter |
42 changes: 42 additions & 0 deletions
42
examples/tv-casting-app/tv-casting-common/clusters/MediaPlaybackCluster.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "core/Endpoint.h" | ||
#include "core/Types.h" | ||
|
||
#include "lib/support/logging/CHIPLogging.h" | ||
|
||
namespace matter { | ||
namespace casting { | ||
namespace clusters { | ||
|
||
class MediaPlaybackCluster : public core::BaseCluster | ||
{ | ||
private: | ||
protected: | ||
public: | ||
MediaPlaybackCluster(memory::Weak<core::Endpoint> endpoint) : core::BaseCluster(endpoint) {} | ||
|
||
// TODO: add commands | ||
}; | ||
|
||
}; // namespace clusters | ||
}; // namespace casting | ||
}; // namespace matter |
42 changes: 42 additions & 0 deletions
42
examples/tv-casting-app/tv-casting-common/clusters/TargetNavigatorCluster.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "core/Endpoint.h" | ||
#include "core/Types.h" | ||
|
||
#include "lib/support/logging/CHIPLogging.h" | ||
|
||
namespace matter { | ||
namespace casting { | ||
namespace clusters { | ||
|
||
class TargetNavigatorCluster : public core::BaseCluster | ||
{ | ||
private: | ||
protected: | ||
public: | ||
TargetNavigatorCluster(memory::Weak<core::Endpoint> endpoint) : core::BaseCluster(endpoint) {} | ||
|
||
// TODO: add commands | ||
}; | ||
|
||
}; // namespace clusters | ||
}; // namespace casting | ||
}; // namespace matter |
76 changes: 76 additions & 0 deletions
76
examples/tv-casting-app/tv-casting-common/core/Attribute.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Cluster.h" | ||
#include "Types.h" | ||
|
||
#include "lib/support/logging/CHIPLogging.h" | ||
|
||
namespace matter { | ||
namespace casting { | ||
namespace core { | ||
|
||
enum ReadAttributeError | ||
{ | ||
READ_ATTRIBUTE_NO_ERROR | ||
}; | ||
|
||
enum WriteAttributeError | ||
{ | ||
WRITE_ATTRIBUTE_NO_ERROR | ||
}; | ||
|
||
template <typename ValueType> | ||
using ReadAttributeCallback = std::function<void(Optional<ValueType> before, ValueType after, ReadAttributeError)>; | ||
|
||
using WriteAttributeCallback = std::function<void(WriteAttributeError)>; | ||
|
||
class BaseCluster; | ||
|
||
template <typename ValueType> | ||
class Attribute | ||
{ | ||
private: | ||
memory::Weak<BaseCluster> cluster; | ||
ValueType value; | ||
|
||
public: | ||
Attribute(memory::Weak<BaseCluster> cluster) { this->cluster = cluster; } | ||
|
||
~Attribute() {} | ||
|
||
Attribute() = delete; | ||
Attribute(Attribute & other) = delete; | ||
void operator=(const Attribute &) = delete; | ||
|
||
protected: | ||
memory::Strong<BaseCluster> GetCluster() const { return cluster.lock(); } | ||
|
||
public: | ||
ValueType GetValue(); | ||
void Read(ReadAttributeCallback<ValueType> onRead); | ||
void Write(ValueType value, WriteAttributeCallback onWrite); | ||
bool SubscribeAttribute(AttributeId attributeId, ReadAttributeCallback<ValueType> callback); | ||
bool UnsubscribeAttribute(AttributeId attributeId, ReadAttributeCallback<ValueType> callback); | ||
}; | ||
|
||
}; // namespace core | ||
}; // namespace casting | ||
}; // namespace matter |
Oops, something went wrong.