Skip to content

Commit

Permalink
Remove using-directives namespaces in Tizen platform (#23637)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamMicSzm authored and pull[bot] committed Dec 22, 2023
1 parent 402a280 commit 1011763
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 156 deletions.
69 changes: 34 additions & 35 deletions src/platform/Tizen/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
#include "MainLoop.h"
#include <bluetooth.h>

using namespace ::chip;
using namespace ::chip::Ble;

namespace chip {
namespace DeviceLayer {
namespace Internal {
Expand Down Expand Up @@ -410,7 +407,7 @@ void BLEManagerImpl::NotifySubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool
PlatformMgr().PostEventOrDie(&event);
}

void BLEManagerImpl::HandleConnectionTimeout(chip::System::Layer * layer, void * data)
void BLEManagerImpl::HandleConnectionTimeout(System::Layer * layer, void * data)
{
sInstance.NotifyHandleConnectFailed(CHIP_ERROR_TIMEOUT);
}
Expand Down Expand Up @@ -448,7 +445,7 @@ void BLEManagerImpl::ConnectHandler(const char * address)
g_source_unref(idleSource);
}

void BLEManagerImpl::OnChipDeviceScanned(void * device, const chip::Ble::ChipBLEDeviceIdentificationInfo & info)
void BLEManagerImpl::OnChipDeviceScanned(void * device, const Ble::ChipBLEDeviceIdentificationInfo & info)
{
auto deviceInfo = reinterpret_cast<bt_adapter_le_device_scan_result_info_s *>(device);
VerifyOrReturn(deviceInfo != nullptr, ChipLogError(DeviceLayer, "Invalid Device Info"));
Expand Down Expand Up @@ -479,7 +476,7 @@ void BLEManagerImpl::OnChipDeviceScanned(void * device, const chip::Ble::ChipBLE

/* Set CHIP Connecting state */
mBLEScanConfig.mBleScanState = BleScanState::kConnecting;
chip::DeviceLayer::SystemLayer().StartTimer(kConnectTimeoutMs, HandleConnectionTimeout, nullptr);
DeviceLayer::SystemLayer().StartTimer(kConnectTimeoutMs, HandleConnectionTimeout, nullptr);
mDeviceScanner->StopChipScan();

/* Initiate Connect */
Expand Down Expand Up @@ -583,12 +580,12 @@ int BLEManagerImpl::RegisterGATTServer()

int BLEManagerImpl::StartBLEAdvertising()
{
int ret = BT_ERROR_NONE;
CHIP_ERROR err = CHIP_NO_ERROR;
char service_data[sizeof(ChipBLEDeviceIdentificationInfo)] = {
int ret = BT_ERROR_NONE;
CHIP_ERROR err = CHIP_NO_ERROR;
char service_data[sizeof(Ble::ChipBLEDeviceIdentificationInfo)] = {
0x0,
}; // need to fill advertising data. 5.2.3.8.6. Advertising Data, CHIP Specification
ChipBLEDeviceIdentificationInfo deviceIdInfo = {
Ble::ChipBLEDeviceIdentificationInfo deviceIdInfo = {
0x0,
};

Expand Down Expand Up @@ -1018,7 +1015,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureBle(uint32_t aAdapterId, bool aIsCentral)
void BLEManagerImpl::CleanScanConfig()
{
if (mBLEScanConfig.mBleScanState == BleScanState::kConnecting)
chip::DeviceLayer::SystemLayer().CancelTimer(HandleConnectionTimeout, nullptr);
DeviceLayer::SystemLayer().CancelTimer(HandleConnectionTimeout, nullptr);

mBLEScanConfig.mBleScanState = BleScanState::kNotScanning;
}
Expand All @@ -1045,8 +1042,8 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv
}
break;
case DeviceEventType::kPlatformTizenBLEWriteComplete: {
ChipBleUUID service_uuid;
ChipBleUUID char_write_uuid;
Ble::ChipBleUUID service_uuid;
Ble::ChipBleUUID char_write_uuid;

StringToUUID(chip_ble_service_uuid, service_uuid);
StringToUUID(chip_ble_char_c1_tx_uuid, char_write_uuid);
Expand All @@ -1055,8 +1052,8 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv
break;
}
case DeviceEventType::kPlatformTizenBLESubscribeOpComplete: {
ChipBleUUID service_uuid;
ChipBleUUID char_notif_uuid;
Ble::ChipBleUUID service_uuid;
Ble::ChipBleUUID char_notif_uuid;

StringToUUID(chip_ble_service_uuid, service_uuid);
StringToUUID(chip_ble_char_c2_rx_uuid, char_notif_uuid);
Expand All @@ -1068,14 +1065,14 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv
break;
}
case DeviceEventType::kPlatformTizenBLEIndicationReceived: {
ChipBleUUID service_uuid;
ChipBleUUID char_notif_uuid;
Ble::ChipBleUUID service_uuid;
Ble::ChipBleUUID char_notif_uuid;

StringToUUID(chip_ble_service_uuid, service_uuid);
StringToUUID(chip_ble_char_c2_rx_uuid, char_notif_uuid);

HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &service_uuid, &char_notif_uuid,
PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData));
System::PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData));
break;
}
default:
Expand All @@ -1085,9 +1082,9 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv

void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
{
ChipBleUUID service_uuid;
ChipBleUUID char_notification_uuid;
ChipBleUUID char_write_uuid;
Ble::ChipBleUUID service_uuid;
Ble::ChipBleUUID char_notification_uuid;
Ble::ChipBleUUID char_write_uuid;

switch (event->Type)
{
Expand All @@ -1114,7 +1111,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
StringToUUID(chip_ble_service_uuid, service_uuid);
StringToUUID(chip_ble_char_c1_tx_uuid, char_write_uuid);
HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &service_uuid, &char_write_uuid,
PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data));
System::PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data));
break;
case DeviceEventType::kCHIPoBLEIndicateConfirm:
ChipLogProgress(DeviceLayer, "CHIPoBLEIndicateConfirm");
Expand Down Expand Up @@ -1142,10 +1139,11 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const
return (conn != nullptr) ? conn->mtu : 0;
}

bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId)
bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId,
const Ble::ChipBleUUID * charId)
{
ChipBleUUID service_uuid;
ChipBleUUID char_notif_uuid;
Ble::ChipBleUUID service_uuid;
Ble::ChipBleUUID char_notif_uuid;
auto conn = static_cast<BLEConnection *>(conId);
int ret = BT_ERROR_NONE;

Expand All @@ -1172,10 +1170,11 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const
return false;
}

bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId)
bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId,
const Ble::ChipBleUUID * charId)
{
ChipBleUUID service_uuid;
ChipBleUUID char_notif_uuid;
Ble::ChipBleUUID service_uuid;
Ble::ChipBleUUID char_notif_uuid;
auto conn = static_cast<BLEConnection *>(conId);
int ret = BT_ERROR_NONE;

Expand Down Expand Up @@ -1223,8 +1222,8 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId)
return false;
}

bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
chip::System::PacketBufferHandle pBuf)
bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
System::PacketBufferHandle pBuf)
{
auto conn = static_cast<BLEConnection *>(conId);
int ret = BT_ERROR_NONE;
Expand All @@ -1250,10 +1249,10 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
}

bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
chip::System::PacketBufferHandle pBuf)
System::PacketBufferHandle pBuf)
{
ChipBleUUID service_uuid;
ChipBleUUID char_write_uuid;
Ble::ChipBleUUID service_uuid;
Ble::ChipBleUUID char_write_uuid;
auto conn = static_cast<BLEConnection *>(conId);
int ret = BT_ERROR_NONE;

Expand Down Expand Up @@ -1283,7 +1282,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch
}

bool BLEManagerImpl::SendReadRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
chip::System::PacketBufferHandle pBuf)
System::PacketBufferHandle pBuf)
{
return false;
}
Expand Down Expand Up @@ -1357,7 +1356,7 @@ void BLEManagerImpl::InitiateScan(BleScanState scanType)

if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "Failed to start a BLE Scan: %s", chip::ErrorStr(err));
ChipLogError(DeviceLayer, "Failed to start a BLE Scan: %s", ErrorStr(err));
goto exit;
}

Expand Down
6 changes: 2 additions & 4 deletions src/platform/Tizen/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ namespace chip {
namespace DeviceLayer {
namespace Internal {

using namespace chip::Ble;

/**
* enum Class for BLE Scanning state. CHIP supports Scanning by Discriminator or Address
*/
Expand Down Expand Up @@ -127,7 +125,7 @@ class BLEManagerImpl final : public BLEManager,
CHIP_ERROR CancelConnection() override;

// ===== Members that implement virtual methods on ChipDeviceScannerDelegate
void OnChipDeviceScanned(void * device, const chip::Ble::ChipBLEDeviceIdentificationInfo & info) override;
void OnChipDeviceScanned(void * device, const Ble::ChipBLEDeviceIdentificationInfo & info) override;
void OnChipScanComplete() override;

// ===== Members for internal use by the following friends.
Expand Down Expand Up @@ -180,7 +178,7 @@ class BLEManagerImpl final : public BLEManager,
void HandleC1CharWriteEvent(BLE_CONNECTION_OBJECT conId, const uint8_t * value, size_t len);
void HandleRXCharChanged(BLE_CONNECTION_OBJECT conId, const uint8_t * value, size_t len);
void HandleConnectionEvent(bool connected, const char * remoteAddress);
static void HandleConnectionTimeout(chip::System::Layer * layer, void * data);
static void HandleConnectionTimeout(System::Layer * layer, void * data);
static bool IsDeviceChipPeripheral(BLE_CONNECTION_OBJECT conId);

// ==== BLE Adv & GATT Server.
Expand Down
46 changes: 22 additions & 24 deletions src/platform/Tizen/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
namespace chip {
namespace DeviceLayer {

using namespace ::chip::DeviceLayer::Internal;

ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance()
{
static ConfigurationManagerImpl sInstance;
Expand All @@ -49,16 +47,16 @@ CHIP_ERROR ConfigurationManagerImpl::Init(void)
{
CHIP_ERROR error;

error = Internal::GenericConfigurationManagerImpl<PosixConfig>::Init();
error = Internal::GenericConfigurationManagerImpl<Internal::PosixConfig>::Init();
SuccessOrExit(error);

if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_VendorId))
if (!Internal::PosixConfig::ConfigValueExists(Internal::PosixConfig::kConfigKey_VendorId))
{
error = StoreVendorId(CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID);
SuccessOrExit(error);
}

if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_ProductId))
if (!Internal::PosixConfig::ConfigValueExists(Internal::PosixConfig::kConfigKey_ProductId))
{
error = StoreProductId(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID);
SuccessOrExit(error);
Expand All @@ -72,19 +70,19 @@ CHIP_ERROR ConfigurationManagerImpl::Init(void)

CHIP_ERROR ConfigurationManagerImpl::StoreVendorId(uint16_t vendorId)
{
return WriteConfigValue(PosixConfig::kConfigKey_VendorId, vendorId);
return WriteConfigValue(Internal::PosixConfig::kConfigKey_VendorId, vendorId);
}

CHIP_ERROR ConfigurationManagerImpl::StoreProductId(uint16_t productId)
{
return WriteConfigValue(PosixConfig::kConfigKey_ProductId, productId);
return WriteConfigValue(Internal::PosixConfig::kConfigKey_ProductId, productId);
}

CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf)
{
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
constexpr size_t kExpectedBufSize = ConfigurationManager::kPrimaryMACAddressLength;
return WiFiMgr().GetDeviceMACAddress(buf, kExpectedBufSize);
return Internal::WiFiMgr().GetDeviceMACAddress(buf, kExpectedBufSize);
#else
return CHIP_ERROR_NOT_IMPLEMENTED;
#endif
Expand All @@ -97,84 +95,84 @@ bool ConfigurationManagerImpl::CanFactoryReset(void)

void ConfigurationManagerImpl::InitiateFactoryReset(void) {}

CHIP_ERROR ConfigurationManagerImpl::ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value)
CHIP_ERROR ConfigurationManagerImpl::ReadPersistedStorageValue(Platform::PersistedStorage::Key key, uint32_t & value)
{
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value)
CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(Platform::PersistedStorage::Key key, uint32_t value)
{
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, bool & val)
{
return PosixConfig::ReadConfigValue(key, val);
return Internal::PosixConfig::ReadConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint16_t & val)
{
return PosixConfig::ReadConfigValue(key, val);
return Internal::PosixConfig::ReadConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint32_t & val)
{
return PosixConfig::ReadConfigValue(key, val);
return Internal::PosixConfig::ReadConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint64_t & val)
{
return PosixConfig::ReadConfigValue(key, val);
return Internal::PosixConfig::ReadConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen)
{
return PosixConfig::ReadConfigValueStr(key, buf, bufSize, outLen);
return Internal::PosixConfig::ReadConfigValueStr(key, buf, bufSize, outLen);
}

CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen)
{
return PosixConfig::ReadConfigValueBin(key, buf, bufSize, outLen);
return Internal::PosixConfig::ReadConfigValueBin(key, buf, bufSize, outLen);
}

CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, bool val)
{
return PosixConfig::WriteConfigValue(key, val);
return Internal::PosixConfig::WriteConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint16_t val)
{
return PosixConfig::WriteConfigValue(key, val);
return Internal::PosixConfig::WriteConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint32_t val)
{
return PosixConfig::WriteConfigValue(key, val);
return Internal::PosixConfig::WriteConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint64_t val)
{
return PosixConfig::WriteConfigValue(key, val);
return Internal::PosixConfig::WriteConfigValue(key, val);
}

CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str)
{
return PosixConfig::WriteConfigValueStr(key, str);
return Internal::PosixConfig::WriteConfigValueStr(key, str);
}

CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str, size_t strLen)
{
return PosixConfig::WriteConfigValueStr(key, str, strLen);
return Internal::PosixConfig::WriteConfigValueStr(key, str, strLen);
}

CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen)
{
return PosixConfig::WriteConfigValueBin(key, data, dataLen);
return Internal::PosixConfig::WriteConfigValueBin(key, data, dataLen);
}

void ConfigurationManagerImpl::RunConfigUnitTest(void)
{
PosixConfig::RunConfigUnitTest();
Internal::PosixConfig::RunConfigUnitTest();
}

ConfigurationManager & ConfigurationMgrImpl()
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Tizen/ConfigurationManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp
CHIP_ERROR GetPrimaryWiFiMACAddress(uint8_t * buf) override;
bool CanFactoryReset(void) override;
void InitiateFactoryReset(void) override;
CHIP_ERROR ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value) override;
CHIP_ERROR WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value) override;
CHIP_ERROR ReadPersistedStorageValue(Platform::PersistedStorage::Key key, uint32_t & value) override;
CHIP_ERROR WritePersistedStorageValue(Platform::PersistedStorage::Key key, uint32_t value) override;

// NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.
CHIP_ERROR WriteConfigValue(Key key, uint16_t val);
Expand Down
Loading

0 comments on commit 1011763

Please sign in to comment.