Skip to content

Commit

Permalink
Cleanup prefix chip:: from all cluster implementations (#8771)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Sep 1, 2021
1 parent f469f1c commit 1305001
Show file tree
Hide file tree
Showing 53 changed files with 430 additions and 433 deletions.
25 changes: 13 additions & 12 deletions src/app/clusters/account-login-server/account-login-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,29 @@
#include <app/util/af.h>
#include <string>

using namespace chip;

bool accountLoginClusterIsUserLoggedIn(std::string requestTempAccountIdentifier, std::string requestSetupPin);
std::string accountLoginClusterGetSetupPin(std::string requestTempAccountIdentifier, chip::EndpointId endpoint);
std::string accountLoginClusterGetSetupPin(std::string requestTempAccountIdentifier, EndpointId endpoint);

void sendResponse(chip::app::CommandHandler * command, const char * responseSetupPin)
void sendResponse(app::CommandHandler * command, const char * responseSetupPin)
{
CHIP_ERROR err = CHIP_NO_ERROR;
chip::app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_ACCOUNT_LOGIN_CLUSTER_ID,
ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID,
(chip::app::CommandPathFlags::kEndpointIdValid) };
chip::TLV::TLVWriter * writer = nullptr;
CHIP_ERROR err = CHIP_NO_ERROR;
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_ACCOUNT_LOGIN_CLUSTER_ID,
ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID, (app::CommandPathFlags::kEndpointIdValid) };
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = command->PrepareCommand(cmdParams));
VerifyOrExit((writer = command->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
SuccessOrExit(err = writer->PutString(chip::TLV::ContextTag(0), responseSetupPin));
SuccessOrExit(err = writer->PutString(TLV::ContextTag(0), responseSetupPin));
SuccessOrExit(err = command->FinishCommand());
exit:
if (err != CHIP_NO_ERROR)
{
ChipLogError(Zcl, "Failed to encode GetSetupPIN command. Error:%s", chip::ErrorStr(err));
ChipLogError(Zcl, "Failed to encode GetSetupPIN command. Error:%s", ErrorStr(err));
}
}

bool emberAfAccountLoginClusterGetSetupPINCallback(chip::EndpointId endpoint, chip::app::CommandHandler * command,
bool emberAfAccountLoginClusterGetSetupPINCallback(EndpointId endpoint, app::CommandHandler * command,
uint8_t * tempAccountIdentifier)
{
// TODO: char is not null terminated, verify this code once #7963 gets merged.
Expand All @@ -58,8 +59,8 @@ bool emberAfAccountLoginClusterGetSetupPINCallback(chip::EndpointId endpoint, ch
return true;
}

bool emberAfAccountLoginClusterLoginCallback(chip::EndpointId endpoint, chip::app::CommandHandler * command,
uint8_t * tempAccountIdentifier, uint8_t * tempSetupPin)
bool emberAfAccountLoginClusterLoginCallback(EndpointId endpoint, app::CommandHandler * 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ using namespace chip;
// Specifications section 5.4.2.3. Announcement Duration
constexpr uint32_t kMaxCommissionioningTimeoutSeconds = 15 * 60;

bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(chip::EndpointId endpoint,
app::CommandHandler * commandObj,
bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(EndpointId endpoint, app::CommandHandler * commandObj,
uint16_t commissioningTimeout, ByteSpan pakeVerifier,
uint16_t discriminator, uint32_t iterations,
ByteSpan salt, uint16_t passcodeID)
Expand Down Expand Up @@ -70,7 +69,7 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(chi
return true;
}

bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallback(chip::EndpointId endpoint,
bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallback(EndpointId endpoint,
app::CommandHandler * commandObj,
uint16_t commissioningTimeout)
{
Expand All @@ -91,8 +90,7 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac
return true;
}

bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(chip::EndpointId endpoint,
app::CommandHandler * commandObj)
bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(EndpointId endpoint, app::CommandHandler * commandObj)
{
ChipLogProgress(Zcl, "Received command to close commissioning window");
ClosePairingWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
#include <app/util/af.h>
#include <string>

bool applicationBasicClusterChangeApplicationStatus(EmberAfApplicationBasicStatus status, chip::EndpointId endpoint);
using namespace chip;

bool emberAfApplicationBasicClusterChangeStatusCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj,
bool applicationBasicClusterChangeApplicationStatus(EmberAfApplicationBasicStatus status, EndpointId endpoint);

bool emberAfApplicationBasicClusterChangeStatusCallback(EndpointId endpoint, app::CommandHandler * commandObj,
uint8_t newApplicationStatus)
{
bool success = applicationBasicClusterChangeApplicationStatus(static_cast<EmberAfApplicationBasicStatus>(newApplicationStatus),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,32 @@
#include <app/common/gen/enums.h>
#include <app/util/af.h>

using namespace chip;

ApplicationLauncherResponse applicationLauncherClusterLaunchApp(EmberAfApplicationLauncherApp application, std::string data);

bool emberAfApplicationLauncherClusterLaunchAppCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj,
uint8_t *, uint8_t *)
bool emberAfApplicationLauncherClusterLaunchAppCallback(EndpointId endpoint, app::CommandHandler * commandObj, uint8_t *, uint8_t *)
{
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
emberAfSendImmediateDefaultResponse(status);
return true;
}

void sendResponse(chip::app::CommandHandler * command, ApplicationLauncherResponse response)
void sendResponse(app::CommandHandler * command, ApplicationLauncherResponse response)
{
CHIP_ERROR err = CHIP_NO_ERROR;
chip::app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_APPLICATION_LAUNCHER_CLUSTER_ID,
ZCL_LAUNCH_APP_RESPONSE_COMMAND_ID,
(chip::app::CommandPathFlags::kEndpointIdValid) };
chip::TLV::TLVWriter * writer = nullptr;
CHIP_ERROR err = CHIP_NO_ERROR;
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_APPLICATION_LAUNCHER_CLUSTER_ID,
ZCL_LAUNCH_APP_RESPONSE_COMMAND_ID, (app::CommandPathFlags::kEndpointIdValid) };
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = command->PrepareCommand(cmdParams));
VerifyOrExit((writer = command->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
SuccessOrExit(err = writer->Put(chip::TLV::ContextTag(0), response.status));
SuccessOrExit(err = writer->PutString(chip::TLV::ContextTag(1), reinterpret_cast<const char *>(response.data)));
SuccessOrExit(err = writer->Put(TLV::ContextTag(0), response.status));
SuccessOrExit(err = writer->PutString(TLV::ContextTag(1), reinterpret_cast<const char *>(response.data)));
SuccessOrExit(err = command->FinishCommand());
exit:
if (err != CHIP_NO_ERROR)
{
ChipLogError(Zcl, "Failed to send LaunchAppResponse. Error:%s", chip::ErrorStr(err));
ChipLogError(Zcl, "Failed to send LaunchAppResponse. Error:%s", ErrorStr(err));
}
}

Expand All @@ -67,9 +67,8 @@ EmberAfApplicationLauncherApp getApplicationFromCommand(uint16_t catalogVendorId
return application;
}

bool emberAfApplicationLauncherClusterLaunchAppCallback(chip::EndpointId endpoint, chip::app::CommandHandler * command,
uint8_t * requestData, uint16_t requestApplicationCatalogVendorId,
uint8_t * requestApplicationId)
bool emberAfApplicationLauncherClusterLaunchAppCallback(EndpointId endpoint, app::CommandHandler * command, uint8_t * requestData,
uint16_t requestApplicationCatalogVendorId, uint8_t * requestApplicationId)
{
EmberAfApplicationLauncherApp application = getApplicationFromCommand(requestApplicationCatalogVendorId, requestApplicationId);
// TODO: Char is not null terminated, verify this code once #7963 gets merged.
Expand Down
6 changes: 4 additions & 2 deletions src/app/clusters/audio-output-server/audio-output-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
#include <app/CommandHandler.h>
#include <app/util/af.h>

using namespace chip;

bool audioOutputClusterSelectOutput(uint8_t index);
bool audioOutputClusterRenameOutput(uint8_t index, uint8_t * name);

bool emberAfAudioOutputClusterRenameOutputCallback(chip::EndpointId endpoint, chip::app::CommandHandler * command, uint8_t index,
bool emberAfAudioOutputClusterRenameOutputCallback(EndpointId endpoint, app::CommandHandler * command, uint8_t index,
uint8_t * name)
{
bool success = audioOutputClusterRenameOutput(index, name);
Expand All @@ -37,7 +39,7 @@ bool emberAfAudioOutputClusterRenameOutputCallback(chip::EndpointId endpoint, ch
return true;
}

bool emberAfAudioOutputClusterSelectOutputCallback(chip::EndpointId endpoint, chip::app::CommandHandler * command, uint8_t index)
bool emberAfAudioOutputClusterSelectOutputCallback(EndpointId endpoint, app::CommandHandler * command, uint8_t index)
{
bool success = audioOutputClusterSelectOutput(index);
EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ static void sendDefaultResponse(EmberAfStatus status)
}
}

bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(chip::EndpointId aEndpoint,
chip::app::CommandHandler * commandObj, uint8_t percentOpen)
bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(EndpointId aEndpoint, app::CommandHandler * commandObj,
uint8_t percentOpen)
{
EndpointId endpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint;
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
Expand Down Expand Up @@ -339,7 +339,7 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(chip::Endpoin
return true;
}

bool emberAfBarrierControlClusterBarrierControlStopCallback(chip::EndpointId aEndpoint, chip::app::CommandHandler * commandObj)
bool emberAfBarrierControlClusterBarrierControlStopCallback(EndpointId aEndpoint, app::CommandHandler * commandObj)
{
EndpointId endpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint;
emberAfDeactivateServerTick(endpoint, BarrierControl::Id);
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/basic/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ uint8_t * MakeZclCharString(uint8_t (&zclString)[BufferLength], char (&cString)[
}
} // namespace

void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint)
void emberAfBasicClusterServerInitCallback(EndpointId endpoint)
{
uint16_t vendorId;
uint16_t productId;
Expand Down
11 changes: 6 additions & 5 deletions src/app/clusters/binary-input-server/binary-input-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,33 @@
#include <app/common/gen/cluster-id.h>
#include <app/util/af-event.h>
#include <app/util/attribute-storage.h>

#include <support/logging/CHIPLogging.h>

using namespace chip;

#ifndef emberAfBinaryInputBasicClusterPrintln
#define emberAfBinaryInputBasicClusterPrintln(...) ChipLogProgress(Zcl, __VA_ARGS__);
#endif

EmberAfStatus emberAfBinaryInputBasicClusterGetPresentValue(chip::EndpointId endpoint, bool * presentValue)
EmberAfStatus emberAfBinaryInputBasicClusterGetPresentValue(EndpointId endpoint, bool * presentValue)
{
return emberAfReadServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_PRESENT_VALUE_ATTRIBUTE_ID,
(uint8_t *) presentValue, sizeof(uint8_t));
}

EmberAfStatus emberAfBinaryInputBasicClusterGetOutOfService(chip::EndpointId endpoint, bool * isOutOfService)
EmberAfStatus emberAfBinaryInputBasicClusterGetOutOfService(EndpointId endpoint, bool * isOutOfService)
{
return emberAfReadServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_OUT_OF_SERVICE_ATTRIBUTE_ID,
(uint8_t *) isOutOfService, sizeof(uint8_t));
}

EmberAfStatus emberAfBinaryInputBasicClusterSetPresentValueCallback(chip::EndpointId endpoint, bool presentValue)
EmberAfStatus emberAfBinaryInputBasicClusterSetPresentValueCallback(EndpointId endpoint, bool presentValue)
{
return emberAfWriteServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_PRESENT_VALUE_ATTRIBUTE_ID,
(uint8_t *) &presentValue, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
}

EmberAfStatus emberAfBinaryInputBasicClusterSetOutOfServiceCallback(chip::EndpointId endpoint, bool isOutOfService)
EmberAfStatus emberAfBinaryInputBasicClusterSetOutOfServiceCallback(EndpointId endpoint, bool isOutOfService)
{
return emberAfWriteServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_OUT_OF_SERVICE_ATTRIBUTE_ID,
(uint8_t *) &isOutOfService, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
Expand Down
8 changes: 4 additions & 4 deletions src/app/clusters/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ EmberStatus getUnusedBindingIndex(uint8_t * bindingIndex)
return EMBER_NOT_FOUND;
}

bool emberAfBindingClusterBindCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, NodeId nodeId,
GroupId groupId, EndpointId endpointId, ClusterId clusterId)
bool emberAfBindingClusterBindCallback(EndpointId endpoint, app::CommandHandler * commandObj, NodeId nodeId, GroupId groupId,
EndpointId endpointId, ClusterId clusterId)
{
ChipLogDetail(Zcl, "RX: BindCallback");

Expand Down Expand Up @@ -118,8 +118,8 @@ bool emberAfBindingClusterBindCallback(chip::EndpointId endpoint, chip::app::Com
return true;
}

bool emberAfBindingClusterUnbindCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, NodeId nodeId,
GroupId groupId, EndpointId endpointId, ClusterId clusterId)
bool emberAfBindingClusterUnbindCallback(EndpointId endpoint, app::CommandHandler * commandObj, NodeId nodeId, GroupId groupId,
EndpointId endpointId, ClusterId clusterId)
{
ChipLogDetail(Zcl, "RX: UnbindCallback");

Expand Down
Loading

0 comments on commit 1305001

Please sign in to comment.