Skip to content

Commit f12e6eb

Browse files
authored
nodiscard ChipError Batch project-chip#18: platform-specific: example apps pump-window (project-chip#42080)
* Batch project-chip#18 nodiscard errors: platform-specific: example apps pump-window * Apply review suggestions
1 parent 2112c0b commit f12e6eb

File tree

35 files changed

+105
-100
lines changed

35 files changed

+105
-100
lines changed

examples/pump-app/telink/src/AppTask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ AppTask AppTask::sAppTask;
3434
CHIP_ERROR AppTask::Init(void)
3535
{
3636
SetExampleButtonCallbacks(StartActionEventHandler);
37-
InitCommonParts();
37+
ReturnErrorOnFailure(InitCommonParts());
3838

3939
LedManager::getInstance().setLed(LedManager::EAppLed_App0, !PumpMgr().IsStopped());
4040

examples/pump-app/ti/cc13x4_26x4/main/AppTask.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void InitializeOTARequestor(void)
128128
SetRequestorInstance(&sRequestorCore);
129129

130130
sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
131-
sRequestorCore.Init(chip::Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
131+
TEMPORARY_RETURN_IGNORED sRequestorCore.Init(chip::Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
132132
sImageProcessor.SetOTADownloader(&sDownloader);
133133
sDownloader.SetImageProcessorDelegate(&sImageProcessor);
134134
sRequestorUser.Init(&sRequestorCore, &sImageProcessor);
@@ -223,7 +223,7 @@ int AppTask::Init()
223223
cc13xx_26xxLogInit();
224224

225225
// Init Chip memory management before the stack
226-
Platform::MemoryInit();
226+
SuccessOrDie(Platform::MemoryInit());
227227

228228
PLAT_LOG("Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
229229
PLAT_LOG("Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
@@ -278,7 +278,7 @@ int AppTask::Init()
278278
;
279279
}
280280

281-
sThreadNetworkDriver.Init();
281+
TEMPORARY_RETURN_IGNORED sThreadNetworkDriver.Init();
282282
ret = ThreadStackMgrImpl().StartThreadTask();
283283
if (ret != CHIP_NO_ERROR)
284284
{
@@ -287,7 +287,7 @@ int AppTask::Init()
287287
;
288288
}
289289

290-
PlatformMgr().AddEventHandler(DeviceEventCallback, reinterpret_cast<intptr_t>(nullptr));
290+
TEMPORARY_RETURN_IGNORED PlatformMgr().AddEventHandler(DeviceEventCallback, reinterpret_cast<intptr_t>(nullptr));
291291

292292
uiInit();
293293

@@ -329,7 +329,7 @@ int AppTask::Init()
329329
nativeParams.openThreadInstancePtr = chip::DeviceLayer::ThreadStackMgrImpl().OTInstance();
330330
initParams.endpointNativeParams = static_cast<void *>(&nativeParams);
331331

332-
chip::Server::GetInstance().Init(initParams);
332+
TEMPORARY_RETURN_IGNORED chip::Server::GetInstance().Init(initParams);
333333

334334
ConfigurationMgr().LogDeviceConfig();
335335

@@ -518,7 +518,8 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
518518
// Post event for demonstration purposes, we must ensure that the
519519
// LogEvent is called in the right context which is the Matter mainloop
520520
// thru ScheduleWork()
521-
chip::DeviceLayer::PlatformMgr().ScheduleWork(sAppTask.PostEvents, reinterpret_cast<intptr_t>(nullptr));
521+
TEMPORARY_RETURN_IGNORED chip::DeviceLayer::PlatformMgr().ScheduleWork(sAppTask.PostEvents,
522+
reinterpret_cast<intptr_t>(nullptr));
522523

523524
// Toggle BLE advertisements
524525
if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
@@ -535,7 +536,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
535536
else
536537
{
537538
// Disable BLE advertisements
538-
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
539+
TEMPORARY_RETURN_IGNORED ConnectivityMgr().SetBLEAdvertisingEnabled(false);
539540
PLAT_LOG("Disabled BLE Advertisements");
540541
}
541542
}
@@ -602,7 +603,7 @@ void AppTask::UpdateClusterState(void)
602603
{
603604
// We must ensure that the Cluster accessors gets called in the right context
604605
// which is the Matter mainloop thru ScheduleWork()
605-
chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateCluster, reinterpret_cast<intptr_t>(nullptr));
606+
TEMPORARY_RETURN_IGNORED chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateCluster, reinterpret_cast<intptr_t>(nullptr));
606607
}
607608

608609
void AppTask::UpdateCluster(intptr_t context)

examples/pump-app/ti/cc13x4_26x4/main/CHIPDeviceManager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
5656

5757
// Register a function to receive events from the CHIP device layer. Note that calls to
5858
// this function will happen on the CHIP event loop thread, not the app_main thread.
59-
PlatformMgr().AddEventHandler(CHIPDeviceManager::CommonDeviceEventHandler, reinterpret_cast<intptr_t>(cb));
59+
TEMPORARY_RETURN_IGNORED PlatformMgr().AddEventHandler(CHIPDeviceManager::CommonDeviceEventHandler,
60+
reinterpret_cast<intptr_t>(cb));
6061

6162
// Start a task to run the CHIP Device event loop.
6263
return PlatformMgr().StartEventLoopTask();

examples/pump-controller-app/telink/src/AppTask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ AppTask AppTask::sAppTask;
3232
CHIP_ERROR AppTask::Init(void)
3333
{
3434
SetExampleButtonCallbacks(StartActionEventHandler);
35-
InitCommonParts();
35+
ReturnErrorOnFailure(InitCommonParts());
3636

3737
LedManager::getInstance().setLed(LedManager::EAppLed_App0, !PumpMgr().IsStopped());
3838

examples/pump-controller-app/ti/cc13x4_26x4/main/AppTask.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void InitializeOTARequestor(void)
114114
SetRequestorInstance(&sRequestorCore);
115115

116116
sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
117-
sRequestorCore.Init(chip::Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
117+
TEMPORARY_RETURN_IGNORED sRequestorCore.Init(chip::Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
118118
sImageProcessor.SetOTADownloader(&sDownloader);
119119
sDownloader.SetImageProcessorDelegate(&sImageProcessor);
120120
sRequestorUser.Init(&sRequestorCore, &sImageProcessor);
@@ -228,7 +228,7 @@ int AppTask::Init()
228228
cc13xx_26xxLogInit();
229229

230230
// Init Chip memory management before the stack
231-
chip::Platform::MemoryInit();
231+
SuccessOrDie(chip::Platform::MemoryInit());
232232

233233
PLAT_LOG("Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
234234
PLAT_LOG("Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
@@ -283,7 +283,7 @@ int AppTask::Init()
283283
;
284284
}
285285

286-
sThreadNetworkDriver.Init();
286+
TEMPORARY_RETURN_IGNORED sThreadNetworkDriver.Init();
287287
ret = ThreadStackMgrImpl().StartThreadTask();
288288
if (ret != CHIP_NO_ERROR)
289289
{
@@ -320,7 +320,7 @@ int AppTask::Init()
320320
nativeParams.openThreadInstancePtr = chip::DeviceLayer::ThreadStackMgrImpl().OTInstance();
321321
initParams.endpointNativeParams = static_cast<void *>(&nativeParams);
322322

323-
chip::Server::GetInstance().Init(initParams);
323+
TEMPORARY_RETURN_IGNORED chip::Server::GetInstance().Init(initParams);
324324

325325
ret = PlatformMgr().StartEventLoopTask();
326326
if (ret != CHIP_NO_ERROR)
@@ -330,7 +330,7 @@ int AppTask::Init()
330330
;
331331
}
332332

333-
PlatformMgr().AddEventHandler(DeviceEventCallback, reinterpret_cast<intptr_t>(nullptr));
333+
TEMPORARY_RETURN_IGNORED PlatformMgr().AddEventHandler(DeviceEventCallback, reinterpret_cast<intptr_t>(nullptr));
334334

335335
uiInit();
336336

@@ -525,7 +525,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
525525
else
526526
{
527527
// Disable BLE advertisements
528-
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
528+
TEMPORARY_RETURN_IGNORED ConnectivityMgr().SetBLEAdvertisingEnabled(false);
529529
PLAT_LOG("Disabled BLE Advertisements");
530530
}
531531
}

examples/refrigerator-app/asr/src/AppTask.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const app::Clusters::Descriptor::Structs::SemanticTagStruct::Type freezerTagList
7676

7777
void NetWorkCommissioningInstInit()
7878
{
79-
sWiFiNetworkCommissioningInstance.Init();
79+
TEMPORARY_RETURN_IGNORED sWiFiNetworkCommissioningInstance.Init();
8080

8181
// We only have network commissioning on endpoint 0.
8282
emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false);
@@ -124,14 +124,15 @@ void AppTask::AppTaskMain(void * pvParameter)
124124
EndpointId kRefEndpointId = 1;
125125
EndpointId kColdCabinetEndpointId = 2;
126126
EndpointId kFreezeCabinetEndpointId = 3;
127-
app::SetTreeCompositionForEndpoint(kRefEndpointId);
128-
app::SetParentEndpointForEndpoint(kColdCabinetEndpointId, kRefEndpointId);
129-
app::SetParentEndpointForEndpoint(kFreezeCabinetEndpointId, kRefEndpointId);
127+
TEMPORARY_RETURN_IGNORED app::SetTreeCompositionForEndpoint(kRefEndpointId);
128+
TEMPORARY_RETURN_IGNORED app::SetParentEndpointForEndpoint(kColdCabinetEndpointId, kRefEndpointId);
129+
TEMPORARY_RETURN_IGNORED app::SetParentEndpointForEndpoint(kFreezeCabinetEndpointId, kRefEndpointId);
130130

131131
// set TagList
132-
SetTagList(kColdCabinetEndpointId,
133-
Span<const app::Clusters::Descriptor::Structs::SemanticTagStruct::Type>(refrigeratorTagList));
134-
SetTagList(kFreezeCabinetEndpointId, Span<const app::Clusters::Descriptor::Structs::SemanticTagStruct::Type>(freezerTagList));
132+
TEMPORARY_RETURN_IGNORED SetTagList(
133+
kColdCabinetEndpointId, Span<const app::Clusters::Descriptor::Structs::SemanticTagStruct::Type>(refrigeratorTagList));
134+
TEMPORARY_RETURN_IGNORED SetTagList(kFreezeCabinetEndpointId,
135+
Span<const app::Clusters::Descriptor::Structs::SemanticTagStruct::Type>(freezerTagList));
135136

136137
app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate);
137138

examples/refrigerator-app/asr/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ int main(void)
8383
vTaskStartScheduler();
8484

8585
chip::Platform::MemoryShutdown();
86-
PlatformMgr().StopEventLoopTask();
86+
TEMPORARY_RETURN_IGNORED PlatformMgr().StopEventLoopTask();
8787
PlatformMgr().Shutdown();
8888

8989
// Should never get here.

examples/temperature-measurement-app/asr/src/AppTask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ app::Clusters::NetworkCommissioning::Instance
5858

5959
void NetWorkCommissioningInstInit()
6060
{
61-
sWiFiNetworkCommissioningInstance.Init();
61+
TEMPORARY_RETURN_IGNORED sWiFiNetworkCommissioningInstance.Init();
6262

6363
// We only have network commissioning on endpoint 0.
6464
emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false);

examples/temperature-measurement-app/asr/src/DeviceCallbacks.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void TempMeas(System::Layer * systemLayer, void * appState)
104104
// chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MeasuredValue::Set(
105105
// /* endpoint ID */ 1, /* humidity in 0.01*C */ int16_t(humidity));
106106

107-
systemLayer->StartTimer(Clock::Seconds32(kReportDelaySec), TempMeas, nullptr);
107+
TEMPORARY_RETURN_IGNORED systemLayer->StartTimer(Clock::Seconds32(kReportDelaySec), TempMeas, nullptr);
108108
}
109109

110110
void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event)
@@ -116,7 +116,8 @@ void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event
116116
{
117117
ChipLogProgress(DeviceLayer, "IPv4 Server ready...");
118118
chip::app::DnssdServer::Instance().StartServer();
119-
chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kReportDelaySec), TempMeas, nullptr);
119+
TEMPORARY_RETURN_IGNORED chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kReportDelaySec),
120+
TempMeas, nullptr);
120121
}
121122
else if (event->InternetConnectivityChange.IPv4 == kConnectivity_Lost)
122123
{

examples/temperature-measurement-app/asr/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int main(void)
7575
vTaskStartScheduler();
7676

7777
chip::Platform::MemoryShutdown();
78-
PlatformMgr().StopEventLoopTask();
78+
TEMPORARY_RETURN_IGNORED PlatformMgr().StopEventLoopTask();
7979
PlatformMgr().Shutdown();
8080

8181
// Should never get here.

0 commit comments

Comments
 (0)