Skip to content

Commit

Permalink
Updated the PR per latest comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov committed Jul 2, 2021
1 parent 9bb5a86 commit f556c0c
Show file tree
Hide file tree
Showing 26 changed files with 2,207 additions and 294 deletions.
16 changes: 0 additions & 16 deletions examples/all-clusters-app/linux/include/tv-callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,6 @@
* limitations under the License.
*/

/**
*
* Copyright (c) 2021 Silicon Labs
*
* 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.
*/
/****************************************************************************
* @file
* @brief Routines for TV stubs
Expand Down
78 changes: 78 additions & 0 deletions examples/chip-tool/commands/tests/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -1757,6 +1764,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -1826,6 +1840,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -1895,6 +1916,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -1964,6 +1992,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -2033,6 +2068,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -2102,6 +2144,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -2171,6 +2220,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -2242,6 +2298,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -2314,6 +2377,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}

Expand Down Expand Up @@ -2384,6 +2454,13 @@ class TV_MediaPlaybackCluster : public TestCommand
return;
}

if (mediaPlaybackStatus != 0)
{
ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0");
runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL);
return;
}

runner->NextTest();
}
};
Expand Down Expand Up @@ -15004,6 +15081,7 @@ void registerCommandsTests(Commands & commands)
make_unique<Test_3_2_1>(),
make_unique<Test_3_2_2>(),
make_unique<Test_10_1_1>(),
make_unique<Test_TC_DM_3_1>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
*/

#include "ApplicationLauncherManager.h"
#include <app/Command.h>
#include <app/clusters/application-launcher-server/application-launcher-server.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>

Expand All @@ -49,9 +44,9 @@ ApplicationLauncherResponse applicationLauncherClusterLaunchApp(EmberAfApplicati
{
// TODO: Insert your code
ApplicationLauncherResponse response;
char testData[] = "data";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
const char * testData = "data";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
// TODO: Update once storing a structure attribute is supported
// emberAfWriteServerAttribute(endpoint, ZCL_APPLICATION_LAUNCH_CLUSTER_ID, ZCL_APPLICATION_LAUNCHER_CURRENT_APP_APPLICATION_ID,
// (uint8_t *) &application, ZCL_STRUCT_ATTRIBUTE_TYPE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@

#include "AudioOutputManager.h"

#include <app/Command.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPSafeCasts.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@

#include "KeypadInputManager.h"

#include <app/Command.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>

Expand Down
7 changes: 0 additions & 7 deletions examples/tv-app/linux/include/low-power/LowPowerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@

#include "LowPowerManager.h"

#include <app/Command.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>
#include <app/util/af.h>

bool lowPowerClusterSleep()
{
// TODO: Insert code here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
*/

#include "MediaInputManager.h"
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>

#include <app/util/af.h>
#include <lib/core/CHIPSafeCasts.h>
#include <map>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
*/

#include "TargetNavigatorManager.h"
#include <app/Command.h>
#include <app/clusters/target-navigator-server/target-navigator-server.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPSafeCasts.h>
Expand Down Expand Up @@ -63,8 +58,8 @@ TargetNavigatorResponse targetNavigatorClusterNavigateTarget(uint8_t target, std
{
// TODO: Insert code here
TargetNavigatorResponse response;
char testData[] = "data response";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
const char * testData = "data response";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
return response;
}
6 changes: 0 additions & 6 deletions examples/tv-app/linux/include/tv-channel/TvChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
*/

#include "TvChannelManager.h"
#include <app/Command.h>
#include <app/common/gen/af-structs.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>
#include <app/util/af.h>
#include <app/util/attribute-storage.h>
#include <lib/core/CHIPSafeCasts.h>
Expand Down
26 changes: 5 additions & 21 deletions src/app/clusters/account-login-server/account-login-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
*
* Copyright (c) 2021 Silicon Labs
*
* 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.
*/
/****************************************************************************
* @file
* @brief Routines for the Application Launcher plugin, the
Expand Down Expand Up @@ -65,24 +48,25 @@ void sendResponse(chip::app::Command * command, const char * responseSetupPin)
}
}

bool emberAfAccountLoginClusterGetSetupPINCallback(chip::app::Command * command, unsigned char * tempAccountIdentifier)
bool emberAfAccountLoginClusterGetSetupPINCallback(chip::app::Command * command, uint8_t * tempAccountIdentifier)
{
// TODO: char is not null terminated, verify this code once #7963 gets merged.
std::string tempAccountIdentifierString(reinterpret_cast<char *>(tempAccountIdentifier));
std::string responseSetupPin = accountLoginClusterGetSetupPin(tempAccountIdentifierString, emberAfCurrentEndpoint());
sendResponse(command, responseSetupPin.c_str());
return true;
}

bool emberAfAccountLoginClusterLoginCallback(chip::app::Command * command, unsigned char * tempAccountIdentifier,
unsigned char * tempSetupPin)
bool emberAfAccountLoginClusterLoginCallback(chip::app::Command * command, uint8_t * tempAccountIdentifier, uint8_t * tempSetupPin)
{
// TODO: char is not null terminated, verify this code once #7963 gets merged.
std::string tempAccountIdentifierString(reinterpret_cast<char *>(tempAccountIdentifier));
std::string tempSetupPinString(reinterpret_cast<char *>(tempSetupPin));
bool isLoggedIn = accountLoginClusterIsUserLoggedIn(tempAccountIdentifierString, tempSetupPinString);
EmberAfStatus status = isLoggedIn ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_NOT_AUTHORIZED;
if (!isLoggedIn)
{
ChipLogError(Zcl, "User is not authorized. Error:%s", chip::ErrorStr(EMBER_ZCL_STATUS_NOT_AUTHORIZED));
ChipLogError(Zcl, "User is not authorized.");
}
emberAfSendImmediateDefaultResponse(status);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,6 @@
* limitations under the License.
*/

/**
*
* Copyright (c) 2021 Silicon Labs
*
* 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.
*/
/****************************************************************************
* @file
* @brief Routines for the Application Launcher plugin, the
Expand Down
Loading

0 comments on commit f556c0c

Please sign in to comment.