ADD_DEPENDENCIES(widget_viewer_sdk widget_viewer_evas)
ADD_DEPENDENCIES(widget_viewer_sdk watch-holder)
-ENABLE_TESTING()
+#ENABLE_TESTING()
SET(WIDGET_VIEWER_UNIT_TESTS widget-viewer_unittests)
ADD_TEST(NAME ${WIDGET_VIEWER_UNIT_TESTS} COMMAND ${WIDGET_VIEWER_UNIT_TESTS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/unittest)
*/
#include <bundle.h>
+#include <dlog.h>
+#include <aul_app_com.h>
#include "ambient-viewer.h"
#include "top-app-surface.h"
int AmbientViewer::NotifyAmbientEvent(bool enter, AmbientViewer::Direction dir,
bundle* extra) {
+ bundle* b;
+ bundle_raw* raw = nullptr;
+ int len;
+ int ret;
+ char ambient_mode[32] = {0, };
+
+ b = bundle_create();
+ if (b == NULL) {
+ return -1;
+ }
+
+ snprintf(ambient_mode, sizeof(ambient_mode), "%d", (int)enter);
+ bundle_add_str(b, "__AMBIENT_MODE__", ambient_mode);
+
+ bundle_encode(extra, &raw, &len);
+ bundle_add_str(b, "__AMBIENT_EXTRA__", (const char*)raw);
+
+ switch (dir) {
+ case DIRECTION_VIEWER_AND_WATCH:
+ ret = aul_app_com_send("watch.ambientchange", b);
+ if (ret < 0)
+ LOGE("notify watch ambient error:%d", ret);
+ break;
+ case DIRECTION_VIEWER_AND_TOP_APP:
+ ret = aul_app_com_send("ui.ambientchange", b);
+ if (ret < 0)
+ LOGE("notify app ambient error:%d", ret);
+ break;
+ case DIRECTION_ALL:
+ ret = aul_app_com_send("watch.ambientchange", b);
+ if (ret < 0)
+ LOGE("notify watch ambient error:%d", ret);
+
+ ret = aul_app_com_send("ui.ambientchange", b);
+ if (ret < 0)
+ LOGE("notify app ambient error:%d", ret);
+ break;
+ }
+
+ if (b)
+ bundle_free(b);
+
+ if (raw)
+ free(raw);
+
return 0;
}