Skip to content

Commit

Permalink
Fixed bugs, UNSUPPORTED_ENDPOINT appearing
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadb-amazon committed Feb 9, 2024
1 parent c79f5ca commit f904561
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,25 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
Log.d(TAG, "CompletableFuture.thenRun() endpoints: " + endpoints);
for(Endpoint endpoint: endpoints)
{
MatterClusters.ContentLauncherCluster cluster = endpoint.getCluster(MatterClusters.ContentLauncherCluster.class);
Log.d(TAG, "CompletableFuture.thenRun() endpoint.cluster: " + cluster);
Log.d(TAG, "CompletableFuture.thenRun() endpoint.cluster.getEndpoint: " + cluster.getEndpoint());
MatterCommands.ContentLauncherClusterLaunchURLCommand command = cluster.getCommand(MatterCommands.ContentLauncherClusterLaunchURLCommand.class);
Log.d(TAG, "CompletableFuture.thenRun() endpoint.cluster.getEndpoint: " + command);

MatterCommands.ContentLauncherClusterLaunchURLRequest request = new MatterCommands.ContentLauncherClusterLaunchURLRequest();
request.contentURL = "testurl";
request.displayString = Optional.of("test string");
CompletableFuture<MatterCommands.ContentLauncherClusterResponse> responseFuture = command.invoke(request, null, 5000);
/*responseFuture.thenAccept(response -> {
Log.d(TAG, "Command CompletableFuture.thenAccept() response " + response);
});*/
if(endpoint.hasCluster(MatterClusters.ContentLauncherCluster.class))
{
MatterClusters.ContentLauncherCluster cluster = endpoint.getCluster(MatterClusters.ContentLauncherCluster.class);
Log.d(TAG, "CompletableFuture.thenRun() endpoint.cluster: " + cluster);
Log.d(TAG, "CompletableFuture.thenRun() endpoint.cluster.getEndpoint: " + cluster.getEndpoint());
MatterCommands.ContentLauncherClusterLaunchURLCommand command = cluster.getCommand(MatterCommands.ContentLauncherClusterLaunchURLCommand.class);
if(command != null)
{
Log.d(TAG, "CompletableFuture.thenRun() endpoint.cluster.getEndpoint: " + command);

MatterCommands.ContentLauncherClusterLaunchURLRequest request = new MatterCommands.ContentLauncherClusterLaunchURLRequest();
request.contentURL = "testurl";
request.displayString = Optional.of("test string");
CompletableFuture<MatterCommands.ContentLauncherClusterResponse> responseFuture = command.invoke(request, null, 5000);
/*responseFuture.thenAccept(response -> {
Log.d(TAG, "Command CompletableFuture.thenAccept() response " + response);
});*/
}
}
}

connectionFragmentNextButton.setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ JNI_METHOD(jobject, getCluster)
{
matter::casting::memory::Strong<matter::casting::clusters::content_launcher::ContentLauncherCluster>
contentLauncherCluster = endpoint->GetCluster<matter::casting::clusters::content_launcher::ContentLauncherCluster>();

jobject clusterJavaObject = support::createJCluster(
contentLauncherCluster,
"com/matter/casting/clusters/MatterClusters$ContentLauncherCluster");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ using namespace chip;
jobject createJCluster(matter::casting::memory::Strong<core::BaseCluster> cluster, const char * className)
{
ChipLogProgress(AppServer, "ClusterConverter-JNI.createJCluster() called");
VerifyOrReturnValue(cluster.get() != nullptr, nullptr, ChipLogError(AppServer, "ClusterConverter-JNI::createJCluster() cluster.get() == nullptr"));
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();

// Get a reference to the cluster's Java class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ using namespace chip;
jobject createJCommand(void * command, const char * className)
{
ChipLogProgress(AppServer, "CommandConverter-JNI.createJCommand() called");
VerifyOrReturnValue(command != nullptr, nullptr, ChipLogError(AppServer, "CommandConverter-JNI::createJCommand() command == nullptr"));
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();

// Get a reference to the command's Java class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ std::vector<core::CastingPlayer> CastingStore::ReadAll()

endpointAttributesList.push_back(endpointAttributes);
endpointServerListMap[endpointAttributes.mId] = serverList;
serverList.clear();
continue;
}
}
Expand Down

0 comments on commit f904561

Please sign in to comment.