Skip to content

Commit

Permalink
Merge branch 'master' into feature/enable_uart_logging
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-silabs authored Mar 4, 2024
2 parents f306475 + c1ae85c commit d0da4d0
Show file tree
Hide file tree
Showing 104 changed files with 947 additions and 1,524 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ jobs:
- name: Validate zap-cli is NOT available
# run_in_build_env.sh is used to ensure PATH is set to something that would otherwise find zap-cli
run: scripts/run_in_build_env.sh '(zap-cli --version && exit 1) || exit 0'
- name: Run watchOS Build Debug
working-directory: src/darwin/Framework
# Disable availability annotations, since we are not building a system
# Matter.framework.
run: xcodebuild -target "Matter" -sdk watchos -configuration Debug GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
- name: Run iOS Build Debug
working-directory: src/darwin/Framework
# Disable availability annotations, since we are not building a system
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,10 @@ jobs:
--known-failure app/util/generic-callback-stubs.cpp \
--known-failure app/util/im-client-callbacks.h \
--known-failure app/util/MatterCallbacks.h \
--known-failure app/util/message.cpp \
--known-failure app/util/odd-sized-integers.h \
--known-failure app/util/util.cpp \
--known-failure app/util/util.h \
--known-failure app/WriteHandler.h \
--known-failure lib/core/CHIPVendorIdentifiers.hpp \
--known-failure platform/DeviceSafeQueue.cpp \
--known-failure platform/DeviceSafeQueue.h \
--known-failure platform/GLibTypeDeleter.h \
Expand Down
4 changes: 4 additions & 0 deletions examples/platform/silabs/display/demo-ui-bitmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#define ZIGBEE_BITMAP_WIDTH 16
#define ZIGBEE_BITMAP_HEIGHT 16

#define ZIGBEE_BITMAP \
0x3f, 0xfc, 0x07, 0xf0, 0xff, 0xc7, 0xff, 0x9f, 0x01, 0x9c, 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01, 0xe0, 0x00, 0x70, \
0x80, 0x39, 0x80, 0xf9, 0xff, 0xfb, 0xff, 0x07, 0xe0, 0x1f, 0xfc

#define RAIL_BITMAP_WIDTH 16
#define RAIL_BITMAP_HEIGHT 16

Expand Down
34 changes: 17 additions & 17 deletions examples/platform/silabs/display/demo-ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "dmd/dmd.h"
#include "em_types.h"
#include "glib.h"
#include "sl_component_catalog.h"
#include "sl_memlcd.h"
#if SL_WIFI && !SIWX_917
#include "spi_multiplex.h"
Expand All @@ -41,28 +42,25 @@
#define PROT2_ID_X_POSITION 79

// Matter Logo
#define PROT2_BITMAP_WIDTH MATTER_LOGO_WIDTH
#define PROT2_BITMAP_HEIGHT MATTER_LOGO_HEIGHT
#define PROT2_X_POSITION 104
#define PROT2_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
#define PROT2_BITMAP (matterLogoBitmap)
#define PROT2_BITMAP_CONN (matterLogoBitmap)

// Networking Protocol Logo
#ifdef SL_WIFI
#define PROT1_BITMAP_WIDTH WIFI_BITMAP_WIDTH
#define PROT1_BITMAP_HEIGHT WIFI_BITMAP_HEIGHT
#define PROT1_X_POSITION 8
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
#define PROT1_BITMAP (networkBitMap)
#define PROT1_BITMAP_CONN (networkBitMap)
#else
#define PROT1_BITMAP_WIDTH THREAD_BITMAP_WIDTH
#define PROT1_BITMAP_HEIGHT THREAD_BITMAP_HEIGHT
#define PROT1_X_POSITION 8
#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
#define ZIGBEE_POSITION_Y (APP_Y_POSITION + (APP_Y_POSITION / 2) + (ZIGBEE_BITMAP_HEIGHT / 2))
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2) - (ZIGBEE_BITMAP_HEIGHT / 2))
#else
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
#define PROT1_BITMAP (networkBitMap)
#define PROT1_BITMAP_CONN (networkBitMap)
#endif
#endif

/*******************************************************************************
Expand All @@ -82,6 +80,10 @@ static const uint8_t networkBitMap[] = { WIFI_BITMAP };
static const uint8_t networkBitMap[] = { THREAD_BITMAP };
#endif

#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
static const uint8_t zigbeeBitMap[] = { ZIGBEE_BITMAP };
#endif

// Future usage
// static const uint8_t unconnectedBitMap[] = { QUESTION_MARK_BITMAP };

Expand Down Expand Up @@ -141,14 +143,13 @@ void demoUIDisplayApp(bool on)
updateDisplay();
}

void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected)
void demoUIDisplayProtocols()
{
GLIB_drawBitmap(&glibContext, (protocol == DEMO_UI_PROTOCOL1 ? PROT1_X_POSITION : PROT2_X_POSITION),
(protocol == DEMO_UI_PROTOCOL1 ? PROT1_Y_POSITION : PROT2_Y_POSITION),
(protocol == DEMO_UI_PROTOCOL1 ? PROT1_BITMAP_WIDTH : PROT2_BITMAP_WIDTH),
(protocol == DEMO_UI_PROTOCOL1 ? PROT1_BITMAP_HEIGHT : PROT2_BITMAP_HEIGHT),
(protocol == DEMO_UI_PROTOCOL1 ? (isConnected ? PROT1_BITMAP_CONN : PROT1_BITMAP)
: (isConnected ? PROT2_BITMAP_CONN : PROT2_BITMAP)));
GLIB_drawBitmap(&glibContext, PROT2_X_POSITION, PROT2_Y_POSITION, MATTER_LOGO_WIDTH, MATTER_LOGO_HEIGHT, matterLogoBitmap);
GLIB_drawBitmap(&glibContext, PROT1_X_POSITION, PROT1_Y_POSITION, PROT1_BITMAP_WIDTH, PROT1_BITMAP_HEIGHT, networkBitMap);
#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
GLIB_drawBitmap(&glibContext, PROT1_X_POSITION, ZIGBEE_POSITION_Y, ZIGBEE_BITMAP_WIDTH, ZIGBEE_BITMAP_HEIGHT, zigbeeBitMap);
#endif
updateDisplay();
}

Expand All @@ -157,6 +158,5 @@ void demoUIClearMainScreen(uint8_t * name)
GLIB_clear(&glibContext);
demoUIDisplayHeader((char *) name);
demoUIDisplayApp(false);
demoUIDisplayProtocol(DEMO_UI_PROTOCOL1, false);
demoUIDisplayProtocol(DEMO_UI_PROTOCOL2, false);
demoUIDisplayProtocols();
}
2 changes: 1 addition & 1 deletion examples/platform/silabs/display/demo-ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void demoUIDisplayApp(bool on);
* @return
* void
*****************************************************************************/
void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected);
void demoUIDisplayProtocols();

/**************************************************************************/
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class TerminalFragment extends Fragment {
private static String TERMINAL_INSTRUCTIONS =
"add <vid> [<pid>] Add app with given vendor ID [1, 2, 9050]. Usage: add 9050\r\n"
+ "remove <endpoint> Remove app at given endpoint [6, 7, etc]. Usage: remove 6\r\n"
+ "appobserver <appendpoint> <clientnodeindex> <data> <hint> Send app observer command to client node of the given app endpoint. Usage: appobserver 4 0 data hint\r\n"
+ "printclients <appendpoint> Print list of client nodes for the given app endpoint. Usage: printclients 4\r\n"
+ "setpin <endpoint> <pincode> Set pincode for app with given endpoint ID. Usage: setpin 6 34567890\r\n"
+ "commission <udc-entry> Commission given udc-entry using given pincode from corresponding app. Usage:"
+ "commission 0\r\n"
Expand Down
19 changes: 13 additions & 6 deletions examples/tv-app/android/java/AppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ ContentApp * ContentAppFactoryImpl::LoadContentApp(const CatalogVendorApp & vend
ChipLogProgress(DeviceLayer, " Looking next=%s ", app->GetApplicationBasicDelegate()->GetCatalogVendorApp()->applicationId);
if (app->GetApplicationBasicDelegate()->GetCatalogVendorApp()->Matches(vendorApp))
{
// need to think about loading apk here?
ContentAppPlatform::GetInstance().AddContentApp(app, &contentAppEndpoint, Span<DataVersion>(gDataVersions[i]),
Span<const EmberAfDeviceType>(gContentAppDeviceType));
return app;
Expand Down Expand Up @@ -422,19 +423,25 @@ std::list<ClusterId> ContentAppFactoryImpl::GetAllowedClusterListForStaticEndpoi
ChipLogProgress(DeviceLayer,
"ContentAppFactoryImpl GetAllowedClusterListForStaticEndpoint priviledged vendor accessible clusters "
"being returned.");
return { chip::app::Clusters::Descriptor::Id, chip::app::Clusters::OnOff::Id,
chip::app::Clusters::WakeOnLan::Id, chip::app::Clusters::MediaPlayback::Id,
chip::app::Clusters::LowPower::Id, chip::app::Clusters::KeypadInput::Id,
chip::app::Clusters::ContentLauncher::Id, chip::app::Clusters::AudioOutput::Id,
chip::app::Clusters::ApplicationLauncher::Id };
return { chip::app::Clusters::Descriptor::Id,
chip::app::Clusters::OnOff::Id,
chip::app::Clusters::WakeOnLan::Id,
chip::app::Clusters::MediaPlayback::Id,
chip::app::Clusters::LowPower::Id,
chip::app::Clusters::KeypadInput::Id,
chip::app::Clusters::ContentLauncher::Id,
chip::app::Clusters::AudioOutput::Id,
chip::app::Clusters::ApplicationLauncher::Id,
chip::app::Clusters::Messages::Id };
}
ChipLogProgress(
DeviceLayer,
"ContentAppFactoryImpl GetAllowedClusterListForStaticEndpoint operator vendor accessible clusters being returned.");
return { chip::app::Clusters::Descriptor::Id, chip::app::Clusters::OnOff::Id,
chip::app::Clusters::WakeOnLan::Id, chip::app::Clusters::MediaPlayback::Id,
chip::app::Clusters::LowPower::Id, chip::app::Clusters::KeypadInput::Id,
chip::app::Clusters::ContentLauncher::Id, chip::app::Clusters::AudioOutput::Id };
chip::app::Clusters::ContentLauncher::Id, chip::app::Clusters::AudioOutput::Id,
chip::app::Clusters::Messages::Id };
}
return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ public class MessagesManagerStub implements MessagesManager {
public MessagesManagerStub(int endpoint) {
this.endpoint = endpoint;
Log.d(TAG, "MessagesManagerStub: at " + this.endpoint);

HashMap<Long, String> responseOptions = new HashMap<Long, String>();
responseOptions.put(new Long(1), "Yes");
responseOptions.put(new Long(2), "No");
presentMessages(
"31323334353637383930313233343536", 1, 1, 30, 60000, "TestMessage", responseOptions);
Log.d(TAG, "MessagesManagerStub: added dummy message");
}

@Override
Expand Down
62 changes: 62 additions & 0 deletions examples/tv-app/tv-common/shell/AppTvShellCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ static CHIP_ERROR PrintAllCommands()
#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
streamer_printf(sout, " add <vid> [<pid>] Add app with given vendor ID [1, 2, 9050]. Usage: app add 9050\r\n");
streamer_printf(sout, " remove <endpoint> Remove app at given endpoint [6, 7, etc]. Usage: app remove 6\r\n");
streamer_printf(sout,
" appobserver <appendpoint> <clientnodeindex> <data> <hint> Send app observer command to client node of "
"the given app endpoint. Usage: appobserver 4 0 data hint\r\n");
streamer_printf(
sout, " printclients <appendpoint> Print list of client nodes for the given app endpoint. Usage: printclients 4\r\n");
streamer_printf(
sout, " setpin <endpoint> <pincode> Set pincode for app with given endpoint ID. Usage: app setpin 6 34567890\r\n");
streamer_printf(sout,
Expand Down Expand Up @@ -277,6 +282,63 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv)

return CHIP_NO_ERROR;
}
else if (strcmp(argv[0], "printclients") == 0)
{
if (argc < 2)
{
return PrintAllCommands();
}
char * eptr;

uint16_t endpoint = (uint16_t) strtol(argv[1], &eptr, 10);
ContentApp * app = ContentAppPlatform::GetInstance().GetContentApp(endpoint);
if (app == nullptr)
{
ChipLogProgress(DeviceLayer, "app not found");
return CHIP_ERROR_BAD_REQUEST;
}
uint8_t count = app->GetClientNodeCount();
ChipLogProgress(DeviceLayer, " node count: %d", count);
for (uint8_t i = 0; i < count; i++)
{
NodeId node = app->GetClientNode(i);
ChipLogProgress(DeviceLayer, " node[%d] " ChipLogFormatX64, i, ChipLogValueX64(node));
}
}
#if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE
else if (strcmp(argv[0], "appobserver") == 0)
{
if (argc < 5)
{
return PrintAllCommands();
}
char * eptr;

uint16_t endpoint = (uint16_t) strtol(argv[1], &eptr, 10);
ContentApp * app = ContentAppPlatform::GetInstance().GetContentApp(endpoint);
if (app == nullptr)
{
ChipLogProgress(DeviceLayer, "app not found");
return CHIP_ERROR_BAD_REQUEST;
}
uint8_t clientNodeIndex = (uint8_t) strtol(argv[2], &eptr, 10);
if (clientNodeIndex >= app->GetClientNodeCount())
{
ChipLogProgress(DeviceLayer, "illegal client node index");
return CHIP_ERROR_BAD_REQUEST;
}
NodeId clientNode = app->GetClientNode(clientNodeIndex);

char * data = argv[3];
char * encodingHint = argv[4];

app->SendAppObserverCommand(GetDeviceCommissioner(), clientNode, data, encodingHint);

ChipLogProgress(DeviceLayer, "sent appobserver command");

return CHIP_NO_ERROR;
}
#endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE
else if (strcmp(argv[0], "setpin") == 0)
{
if (argc < 3)
Expand Down
18 changes: 12 additions & 6 deletions examples/tv-app/tv-common/src/AppTv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,19 +549,25 @@ std::list<ClusterId> ContentAppFactoryImpl::GetAllowedClusterListForStaticEndpoi
ChipLogProgress(DeviceLayer,
"ContentAppFactoryImpl GetAllowedClusterListForStaticEndpoint priviledged vendor accessible clusters "
"being returned.");
return { chip::app::Clusters::Descriptor::Id, chip::app::Clusters::OnOff::Id,
chip::app::Clusters::WakeOnLan::Id, chip::app::Clusters::MediaPlayback::Id,
chip::app::Clusters::LowPower::Id, chip::app::Clusters::KeypadInput::Id,
chip::app::Clusters::ContentLauncher::Id, chip::app::Clusters::AudioOutput::Id,
chip::app::Clusters::ApplicationLauncher::Id };
return { chip::app::Clusters::Descriptor::Id,
chip::app::Clusters::OnOff::Id,
chip::app::Clusters::WakeOnLan::Id,
chip::app::Clusters::MediaPlayback::Id,
chip::app::Clusters::LowPower::Id,
chip::app::Clusters::KeypadInput::Id,
chip::app::Clusters::ContentLauncher::Id,
chip::app::Clusters::AudioOutput::Id,
chip::app::Clusters::ApplicationLauncher::Id,
chip::app::Clusters::Messages::Id }; // TODO: messages?
}
ChipLogProgress(
DeviceLayer,
"ContentAppFactoryImpl GetAllowedClusterListForStaticEndpoint operator vendor accessible clusters being returned.");
return { chip::app::Clusters::Descriptor::Id, chip::app::Clusters::OnOff::Id,
chip::app::Clusters::WakeOnLan::Id, chip::app::Clusters::MediaPlayback::Id,
chip::app::Clusters::LowPower::Id, chip::app::Clusters::KeypadInput::Id,
chip::app::Clusters::ContentLauncher::Id, chip::app::Clusters::AudioOutput::Id };
chip::app::Clusters::ContentLauncher::Id, chip::app::Clusters::AudioOutput::Id,
chip::app::Clusters::Messages::Id };
}
return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ private void runCertTests(Activity activity) {
kContentApp, successCallbackInteger, failureCallback);
});

runAndWait(
"messages_presentMessages",
successFailureCallback,
() -> {
tvCastingApp.messages_presentMessages(kTVApp, "CastingAppTestMessage", callback);
});

runAndWait(
"mediaPlayback_subscribeToCurrentState",
successFailureCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ public native boolean applicationBasic_readApplicationVersion(

public native boolean onOff_toggle(ContentApp contentApp, Object responseHandler);

public native boolean messages_presentMessages(
ContentApp contentApp, String messageText, Object responseHandler);

static {
System.loadLibrary("TvCastingApp");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum MediaCommandName
MediaPlayback_Seek,
MediaPlayback_SkipForward,
MediaPlayback_SkipBackward,
Messages_PresentMessagesRequest,
ApplicationLauncher_LaunchApp,
ApplicationLauncher_StopApp,
ApplicationLauncher_HideApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,36 @@ JNI_METHOD(jboolean, onOff_1toggle)
return (err == CHIP_NO_ERROR);
}

JNI_METHOD(jboolean, messages_1presentMessages)
(JNIEnv * env, jobject, jobject contentApp, jstring messageText, jobject jResponseHandler)
{
chip::DeviceLayer::StackLock lock;

ChipLogProgress(AppServer, "JNI_METHOD messages_presentMessages called");
const char * nativeMessageText = env->GetStringUTFChars(messageText, 0);

TargetEndpointInfo endpoint;
CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint);
VerifyOrExit(err == CHIP_NO_ERROR,
ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT,
err.Format()));

err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(Messages_PresentMessagesRequest).SetUp(env, jResponseHandler);
VerifyOrExit(CHIP_NO_ERROR == err,
ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format()));

err = CastingServer::GetInstance()->Messages_PresentMessagesRequest(&endpoint, nativeMessageText, [](CHIP_ERROR err) {
TvCastingAppJNIMgr().getMediaCommandResponseHandler(Messages_PresentMessagesRequest).Handle(err);
});
VerifyOrExit(CHIP_NO_ERROR == err,
ChipLogError(AppServer, "CastingServer.Messages_PresentMessagesRequest failed %" CHIP_ERROR_FORMAT, err.Format()));

env->ReleaseStringUTFChars(messageText, nativeMessageText);

exit:
return (err == CHIP_NO_ERROR);
}

JNI_METHOD(jboolean, mediaPlayback_1play)
(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler)
{
Expand Down
2 changes: 2 additions & 0 deletions examples/tv-casting-app/tv-casting-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ chip_data_model("tv-casting-common") {
"include/MediaPlayback.h",
"include/MediaReadBase.h",
"include/MediaSubscriptionBase.h",
"include/Messages.h",
"include/OnOff.h",
"include/PersistenceManager.h",
"include/TargetEndpointInfo.h",
Expand All @@ -83,6 +84,7 @@ chip_data_model("tv-casting-common") {
"src/KeypadInput.cpp",
"src/LevelControl.cpp",
"src/MediaPlayback.cpp",
"src/Messages.cpp",
"src/OnOff.cpp",
"src/PersistenceManager.cpp",
"src/TargetEndpointInfo.cpp",
Expand Down
Loading

0 comments on commit d0da4d0

Please sign in to comment.