-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement sending message from the linux layer of the android tv-app:…
…:platform-app to the tv-app::content-app (#18696) * Implement sending message from the linux layer of the android tv-app::platform-app to the tv-app::content-app. Resolving conflicts * Review fixes. Used more appropriate datatype wrappers. introduced null checks for hardcoded sample apps. * Squashed commit of the following: commit bde9a1b Author: Restyled.io <[email protected]> Date: Fri May 20 22:25:44 2022 +0000 Restyled by clang-format commit 27c0f3d Author: Restyled.io <[email protected]> Date: Fri May 20 22:25:33 2022 +0000 Restyled by google-java-format commit 56bb8b4 Author: Restyled.io <[email protected]> Date: Fri May 20 22:25:15 2022 +0000 Restyled by whitespace commit 22ba274 Author: Amit Jain <[email protected]> Date: Fri May 20 15:15:45 2022 -0700 Implement sending message from the linux layer of the android tv-app::platform-app to the tv-app::content-app. * More restyling fixes. * One more restyle commit.
- Loading branch information
Showing
26 changed files
with
608 additions
and
122 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
examples/tv-app/android/App/.idea/deploymentTargetDropDown.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
examples/tv-app/android/App/content-app/src/main/res/raw/static_matter_clusters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
{ | ||
"clusters": [ | ||
{ | ||
"identifier": "0x050a", | ||
"features": "CS" | ||
"identifier": 1289, | ||
"features": ["NV", "LK", "NK"] | ||
}, | ||
{ | ||
"identifier": "0x0506", | ||
"features": "AS", | ||
"optionalCommands" : [4, 5] | ||
"identifier": 1290, | ||
"features": ["CS"], | ||
}, | ||
{ | ||
"identifier": 1286, | ||
"features": ["AS"], | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...atform-app/src/main/java/com/matter/tv/server/handlers/ContentAppEndpointManagerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.matter.tv.server.handlers; | ||
|
||
import android.content.Context; | ||
import android.util.Log; | ||
import com.matter.tv.server.model.ContentApp; | ||
import com.matter.tv.server.receivers.ContentAppDiscoveryService; | ||
import com.matter.tv.server.service.ContentAppAgentService; | ||
import com.tcl.chip.tvapp.ContentAppEndpointManager; | ||
|
||
public class ContentAppEndpointManagerImpl implements ContentAppEndpointManager { | ||
|
||
private static final String TAG = "MatterMainActivity"; | ||
private final Context context; | ||
|
||
public ContentAppEndpointManagerImpl(Context context) { | ||
this.context = context; | ||
} | ||
|
||
public String sendCommand(int endpointId, String commandPayload) { | ||
Log.d(TAG, "Received a command for endpointId " + endpointId + ". Message " + commandPayload); | ||
for (ContentApp app : | ||
ContentAppDiscoveryService.getReceiverInstance().getDiscoveredContentApps().values()) { | ||
if (app.getEndpointId() == endpointId) { | ||
Log.d( | ||
TAG, "Sending a command for endpointId " + endpointId + ". Message " + commandPayload); | ||
ContentAppAgentService.sendCommand(context, app.getAppName(), commandPayload); | ||
} | ||
} | ||
return "Success"; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
.../tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/model/ContentApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.matter.tv.server.model; | ||
|
||
import com.matter.tv.app.api.SupportedCluster; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
public class ContentApp { | ||
|
||
private String appName; | ||
private String vendorName; | ||
private int vendorId; | ||
private int productId; | ||
private Set<SupportedCluster> supportedClusters; | ||
private int endpoint; | ||
|
||
public ContentApp( | ||
String appName, | ||
String vendorName, | ||
int vendorId, | ||
int productId, | ||
Set<SupportedCluster> supportedClusters) { | ||
this.vendorName = vendorName; | ||
this.appName = appName; | ||
this.vendorId = vendorId; | ||
this.productId = productId; | ||
this.supportedClusters = supportedClusters; | ||
} | ||
|
||
public String getAppName() { | ||
return appName; | ||
} | ||
|
||
public String getVendorName() { | ||
return vendorName; | ||
} | ||
|
||
public int getVendorId() { | ||
return vendorId; | ||
} | ||
|
||
public int getProductId() { | ||
return productId; | ||
} | ||
|
||
public int getEndpointId() { | ||
return endpoint; | ||
} | ||
|
||
public void setEndpointId(int endpoint) { | ||
this.endpoint = endpoint; | ||
} | ||
|
||
public Set<SupportedCluster> getSupportedClusters() { | ||
return Collections.unmodifiableSet(supportedClusters); | ||
} | ||
} |
Oops, something went wrong.