Skip to content

Commit

Permalink
Small cleanups (#12694)
Browse files Browse the repository at this point in the history
- Fix debug logging in `src/ble/BtpEngine.cpp`.

- Fix `Transport::PeerAddress::kMaxToStringSize` to use
  `Inet::IPAddress::kMaxStringLength` for the result of
  `Inet::IPAddress::ToString()`.

- Fix some Doxygen.
  • Loading branch information
kpschoedel authored and pull[bot] committed Dec 9, 2021
1 parent 185d54c commit 1b56d04
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/ble/BtpEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
mTxLength = mTxBuf->DataLength();

ChipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send whole message:");
PrintBufDebug(data);
PrintBufDebug(mTxBuf);

// Determine fragment header size.
uint8_t header_size =
Expand Down Expand Up @@ -493,7 +493,7 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s

characteristic[0] = headerFlags.Raw();
ChipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send first fragment:");
PrintBufDebug(data);
PrintBufDebug(mTxBuf);
}
else if (mTxState == kState_InProgress)
{
Expand Down
9 changes: 7 additions & 2 deletions src/controller/CHIPDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,14 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController,
*
* @param[in] remoteDeviceId The remote device Id.
* @param[in] rendezvousParams The Rendezvous connection parameters
* @param[in] commssioningParams The commissioning parameters (uses defualt if not supplied)
*/
CHIP_ERROR PairDevice(NodeId remoteDeviceId, RendezvousParameters & rendezvousParams);
/**
* @overload
* @param[in] remoteDeviceId The remote device Id.
* @param[in] rendezvousParams The Rendezvous connection parameters
* @param[in] commissioningParams The commissioning parameters (uses default if not supplied)
*/
CHIP_ERROR PairDevice(NodeId remoteDeviceId, RendezvousParameters & rendezvousParams,
CommissioningParameters & commissioningParams);

Expand All @@ -514,7 +519,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController,
* OnPairingComplete will be called with an error.
*
* @param[in] remoteDeviceId The remote device Id.
* @param[in] rendezvousParams The Rendezvous connection parameters
* @param[in] params The Rendezvous connection parameters
*/
CHIP_ERROR EstablishPASEConnection(NodeId remoteDeviceId, RendezvousParameters & params);

Expand Down
4 changes: 2 additions & 2 deletions src/platform/cc13x2_26x2/ble_user_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/

/**
* @file This file contains user configurable variables for the BLE
* Application.
* @file
* This file contains user configurable variables for the BLE Application.
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/transport/SecureSessionTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SecureSessionTable
/**
* Allocates a new secure session out of the internal resource pool.
*
* @param sessionType secure session type
* @param secureSessionType secure session type
* @param localSessionId represents the encryption key ID assigned by local node
* @param peerNodeId represents peer Node's ID
* @param peerCATs represents peer CASE Authenticated Tags
Expand Down
11 changes: 2 additions & 9 deletions src/transport/raw/PeerAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,12 @@ class PeerAddress

bool operator!=(const PeerAddress & other) const { return !(*this == other); }

/// Maximum size of an Inet address ToString format, that can hold both IPV6 and IPV4 addresses.
#ifdef INET6_ADDRSTRLEN
static constexpr size_t kInetMaxAddrLen = INET6_ADDRSTRLEN;
#else
static constexpr size_t kInetMaxAddrLen = INET_ADDRSTRLEN;
#endif

/// Maximum size of the string outputes by ToString. Format is of the form:
/// "UDP:<ip>:<port>"
static constexpr size_t kMaxToStringSize = 3 // type: UDP/TCP/BLE
+ 1 // splitter :
+ 2 // brackets around address
+ kInetMaxAddrLen // address
+ Inet::IPAddress::kMaxStringLength // address
+ 1 // splitter %
+ Inet::InterfaceId::kMaxIfNameLength // interface
+ 1 // splitter :
Expand All @@ -138,7 +131,7 @@ class PeerAddress

void ToString(char * buf, size_t bufSize) const
{
char ip_addr[kInetMaxAddrLen];
char ip_addr[Inet::IPAddress::kMaxStringLength];

char interface[Inet::InterfaceId::kMaxIfNameLength + 1] = {}; // +1 to prepend '%'
if (mInterface.IsPresent())
Expand Down

0 comments on commit 1b56d04

Please sign in to comment.