Skip to content

Commit

Permalink
Fix a a few gaps in jumping between Java and C++ for Messages cluster
Browse files Browse the repository at this point in the history
Fix dangling problems arising from uint16 seconds for duration to uint64_t milliseconds
  • Loading branch information
robszewczyk committed Feb 23, 2024
1 parent 9cf74ab commit 1958365
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/MessagesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void MessagesManager::InitializeWithObjects(jobject managerObject)
}

mPresentMessagesMethod =
env->GetMethodID(managerClass, "presentMessages", "(Ljava/lang/String;IIJILjava/lang/String;Ljava/util/HashMap;)Z");
env->GetMethodID(managerClass, "presentMessages", "(Ljava/lang/String;IIJJLjava/lang/String;Ljava/util/HashMap;)Z");
if (mPresentMessagesMethod == nullptr)
{
ChipLogError(Zcl, "Failed to access MessagesManager 'presentMessages' method");
Expand Down Expand Up @@ -182,7 +182,7 @@ CHIP_ERROR MessagesManager::HandleGetMessages(AttributeValueEncoder & aEncoder)
message.startTime = DataModel::Nullable<uint32_t>(static_cast<uint32_t>(jstartTime));
}

jfieldID durationField = env->GetFieldID(messageClass, "duration", "I");
jfieldID durationField = env->GetFieldID(messageClass, "duration", "J");
jlong jduration = env->GetLongField(messageObject, durationField);
if (jduration >= 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public MessagesManagerStub(int endpoint) {
responseOptions.put(new Long(1), "Yes");
responseOptions.put(new Long(2), "No");
presentMessages(
"31323334353637383930313233343536", 1, 1, 30, 60, "TestMessage", responseOptions);
"31323334353637383930313233343536", 1, 1, 30, 60000, "TestMessage", responseOptions);
Log.d(TAG, "MessagesManagerStub: added dummy message");
}

Expand Down

0 comments on commit 1958365

Please sign in to comment.