From f508a95f8e5e5c7951107357f1de4d8b5823337f Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 19 Aug 2020 00:25:07 +0000 Subject: [PATCH] Restyled by clang-format --- .../server/esp32/main/EchoServer.cpp | 2 +- .../server/esp32/main/RendezvousSession.cpp | 20 +++++++--------- .../esp32/main/include/RendezvousSession.h | 2 +- src/controller/CHIPDeviceController.cpp | 24 ++++++++++--------- src/controller/CHIPDeviceController.h | 12 ++++++---- .../java/CHIPDeviceController-JNI.cpp | 4 +--- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/wifi-echo/server/esp32/main/EchoServer.cpp b/examples/wifi-echo/server/esp32/main/EchoServer.cpp index ab0e04c127c973..858f404cf4d1ec 100644 --- a/examples/wifi-echo/server/esp32/main/EchoServer.cpp +++ b/examples/wifi-echo/server/esp32/main/EchoServer.cpp @@ -238,7 +238,7 @@ SecureSessionMgr peerNodeId, uint16_t peerKeyId, uint16_t localKeyId, SecurePairingSession* pairing) +void PairingComplete(Optional peerNodeId, uint16_t peerKeyId, uint16_t localKeyId, SecurePairingSession * pairing) { Optional peer(Transport::Type::kUndefined); sessions.NewPairing(peerNodeId, peer, peerKeyId, localKeyId, pairing); diff --git a/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp b/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp index 3d9ba99154d3fb..4458d27ca50a14 100644 --- a/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp +++ b/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp @@ -33,9 +33,9 @@ bool RendezvousSession::mPairingInProgress = false; SecurePairingSession RendezvousSession::mPairing; static constexpr uint32_t kSpake2p_Iteration_Count = 50000; -static const char * kSpake2pKeyExchangeSalt = "SPAKE2P Key Exchange Salt"; +static const char * kSpake2pKeyExchangeSalt = "SPAKE2P Key Exchange Salt"; -extern void PairingComplete(Optional peerNodeId, uint16_t peerKeyId, uint16_t localKeyId, SecurePairingSession* pairing); +extern void PairingComplete(Optional peerNodeId, uint16_t peerKeyId, uint16_t localKeyId, SecurePairingSession * pairing); RendezvousSession::RendezvousSession(BluetoothWidget * virtualLed, uint32_t setUpPINCode, NodeId myNodeId) { @@ -44,12 +44,11 @@ RendezvousSession::RendezvousSession(BluetoothWidget * virtualLed, uint32_t setU DeviceLayer::ConnectivityMgr().AddCHIPoBLEConnectionHandler(HandleConnectionOpened); RendezvousSession::mPairing.WaitForPairing(setUpPINCode, kSpake2p_Iteration_Count, - (const unsigned char*) kSpake2pKeyExchangeSalt, - strlen(kSpake2pKeyExchangeSalt), - Optional::Value(myNodeId), 0, this); + (const unsigned char *) kSpake2pKeyExchangeSalt, strlen(kSpake2pKeyExchangeSalt), + Optional::Value(myNodeId), 0, this); RendezvousSession::mPairingInProgress = true; - mSetUpPINCode = setUpPINCode; - mNodeId = myNodeId; + mSetUpPINCode = setUpPINCode; + mNodeId = myNodeId; } CHIP_ERROR RendezvousSession::OnNewMessageForPeer(System::PacketBuffer * buffer) @@ -68,16 +67,15 @@ void RendezvousSession::OnPairingError(CHIP_ERROR error) ChipLogError(Ble, "RendezvousSession: failed in pairing"); mPaired = false; RendezvousSession::mPairing.WaitForPairing(mSetUpPINCode, kSpake2p_Iteration_Count, - (const unsigned char*) kSpake2pKeyExchangeSalt, - strlen(kSpake2pKeyExchangeSalt), - Optional::Value(mNodeId), 0, this); + (const unsigned char *) kSpake2pKeyExchangeSalt, strlen(kSpake2pKeyExchangeSalt), + Optional::Value(mNodeId), 0, this); RendezvousSession::mPairingInProgress = true; } void RendezvousSession::OnPairingComplete(Optional peerNodeId, uint16_t peerKeyId, uint16_t localKeyId) { ChipLogProgress(Ble, "RendezvousSession: pairing complete"); - mPaired = true; + mPaired = true; RendezvousSession::mPairingInProgress = false; PairingComplete(peerNodeId, peerKeyId, localKeyId, &RendezvousSession::mPairing); } diff --git a/examples/wifi-echo/server/esp32/main/include/RendezvousSession.h b/examples/wifi-echo/server/esp32/main/include/RendezvousSession.h index 6bfa4eec68f800..536d3ec6239f59 100644 --- a/examples/wifi-echo/server/esp32/main/include/RendezvousSession.h +++ b/examples/wifi-echo/server/esp32/main/include/RendezvousSession.h @@ -43,7 +43,7 @@ class RendezvousSession : public SecurePairingSessionDelegate static SecurePairingSession mPairing; static bool mPairingInProgress; - bool mPaired = false; + bool mPaired = false; uint32_t mSetUpPINCode = 0; NodeId mNodeId; }; diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 2b8f8fd12c6db7..2fe00ff152542f 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -54,7 +54,7 @@ namespace DeviceController { using namespace chip::Encoding; static constexpr uint32_t kSpake2p_Iteration_Count = 50000; -static const char * kSpake2pKeyExchangeSalt = "SPAKE2P Key Exchange Salt"; +static const char * kSpake2pKeyExchangeSalt = "SPAKE2P Key Exchange Salt"; ChipDeviceController::ChipDeviceController() { @@ -172,20 +172,21 @@ void ChipDeviceController::OnPairingComplete(Optional peerNodeId, uint16 if (mPairingComplete != nullptr) { - mPeerKeyId = peerKeyId; + mPeerKeyId = peerKeyId; mLocalPairedKeyId = localKeyId; ChipLogProgress(Controller, "Calling mPairingComplete"); mPairingComplete(this, nullptr, mAppReqState); } } -void ChipDeviceController::PairingMessageHandler(ChipDeviceController * controller, void * appReqState, System::PacketBuffer * payload) +void ChipDeviceController::PairingMessageHandler(ChipDeviceController * controller, void * appReqState, + System::PacketBuffer * payload) { if (controller->mPairingInProgress) { MessageHeader header; size_t headerSize = 0; - CHIP_ERROR err = header.Decode(payload->Start(), payload->DataLength(), &headerSize); + CHIP_ERROR err = header.Decode(payload->Start(), payload->DataLength(), &headerSize); SuccessOrExit(err); payload->ConsumeHead(headerSize); @@ -201,12 +202,13 @@ void ChipDeviceController::PairingMessageHandler(ChipDeviceController * controll } void ChipDeviceController::BLEConnectionHandler(ChipDeviceController * controller, Transport::PeerConnectionState * state, - void * appReqState) + void * appReqState) { ChipLogProgress(Controller, "Starting pairing session"); controller->mPairingInProgress = true; - CHIP_ERROR err = controller->mPairingSession.Pair(controller->mSetupPINCode, kSpake2p_Iteration_Count, (const unsigned char*) kSpake2pKeyExchangeSalt, - strlen(kSpake2pKeyExchangeSalt), Optional::Value(controller->mLocalDeviceId), controller->mNextKeyId++, controller); + CHIP_ERROR err = controller->mPairingSession.Pair( + controller->mSetupPINCode, kSpake2p_Iteration_Count, (const unsigned char *) kSpake2pKeyExchangeSalt, + strlen(kSpake2pKeyExchangeSalt), Optional::Value(controller->mLocalDeviceId), controller->mNextKeyId++, controller); SuccessOrExit(err); exit: @@ -297,7 +299,9 @@ CHIP_ERROR ChipDeviceController::ConnectDevice(NodeId remoteDeviceId, IPAddress mOnComplete.Response = onMessageReceived; mOnError = onError; - err = mSessionManager->NewPairing(mRemoteDeviceId, Optional::Value(Transport::PeerAddress::UDP(deviceAddr, devicePort)), mPeerKeyId, mLocalPairedKeyId, &mPairingSession); + err = mSessionManager->NewPairing(mRemoteDeviceId, + Optional::Value(Transport::PeerAddress::UDP(deviceAddr, devicePort)), + mPeerKeyId, mLocalPairedKeyId, &mPairingSession); SuccessOrExit(err); mMessageNumber = 1; @@ -433,9 +437,7 @@ void ChipDeviceController::ClearRequestState() } } -void ChipDeviceController::OnNewConnection(Transport::PeerConnectionState * state, SecureSessionMgrBase * mgr) -{ -} +void ChipDeviceController::OnNewConnection(Transport::PeerConnectionState * state, SecureSessionMgrBase * mgr) {} void ChipDeviceController::OnMessageReceived(const MessageHeader & header, Transport::PeerConnectionState * state, System::PacketBuffer * msgBuf, SecureSessionMgrBase * mgr) diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index a832645a2088e7..624aa72d0ddff6 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -51,7 +51,9 @@ typedef void (*ErrorHandler)(ChipDeviceController * deviceController, void * app typedef void (*MessageReceiveHandler)(ChipDeviceController * deviceController, void * appReqState, System::PacketBuffer * payload); }; -class DLL_EXPORT ChipDeviceController : public SecureSessionMgrCallback, public SecurePairingSessionDelegate, public Transport::BLECallbackHandler +class DLL_EXPORT ChipDeviceController : public SecureSessionMgrCallback, + public SecurePairingSessionDelegate, + public Transport::BLECallbackHandler { friend class ChipDeviceControllerCallback; @@ -234,7 +236,7 @@ class DLL_EXPORT ChipDeviceController : public SecureSessionMgrCallback, public ErrorHandler mOnError; NewConnectionHandler mOnNewConnection; NewConnectionHandler mPairingComplete = nullptr; - MessageReceiveHandler mAppMsgHandler = nullptr; + MessageReceiveHandler mAppMsgHandler = nullptr; System::PacketBuffer * mCurReqMsg; NodeId mLocalDeviceId; @@ -244,11 +246,11 @@ class DLL_EXPORT ChipDeviceController : public SecureSessionMgrCallback, public uint32_t mMessageNumber = 0; SecurePairingSession mPairingSession; - uint16_t mNextKeyId = 0; + uint16_t mNextKeyId = 0; bool mPairingInProgress = false; - uint32_t mSetupPINCode = 0; - uint16_t mPeerKeyId = 0; + uint32_t mSetupPINCode = 0; + uint16_t mPeerKeyId = 0; uint16_t mLocalPairedKeyId = 0; void ClearRequestState(); diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index f5de1a5e21f328..e703bb881fd735 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -402,9 +402,7 @@ void HandleSimpleOperationComplete(ChipDeviceController * deviceController, void env->ExceptionClear(); } -void HandleKeyExchange(ChipDeviceController * deviceController, Transport::PeerConnectionState * state, void * appReqState) -{ -} +void HandleKeyExchange(ChipDeviceController * deviceController, Transport::PeerConnectionState * state, void * appReqState) {} void HandleEchoResponse(ChipDeviceController * deviceController, void * appReqState, System::PacketBuffer * payload) {