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.
Add ContentAppObserver cluster and ContentControlCluster. Also Update…
…d the spec per suggestions
- Loading branch information
Showing
33 changed files
with
2,847 additions
and
183 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
38 changes: 38 additions & 0 deletions
38
examples/tv-app/android/include/content-app-observer/ContentAppObserver.cpp
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,38 @@ | ||
/** | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* 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. | ||
*/ | ||
|
||
#include "ContentAppObserver.h" | ||
|
||
#include <app-common/zap-generated/attributes/Accessors.h> | ||
#include <app/util/config.h> | ||
|
||
using namespace std; | ||
using namespace chip; | ||
using namespace chip::app::Clusters::ContentAppObserver; | ||
|
||
ContentAppObserver::ContentAppObserver() | ||
{ | ||
// Create Test Data | ||
} | ||
|
||
void ContentAppObserver::HandleContentAppMessage(chip::app::CommandResponseHelper<ContentAppMessageResponse> & helper, | ||
const chip::Optional<chip::CharSpan> & data, | ||
const chip::CharSpan & encodingHint) | ||
{ | ||
ChipLogProgress(Zcl, "ContentAppObserver::HandleContentAppMessage"); | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
examples/tv-app/android/include/content-app-observer/ContentAppObserver.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,40 @@ | ||
/* | ||
* | ||
* 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 <app/AttributeAccessInterface.h> | ||
#include <app/clusters/content-app-observer/content-app-observer.h> | ||
#include <vector> | ||
|
||
using ContentAppObserverDelegate = chip::app::Clusters::ContentAppObserver::Delegate; | ||
using ContentAppMessageResponse = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessageResponse::Type; | ||
|
||
class ContentAppObserver : public ContentAppObserverDelegate | ||
{ | ||
public: | ||
ContentAppObserver(); | ||
|
||
void HandleContentAppMessage(chip::app::CommandResponseHelper<ContentAppMessageResponse> & helper, | ||
const chip::Optional<chip::CharSpan> & data, | ||
const chip::CharSpan & encodingHint) override; | ||
void SetEndpointId(chip::EndpointId epId) { mEndpointId = epId; }; | ||
protected: | ||
private: | ||
chip::EndpointId mEndpointId; | ||
}; |
139 changes: 139 additions & 0 deletions
139
examples/tv-app/android/include/content-control/ContentController.cpp
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,139 @@ | ||
/** | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* 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. | ||
*/ | ||
|
||
#include "ContentController.h" | ||
#include <app-common/zap-generated/attributes/Accessors.h> | ||
#include <app/util/config.h> | ||
|
||
using namespace std; | ||
using namespace chip::app; | ||
using namespace chip::app::Clusters; | ||
using namespace chip::app::DataModel; | ||
using namespace chip::app::Clusters::ContentControl; | ||
|
||
ContentController::ContentController() | ||
{ | ||
// Create Test Data | ||
} | ||
|
||
// Attribute Delegates | ||
bool ContentController::HandleGetEnabled() | ||
{ | ||
return false; | ||
} | ||
|
||
CHIP_ERROR ContentController::HandleGetOnDemandRatings(chip::app::AttributeValueEncoder & aEncoder) | ||
{ | ||
return aEncoder.Encode(chip::CharSpan()); | ||
} | ||
|
||
chip::CharSpan ContentController::HandleGetOnDemandRatingThreshold() | ||
{ | ||
return chip::CharSpan(); | ||
} | ||
|
||
CHIP_ERROR ContentController::HandleGetScheduledContentRatings(chip::app::AttributeValueEncoder & aEncoder) | ||
{ | ||
return aEncoder.Encode(chip::CharSpan()); | ||
} | ||
|
||
chip::CharSpan ContentController::HandleGetScheduledContentRatingThreshold() | ||
{ | ||
return chip::CharSpan(); | ||
} | ||
|
||
uint32_t ContentController::HandleGetScreenDailyTime() | ||
{ | ||
return (uint32_t) 0xFFFFFFFF; | ||
} | ||
|
||
uint32_t ContentController::HandleGetRemainingScreenTime() | ||
{ | ||
return (uint32_t) 0xFFFFFFFF; | ||
} | ||
|
||
bool ContentController::HandleGetBlockUnrated() | ||
{ | ||
return false; | ||
} | ||
|
||
|
||
// Command Delegates | ||
void ContentController::HandleUpdatePIN(chip::Optional<chip::CharSpan> oldPIN, chip::CharSpan newPIN) | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleResetPIN(chip::app::CommandResponseHelper<ResetPINResponseType> & helper) | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleEnable() | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleDisable() | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleAddBonusTime(chip::Optional<chip::CharSpan> PINCode, chip::Optional<uint32_t> bonusTime) | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleSetScreenDailyTime(uint32_t screenDailyTime) | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleBlockUnratedContent() | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleUnblockUnratedContent() | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleSetOnDemandRatingThreshold(chip::CharSpan rating) | ||
{ | ||
|
||
} | ||
|
||
void ContentController::HandleSetScheduledContentRatingThreshold(chip::CharSpan rating) | ||
{ | ||
|
||
} | ||
|
||
|
||
|
||
uint32_t ContentController::GetFeatureMap(chip::EndpointId endpoint) | ||
{ | ||
if (endpoint >= EMBER_AF_CONTENT_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT) | ||
{ | ||
return mDynamicEndpointFeatureMap; | ||
} | ||
|
||
uint32_t featureMap = 0; | ||
// TODO: ReEnable the code bellow | ||
// Attributes::FeatureMap::Get(endpoint, &featureMap); | ||
return featureMap; | ||
} |
64 changes: 64 additions & 0 deletions
64
examples/tv-app/android/include/content-control/ContentController.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,64 @@ | ||
/* | ||
* | ||
* 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 <app/AttributeAccessInterface.h> | ||
#include <app/clusters/content-control-server/content-control-server.h> | ||
#include <vector> | ||
|
||
using ContentControlDelegate = chip::app::Clusters::ContentControl::Delegate; | ||
using ResetPINResponseType = chip::app::Clusters::ContentControl::Commands::ResetPINResponse::Type; | ||
|
||
class ContentController : public ContentControlDelegate | ||
{ | ||
public: | ||
ContentController(); | ||
|
||
// Attribute Delegates | ||
bool HandleGetEnabled() override; | ||
CHIP_ERROR HandleGetOnDemandRatings(chip::app::AttributeValueEncoder & aEncoder) override; | ||
chip::CharSpan HandleGetOnDemandRatingThreshold() override; | ||
CHIP_ERROR HandleGetScheduledContentRatings(chip::app::AttributeValueEncoder & aEncoder) override; | ||
chip::CharSpan HandleGetScheduledContentRatingThreshold() override; | ||
uint32_t HandleGetScreenDailyTime() override; | ||
uint32_t HandleGetRemainingScreenTime() override; | ||
bool HandleGetBlockUnrated() override; | ||
|
||
// Command Delegates | ||
void HandleUpdatePIN(chip::Optional<chip::CharSpan> oldPIN, chip::CharSpan newPIN) override; | ||
void HandleResetPIN(chip::app::CommandResponseHelper<ResetPINResponseType> & helper) override; | ||
void HandleEnable() override; | ||
void HandleDisable() override; | ||
void HandleAddBonusTime(chip::Optional<chip::CharSpan> PINCode, chip::Optional<uint32_t> bonusTime) override; | ||
void HandleSetScreenDailyTime(uint32_t screenDailyTime) override; | ||
void HandleBlockUnratedContent() override; | ||
void HandleUnblockUnratedContent() override; | ||
void HandleSetOnDemandRatingThreshold(chip::CharSpan rating) override; | ||
void HandleSetScheduledContentRatingThreshold(chip::CharSpan rating) override; | ||
|
||
uint32_t GetFeatureMap(chip::EndpointId endpoint) override; | ||
void SetEndpointId(chip::EndpointId epId) { mEndpointId = epId; }; | ||
|
||
protected: | ||
|
||
private: | ||
// TODO: set this based upon meta data from app | ||
uint32_t mDynamicEndpointFeatureMap = 3; | ||
chip::EndpointId mEndpointId; | ||
}; |
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
Oops, something went wrong.