diff options
author | wansu.yoo <wansu.yoo@samsung.com> | 2019-09-30 08:25:10 +0900 |
---|---|---|
committer | wansu.yoo <wansu.yoo@samsung.com> | 2019-09-30 14:50:34 +0900 |
commit | a5a798b1824d2228b22af78bc41f018ad4a3cdf7 (patch) | |
tree | deab91d1926fc01d040aad81149be752b3e9472a | |
parent | d85c9a0069cb79abc7021a8f79ece4b5b08d4d5e (diff) | |
download | edge-orchestration-a5a798b1824d2228b22af78bc41f018ad4a3cdf7.tar.gz edge-orchestration-a5a798b1824d2228b22af78bc41f018ad4a3cdf7.tar.bz2 edge-orchestration-a5a798b1824d2228b22af78bc41f018ad4a3cdf7.zip |
fix sample for android service param
Change-Id: I948fda21476f9eb849a5afba4aa0a310ab862dcd
Signed-off-by: wansu.yoo <wansu.yoo@samsung.com>
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | libedge-orchestration/Makefile | 5 | ||||
-rw-r--r-- | libedge-orchestration/sample/exec_browser.sh | 4 | ||||
-rw-r--r-- | libedge-orchestration/sample/main_android.c | 2 | ||||
-rw-r--r-- | libedge-orchestration/sample/main_android_chromium.c | 83 | ||||
-rw-r--r-- | libedge-orchestration/sample/main_native.c (renamed from libedge-orchestration/sample/main.c) | 0 | ||||
-rw-r--r-- | libedge-orchestration/sample/main_native_chromium.c (renamed from libedge-orchestration/sample/main_chrome.c) | 0 | ||||
-rw-r--r-- | packaging/edge-orchestration.spec | 6 |
8 files changed, 96 insertions, 10 deletions
@@ -67,10 +67,12 @@ install: install -d $(DESTDIR)/usr/share/dbus-1/system-services install -d $(DESTDIR)/etc/dbus-1/system.d install -m 755 $(CMAIN_BIN_DIR)/$(CMAIN_BIN_FILE) $(DESTDIR)/usr/bin/$(CMAIN_BIN_FILE) - install -m 755 $(LIBPKG_SAMPLE_DIR)/output/orchestration_sample $(DESTDIR)/usr/bin/orchestration_sample - install -m 755 $(LIBPKG_SAMPLE_DIR)/output/orchestration_chrome_sample $(DESTDIR)/usr/bin/orchestration_chrome_sample + install -m 755 $(LIBPKG_SAMPLE_DIR)/exec_browser.sh $(DESTDIR)/usr/bin/orchestration_exec_browser.sh + install -m 755 $(LIBPKG_SAMPLE_DIR)/output/orchestration_native_sample $(DESTDIR)/usr/bin/orchestration_native_sample + install -m 755 $(LIBPKG_SAMPLE_DIR)/output/orchestration_native_chromium_sample $(DESTDIR)/usr/bin/orchestration_native_chromium_sample install -m 755 $(LIBPKG_SAMPLE_DIR)/output/orchestration_container_sample $(DESTDIR)/usr/bin/orchestration_container_sample install -m 755 $(LIBPKG_SAMPLE_DIR)/output/orchestration_android_sample $(DESTDIR)/usr/bin/orchestration_android_sample + install -m 755 $(LIBPKG_SAMPLE_DIR)/output/orchestration_android_chromium_sample $(DESTDIR)/usr/bin/orchestration_android_chromium_sample install -m 644 $(BASE_DIR)/$(SERVICE_FILE) $(DESTDIR)/usr/lib/systemd/system/$(SERVICE_FILE) ln -s ../$(SERVICE_FILE) $(DESTDIR)/usr/lib/systemd/system/multi-user.target.wants/ diff --git a/libedge-orchestration/Makefile b/libedge-orchestration/Makefile index f5be7df..cc2461f 100644 --- a/libedge-orchestration/Makefile +++ b/libedge-orchestration/Makefile @@ -22,10 +22,11 @@ all: build build-sample build-sample: build mkdir -p $(SAMPLE_DIR)/output - $(CC) -Wall -fPIE -pie $(SAMPLE_DIR)/main.c -o $(SAMPLE_DIR)/output/orchestration_sample -I$(INC_DIR) -L$(LIB_DIR) -lorchestration-client `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0` - $(CC) -Wall -fPIE -pie $(SAMPLE_DIR)/main_chrome.c -o $(SAMPLE_DIR)/output/orchestration_chrome_sample -I$(INC_DIR) -L$(LIB_DIR) -lorchestration-client `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0` + $(CC) -Wall -fPIE -pie $(SAMPLE_DIR)/main_native.c -o $(SAMPLE_DIR)/output/orchestration_native_sample -I$(INC_DIR) -L$(LIB_DIR) -lorchestration-client `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0` + $(CC) -Wall -fPIE -pie $(SAMPLE_DIR)/main_native_chromium.c -o $(SAMPLE_DIR)/output/orchestration_native_chromium_sample -I$(INC_DIR) -L$(LIB_DIR) -lorchestration-client `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0` $(CC) -Wall -fPIE -pie $(SAMPLE_DIR)/main_container.c -o $(SAMPLE_DIR)/output/orchestration_container_sample -I$(INC_DIR) -L$(LIB_DIR) -lorchestration-client `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0` $(CC) -Wall -fPIE -pie $(SAMPLE_DIR)/main_android.c -o $(SAMPLE_DIR)/output/orchestration_android_sample -I$(INC_DIR) -L$(LIB_DIR) -lorchestration-client `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0` + $(CC) -Wall -fPIE -pie $(SAMPLE_DIR)/main_android_chromium.c -o $(SAMPLE_DIR)/output/orchestration_android_chromium_sample -I$(INC_DIR) -L$(LIB_DIR) -lorchestration-client `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0` -rm -f ./sample/*.o build: diff --git a/libedge-orchestration/sample/exec_browser.sh b/libedge-orchestration/sample/exec_browser.sh new file mode 100644 index 0000000..636daa5 --- /dev/null +++ b/libedge-orchestration/sample/exec_browser.sh @@ -0,0 +1,4 @@ +#! /bin/bash + +echo 'System' > /proc/self/attr/current +su - owner -c "/usr/apps/org.tizen.chromium-efl/bin/ubrowser --enable-castanets"
\ No newline at end of file diff --git a/libedge-orchestration/sample/main_android.c b/libedge-orchestration/sample/main_android.c index 2114f05..ce480f9 100644 --- a/libedge-orchestration/sample/main_android.c +++ b/libedge-orchestration/sample/main_android.c @@ -19,7 +19,7 @@ #include <orchestration_client.h> #define SERVICE_NAME "Renderer" -#define PACKAGE_NAME "com.samsung.renderer.sample/com.samsung.renderer.sample.MainActivity" +#define PACKAGE_NAME "com.samsung.renderer.sample" void status_cb(orchestration_service_status_e staus, void* user_data) { diff --git a/libedge-orchestration/sample/main_android_chromium.c b/libedge-orchestration/sample/main_android_chromium.c new file mode 100644 index 0000000..9999f92 --- /dev/null +++ b/libedge-orchestration/sample/main_android_chromium.c @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright 2019 Samsung Electronics All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *******************************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <orchestration_client.h> + +#include <unistd.h> +#include <string.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/ioctl.h> +#include <netinet/in.h> +#include <net/if.h> +#include <arpa/inet.h> + +#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) + +#define SERVICE_NAME "chromium-renderer" +#define PACKAGE_NAME "org.chromium.chrome" + +int get_ip_addr(char ipstr[40]) { + int fd; + struct ifreq ifr; + char *addr = {0, }; + + fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd == -1) { + printf("socket failed"); + exit(EXIT_FAILURE); + } + ifr.ifr_addr.sa_family = AF_INET; + + /* I want IP address attached to "wlan0" */ + strncpy(ifr.ifr_name, "wlan0", IFNAMSIZ-1); + ioctl(fd, SIOCGIFADDR, &ifr); + close(fd); + + addr = inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr); + strncpy(ipstr, addr, MIN(strlen(addr), 40 - 1)); + return 0; +} + +void status_cb(orchestration_service_status_e staus, void* user_data) +{ + +} + +int main() { + char exec_param[512] = {0, }; + char params[256] = " --type=renderer --server-address="; + char ipstr[40] = {0, }; + if (get_ip_addr(ipstr) != 0) { + printf("error from getting ip addr\n"); + return 0; + } + strncat(params, ipstr, strlen(ipstr)); + + strncat(exec_param, PACKAGE_NAME, strlen(PACKAGE_NAME)); + strncat(exec_param, params, strlen(params)); + orchestration_service_info_s service_info; + service_info.count = 1; + service_info.services[0].exec_type = "android"; + service_info.services[0].exec_parameter = exec_param; + printf("service_info.exec_parameter: %s\n", service_info.services[0].exec_parameter); + orchestration_request_service(SERVICE_NAME, service_info, status_cb, NULL); + return 0; +}
\ No newline at end of file diff --git a/libedge-orchestration/sample/main.c b/libedge-orchestration/sample/main_native.c index bb2c14a..bb2c14a 100644 --- a/libedge-orchestration/sample/main.c +++ b/libedge-orchestration/sample/main_native.c diff --git a/libedge-orchestration/sample/main_chrome.c b/libedge-orchestration/sample/main_native_chromium.c index 52b37b0..52b37b0 100644 --- a/libedge-orchestration/sample/main_chrome.c +++ b/libedge-orchestration/sample/main_native_chromium.c diff --git a/packaging/edge-orchestration.spec b/packaging/edge-orchestration.spec index 2b169c1..4945a55 100644 --- a/packaging/edge-orchestration.spec +++ b/packaging/edge-orchestration.spec @@ -118,11 +118,7 @@ systemctl restart %{name} %attr(755,system_fw,system_fw)%{_libdir}/pkgconfig/%{name}.pc %attr(755,system_fw,system_fw)%{_includedir}/%{name}/orchestration_client.h # orchestration sample -%attr(755,system_fw,system_fw)%{_bindir}/orchestration_sample -%attr(755,system_fw,system_fw)%{_bindir}/orchestration_chrome_sample -%attr(755,system_fw,system_fw)%{_bindir}/orchestration_container_sample -%attr(755,system_fw,system_fw)%{_bindir}/orchestration_android_sample +%attr(755,system_fw,system_fw)%{_bindir}/orchestration_* %attr(755,system_fw,system_fw)%{_sysconfdir}/%{name}/apps/myscoring/* %attr(755,system_fw,system_fw)%{_sysconfdir}/%{name}/apps/myscoring2/* %attr(755,system_fw,system_fw)%{_sysconfdir}/%{name}/apps/Renderer/* - |