Skip to content

Commit 7831d91

Browse files
silabs-borislrzr
authored andcommitted
UIC-3222: Move user credential helpers into their own files
1 parent b909075 commit 7831d91

File tree

6 files changed

+493
-442
lines changed

6 files changed

+493
-442
lines changed

applications/zpc/components/zwave_command_classes/src/private/user_credential/user_credential_checksum_calculator.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
* sections of the MSLA applicable to Source Code.
1111
*
1212
*****************************************************************************/
13-
13+
// Base class
1414
#include "user_credential_checksum_calculator.h"
1515

16+
// CRC 16
1617
#include "zwave_controller_crc16.h"
1718

18-
// Log
19-
#include "sl_log.h"
19+
// Common definitions
20+
#include "user_credential_definitions.hpp"
2021

2122
namespace user_credential
2223
{
@@ -25,8 +26,6 @@ namespace user_credential
2526
constexpr uint16_t CRC_INITIALIZATION_VALUE = 0x1D0F;
2627
constexpr uint8_t MAX_CHAR_SIZE = 64;
2728

28-
constexpr char LOG_TAG[] = "zwave_command_class_user_credential";
29-
3029
std::vector<uint8_t>
3130
get_raw_data_from_node(const attribute_store::attribute &node)
3231
{

applications/zpc/components/zwave_command_classes/src/private/user_credential/user_credential_credential_capabilities.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
// Get attribute store names
1717
#include "attribute_store_defined_attribute_types.h"
1818

19-
// Log
20-
#include "sl_log.h"
21-
2219
// UTF16 conversion (deprecated in C++17 but we don't have a better alternative yet)
2320
// Needed for credential data (password) per specification
2421
#include <locale>
@@ -27,13 +24,12 @@
2724
// Boost
2825
#include <boost/format.hpp>
2926

30-
#define ATTRIBUTE(type) ATTRIBUTE_COMMAND_CLASS_USER_CREDENTIAL_##type
27+
// Common definitions
28+
#include "user_credential_definitions.hpp"
3129

3230
namespace user_credential
3331
{
3432

35-
constexpr char LOG_TAG[] = "zwave_command_class_user_credential";
36-
3733
credential_capabilities::credential_capabilities(
3834
const attribute_store::attribute &endpoint_node,
3935
user_credential_type_t credential_type)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/******************************************************************************
2+
* # License
3+
* <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
4+
******************************************************************************
5+
* The licensor of this software is Silicon Laboratories Inc. Your use of this
6+
* software is governed by the terms of Silicon Labs Master Software License
7+
* Agreement (MSLA) available at
8+
* www.silabs.com/about-us/legal/master-software-license-agreement. This
9+
* software is distributed to you in Source Code format and is governed by the
10+
* sections of the MSLA applicable to Source Code.
11+
*
12+
*****************************************************************************/
13+
14+
#ifndef USER_CREDENTIAL_DEFINITIONS_HPP
15+
#define USER_CREDENTIAL_DEFINITIONS_HPP
16+
17+
// Log
18+
#include "sl_log.h"
19+
20+
#ifndef ATTRIBUTE
21+
#define ATTRIBUTE(type) ATTRIBUTE_COMMAND_CLASS_USER_CREDENTIAL_##type
22+
#endif
23+
24+
constexpr char LOG_TAG[] = "zwave_command_class_user_credential";
25+
26+
#endif // USER_CREDENTIAL_DEFINITIONS_HPP

0 commit comments

Comments
 (0)