Skip to content

Commit

Permalink
Remove intermediate CRTP layer from DeviceNetworkProvisioningDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Nov 1, 2022
1 parent 16f49ea commit 0d1314e
Show file tree
Hide file tree
Showing 46 changed files with 144 additions and 415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#pragma once

#include <lib/core/CHIPCore.h>
#include <platform/internal/CHIPDeviceLayerInternal.h>
#include <platform/internal/DeviceNetworkInfo.h>

namespace chip {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace chip {
namespace DeviceLayer {

CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const char * ssid, const char * key)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionWiFi(const char * ssid, const char * key)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Expand Down
20 changes: 5 additions & 15 deletions src/platform/Ameba/DeviceNetworkProvisioningDelegateImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,16 @@

#pragma once

#include <platform/internal/GenericDeviceNetworkProvisioningDelegateImpl.h>
#include <platform/internal/DeviceNetworkProvisioningDelegate.h>

namespace chip {
namespace DeviceLayer {

namespace Internal {

template <class ImplClass>
class GenericDeviceNetworkProvisioningDelegateImpl;

} // namespace Internal

class DeviceNetworkProvisioningDelegateImpl final
: public Internal::GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>
class DeviceNetworkProvisioningDelegateImpl final : public Internal::DeviceNetworkProvisioningDelegate
{
private:
friend class GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>;

CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd);
CHIP_ERROR _ProvisionThreadNetwork(ByteSpan threadData) { return CHIP_ERROR_NOT_IMPLEMENTED; }
public:
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override;
CHIP_ERROR ProvisionThread(ByteSpan threadData) override { return CHIP_ERROR_NOT_IMPLEMENTED; }
};

} // namespace DeviceLayer
Expand Down
2 changes: 1 addition & 1 deletion src/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ if (chip_device_platform != "none") {
"../include/platform/internal/BLEManager.h",
"../include/platform/internal/CHIPDeviceLayerInternal.h",
"../include/platform/internal/DeviceNetworkInfo.h",
"../include/platform/internal/DeviceNetworkProvisioning.h",
"../include/platform/internal/DeviceNetworkProvisioningDelegate.h",
"../include/platform/internal/EventLogging.h",
"../include/platform/internal/GenericConfigurationManagerImpl.h",
"../include/platform/internal/GenericConfigurationManagerImpl.ipp",
Expand Down
20 changes: 5 additions & 15 deletions src/platform/Darwin/DeviceNetworkProvisioningDelegateImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,16 @@

#pragma once

#include <platform/internal/GenericDeviceNetworkProvisioningDelegateImpl.h>
#include <platform/internal/DeviceNetworkProvisioningDelegate.h>

namespace chip {
namespace DeviceLayer {

namespace Internal {

template <class ImplClass>
class GenericDeviceNetworkProvisioningDelegateImpl;

} // namespace Internal

class DeviceNetworkProvisioningDelegateImpl final
: public Internal::GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>
class DeviceNetworkProvisioningDelegateImpl final : public Internal::DeviceNetworkProvisioningDelegate
{
friend class GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>;

private:
CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd) { return CHIP_ERROR_NOT_IMPLEMENTED; }
CHIP_ERROR _ProvisionThreadNetwork(ByteSpan threadData) { return CHIP_ERROR_NOT_IMPLEMENTED; }
public:
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override { return CHIP_ERROR_NOT_IMPLEMENTED; }
CHIP_ERROR ProvisionThread(ByteSpan threadData) override { return CHIP_ERROR_NOT_IMPLEMENTED; }
};

} // namespace DeviceLayer
Expand Down
4 changes: 2 additions & 2 deletions src/platform/EFR32/DeviceNetworkProvisioningDelegateImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace chip {
namespace DeviceLayer {

CHIP_ERROR
DeviceNetworkProvisioningDelegateImpl::_ProvisionThreadNetwork(ByteSpan threadData)
DeviceNetworkProvisioningDelegateImpl::ProvisionThread(ByteSpan threadData)
{
#if CHIP_ENABLE_OPENTHREAD
CHIP_ERROR error = CHIP_NO_ERROR;
Expand All @@ -44,7 +44,7 @@ DeviceNetworkProvisioningDelegateImpl::_ProvisionThreadNetwork(ByteSpan threadDa
}

#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const char * ssid, const char * key)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionWiFi(const char * ssid, const char * key)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Expand Down
22 changes: 6 additions & 16 deletions src/platform/EFR32/DeviceNetworkProvisioningDelegateImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,20 @@

#pragma once

#include <platform/internal/GenericDeviceNetworkProvisioningDelegateImpl.h>
#include <platform/internal/DeviceNetworkProvisioningDelegate.h>

namespace chip {
namespace DeviceLayer {

namespace Internal {

template <class ImplClass>
class GenericDeviceNetworkProvisioningDelegateImpl;

} // namespace Internal

class DeviceNetworkProvisioningDelegateImpl final
: public Internal::GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>
class DeviceNetworkProvisioningDelegateImpl final : public Internal::DeviceNetworkProvisioningDelegate
{
friend class GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>;

private:
public:
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd);
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override;
#else
CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd) { return CHIP_ERROR_NOT_IMPLEMENTED; }
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override { return CHIP_ERROR_NOT_IMPLEMENTED; }
#endif
CHIP_ERROR _ProvisionThreadNetwork(ByteSpan threadData);
CHIP_ERROR ProvisionThread(ByteSpan threadData) override;
};

} // namespace DeviceLayer
Expand Down
4 changes: 2 additions & 2 deletions src/platform/ESP32/DeviceNetworkProvisioningDelegateImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace chip {
namespace DeviceLayer {

CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const char * ssid, const char * key)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionWiFi(const char * ssid, const char * key)
{
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
CHIP_ERROR err = CHIP_NO_ERROR;
Expand All @@ -40,7 +40,7 @@ CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const ch
#endif
}

CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionThreadNetwork(ByteSpan threadData)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionThread(ByteSpan threadData)
{
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down
20 changes: 5 additions & 15 deletions src/platform/ESP32/DeviceNetworkProvisioningDelegateImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,16 @@

#pragma once

#include <platform/internal/GenericDeviceNetworkProvisioningDelegateImpl.h>
#include <platform/internal/DeviceNetworkProvisioningDelegate.h>

namespace chip {
namespace DeviceLayer {

namespace Internal {

template <class ImplClass>
class GenericDeviceNetworkProvisioningDelegateImpl;

} // namespace Internal

class DeviceNetworkProvisioningDelegateImpl final
: public Internal::GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>
class DeviceNetworkProvisioningDelegateImpl final : public Internal::DeviceNetworkProvisioningDelegate
{
private:
friend class GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>;

CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd);
CHIP_ERROR _ProvisionThreadNetwork(ByteSpan threadData);
public:
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override;
CHIP_ERROR ProvisionThread(ByteSpan threadData) override;
};

} // namespace DeviceLayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace chip {
namespace DeviceLayer {

CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionThreadNetwork(ByteSpan threadData)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionThread(ByteSpan threadData)
{
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
CHIP_ERROR error = CHIP_NO_ERROR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,16 @@

#pragma once

#include <platform/internal/GenericDeviceNetworkProvisioningDelegateImpl.h>
#include <platform/internal/DeviceNetworkProvisioningDelegate.h>

namespace chip {
namespace DeviceLayer {

namespace Internal {

template <class ImplClass>
class GenericDeviceNetworkProvisioningDelegateImpl;

} // namespace Internal

class DeviceNetworkProvisioningDelegateImpl final
: public Internal::GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>
class DeviceNetworkProvisioningDelegateImpl final : public Internal::DeviceNetworkProvisioningDelegate
{
friend class GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>;

private:
CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd) { return CHIP_ERROR_NOT_IMPLEMENTED; }
CHIP_ERROR _ProvisionThreadNetwork(ByteSpan threadData);
public:
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override { return CHIP_ERROR_NOT_IMPLEMENTED; }
CHIP_ERROR ProvisionThread(ByteSpan threadData) override;
};

} // namespace DeviceLayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace chip {
namespace DeviceLayer {

CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const char * ssid, const char * passwd)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionWiFi(const char * ssid, const char * passwd)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,16 @@

#pragma once

#include <platform/internal/GenericDeviceNetworkProvisioningDelegateImpl.h>
#include <platform/internal/DeviceNetworkProvisioningDelegate.h>

namespace chip {
namespace DeviceLayer {

namespace Internal {

template <class ImplClass>
class GenericDeviceNetworkProvisioningDelegateImpl;

} // namespace Internal

class DeviceNetworkProvisioningDelegateImpl final
: public Internal::GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>
class DeviceNetworkProvisioningDelegateImpl final : public Internal::DeviceNetworkProvisioningDelegate
{
private:
friend class GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>;

CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd);
CHIP_ERROR _ProvisionThreadNetwork(ByteSpan threadData) { return CHIP_ERROR_NOT_IMPLEMENTED; }
public:
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override;
CHIP_ERROR ProvisionThread(ByteSpan threadData) override { return CHIP_ERROR_NOT_IMPLEMENTED; }
};

} // namespace DeviceLayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace chip {
namespace DeviceLayer {

CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const char * ssid, const char * key)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionWiFi(const char * ssid, const char * key)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Expand Down
23 changes: 8 additions & 15 deletions src/platform/Linux/DeviceNetworkProvisioningDelegateImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,19 @@

#pragma once

#include <platform/internal/GenericDeviceNetworkProvisioningDelegateImpl.h>
#include <platform/internal/DeviceNetworkProvisioningDelegate.h>

namespace chip {
namespace DeviceLayer {

namespace Internal {

template <class ImplClass>
class GenericDeviceNetworkProvisioningDelegateImpl;

} // namespace Internal

class DeviceNetworkProvisioningDelegateImpl final
: public Internal::GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>
/**
* Concrete implementation of the DeviceNetworkProvisioningDelegate for Linux platforms.
*/
class DeviceNetworkProvisioningDelegateImpl final : public Internal::DeviceNetworkProvisioningDelegate
{
friend class GenericDeviceNetworkProvisioningDelegateImpl<DeviceNetworkProvisioningDelegateImpl>;

private:
CHIP_ERROR _ProvisionWiFiNetwork(const char * ssid, const char * passwd);
CHIP_ERROR _ProvisionThreadNetwork(ByteSpan threadData) { return CHIP_ERROR_NOT_IMPLEMENTED; }
public:
CHIP_ERROR ProvisionWiFi(const char * ssid, const char * passwd) override;
CHIP_ERROR ProvisionThread(ByteSpan threadData) override { return CHIP_ERROR_NOT_IMPLEMENTED; }
};

} // namespace DeviceLayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace chip {
namespace DeviceLayer {

CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const char * ssid, const char * key)
CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::ProvisionWiFi(const char * ssid, const char * key)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Expand Down
Loading

0 comments on commit 0d1314e

Please sign in to comment.