[cli-tcat] define VendorInfo as a member variable (#9869)

Changes `mVendorInfo` to be a member variable of `Tcat` class
instead of a static variable.
This commit is contained in:
Abtin Keshavarzian
2024-02-22 11:30:23 -08:00
committed by GitHub
parent a0d805c8f0
commit f0b6fcea6e
2 changed files with 10 additions and 6 deletions
+6 -6
View File
@@ -79,9 +79,8 @@ namespace ot {
namespace Cli {
otTcatVendorInfo sVendorInfo;
const char kPskdVendor[] = "J01NM3";
const char kUrl[] = "dummy_url";
const char kPskdVendor[] = "J01NM3";
const char kUrl[] = "dummy_url";
static void HandleBleSecureReceive(otInstance *aInstance,
const otMessage *aMessage,
@@ -116,8 +115,9 @@ template <> otError Tcat::Process<Cmd("start")>(Arg aArgs[])
otError error = OT_ERROR_NONE;
sVendorInfo.mPskdString = kPskdVendor;
sVendorInfo.mProvisioningUrl = kUrl;
ClearAllBytes(mVendorInfo);
mVendorInfo.mPskdString = kPskdVendor;
mVendorInfo.mProvisioningUrl = kUrl;
otBleSecureSetCertificate(GetInstancePtr(), reinterpret_cast<const uint8_t *>(OT_CLI_TCAT_X509_CERT),
sizeof(OT_CLI_TCAT_X509_CERT), reinterpret_cast<const uint8_t *>(OT_CLI_TCAT_PRIV_KEY),
@@ -130,7 +130,7 @@ template <> otError Tcat::Process<Cmd("start")>(Arg aArgs[])
otBleSecureSetSslAuthMode(GetInstancePtr(), true);
SuccessOrExit(error = otBleSecureStart(GetInstancePtr(), nullptr, HandleBleSecureReceive, true, nullptr));
SuccessOrExit(error = otBleSecureTcatStart(GetInstancePtr(), &sVendorInfo, nullptr));
SuccessOrExit(error = otBleSecureTcatStart(GetInstancePtr(), &mVendorInfo, nullptr));
exit:
return error;
+4
View File
@@ -31,6 +31,8 @@
#include "openthread-core-config.h"
#include <openthread/tcat.h>
#include "cli/cli_output.hpp"
#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE && OPENTHREAD_CONFIG_CLI_BLE_SECURE_ENABLE
@@ -78,6 +80,8 @@ private:
using Command = CommandEntry<Tcat>;
template <CommandId kCommandId> otError Process(Arg aArgs[]);
otTcatVendorInfo mVendorInfo;
};
} // namespace Cli