LIBSCORE_SAMPLE_2_CONF := myscoring2.conf
LIBSCORE_SAMPLE_2_DIR := $(LIBPKG_SAMPLE_DIR)/$(LIBSCORE_SAMPLE_2)
+LIBSCORE_SAMPLE_3 := Renderer
+LIBSCORE_SAMPLE_3_CONF := Renderer.conf
+LIBSCORE_SAMPLE_3_DIR := $(LIBPKG_SAMPLE_DIR)/$(LIBSCORE_SAMPLE_3)
+
TARGET_LIBSCORE_DIR := /etc/edge-orchestration/apps
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)/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 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/
install -d $(DESTDIR)/$(TARGET_LIBSCORE_DIR)/$(LIBSCORE_SAMPLE)
install -d $(DESTDIR)/$(TARGET_LIBSCORE_DIR)/$(LIBSCORE_SAMPLE_2)
+ install -d $(DESTDIR)/$(TARGET_LIBSCORE_DIR)/$(LIBSCORE_SAMPLE_3)
install -m 644 $(LIBSCORE_SAMPLE_DIR)/$(LIBSCORE_SAMPLE_CONF) $(DESTDIR)/$(TARGET_LIBSCORE_DIR)/$(LIBSCORE_SAMPLE)/
install -m 644 $(LIBSCORE_SAMPLE_2_DIR)/$(LIBSCORE_SAMPLE_2_CONF) $(DESTDIR)/$(TARGET_LIBSCORE_DIR)/$(LIBSCORE_SAMPLE_2)/
+ install -m 644 $(LIBSCORE_SAMPLE_3_DIR)/$(LIBSCORE_SAMPLE_3_CONF) $(DESTDIR)/$(TARGET_LIBSCORE_DIR)/$(LIBSCORE_SAMPLE_3)/
## c test and coverage
test:
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_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`
-rm -f ./sample/*.o
build:
--- /dev/null
+# Description of service that will be requested
+[Version]
+ConfVersion=v0.0 ; Version of Configuration file
+
+[ServiceInfo]
+ServiceName=Renderer ; Name of distributed service
+
+[ScoringMethod]
+IntervalTimeMs=1000 ; Interval time of get resource
--- /dev/null
+/*******************************************************************************
+ * 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>
+
+#define SERVICE_NAME "Renderer"
+#define PACKAGE_NAME "com.samsung.renderer.sample/com.samsung.renderer.sample.MainActivity"
+
+void status_cb(orchestration_service_status_e staus, void* user_data)
+{
+
+}
+
+int main() {
+ orchestration_service_info_s service_info;
+ service_info.count = 1;
+ service_info.services[0].exec_type = "android";
+ service_info.services[0].exec_parameter = PACKAGE_NAME;
+ orchestration_request_service(SERVICE_NAME, service_info, status_cb, NULL);
+ return 0;
+}
\ No newline at end of file
#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;
+ char *addr = {0, };
fd = socket(AF_INET, SOCK_DGRAM, 0);
ifr.ifr_addr.sa_family = AF_INET;
close(fd);
addr = inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr);
- strncpy(ipstr, addr, strlen(addr));
+ strncpy(ipstr, addr, MIN(strlen(addr), 40 - 1));
return 0;
}
}
int main() {
- char command[256] = "/usr/share/chromium-efl/bin/efl_webprocess --type=renderer --enable-castanets=";
+ 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");
--- /dev/null
+/*******************************************************************************
+ * 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 = 1;
+ service_info.services[0].exec_type = "container";
+ service_info.services[0].exec_parameter = "docker run hello-world";
+ orchestration_request_service("hello", service_info, status_cb, NULL);
+ return 0;
+}
\ No newline at end of file
# 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)%{_sysconfdir}/%{name}/apps/myscoring/*
%attr(755,system_fw,system_fw)%{_sysconfdir}/%{name}/apps/myscoring2/*
+%attr(755,system_fw,system_fw)%{_sysconfdir}/%{name}/apps/Renderer/*
+