-. update interface of go library for multiple input services.
-. add /var/data/db directory for boltdb pkg.
-. update dbus interface at server and client.
-. update generated lib.
Change-Id: I98c3e0ea1a2e9e5b566752fd40203601b481a393
Signed-off-by: wansu.yoo <wansu.yoo@samsung.com>
[submodule "edge-home-orchestration-go"]
path = edge-home-orchestration-go
url = https://github.com/lf-edge/edge-home-orchestration-go.git
- ignore = dirty
/* package interfaces/capi */
-#line 1 "cgo-builtin-prolog"
+#line 1 "cgo-builtin-export-prolog"
#include <stddef.h> /* for ptrdiff_t below */
#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H
+#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
+#endif
#endif
* limitations under the License.
*
*******************************************************************************/
+#define MAX_SVC_INFO_NUM 3
+typedef struct {
+ char* ExecutionType;
+ char* ExeCmd;
+} RequestServiceInfo;
+
+typedef struct {
+ char* ExecutionType;
+ char* Target;
+} TargetInfo;
+
+typedef struct {
+ char* Message;
+ char* ServiceName;
+ TargetInfo RemoteTargetInfo;
+} ResponseService;
#line 1 "cgo-generated-wrapper"
*/
typedef char _check_for_32_bit_pointer_matching_GoInt[sizeof(void*)==32/8 ? 1:-1];
+#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
+#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
extern int OrchestrationInit();
-extern int OrchestrationRequestService(char* p0, char* p1);
+extern ResponseService OrchestrationRequestService(char* p0, RequestServiceInfo* p1, int p2);
extern int PrintLog(char* p0);
{
#endif
+#include <orchestration.h>
+
#define DEBUG(format, ...) printLog("[%s:%d] "format, __FILE__, __LINE__, ##__VA_ARGS__);
typedef enum {
ORCH_ERROR_NONE = 0,
} _orchestration_state_e;
-typedef int (*request_service_cb)(char* app_name, char* service_info);
+typedef int (*request_service_cb)(char* app_name, RequestServiceInfo service_info[], int count);
void set_default_dbus_interface(void);
int orchestration_server_initialize(request_service_cb cb);
#include <pthread.h>
#include <orchestration_server.h>
-#include <orchestration.h>
-int request_cb(char* app_name, char* service_info){
- int result = ORCH_ERROR_FAULT;
+int request_cb(char* app_name, RequestServiceInfo service_info[], int count){
+ int ret = ORCH_ERROR_NONE;
+ ResponseService result;
- DEBUG("app_name : %s\n", app_name);
- DEBUG("service_info : %s\n", service_info);
- result = OrchestrationRequestService(app_name, service_info);
+ DEBUG("[orchestration_server]\n")
+ DEBUG("\t app_name : %s\n", app_name);
+ DEBUG("\t count : %d\n", count);
+ for (int ix = 0; ix < count; ix++) {
+ DEBUG("\t service_info[%d].ExecutionType : %s\n", ix, service_info[ix].ExecutionType);
+ DEBUG("\t service_info[%d].ExeCmd : %s\n", ix, service_info[ix].ExeCmd);
+ }
+
+ result = OrchestrationRequestService(app_name, service_info, count);
+ DEBUG("result = %s\n", result.Message);
- return result;
+ /* TO DO : parsing API response */
+ return ret;
}
void* thread_orchestration() {
int main(void){
int result;
- pthread_t p_thread;
+ pthread_t p_thread;
GMainLoop *loop;
" <interface name='org.tizen.orchestration.agent'>"
" <method name='request_service'>"
" <arg type='s' name='app_name' direction='in'/>"
- " <arg type='s' name='service_info' direction='in'/>"
+ " <arg type='a(ss)' name='service_info' direction='in'/>"
+ " <arg type='i' name='count' direction='in'/>"
" <arg type='i' name='return_value' direction='out'/>"
" </method>"
" </interface>"
{
int result = ORCH_ERROR_NONE;
- char *app_name, *service_info;
+ char *app_name;
+ int count;
+ GVariantIter *iter;
+ RequestServiceInfo service_info[MAX_SVC_INFO_NUM] = {NULL, };
if (!parameters)
{
return ORCH_ERROR_INVALID_PARAMETER;
}
- g_variant_get(parameters, "(&ss)", &app_name, &service_info);
+ g_variant_get(parameters, "(sa(ss)i)", &app_name, &iter, &count);
+
+ DEBUG("[orchestration dbus_interface] _request_service\n");
+ DEBUG("\t app_name = %s\n", app_name);
+ DEBUG("\t count = %d\n", count);
+
+ for (int i = 0; i < count; i++) {
+ g_variant_iter_loop (iter, "(ss)", &service_info[i].ExecutionType, &service_info[i].ExeCmd);
+
+ DEBUG("\t service_info[%d].ExecutionType = %s\n", i, service_info[i].ExecutionType);
+ DEBUG("\t service_info[%d].ExeCmd = %s\n", i, service_info[i].ExeCmd);
+ }
+ g_variant_iter_free (iter);
+
if (g_strcmp0(app_name, "") == 0)
return ORCH_ERROR_INVALID_PARAMETER;
- result = _request_service_cb(app_name, service_info);
+ result = _request_service_cb(app_name, service_info, count);
return result;
}
install -d $(DESTDIR)/usr/bin
install -d $(DESTDIR)/etc/$(PKG_NAME)
install -d $(DESTDIR)/var/log/$(PKG_NAME)
+ install -d $(DESTDIR)/var/data/db
install -d $(DESTDIR)/usr/lib/systemd/system/multi-user.target.wants
install -d $(DESTDIR)/usr/share/dbus-1/system-services
install -d $(DESTDIR)/etc/dbus-1/system.d
echo "=================================================================="
submodule_init
submodule_sync
- submodule_update
}
function build_c_interface() {
build_c_interface
build_package
;;
+ "init")
+ build_clean
+ build_init
+ submodule_update
+ build_c_interface
+ build_package
+ ;;
"local")
build_clean
build_c_interface
echo "Usage:"
echo "--------------------------------------------------------------"
echo " $0 : build C-Archive & RPM packages from Submodule"
+ echo " $0 init : build from latest Submodule"
echo " $0 local : build from local Submodule"
echo " $0 test : build test"
echo " $0 clean : build clean"
-Subproject commit 69c8a60f9016d3ad483b1734cc69d88206f23f03
+Subproject commit a7243de06d809dd7377d4bde7b4d7786f2150998
{
#endif
+#include <orchestration_client.h>
+
typedef enum {
ORCH_DBUS_ERROR_NONE = 0,
ORCH_DBUS_ERROR_INVALID_PARAMETER,
} _orchestration_dbus_state_e;
int dbus_consumer_initailze();
-int request_service_execute(char* app_name, char* exec_param);
+int request_service_execute(char* app_name, service_info_s service_info[], int count);
#ifdef __cplusplus
}
#endif
#endif /* __ORCHESTRATION_DBUS_CONSUMER_H__ */
-
\ No newline at end of file
ORCHESTRATION_SERVICE_STATUS_UNDEFINED_ERROR,
} orchestration_service_status_e;
+#define MAX_SVC_INFO_NUM 3
typedef struct
{
+ char *exec_type;
char *exec_parameter;
+} service_info_s;
+
+typedef struct
+{
+ int count;
+ service_info_s services[MAX_SVC_INFO_NUM];
} orchestration_service_info_s;
typedef void (*orchestration_changed_service_status_cb)(orchestration_service_status_e staus, void *user_data);
orchestration_client_state_e orchestration_request_service(char *app_name,
orchestration_service_info_s service_info,
orchestration_changed_service_status_cb cb,
- void *user_data);
+ void *user_data);
#ifdef __cplusplus
}
int main() {
orchestration_service_info_s service_info;
- service_info.exec_parameter = "ls -al";
+ 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
return 0;
}
orchestration_service_info_s service_info;
- service_info.exec_parameter = strcat(command, ipstr);
- printf("service_info.exec_parameter: %s\n", service_info.exec_parameter);
+ service_info.count = 1;
+ service_info.services[0].exec_type = "native";
+ service_info.services[0].exec_parameter = strcat(command, 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
return ORCH_DBUS_ERROR_NONE;
}
-int request_service_execute(char* app_name, char* exec_param)
+int request_service_execute(char* app_name, service_info_s service_info[], int count)
{
+ int idx;
GError *error = NULL;
+ GVariant *services;
+ GVariantBuilder *builder;
+
+ printf("[orchestration dbus_consumer] request_service_execute\n");
+ printf("\t app_name = %s\n", app_name);
+ printf("\t count = %d\n", count);
+ for (idx = 0; idx < count; idx++) {
+ printf("\t service_info[%d].exec_type = %s\n", idx, service_info[idx].exec_type);
+ printf("\t service_info[%d].exec_parameter = %s\n", idx, service_info[idx].exec_parameter);
+ }
+
+ builder = g_variant_builder_new (G_VARIANT_TYPE ("a(ss)"));
+ for (idx = 0; idx < count; idx++) {
+ g_variant_builder_add (
+ builder,
+ "(ss)",
+ service_info[idx].exec_type,
+ service_info[idx].exec_parameter
+ );
+ }
+
+ services = g_variant_new ("(sa(ss)i)", app_name, builder, count);
+ g_variant_builder_unref (builder);
GVariant *result =
g_dbus_connection_call_sync (_gdbus_conn,
_ORCHESTRATION_OBJECT_PATH,
_ORCHESTRATION_INTERFACE,
_ORCHESTRATION_REQUEST_SERVICE_METHOD,
- g_variant_new ("(ss)", app_name, exec_param),
+ services,
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
&error);
if (result)
g_variant_unref (result);
-
+
if (error)
{
printf("Failed to call remote method - %i : %s\n", error->code, error->message);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <orchestration_client.h>
#include <dbus_consumer.h>
/* ---------------------------------------------------------------------------------------------------- */
return ORCH_CLIENT_ERROR_FAULT;
}
- result = request_service_execute(app_name, service_info.exec_parameter);
+ printf("[orchestration_client]\n");
+ printf("\t app_name : %s\n", app_name);
+ printf("\t count : %d\n", service_info.count);
+ for (int i = 0; i < service_info.count; i++) {
+ printf("\t service_info[%d]->exec_type : %s\n", i, service_info.services[i].exec_type);
+ printf("\t service_info[%d]->exec_parameter : %s\n", i, service_info.services[i].exec_parameter);
+ }
+
+ result = request_service_execute(app_name, service_info.services, service_info.count);
if (result != ORCH_DBUS_ERROR_NONE)
{
printf("request_service_execute failed\n");
%attr(644,root,root)%{_datadir}/dbus-1/system-services/org.tizen.orchestration.service
%attr(644,root,root)%{_sysconfdir}/dbus-1/system.d/org.tizen.orchestration.conf
%attr(755,system_fw,system_fw)%dir /var/log/%{name}
+%attr(755,system_fw,system_fw)%dir /var/data/db
%attr(755,system_fw,system_fw)%dir %{_sysconfdir}/%{name}
%attr(755,system_fw,system_fw)%dir %{_sysconfdir}/%{name}/apps