Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Feb 1, 2022
1 parent cf12e8b commit 9650f9b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/controller/java/AndroidCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ ReportCallback::~ReportCallback()
env->DeleteGlobalRef(mSubscriptionEstablishedCallbackRef);
}
env->DeleteGlobalRef(mReportCallbackRef);
if (mReadClient != nullptr) {
if (mReadClient != nullptr)
{
Platform::Delete(mReadClient);
}
}
Expand Down Expand Up @@ -157,8 +158,8 @@ void ReportCallback::OnReportEnd()
env->CallVoidMethod(mReportCallbackRef, onReportMethod, map);
}

void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPath, DataVersion aVersion,
TLV::TLVReader * apData, const app::StatusIB & aStatus)
void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPath, DataVersion aVersion, TLV::TLVReader * apData,
const app::StatusIB & aStatus)
{
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
Expand Down
6 changes: 3 additions & 3 deletions src/controller/java/AndroidCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ struct ReportCallback : public app::ReadClient::Callback

void OnReportEnd() override;

void OnAttributeData(const app::ConcreteDataAttributePath & aPath, DataVersion aVersion,
TLV::TLVReader * apData, const app::StatusIB & aStatus) override;
void OnAttributeData(const app::ConcreteDataAttributePath & aPath, DataVersion aVersion, TLV::TLVReader * apData,
const app::StatusIB & aStatus) override;

void OnError(CHIP_ERROR aError) override;

Expand All @@ -62,7 +62,7 @@ struct ReportCallback : public app::ReadClient::Callback

/** Report errors back to Java layer. attributePath may be nullptr for general errors. */
void ReportError(jobject attributePath, CHIP_ERROR err);
void ReportError(jobject attributePath, Protocols::InteractionModel::Status status);
void ReportError(jobject attributePath, Protocols::InteractionModel::Status status);
void ReportError(jobject attributePath, const char * message, ChipError::StorageType errorCode);

CHIP_ERROR CreateChipAttributePath(const app::ConcreteDataAttributePath & aPath, jobject & outObj);
Expand Down
20 changes: 12 additions & 8 deletions src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,8 @@ JNI_METHOD(jobject, computePaseVerifier)
}

JNI_METHOD(void, subscribeToPath)
(JNIEnv * env, jobject self, jlong handle, jlong callbackHandle, jlong devicePtr,
jobject attributePath, jint minInterval, jint maxInterval)
(JNIEnv * env, jobject self, jlong handle, jlong callbackHandle, jlong devicePtr, jobject attributePath, jint minInterval,
jint maxInterval)
{
chip::DeviceLayer::StackLock lock;
CHIP_ERROR err = CHIP_NO_ERROR;
Expand All @@ -647,13 +647,15 @@ JNI_METHOD(void, subscribeToPath)

auto callback = reinterpret_cast<ReportCallback *>(callbackHandle);

app::ReadClient * readClient = Platform::New<app::ReadClient>(app::InteractionModelEngine::GetInstance(), device->GetExchangeManager(),
callback->mBufferedReadAdapter, app::ReadClient::InteractionType::Subscribe);
app::ReadClient * readClient =
Platform::New<app::ReadClient>(app::InteractionModelEngine::GetInstance(), device->GetExchangeManager(),
callback->mBufferedReadAdapter, app::ReadClient::InteractionType::Subscribe);

err = readClient->SendRequest(params);
if (err != CHIP_NO_ERROR)
{
chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback->mReportCallbackRef, ErrorStr(err), err);
chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback->mReportCallbackRef, ErrorStr(err),
err);
delete readClient;
delete callback;
return;
Expand Down Expand Up @@ -688,13 +690,15 @@ JNI_METHOD(void, readPath)

auto callback = reinterpret_cast<ReportCallback *>(callbackHandle);

app::ReadClient * readClient = Platform::New<app::ReadClient>(app::InteractionModelEngine::GetInstance(), device->GetExchangeManager(),
callback->mBufferedReadAdapter, app::ReadClient::InteractionType::Read);
app::ReadClient * readClient =
Platform::New<app::ReadClient>(app::InteractionModelEngine::GetInstance(), device->GetExchangeManager(),
callback->mBufferedReadAdapter, app::ReadClient::InteractionType::Read);

err = readClient->SendRequest(params);
if (err != CHIP_NO_ERROR)
{
chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback->mReportCallbackRef, ErrorStr(err), err);
chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback->mReportCallbackRef, ErrorStr(err),
err);
delete readClient;
delete callback;
return;
Expand Down

0 comments on commit 9650f9b

Please sign in to comment.