Skip to content

Commit

Permalink
Update CHIP protocol definations to align with the latest spec (#6631)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Aug 6, 2021
1 parent 61900ee commit 1069014
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/platform/Linux/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

// ==================== Platform Adaptations ====================

#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 1

#ifndef CHIP_DEVICE_CONFIG_ENABLE_THREAD
#define CHIP_DEVICE_CONFIG_ENABLE_THREAD CHIP_ENABLE_OPENTHREAD
Expand Down
12 changes: 6 additions & 6 deletions src/platform/Linux/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,30 @@ CHIP_ERROR ConfigurationManagerImpl::_WritePersistedStorageValue(::chip::Platfor
}

#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
CHIP_ERROR ConfigurationManagerImpl::GetWiFiStationSecurityType(Profiles::NetworkProvisioning::WiFiSecurityType & secType)
CHIP_ERROR ConfigurationManagerImpl::GetWiFiStationSecurityType(WiFiAuthSecurityType & secType)
{
CHIP_ERROR err;
uint32_t secTypeInt;

err = ReadConfigValue(kConfigKey_WiFiStationSecType, secTypeInt);
if (err == CHIP_NO_ERROR)
{
secType = (Profiles::NetworkProvisioning::WiFiSecurityType) secTypeInt;
secType = static_cast<WiFiAuthSecurityType>(secTypeInt);
}
return err;
}

CHIP_ERROR ConfigurationManagerImpl::UpdateWiFiStationSecurityType(Profiles::NetworkProvisioning::WiFiSecurityType secType)
CHIP_ERROR ConfigurationManagerImpl::UpdateWiFiStationSecurityType(WiFiAuthSecurityType secType)
{
CHIP_ERROR err;
Profiles::NetworkProvisioning::WiFiSecurityType curSecType;
WiFiAuthSecurityType curSecType;

if (secType != Profiles::NetworkProvisioning::kWiFiSecurityType_NotSpecified)
if (secType != kWiFiSecurityType_NotSpecified)
{
err = GetWiFiStationSecurityType(curSecType);
if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND || (err == CHIP_NO_ERROR && secType != curSecType))
{
uint32_t secTypeInt = secType;
uint32_t secTypeInt = static_cast<uint32_t>(secType);
err = WriteConfigValue(kConfigKey_WiFiStationSecType, secTypeInt);
}
SuccessOrExit(err);
Expand Down
6 changes: 6 additions & 0 deletions src/platform/Linux/ConfigurationManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#pragma once

#include "platform/internal/DeviceNetworkInfo.h"
#include <platform/internal/GenericConfigurationManagerImpl.h>

#include <platform/Linux/PosixConfig.h>
Expand Down Expand Up @@ -57,6 +58,11 @@ class ConfigurationManagerImpl final : public ConfigurationManager,
CHIP_ERROR _ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value);
CHIP_ERROR _WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value);

#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
CHIP_ERROR GetWiFiStationSecurityType(Internal::WiFiAuthSecurityType & secType);
CHIP_ERROR UpdateWiFiStationSecurityType(Internal::WiFiAuthSecurityType secType);
#endif

// NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.

// ===== Members for internal use by the following friends.
Expand Down
15 changes: 7 additions & 8 deletions src/protocols/Protocols.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,13 @@ class Id
static constexpr Protocols::Id Id(VendorId::Common, id); \
} // namespace name.

CHIP_STANDARD_PROTOCOL(SecureChannel, 0x0000) // Secure Channel Protocol
CHIP_STANDARD_PROTOCOL(Echo, 0x0002) // Echo Protocol
CHIP_STANDARD_PROTOCOL(BDX, 0x0003) // Bulk Data Exchange Protocol
CHIP_STANDARD_PROTOCOL(NetworkProvisioning, 0x0004) // Network Provisioning Protocol
CHIP_STANDARD_PROTOCOL(InteractionModel, 0x0005) // Interaction Model Protocol
CHIP_STANDARD_PROTOCOL(FabricProvisioning, 0x0006) // Fabric Provisioning Protocol
CHIP_STANDARD_PROTOCOL(ServiceProvisioning, 0x0007) // Service Provisioning Protocol
CHIP_STANDARD_PROTOCOL(OpCredentials, 0x0008) // Operational Credentials
CHIP_STANDARD_PROTOCOL(SecureChannel, 0x0000) // Secure Channel Protocol
CHIP_STANDARD_PROTOCOL(Echo, 0x0001) // Echo Protocol
CHIP_STANDARD_PROTOCOL(BDX, 0x0002) // Bulk Data Exchange Protocol
CHIP_STANDARD_PROTOCOL(UserDirectedCommissioning, 0x0003) // User Directed Commissioning Protocol
CHIP_STANDARD_PROTOCOL(InteractionModel, 0x0005) // Interaction Model Protocol
CHIP_STANDARD_PROTOCOL(ServiceProvisioning, 0x0007) // Service Provisioning Protocol
CHIP_STANDARD_PROTOCOL(OpCredentials, 0x0008) // Operational Credentials
CHIP_STANDARD_PROTOCOL(TempZCL, 0x0009) // For carrying ZCL-compatible messages, to be removed when we no longer use them

#undef CHIP_STANDARD_PROTOCOL
Expand Down

0 comments on commit 1069014

Please sign in to comment.