Skip to content

Commit

Permalink
Ran through clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin-crossman committed Dec 15, 2021
1 parent 4712c3c commit 8f70fcd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
1 change: 1 addition & 0 deletions examples/lock-app/linux/include/LockManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class LockManager

static LockManager & Instance();
static LockManager instance;

private:
bool mLocked;
};
4 changes: 2 additions & 2 deletions examples/lock-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, chip:
return LockManager::Instance().Unlock(pinCode);
}

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type, uint16_t size, uint8_t * value)
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
uint16_t size, uint8_t * value)
{
// TODO: Watch for LockState, DoorState, Mode, etc changes and trigger appropriate action
if (attributePath.mClusterId == DoorLock::Id)
Expand All @@ -55,7 +56,6 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint)
DoorLockServer::Instance().InitServer(endpoint);
}


int main(int argc, char * argv[])
{
VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0);
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/linux/src/LockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include "LockManager.h"

#include <iostream>
#include <cstring>
#include <iostream>
#include <lib/support/logging/CHIPLogging.h>

LockManager LockManager::instance;
Expand Down
52 changes: 26 additions & 26 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ EmberEventControl emberAfPluginDoorLockServerRelockEventControl;
DoorLockServer DoorLockServer::instance;

// TODO: Remove hardcoded pin when SetCredential command is implemented.
chip::ByteSpan mPin({1,2,3,4});
chip::ByteSpan mPin({ 1, 2, 3, 4 });

/**********************************************************
* DoorLockServer Implementation
Expand All @@ -65,7 +65,7 @@ void DoorLockServer::InitServer(chip::EndpointId endpointId)
{
emberAfDoorLockClusterPrintln("Door Lock cluster initialized at %d", endpointId);

SetLockState(endpointId, DlLockState::kLocked);;
SetLockState(endpointId, DlLockState::kLocked);
SetActuatorEnabled(endpointId, true);
}

Expand Down Expand Up @@ -153,10 +153,10 @@ bool emberAfDoorLockClusterLockDoorCallback(chip::app::CommandHandler * commandO
bool require_pin = false;
Attributes::RequirePINforRemoteOperation::Get(endpoint, &require_pin);

if(commandData.pinCode.HasValue())
if (commandData.pinCode.HasValue())
{
// TODO: Search through list of stored PINs and check each.
if(mPin.data_equal(commandData.pinCode.Value()))
if (mPin.data_equal(commandData.pinCode.Value()))
{
success = emberAfPluginDoorLockOnDoorLockCommand(endpoint, commandData.pinCode);
}
Expand All @@ -167,7 +167,7 @@ bool emberAfDoorLockClusterLockDoorCallback(chip::app::CommandHandler * commandO
}
else
{
if(!require_pin)
if (!require_pin)
{
success = emberAfPluginDoorLockOnDoorLockCommand(endpoint, commandData.pinCode);
}
Expand All @@ -182,7 +182,7 @@ bool emberAfDoorLockClusterLockDoorCallback(chip::app::CommandHandler * commandO
// Should be called after reponse sent (indicating command complete) since
// the attribute Set call in SetLockState will error out if the command is
// still pending
if(success)
if (success)
return DoorLockServer::Instance().SetLockState(endpoint, DlLockState::kLocked) == EMBER_ZCL_STATUS_SUCCESS;
return success;
}
Expand All @@ -199,10 +199,10 @@ bool emberAfDoorLockClusterUnlockDoorCallback(
bool require_pin = false;
Attributes::RequirePINforRemoteOperation::Get(endpoint, &require_pin);

if(commandData.pinCode.HasValue())
if (commandData.pinCode.HasValue())
{
// TODO: Search through list of stored PINs and check each.
if(mPin.data_equal(commandData.pinCode.Value()))
if (mPin.data_equal(commandData.pinCode.Value()))
{
success = emberAfPluginDoorLockOnDoorUnlockCommand(endpoint, commandData.pinCode);
}
Expand All @@ -213,7 +213,7 @@ bool emberAfDoorLockClusterUnlockDoorCallback(
}
else
{
if(!require_pin)
if (!require_pin)
{
success = emberAfPluginDoorLockOnDoorUnlockCommand(endpoint, commandData.pinCode);
}
Expand All @@ -228,7 +228,7 @@ bool emberAfDoorLockClusterUnlockDoorCallback(
// Should be called after reponse sent (indicating command complete) since
// the attribute Set call in SetLockState will error out if the command is
// still pending
if(success)
if (success)
return DoorLockServer::Instance().SetLockState(endpoint, DlLockState::kUnlocked) == EMBER_ZCL_STATUS_SUCCESS;
return success;
}
Expand All @@ -239,13 +239,13 @@ bool emberAfDoorLockClusterSetUserCallback(chip::app::CommandHandler * commandOb
{
emberAfDoorLockClusterPrintln("Received Set User command (not implemented)");
// SetUser command fields are:
//DlDataOperationType operationType;
//uint16_t userIndex;
//DataModel::Nullable<chip::CharSpan> userName;
//DataModel::Nullable<uint32_t> userUniqueId;
//DlUserStatus userStatus;
//DlUserType userType;
//DlCredentialRule credentialRule;
// DlDataOperationType operationType;
// uint16_t userIndex;
// DataModel::Nullable<chip::CharSpan> userName;
// DataModel::Nullable<uint32_t> userUniqueId;
// DlUserStatus userStatus;
// DlUserType userType;
// DlCredentialRule credentialRule;

// TODO: Implement setting the user
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
Expand All @@ -258,7 +258,7 @@ bool emberAfDoorLockClusterGetUserCallback(chip::app::CommandHandler * commandOb
{
emberAfDoorLockClusterPrintln("Received Get User command (not implemented)");
// GetUser command fields are:
// uint16_t userIndex;
// uint16_t userIndex;

// TODO: Implement getting the user
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
Expand All @@ -271,7 +271,7 @@ bool emberAfDoorLockClusterClearUserCallback(chip::app::CommandHandler * command
{
emberAfDoorLockClusterPrintln("Received Clear User command (not implemented)");
// ClearUser command fields are:
// uint16_t userIndex;
// uint16_t userIndex;

// TODO: Implement clearing the user
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
Expand All @@ -284,11 +284,11 @@ bool emberAfDoorLockClusterSetCredentialCallback(
{
emberAfDoorLockClusterPrintln("Received Set Credential command (not implemented)");
// SetCredential command fields are:
//DlDataOperationType operationType;
//Structs::DlCredential::Type credential;
//chip::ByteSpan credentialData;
//uint16_t userIndex;
//DlUserStatus userStatus;
// DlDataOperationType operationType;
// Structs::DlCredential::Type credential;
// chip::ByteSpan credentialData;
// uint16_t userIndex;
// DlUserStatus userStatus;

// TODO: Implement clearing the user
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
Expand All @@ -301,7 +301,7 @@ bool emberAfDoorLockClusterGetCredentialStatusCallback(
{
emberAfDoorLockClusterPrintln("Received Get Credential Status command (not implemented)");
// GetCredentialStatus command fields are:
// Structs::DlCredential::Type credential;
// Structs::DlCredential::Type credential;

// TODO: Implement clearing the user
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
Expand All @@ -314,7 +314,7 @@ bool emberAfDoorLockClusterClearCredentialCallback(
{
emberAfDoorLockClusterPrintln("Received Clear Credential command (not implemented)");
// ClearCredential command fields are:
// Structs::DlCredential::Type credential;
// Structs::DlCredential::Type credential;

// TODO: Implement clearing the user
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
Expand Down
1 change: 0 additions & 1 deletion src/app/clusters/door-lock-server/door-lock-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class DoorLockServer

bool SetOneTouchLocking(chip::EndpointId endpointId, bool isEnabled);
bool SetPrivacyModeButton(chip::EndpointId endpointId, bool isEnabled);

};

bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, chip::Optional<chip::ByteSpan> pinCode);
Expand Down

0 comments on commit 8f70fcd

Please sign in to comment.