fix sample for android service param 24/214924/3
authorwansu.yoo <wansu.yoo@samsung.com>
Sun, 29 Sep 2019 23:25:10 +0000 (08:25 +0900)
committerwansu.yoo <wansu.yoo@samsung.com>
Mon, 30 Sep 2019 05:50:34 +0000 (14:50 +0900)
Change-Id: I948fda21476f9eb849a5afba4aa0a310ab862dcd
Signed-off-by: wansu.yoo <wansu.yoo@samsung.com>
Makefile
libedge-orchestration/Makefile
libedge-orchestration/sample/exec_browser.sh [new file with mode: 0644]
libedge-orchestration/sample/main.c [deleted file]
libedge-orchestration/sample/main_android.c
libedge-orchestration/sample/main_android_chromium.c [new file with mode: 0644]
libedge-orchestration/sample/main_chrome.c [deleted file]
libedge-orchestration/sample/main_native.c [new file with mode: 0644]
libedge-orchestration/sample/main_native_chromium.c [new file with mode: 0644]
packaging/edge-orchestration.spec

index f3a8b7b02f4cced6e02f852dee10231d5dddd907..2e28adcdd04d9d65c10494c30e9e9bd963ad6db5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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/
 
index f5be7df03fc5628ef4555b4dfcdf2ed6779d40f8..cc2461f40051903553adf6227311321637ce1144 100644 (file)
@@ -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 (file)
index 0000000..636daa5
--- /dev/null
@@ -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.c b/libedge-orchestration/sample/main.c
deleted file mode 100644 (file)
index bb2c14a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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 <orchestration_client.h>
-
-void status_cb(orchestration_service_status_e staus, void* user_data)
-{
-
-}
-
-int main() {
-    orchestration_service_info_s service_info;
-    service_info.count = 2;
-    service_info.services[0].exec_type = "native";
-    service_info.services[0].exec_parameter = "ls -al";
-    service_info.services[1].exec_type = "container";
-    service_info.services[1].exec_parameter = "docker run hello-world";
-    orchestration_request_service("list_segments", service_info, status_cb, NULL);
-    return 0;
-}
\ No newline at end of file
index 2114f05f10d09313262d2cb67bc2c8c3a4999402..ce480f914a535ba5255cdcffc60a7b38afd393d4 100644 (file)
@@ -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 (file)
index 0000000..9999f92
--- /dev/null
@@ -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_chrome.c b/libedge-orchestration/sample/main_chrome.c
deleted file mode 100644 (file)
index 52b37b0..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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))
-
-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 command[256] = "/usr/bin/efl_webprocess --type=renderer --enable-castanets=";
-    char ipstr[40] = {0, };
-    if (get_ip_addr(ipstr) != 0) {
-        printf("error from getting ip addr\n");
-        return 0;
-    }
-    orchestration_service_info_s service_info;
-    service_info.count = 1;
-    service_info.services[0].exec_type = "native";
-    service_info.services[0].exec_parameter = strncat(command, ipstr, strlen(ipstr));
-    printf("service_info.exec_parameter: %s\n", service_info.services[0].exec_parameter);
-    orchestration_request_service("org.tizen.chromium-efl", service_info, status_cb, NULL);
-    return 0;
-}
\ No newline at end of file
diff --git a/libedge-orchestration/sample/main_native.c b/libedge-orchestration/sample/main_native.c
new file mode 100644 (file)
index 0000000..bb2c14a
--- /dev/null
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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 <orchestration_client.h>
+
+void status_cb(orchestration_service_status_e staus, void* user_data)
+{
+
+}
+
+int main() {
+    orchestration_service_info_s service_info;
+    service_info.count = 2;
+    service_info.services[0].exec_type = "native";
+    service_info.services[0].exec_parameter = "ls -al";
+    service_info.services[1].exec_type = "container";
+    service_info.services[1].exec_parameter = "docker run hello-world";
+    orchestration_request_service("list_segments", service_info, status_cb, NULL);
+    return 0;
+}
\ No newline at end of file
diff --git a/libedge-orchestration/sample/main_native_chromium.c b/libedge-orchestration/sample/main_native_chromium.c
new file mode 100644 (file)
index 0000000..52b37b0
--- /dev/null
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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))
+
+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 command[256] = "/usr/bin/efl_webprocess --type=renderer --enable-castanets=";
+    char ipstr[40] = {0, };
+    if (get_ip_addr(ipstr) != 0) {
+        printf("error from getting ip addr\n");
+        return 0;
+    }
+    orchestration_service_info_s service_info;
+    service_info.count = 1;
+    service_info.services[0].exec_type = "native";
+    service_info.services[0].exec_parameter = strncat(command, ipstr, strlen(ipstr));
+    printf("service_info.exec_parameter: %s\n", service_info.services[0].exec_parameter);
+    orchestration_request_service("org.tizen.chromium-efl", service_info, status_cb, NULL);
+    return 0;
+}
\ No newline at end of file
index 2b169c15d81fe1fcc174cb0045a07e2de03a7c1b..4945a55d5493386ed345a474e6fb65d8ed24aaeb 100644 (file)
@@ -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/*
-