Sync with latest MMI framework code 22/308622/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 28 Mar 2024 07:28:43 +0000 (16:28 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Thu, 28 Mar 2024 07:33:28 +0000 (16:33 +0900)
Sync Commit ID : a31f0c569f98038ebaf08be2cf5cac9255ee2ee9

Change-Id: Icb1e6f69498f847790c39303d4333e5a6c5056e3

73 files changed:
README.md
capi/meson.build
capi/mmi-node-action.h
capi/mmi-node-controller.h
capi/mmi-node-custom.h [new file with mode: 0644]
capi/mmi-node-logic.h
capi/mmi-node-processor.h
capi/mmi-node-source.h
capi/mmi-node.h
capi/mmi-plugin-storage.h
capi/mmi-workflow.h
meson.build
mmi-config.xml [new file with mode: 0644]
packaging/mmi.spec
platform/linux/mmi-platform-config.h
plugins/workflows/script-parser/mmi-module-script-parser.cpp
plugins/workflows/voice-touch/mmi-module-voice-touch.cpp
plugins/workflows/wakeupless-command/mmi-module-wakeupless-command.cpp
src/common/mmi-communication-message.h
src/mmi-cli/mmi-cli-node-tester.cpp
src/mmi-cli/mmi-cli.cpp
src/mmi-manager/mmi-ipc-ecore.cpp
src/mmi-manager/mmi-ipc-tidl.cpp
src/mmi-manager/mmi-ipc-tidl.h
src/mmi-manager/mmi-node-instance-manager.cpp
src/mmi-manager/mmi-node-instance-manager.h
src/mmi-manager/mmi-node-instance.cpp
src/mmi-manager/mmi-node-instance.h
src/mmi-manager/mmi-node-prototype-manager.cpp
src/mmi-manager/mmi-node-prototype-manager.h
src/mmi-manager/mmi-node-prototype.cpp
src/mmi-manager/mmi-node-prototype.h
src/mmi-manager/mmi-plugin-module-proxy.cpp
src/mmi-manager/mmi-plugin-module-proxy.h
src/mmi-manager/mmi-plugin-module-registry.cpp
src/mmi-manager/mmi-self-container.cpp
src/mmi-manager/mmi-workflow-instance-manager.cpp
src/mmi-manager/mmi-workflow-instance-manager.h
src/mmi-manager/mmi-workflow-instance.cpp
src/mmi-manager/mmi-workflow-instance.h
src/mmi-manager/mmi-workflow-prototype-manager.cpp
src/mmi-manager/mmi-workflow-prototype-manager.h
src/mmi-manager/mmi-workflow-prototype.h
src/mmi/meson.build
src/mmi/mmi-attribute.cpp
src/mmi/mmi-client-manager.h
src/mmi/mmi-data.cpp
src/mmi/mmi-ipc-ecore.cpp
src/mmi/mmi-ipc-tidl.cpp
src/mmi/mmi-ipc-tidl.h
src/mmi/mmi-node-action.cpp
src/mmi/mmi-node-controller.cpp
src/mmi/mmi-node-custom.cpp [new file with mode: 0644]
src/mmi/mmi-node-logic.cpp
src/mmi/mmi-node-processor.cpp
src/mmi/mmi-node-source.cpp
src/mmi/mmi-node.cpp
src/mmi/mmi-plugin-storage-impl.h
src/mmi/mmi-primitive-value.cpp
src/mmi/mmi-workflow-instance-manager.h
src/mmi/mmi-workflow-instance.cpp
src/mmi/mmi-workflow-script-parser.h
src/mmi/mmi-workflow-script.cpp
src/mmi/mmi-workflow.cpp
tests/mmi-manager/node-instance-manager/mmi-node-instance-manager-tests.cpp
tests/mmi-manager/node-prototype-manager/mmi-node-prototype-manager-tests.cpp
tests/mmi-manager/node-prototype/mmi-node-prototype-tests.cpp
tests/mmi-manager/plugin-module-registry/mmi-plugin-module-registry-tests.cpp
tests/mmi-manager/workflow-instance-manager/mmi-workflow-instance-manager-tests.cpp
tests/mmi-manager/workflow-instance/mmi-workflow-instance-tests.cpp
tests/mmi/mmi-main-test.cpp
tests/mmi/workflow/mmi-workflow-test.cpp
tidl/mmi.tidl

index fa599b0c36c480f3d25ef4555c3d973e563af4d3..4fc344ff1aece6b3008dbd6478216d7968e83c46 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,61 +1,27 @@
-# MMI(Multi-modal Interaction) Framework Library  
+# MMI(Multi-modal Interaction) Framework
   
+### Build & Install
+Build this project using `gbs` and install the artifacts into the Tizen device via `sdb` command
+
+### Run
+Execute `mmi-manager` program.
+```console
+$ mmi-manager
 ```
-[Source Tree]    
-.  
-├── capi  
-│   â”œâ”€â”€ meson.build  
-│   â”œâ”€â”€ mmi-attribute.h  
-│   â”œâ”€â”€ mmi-data.h  
-│   â”œâ”€â”€ mmi-error.h  
-│   â”œâ”€â”€ mmi.h  
-│   â”œâ”€â”€ mmi-node-gate.h  
-│   â”œâ”€â”€ mmi-node.h  
-│   â”œâ”€â”€ mmi-node-processor.h  
-│   â”œâ”€â”€ mmi-node-source.h  
-│   â”œâ”€â”€ mmi-port.h  
-│   â”œâ”€â”€ mmi-primitive-value.h  
-│   â”œâ”€â”€ mmi-signal.h  
-│   â””── mmi-workflow.h  
-├── CODEOWNERS  
-├── COPYING  
-├── meson.build  
-├── meson_options.txt  
-├── packaging  
-│   â”œâ”€â”€ mmi.manifest  
-│   â””── mmi.spec  
-├── README.md  
-├── src  
-│   â”œâ”€â”€ common  
-│   â”‚   â”œâ”€â”€ mmi-communication-channel.h  
-│   â”‚   â”œâ”€â”€ mmi-communication-message.h  
-│   â”‚   â””── mmi-event-observer.h  
-│   â”œâ”€â”€ meson.build  
-│   â”œâ”€â”€ mmi-attribute.cpp  
-│   â”œâ”€â”€ mmi-client-manager.h  
-│   â”œâ”€â”€ mmi.cpp  
-│   â”œâ”€â”€ mmi-data.cpp  
-│   â”œâ”€â”€ mmi-ipc-tidl.cpp  
-│   â”œâ”€â”€ mmi-ipc-tidl.h  
-│   â”œâ”€â”€ mmi-log.h  
-│   â”œâ”€â”€ mmi-node.cpp  
-│   â”œâ”€â”€ mmi-node-gate.cpp  
-│   â”œâ”€â”€ mmi-node-processor.cpp  
-│   â”œâ”€â”€ mmi-node-source.cpp  
-│   â”œâ”€â”€ mmi-port.cpp  
-│   â”œâ”€â”€ mmi-primitive-value.cpp  
-│   â”œâ”€â”€ mmi-signal.cpp  
-│   â”œâ”€â”€ mmi-workflow.cpp  
-│   â””── mmi-workflow-instance-manager.h  
-├── tests  
-│   â”œâ”€â”€ meson.build  
-│   â”œâ”€â”€ mmi-attribute-test.cpp  
-│   â”œâ”€â”€ mmi-data-test.cpp  
-│   â”œâ”€â”€ mmi-ipc-test.cpp  
-│   â”œâ”€â”€ mmi-main-test.cpp  
-│   â”œâ”€â”€ mmi-primitive-value-test.cpp  
-│   â”œâ”€â”€ mmi-tests.cpp  
-│   â””── mmi-tests.h  
-└── tidl  
-    â””── mmi.tidl  
+
+### Test
+You can write your own program using the headers and libraries
+provided by the package `mmi-devel`, but it is also possible to
+use our CLI program to test the basic functions and capabilities.
+```console
+$ dlogutil MMI MMIMGR & # To check the log
+$ mmi-cli
+State changed to 1
+cli> create 1
+Creating instance of type 1
+cli> activate
+Activating instance
+
+<Logs will be printed>
+....
 ```
index 6423806c6f11ba39134c9bb196f8751a8ae4157a..f4ce9aca0009ceefe55b656c670ec34e18ade902 100644 (file)
@@ -10,6 +10,7 @@ install_headers(
        'mmi-node-logic.h',
        'mmi-node-controller.h',
        'mmi-node-action.h',
+       'mmi-node-custom.h',
        'mmi-port.h',
        'mmi-signal.h',
        'mmi-defines.h',
index 69e3020f6d55fedec13f210dbe13a14f7a952fcb..1141c46b85f7042c67d88b9037c37047aceafb6f 100644 (file)
@@ -39,8 +39,8 @@ extern "C" {
 #endif
 
 
-enum mmi_standard_node_action_type_e {
-    MMI_STANDARD_NODE_ACTION_TYPE_NONE,
+enum mmi_node_action_type_e {
+    MMI_NODE_ACTION_TYPE_NONE,
 
     /* - Description : Emits a mouse event
         - Attributes :
@@ -53,16 +53,14 @@ enum mmi_standard_node_action_type_e {
             Data Type : MMI_DATA_TYPE_COORDINATE
             Description : When a coordinate data is received, emits a mouse event
     */
-    MMI_STANDARD_NODE_ACTION_TYPE_MOUSE_EVENT,
+    MMI_NODE_ACTION_TYPE_MOUSE_EVENT,
 
-    MMI_STANDARD_NODE_ACTION_TYPE_KEY_EVENT,
+    MMI_NODE_ACTION_TYPE_KEY_EVENT,
 };
 
-int mmi_standard_node_create_action(mmi_standard_node_action_type_e type, mmi_node_h *node);
+int mmi_node_create_action(mmi_node_action_type_e type, mmi_node_h *node);
 
-int mmi_standard_node_get_action_type(mmi_node_h node, mmi_standard_node_action_type_e *type);
-
-int mmi_standard_node_register_action(mmi_standard_node_action_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node);
+int mmi_node_get_action_type(mmi_node_h node, mmi_node_action_type_e *type);
 
 #ifdef __cplusplus
 }
index b92a4a17b1c5749bb91d8cfe624036bd10cdef31..03eb074f09001cf9386e98560edfb80a0f79c88d 100644 (file)
@@ -39,8 +39,8 @@ extern "C" {
 #endif
 
 
-enum mmi_standard_node_controller_type_e {
-    MMI_STANDARD_NODE_CONTROLLER_TYPE_NONE,
+enum mmi_node_controller_type_e {
+    MMI_NODE_CONTROLLER_TYPE_NONE,
 
     /* - Description : Turns the node with a name specified in the attribute "TARGET" on or off
         - Attributes :
@@ -49,14 +49,12 @@ enum mmi_standard_node_controller_type_e {
             Name : "VALUE"
             Data Type : MMI_DATA_TYPE_BOOLEAN
     */
-    MMI_STANDARD_NODE_CONTROLLER_TYPE_SWITCH,
+    MMI_NODE_CONTROLLER_TYPE_SWITCH,
 };
 
-int mmi_standard_node_create_controller(mmi_standard_node_controller_type_e type, mmi_node_h *node);
+int mmi_node_create_controller(mmi_node_controller_type_e type, mmi_node_h *node);
 
-int mmi_standard_node_get_controller_type(mmi_node_h node, mmi_standard_node_controller_type_e *type);
-
-int mmi_standard_node_register_controller(mmi_standard_node_controller_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node);
+int mmi_node_get_controller_type(mmi_node_h node, mmi_node_controller_type_e *type);
 
 #ifdef __cplusplus
 }
diff --git a/capi/mmi-node-custom.h b/capi/mmi-node-custom.h
new file mode 100644 (file)
index 0000000..d2f9bdc
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd 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.
+ *
+ */
+
+
+#ifndef __TIZEN_UIX_MMI_NODE_CUSTOM_H__
+#define __TIZEN_UIX_MMI_NODE_CUSTOM_H__
+
+
+
+#include <mmi-node.h>
+
+/**
+* @file mmi-node-custom.h
+*/
+
+
+/**
+* @addtogroup CAPI_UIX_MMI_MODULE
+* @{
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int mmi_node_create_custom(const char *custom_type_id, mmi_node_h *node);
+
+int mmi_node_get_custom_type(mmi_node_h node, const char **custom_type_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/**
+ * @}
+ */
+
+
+#endif /* __TIZEN_UIX_MMI_NODE_CUSTOM_H__ */
index 39f2c60a645035119ffa00f8ea6096c74c53b1b7..13ef9ad5487c70d7bf970c7faf8fa72c16651784 100644 (file)
@@ -39,8 +39,8 @@ extern "C" {
 #endif
 
 
-enum mmi_standard_node_logic_type_e {
-    MMI_STANDARD_NODE_LOGIC_TYPE_NONE,
+enum mmi_node_logic_type_e {
+    MMI_NODE_LOGIC_TYPE_NONE,
 
     /*
         - Description : Compares the text received from the input port 1 ("TEXT") with
@@ -89,7 +89,7 @@ enum mmi_standard_node_logic_type_e {
             Name : "MATCHED_STRUCT_ARRAY"
             Data Type : MMI_DATA_TYPE_STRUCT
     */
-    MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH,
+    MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH,
 
     /*
         - Description : Tests if the regex strings specified in the attribute "REGEX" with
@@ -119,7 +119,7 @@ enum mmi_standard_node_logic_type_e {
             Name : "MATCHED_STRUCT_ARRAY"
             Data Type : MMI_DATA_TYPE_STRUCT
     */
-    MMI_STANDARD_NODE_LOGIC_TYPE_REGEX_STRING_MATCH,
+    MMI_NODE_LOGIC_TYPE_REGEX_STRING_MATCH,
 
 
     /*
@@ -144,14 +144,12 @@ enum mmi_standard_node_logic_type_e {
             Name : "COMPARISON_RESULT"
             Data Type : MMI_DATA_TYPE_USER_IDENTIFICATION
     */
-    MMI_STANDARD_NODE_LOGIC_TYPE_USER_COMPARISON,
+    MMI_NODE_LOGIC_TYPE_USER_COMPARISON,
 };
 
-int mmi_standard_node_create_logic(mmi_standard_node_logic_type_e type, mmi_node_h *node);
+int mmi_node_create_logic(mmi_node_logic_type_e type, mmi_node_h *node);
 
-int mmi_standard_node_get_logic_type(mmi_node_h node, mmi_standard_node_logic_type_e *type);
-
-int mmi_standard_node_register_logic(mmi_standard_node_logic_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node);
+int mmi_node_get_logic_type(mmi_node_h node, mmi_node_logic_type_e *type);
 
 #ifdef __cplusplus
 }
index 8ff0f15a8120b5adeb970d815deec97a21384fbe..a864e4784df1b1b89bda483f5bda3d887a26bd24 100644 (file)
@@ -39,8 +39,8 @@ extern "C" {
 #endif
 
 
-enum mmi_standard_node_processor_type_e {
-    MMI_STANDARD_NODE_PROCESSOR_TYPE_NONE,
+enum mmi_node_processor_type_e {
+    MMI_NODE_PROCESSOR_TYPE_NONE,
 
     /*
         - Attributes : None
@@ -54,7 +54,7 @@ enum mmi_standard_node_processor_type_e {
             Name : "FINAL"
             Data Type : MMI_DATA_TYPE_TEXT
     */
-    MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR,
+    MMI_NODE_PROCESSOR_TYPE_ASR,
 
     /*
         - Attributes : None
@@ -65,7 +65,7 @@ enum mmi_standard_node_processor_type_e {
             Name : "VIDEO_OUT"
             Data Type : MMI_DATA_TYPE_VIDEO
     */
-    MMI_STANDARD_NODE_PROCESSOR_TYPE_VIDEO_CONVERTER,
+    MMI_NODE_PROCESSOR_TYPE_VIDEO_CONVERTER,
 
     /*
         - Attributes : None
@@ -79,7 +79,7 @@ enum mmi_standard_node_processor_type_e {
                 - "USER" : MMI_DATA_TYPE_USER_IDENTIFICATION
                 - "SCORE" : MMI_DATA_TYPE_FLOAT
     */
-    MMI_STANDARD_NODE_PROCESSOR_TYPE_FACE_RECOGNITION,
+    MMI_NODE_PROCESSOR_TYPE_FACE_RECOGNITION,
 
     /*
         - Attributes : None
@@ -93,7 +93,7 @@ enum mmi_standard_node_processor_type_e {
                 - "USER" : MMI_DATA_TYPE_USER_IDENTIFICATION
                 - "SCORE" : MMI_DATA_TYPE_FLOAT
     */
-    MMI_STANDARD_NODE_PROCESSOR_TYPE_SPEAKER_RECOGNITION,
+    MMI_NODE_PROCESSOR_TYPE_SPEAKER_RECOGNITION,
 
     /*
         - Attributes :
@@ -149,14 +149,26 @@ enum mmi_standard_node_processor_type_e {
             Name : "REJECTED"
             Data Type : MMI_DATA_TYPE_TEXT
     */
-    MMI_STANDARD_NODE_PROCESSOR_TYPE_VOICE_TOUCH,
-};
+    MMI_NODE_PROCESSOR_TYPE_VOICE_TOUCH,
 
-int mmi_standard_node_create_processor(mmi_standard_node_processor_type_e type, mmi_node_h *node);
+    /*
+        - Attributes : None
+        - Input Port 1
+            Name : "AUDIO"
+            Data Type : MMI_DATA_TYPE_AUDIO
+        - Output Port 1
+            Name : "DETECTED_BOS"
+            Data Type : MMI_DATA_TYPE_BOOLEAN
+        - Output Port 2
+            Name : "DETECTED_EOS"
+            Data Type : MMI_DATA_TYPE_BOOLEAN
+    */
+    MMI_NODE_PROCESSOR_TYPE_VOICE_ACTIVITY_DETECTOR,
+};
 
-int mmi_standard_node_get_processor_type(mmi_node_h node, mmi_standard_node_processor_type_e *type);
+int mmi_node_create_processor(mmi_node_processor_type_e type, mmi_node_h *node);
 
-int mmi_standard_node_register_processor(mmi_standard_node_processor_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node);
+int mmi_node_get_processor_type(mmi_node_h node, mmi_node_processor_type_e *type);
 
 #ifdef __cplusplus
 }
index dbb445fd527e8626bd862143b587f6eb32b52b57..a78fc892ac66cd47bb7915c2293e41b4b1c67b00 100644 (file)
@@ -38,8 +38,8 @@
 extern "C" {
 #endif
 
-enum mmi_standard_node_source_type_e {
-    MMI_STANDARD_NODE_SOURCE_TYPE_NONE,
+enum mmi_node_source_type_e {
+    MMI_NODE_SOURCE_TYPE_NONE,
 
     /*
         - Description : A microphone that captures sound all the time.
@@ -53,7 +53,7 @@ enum mmi_standard_node_source_type_e {
             Type : OUT
             Data Type : MMI_DATA_TYPE_AUDIO
     */
-    MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT,
+    MMI_NODE_SOURCE_TYPE_MIC_AMBIENT,
 
     /*
         - Description : A camera that captures video.
@@ -62,7 +62,7 @@ enum mmi_standard_node_source_type_e {
             Type : OUT
             Data Type : MMI_DATA_TYPE_VIDEO
      */
-    MMI_STANDARD_NODE_SOURCE_TYPE_CAMERA,
+    MMI_NODE_SOURCE_TYPE_CAMERA,
 
     /*
         - Description : A screen analyzer that gets screen info when rescanning occur.
@@ -85,12 +85,12 @@ enum mmi_standard_node_source_type_e {
                 "role": MMI_DATA_TYPE_TEXT,
             }
     */
-    MMI_STANDARD_NODE_SOURCE_TYPE_SCREEN_ANALYZER,
+    MMI_NODE_SOURCE_TYPE_SCREEN_ANALYZER,
 };
 
-int mmi_standard_node_create_source(mmi_standard_node_source_type_e type, mmi_node_h *node);
+int mmi_node_create_source(mmi_node_source_type_e type, mmi_node_h *node);
 
-int mmi_standard_node_get_source_type(mmi_node_h node, mmi_standard_node_source_type_e *type);
+int mmi_node_get_source_type(mmi_node_h node, mmi_node_source_type_e *type);
 
 #ifdef __cplusplus
 }
index a6ddc093302cdb0c848345b6369b68a6c663abfe..14e0501662284c87233c62f8bb5d427bb991e3b3 100644 (file)
 extern "C" {
 #endif
 
-enum mmi_standard_node_type_e {
-    MMI_STANDARD_NODE_TYPE_NONE,
-    MMI_STANDARD_NODE_TYPE_SOURCE,
-    MMI_STANDARD_NODE_TYPE_PROCESSOR,
-    MMI_STANDARD_NODE_TYPE_LOGIC,
-    MMI_STANDARD_NODE_TYPE_CONTROLLER,
-    MMI_STANDARD_NODE_TYPE_ACTION,
+enum mmi_node_type_e {
+    MMI_NODE_TYPE_NONE,
+    MMI_NODE_TYPE_SOURCE,
+    MMI_NODE_TYPE_PROCESSOR,
+    MMI_NODE_TYPE_LOGIC,
+    MMI_NODE_TYPE_CONTROLLER,
+    MMI_NODE_TYPE_ACTION,
+    MMI_NODE_TYPE_CUSTOM,
 };
 
 typedef void* mmi_node_instance_h;
@@ -71,8 +72,9 @@ typedef struct {
 } mmi_node_callbacks;
 
 typedef struct {
-    mmi_standard_node_type_e type;
+    mmi_node_type_e type;
     int sub_type;
+    char custom_type_id[MMI_NAME_MAX_LENGTH];
     mmi_port_h *ports;
     size_t port_count;
     mmi_node_callbacks callbacks;
@@ -87,7 +89,7 @@ int mmi_node_add_port(mmi_node_h node, mmi_port_h port);
 int mmi_node_find_port(mmi_node_h node, mmi_port_type_e port_type, const char *port_name, mmi_port_h *port);
 
 /* Retrieves the type of a node. */
-int mmi_node_get_type(mmi_node_h node, mmi_standard_node_type_e *type);
+int mmi_node_get_type(mmi_node_h node, mmi_node_type_e *type);
 
 /* Retrieves the number of ports in a node. */
 int mmi_node_get_port_count(mmi_node_h node, size_t *port_count);
index 336233ffb3239129f2849da24948b80982c11295..97e97b6e8a7c547494df7881e8064ba49ee4b97a 100644 (file)
@@ -28,6 +28,7 @@
 #include <mmi-node-logic.h>
 #include <mmi-node-controller.h>
 #include <mmi-node-action.h>
+#include <mmi-node-custom.h>
 #include <mmi-workflow.h>
 
 /**
index 862ebb4ae16f5cdbcd6117de12e8d5b1544e80bb..dfcf666bd31ed94c736b6e9e11e0c294e7748254 100644 (file)
@@ -148,8 +148,11 @@ int mmi_standard_workflow_register(mmi_workflow_h workflow);
 /* Clones a workflow. */
 int mmi_workflow_clone(mmi_workflow_h workflow, mmi_workflow_h *cloned);
 
+/* Create a workflow prototype from a script */
+int mmi_workflow_create_from_script(const char *script, mmi_workflow_h *workflow);
+
 /* Create a workflow prototype from a script file */
-int mmi_workflow_create_from_script(const char *script_path, mmi_workflow_h *workflow);
+int mmi_workflow_create_from_script_file(const char *script_path, mmi_workflow_h *workflow);
 
 /* Destroy a workflow prototype */
 int mmi_workflow_destroy(mmi_workflow_h workflow);
@@ -167,6 +170,12 @@ typedef void (*mmi_workflow_output_cb)(mmi_workflow_instance_h instance, const c
 /* Instantiate a workflow from a workflow prototype */
 int mmi_standard_workflow_instance_create(mmi_standard_workflow_type_e type, mmi_workflow_instance_h *instance);
 
+/* Instantiate a workflow from a workflow script */
+int mmi_custom_workflow_instance_create_from_script(const char *workflow_script, mmi_workflow_instance_h *instance);
+
+/* Instantiate a workflow from a workflow script file */
+int mmi_custom_workflow_instance_create_from_script_file(const char *workflow_script_path, mmi_workflow_instance_h *instance);
+
 /* Destroy a workflow instance */
 int mmi_workflow_instance_destroy(mmi_workflow_instance_h instance);
 
@@ -182,6 +191,9 @@ int mmi_workflow_instance_set_attribute(mmi_workflow_instance_h instance, mmi_at
 /* Emit a signal to a workflow instance */
 int mmi_workflow_instance_emit_signal(mmi_workflow_instance_h instance, mmi_signal_h signal);
 
+/* Feed data to a port of a node with given name pair */
+int mmi_workflow_instance_feed_data(mmi_workflow_instance_h instance, const char *node_name, const char *port_name, mmi_data_h data);
+
 /* Set a callback function to receive workflow output */
 int mmi_workflow_instance_set_output_callback(mmi_workflow_instance_h instance, const char *name, mmi_workflow_output_cb callback, void *user_data);
 
index 9920cdb43bfa1cad6f9df11b576a71662362c266..4dc483c0254b912d3fe0166323f222f70108c1a2 100644 (file)
@@ -18,6 +18,7 @@ mmi_prefix_scriptdir = join_paths(mmi_prefix, get_option('datadir'), 'mmi', 'scr
 
 mmi_extra_flags = ''.join(['-DMMI_INSTALL_PREFIX="', mmi_prefix, '"'])
 add_global_arguments(mmi_extra_flags, language : ['c', 'cpp'])
+add_global_arguments('-Werror', language : ['c', 'cpp'])
 
 pkgconfig = import('pkgconfig')
 
diff --git a/mmi-config.xml b/mmi-config.xml
new file mode 100644 (file)
index 0000000..d211970
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<mmi-config>
+        <confidence>0.5f</confidence>
+</mmi-config>
index 18ef3ed24d9ea28930abdfe77cb0f7993d89eb61..75ee998a8eb455ebf7b0ebbb0fc49794b8c88e71 100644 (file)
@@ -1,5 +1,5 @@
 Name:          mmi
-Version:       2.0.2
+Version:       2.1.0
 Release:       0
 Summary:       Multi-modal Interaction Framework
 License:       MIT
index 5c06d5c4279f216181e657f79b1cc74a327d87c2..f69b29db3035ef1a7ab93acdff074f2c158fe5fb 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdio.h>
 
 #define EXPORT_API
-static char *get_error_message(int err) { return "Unknown"; }
+[[maybe_unused]] static const char *get_error_message(int err) { return "Unknown"; }
 
 #define MMI_DEFAULT_CONFIG             "/usr/local/mmi/configs/mmi-config.xml"
 
index ae02cdd91c96d7a04f7b12ba591aba1853131da8..337d99663b8ce188801caf7fc83058bd01bfc3ce 100644 (file)
@@ -21,7 +21,7 @@ extern "C" {
                 auto const ext = entry.path().string().substr(pos + 1);
                 if (ext == "mws") {
                     mmi_workflow_h workflow = nullptr;
-                    mmi_workflow_create_from_script(entry.path().string().c_str(), &workflow);
+                    mmi_workflow_create_from_script_file(entry.path().string().c_str(), &workflow);
                     mmi_standard_workflow_register(workflow);
                     mmi_workflow_destroy(workflow);
                 }
index a636f7f50fc332885a651948ee334a0460376438..61fd24246b81887261457922ddd22ca91120d197 100644 (file)
@@ -34,33 +34,33 @@ extern "C" {
         mmi_workflow_set_type(workflow, MMI_STANDARD_WORKFLOW_VOICE_TOUCH);
 
         mmi_node_h node_mic = nullptr;
-        mmi_standard_node_create_source(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
+        mmi_node_create_source(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
         mmi_workflow_node_add(workflow, NODE_NAME_MIC, node_mic);
 
         mmi_node_h node_asr = nullptr;
-        mmi_standard_node_create_processor(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR, &node_asr);
+        mmi_node_create_processor(MMI_NODE_PROCESSOR_TYPE_ASR, &node_asr);
         mmi_workflow_node_add(workflow, NODE_NAME_ASR, node_asr);
 
         mmi_node_h node_match_mode_commands = nullptr;
-        mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match_mode_commands);
+        mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match_mode_commands);
         mmi_workflow_node_add(workflow, NODE_NAME_MATCH_MODE_COMMANDS, node_match_mode_commands);
 
         mmi_node_h node_match_predefined_commands = nullptr;
-        mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match_predefined_commands);
+        mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match_predefined_commands);
         mmi_workflow_node_add(workflow, NODE_NAME_MATCH_PREDEFINED_COMMANDS, node_match_predefined_commands);
 
         mmi_node_h node_voice_touch = nullptr;
-        mmi_standard_node_create_processor(MMI_STANDARD_NODE_PROCESSOR_TYPE_VOICE_TOUCH, &node_voice_touch);
+        mmi_node_create_processor(MMI_NODE_PROCESSOR_TYPE_VOICE_TOUCH, &node_voice_touch);
         mmi_workflow_node_add(workflow, NODE_NAME_VOICE_TOUCH_PROCESSOR, node_voice_touch);
 
         mmi_node_h node_screen_analyzer = nullptr;
-        mmi_standard_node_create_source(MMI_STANDARD_NODE_SOURCE_TYPE_SCREEN_ANALYZER, &node_screen_analyzer);
+        mmi_node_create_source(MMI_NODE_SOURCE_TYPE_SCREEN_ANALYZER, &node_screen_analyzer);
         mmi_workflow_node_add(workflow, NODE_NAME_SCREEN_ANALYZER, node_screen_analyzer);
 
 #ifdef ENABLE_TEMP_RESCAN
         /* This is a temporary node for rescanning the screen, it will be removed when the signal mechanism is ready */
         mmi_node_h temp_node_match_rescan_command = nullptr;
-        mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &temp_node_match_rescan_command);
+        mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &temp_node_match_rescan_command);
         mmi_workflow_node_add(workflow, "TEMP_RESCAN", temp_node_match_rescan_command);
 #endif
 
index c0379d3624b88e8c2d88604e21762f1e5419958b..bf642cb6dbb76cb733cba2b65e4b5f36f9f071ed 100644 (file)
@@ -24,15 +24,15 @@ extern "C" {
 
         mmi_node_h node_mic = nullptr;
         /* FIXME: node should be 'found' instead of 'created' */
-        mmi_standard_node_create_source(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
+        mmi_node_create_source(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
         mmi_workflow_node_add(workflow, "MIC", node_mic);
 
         mmi_node_h node_asr = nullptr;
-        mmi_standard_node_create_processor(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR, &node_asr);
+        mmi_node_create_processor(MMI_NODE_PROCESSOR_TYPE_ASR, &node_asr);
         mmi_workflow_node_add(workflow, "ASR", node_asr);
 
         mmi_node_h node_match = nullptr;
-        mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match);
+        mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match);
         mmi_workflow_node_add(workflow, "MATCH", node_match);
 
         mmi_workflow_link_nodes_by_names(workflow, "MIC", "AUDIO", "ASR", "AUDIO");
index 9eb6924b745a1a07605429115ffbd1e7f8bf9fec..12b83df293c19614b1d68b0054e615877e88655a 100644 (file)
@@ -41,6 +41,7 @@ enum class CLIENT_MESSAGE_TYPE {
     WORKFLOW_INSTANCE_DESTROY,
     WORKFLOW_INSTANCE_SET_ATTRIBUTE,
     WORKFLOW_INSTANCE_EMIT_SIGNAL,
+    WORKFLOW_INSTANCE_FEED_DATA,
     WORKFLOW_INSTANCE_ACTIVATE,
     WORKFLOW_INSTANCE_DEACTIVATE,
     /* Manager to Client */
@@ -63,6 +64,8 @@ struct ClientMessage : public Message {
 struct ClientMessageWorkflowInstanceCreate : public ClientMessage {
     ClientMessageWorkflowInstanceCreate() : ClientMessage{CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_CREATE} {}
     mmi_standard_workflow_type_e workflow_type{MMI_STANDARD_WORKFLOW_NONE};
+    bool script_from_file{false};
+    std::string script_info;
     int local_workflow_instance_id{0};
     void *user_data{nullptr};
 };
@@ -84,6 +87,14 @@ struct ClientMessageWorkflowInstanceEmitSignal : public ClientMessage {
     mmi_signal_h signal{nullptr};
 };
 
+struct ClientMessageWorkflowInstanceFeedData : public ClientMessage {
+    ClientMessageWorkflowInstanceFeedData() : ClientMessage{CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_FEED_DATA} {}
+    int local_workflow_instance_id{0};
+    std::string node_name;
+    std::string port_name;
+    mmi_data_h data{nullptr};
+};
+
 struct ClientMessageWorkflowInstanceActivate : public ClientMessage {
     ClientMessageWorkflowInstanceActivate() : ClientMessage{CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_ACTIVATE} {}
     int local_workflow_instance_id{0};
index 2282f857d653fbb861d38f31561e97425d153a7b..4f862902173c4a3af0010dba68ca058aeeb9d29f 100644 (file)
                                printf("%s(%d) > " fmt "\n", __func__, __LINE__, ##arg); \
                } while (0); })
 
-#define _D(fmt, args...) MMI_CLI_LOG_(fmt, ##args)
-#define _I(fmt, args...) MMI_CLI_LOG_(fmt, ##args)
-#define _W(fmt, args...) MMI_CLI_LOG_(fmt, ##args)
-#define _E(fmt, args...) MMI_CLI_LOG_(fmt, ##args)
-
 class Program;
 
 struct PortInstance
@@ -36,7 +31,7 @@ struct PortInstance
 
 struct NodeInstance
 {
-    mmi_standard_node_type_e m_node_type;
+    mmi_node_type_e m_node_type;
 
     mmi_node_callbacks m_callbacks{nullptr,};
 
@@ -493,7 +488,7 @@ void Program::load_module(std::string path) {
     _D("node_list.count: %zu", m_node_list.node_count);
     for (size_t i = 0;i < m_node_list.node_count;i++) {
         mmi_node_h node = m_node_list.nodes[i];
-        mmi_standard_node_type_e type;
+        mmi_node_type_e type;
         mmi_node_get_type(node, &type);
         mmi_node_callbacks callbacks;
         mmi_node_get_callbacks(node, &callbacks);
@@ -566,7 +561,7 @@ void Program::create_node_instance() {
 
     /* Currently only one node is supported */
     mmi_node_h node = m_node_list.nodes[0];
-    mmi_standard_node_type_e type;
+    mmi_node_type_e type;
     mmi_node_get_type(node, &type);
     mmi_node_callbacks callbacks;
     mmi_node_get_callbacks(node, &callbacks);
@@ -708,8 +703,6 @@ void Program::push_data(DataTestType type) {
     std::string name = read_string_value("Enter port name: ");
     for (auto port_instance : node_instance->m_ports) {
         if (port_instance->m_name == name) {
-            mmi_data_h data = nullptr;
-
             size_t entry_index = static_cast<size_t>(DataTestType::MaxCount);
             for (size_t i = 0;i < sizeof(g_data_test_entries) / sizeof(g_data_test_entries[0]);i++) {
                 if (g_data_test_entries[i].type == type) {
index adcaf4d8716acbea156fa5ed6cb787a26d189845..80b5a14edd212cdc10feaa7c78bd61e6e9ff4983 100644 (file)
@@ -41,6 +41,52 @@ public:
             },
             nullptr);
     }
+    void create_instance_from_script() {
+        if (m_instance) {
+            std::cout << "Instance already created" << std::endl;
+            return;
+        }
+
+        std::string script = R"(
+@workflow
+
+@node-list
+[Source] MIC_AMBIENT as MIC
+[Processor] ASR as ASR
+[Logic] FIXED_STRING_MATCH as MATCH
+
+@link-list
+MIC.AUDIO -> ASR.AUDIO
+ASR.FINAL_ASR -> MATCH.TEXT
+
+@attribute-list
+MATCH.CANDIDATES as COMMANDS
+
+@output-list
+MATCH.COMMAND as MATCHED_CANDIDATE
+        )";
+        std::cout << "Creating instance of script : " << std::endl << script << std::endl;
+        mmi_custom_workflow_instance_create_from_script(script.c_str(), &m_instance);
+        mmi_workflow_instance_set_output_callback(m_instance, "COMMAND",
+            [](mmi_workflow_instance_h instance, const char *name, mmi_data_h data, void *user_data) {
+                std::cout << "OUTPUT data received : " << std::string(name ? name : "") << std::endl;
+            },
+            nullptr);
+    }
+    void create_instance_from_file(std::string path) {
+        if (m_instance) {
+            std::cout << "Instance already created" << std::endl;
+            return;
+        }
+
+        std::cout << "Creating instance of script with path : " << path << std::endl;
+        mmi_custom_workflow_instance_create_from_script_file(path.c_str(), &m_instance);
+        mmi_workflow_instance_set_output_callback(m_instance, "COMMAND",
+            [](mmi_workflow_instance_h instance, const char *name, mmi_data_h data, void *user_data) {
+                std::cout << "OUTPUT data received : " << std::string(name ? name : "") << std::endl;
+            },
+            nullptr);
+    }
     void destroy_instance() {
         if (!m_instance) {
             std::cout << "No instance to destroy" << std::endl;
@@ -69,7 +115,7 @@ public:
         std::cout << "Deactivating instance" << std::endl;
         mmi_workflow_instance_deactivate(m_instance);
     }
-    void set_attribute() {
+    void set_attribute(std::string name, std::string type, std::string value) {
         if (!m_instance) {
             std::cout << "No instance to set attribute" << std::endl;
             return;
@@ -77,30 +123,49 @@ public:
 
         std::cout << "Setting attribute " << std::endl;
 
-        mmi_attribute_h attribute = nullptr;
-        constexpr size_t COMMAND_NUM = 2;
-        const char *commands[] = {"Open", "Close"};
-        mmi_attribute_create_string_array("COMMANDS", commands, COMMAND_NUM, &attribute);
-
-        mmi_workflow_instance_set_attribute(m_instance, attribute);
-
-        mmi_attribute_destroy(attribute);
-
-        attribute = nullptr;
-        mmi_primitive_value_h lang_value = nullptr;
-        mmi_primitive_value_create_string("ko-KR", &lang_value);
-        mmi_attribute_create(lang_value, "LANGUAGE", &attribute);
-        mmi_workflow_instance_set_attribute(m_instance, attribute);
-        mmi_attribute_destroy(attribute);
-        mmi_primitive_value_destroy(lang_value);
-
-        attribute = nullptr;
-        mmi_primitive_value_h stop_method_value = nullptr;
-        mmi_primitive_value_create_int(1, &stop_method_value);  // 1 : silence detection
-        mmi_attribute_create(stop_method_value, "STOP_METHOD", &attribute);
-        mmi_workflow_instance_set_attribute(m_instance, attribute);
-        mmi_attribute_destroy(attribute);
-        mmi_primitive_value_destroy(stop_method_value);
+        if (type.compare("int") == 0) {
+            mmi_attribute_h attribute = nullptr;
+            mmi_primitive_value_h int_value = nullptr;
+            mmi_primitive_value_create_int(std::stoi(value), &int_value);
+            mmi_attribute_create(int_value, name.c_str(), &attribute);
+            mmi_workflow_instance_set_attribute(m_instance, attribute);
+            mmi_attribute_destroy(attribute);
+            mmi_primitive_value_destroy(int_value);
+        } else if (type.compare("string") == 0) {
+            mmi_attribute_h attribute = nullptr;
+            mmi_primitive_value_h string_value = nullptr;
+            mmi_primitive_value_create_string(value.c_str(), &string_value);
+            mmi_attribute_create(string_value, name.c_str(), &attribute);
+            mmi_workflow_instance_set_attribute(m_instance, attribute);
+            mmi_attribute_destroy(attribute);
+            mmi_primitive_value_destroy(string_value);
+        } else if (type.compare("string_array") == 0) {
+            mmi_attribute_h attribute = nullptr;
+
+            std::vector<std::string> strings;
+            std::istringstream ss{value};
+            std::string temp;
+
+            while (getline(ss, temp, ',')) {
+                strings.push_back(temp);
+            }
+
+            mmi_primitive_value_h array = nullptr;
+            mmi_primitive_value_create_array(&array);
+
+            for (size_t i = 0; i < strings.size(); i++) {
+                mmi_primitive_value_h element = nullptr;
+                mmi_primitive_value_create_string(strings.at(i).c_str(), &element);
+                mmi_primitive_value_add_array_element(array, element);
+            }
+
+            mmi_attribute_create(array, name.c_str(), &attribute);
+
+            mmi_workflow_instance_set_attribute(m_instance, attribute);
+
+            mmi_primitive_value_destroy(array);
+            mmi_attribute_destroy(attribute);
+        }
     }
     void emit_signal() {
         if (!m_instance) {
@@ -131,6 +196,23 @@ public:
         mmi_signal_parameter_destroy(signal_parameter_2);
         mmi_primitive_value_destroy(signal_parameter_value_2);
     }
+    void feed_data(std::string node_name, std::string port_name, std::string type, std::string value) {
+        if (!m_instance) {
+            std::cout << "No instance to feed data" << std::endl;
+            return;
+        }
+
+        std::cout << "Feeding data " << std::endl;
+
+        mmi_data_h data = nullptr;
+        if (type.compare("int") == 0) {
+            mmi_data_create_int(std::stoi(value), &data);
+        } else if (type.compare("text") == 0) {
+            mmi_data_create_text(value.c_str(), &data);
+        }
+        mmi_workflow_instance_feed_data(m_instance, node_name.c_str(), port_name.c_str(), data);
+        mmi_data_destroy(data);
+    }
 
 
     static int state_changed_cb(mmi_state_e state, void *user_data) {
@@ -166,13 +248,28 @@ int main(void)
         },
         "Creates a new workflow instance");
 
+        rootMenu->Insert("create_from_script", [](std::ostream& out) {
+            g_program.create_instance_from_script();
+        },
+        "Creates a new workflow instance from the predefined script data");
+
+        rootMenu->Insert("create_from_file", [](std::ostream& out, std::string path) {
+            g_program.create_instance_from_file(path);
+        },
+        "Creates a new workflow instance from a script file");
+
         rootMenu->Insert("destroy", [](std::ostream& out) {
             g_program.destroy_instance();
         },
         "Destroys the current workflow instance");
 
-        rootMenu->Insert("set_attribute", [](std::ostream& out) {
-            g_program.set_attribute();
+        rootMenu->Insert("set_attribute", [](std::ostream& out, std::string name, std::string type, std::string value) {
+            g_program.set_attribute(name, type, value);
+        },
+        "Set attributes for the current workflow instance");
+
+        rootMenu->Insert("feed_data", [](std::ostream& out, std::string node_name, std::string port_name, std::string type, std::string value) {
+            g_program.feed_data(node_name, port_name, type, value);
         },
         "Set attributes for the current workflow instance");
 
index b2e678063bfb8fc8fbbd63806c418934010d9dee..2119e62b94ae9be71a872a589f3a0f854404a172 100644 (file)
@@ -168,8 +168,9 @@ Eina_Bool CommunicationChannelEcoreIPC::handler_client_data(void *data, int ev_t
 
 void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, void *data, int size)
 {
-    if (size < sizeof(CLIENT_MESSAGE_TYPE)) {
-        _E("Data Size too small : %d", size)
+    size_t data_size = static_cast<size_t>(size);
+    if (data_size < sizeof(CLIENT_MESSAGE_TYPE)) {
+        _E("Data Size too small : %zu", data_size)
         return;
     }
 
@@ -187,16 +188,23 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
             struct workflow_instance_create_payload {
                 int local_workflow_instance_id;
                 mmi_standard_workflow_type_e workflow_type;
+                bool script_from_file;
+                size_t script_info_size;
             } payload;
-            if (size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
-                _E("Data Size too small : %d", size)
+            if (data_size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
+                _E("Data Size too small : %zu", data_size)
                 return;
             }
-            memcpy(&payload, data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
+            memcpy(&payload, (unsigned char*)data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
             ClientMessageWorkflowInstanceCreate message;
             message.sender = sender;
             message.local_workflow_instance_id = payload.local_workflow_instance_id;
             message.workflow_type = payload.workflow_type;
+            message.script_from_file = payload.script_from_file;
+            message.script_info = std::string(
+                (const char*)((unsigned char*)(data) +
+                    sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)),
+                payload.script_info_size);
             notify_observers(
                 COMMUNICATION_CHANNEL_EVENT_TYPE::MESSAGE_RECEIVED,
                 static_cast<Message*>(&message));
@@ -207,11 +215,11 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
             struct workflow_instance_destroy_payload {
                 int local_workflow_instance_id;
             } payload;
-            if (size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
-                _E("Data Size too small : %d", size)
+            if (data_size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
+                _E("Data Size too small : %zu", data_size)
                 return;
             }
-            memcpy(&payload, data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
+            memcpy(&payload, (unsigned char*)data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
             ClientMessageWorkflowInstanceDestroy message;
             message.sender = sender;
             message.local_workflow_instance_id = payload.local_workflow_instance_id;
@@ -227,12 +235,12 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
                 char attribute_name[MMI_NAME_MAX_LENGTH];
                 size_t value_size;
             } payload;
-            if (size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
-                _E("Data Size too small : %d", size)
+            if (data_size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
+                _E("Data Size too small : %zu", data_size)
                 return;
             }
 
-            memcpy(&payload, data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
+            memcpy(&payload, (unsigned char*)data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
             mmi_primitive_value_h value = nullptr;
             int index = sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload);
             mmi_primitive_value_from_bytes((unsigned char *)data + index, payload.value_size, &value);
@@ -259,11 +267,11 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
                 char signal_name[MMI_NAME_MAX_LENGTH];
                 int signal_parameter_count;
             } payload;
-            if (size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
-                _E("Data Size too small : %d", size)
+            if (data_size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
+                _E("Data Size too small : %zu", data_size)
                 return;
             }
-            memcpy(&payload, data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
+            memcpy(&payload, (unsigned char*)data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
             int index = sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload);
             _D("Signal Name %s, Parameter Count : %d", payload.signal_name, payload.signal_parameter_count);
 
@@ -272,13 +280,13 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
 
             for (int loop = 0;loop < payload.signal_parameter_count;loop++) {
                 char parameter_name[MMI_NAME_MAX_LENGTH];
-                memcpy(parameter_name, data + index, MMI_NAME_MAX_LENGTH);
+                memcpy(parameter_name, (unsigned char*)data + index, MMI_NAME_MAX_LENGTH);
                 index += MMI_NAME_MAX_LENGTH;
 
                 _D("Parameter Name : %s", parameter_name);
 
                 int value_size = 0;
-                memcpy(&value_size, data + index, sizeof(int));
+                memcpy(&value_size, (unsigned char*)data + index, sizeof(int));
                 index += sizeof(int);
 
                 mmi_primitive_value_h value;
@@ -305,16 +313,52 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
             mmi_signal_destroy(signal);
         }
         break;
+        case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_FEED_DATA:
+        {
+            struct workflow_instance_feed_data_payload {
+                int local_workflow_instance_id;
+                char node_name[MMI_NAME_MAX_LENGTH];
+                char port_name[MMI_NAME_MAX_LENGTH];
+            } payload;
+            if (data_size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
+                _E("Data Size too small : %zu", data_size)
+                return;
+            }
+            memcpy(&payload, (unsigned char*)data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
+            int index = sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload);
+            _D("Node Name %s, Port Name %s", payload.node_name, payload.port_name);
+
+            int data_size = 0;
+            memcpy(&data_size, (unsigned char*)data + index, sizeof(size_t));
+            index += sizeof(size_t);
+
+            mmi_data_h restored_data;
+            mmi_data_from_bytes((unsigned char*)data + index, data_size, &restored_data);
+            index += data_size;
+
+            ClientMessageWorkflowInstanceFeedData message;
+            message.sender = sender;
+            message.local_workflow_instance_id = payload.local_workflow_instance_id;
+            message.node_name = payload.node_name;
+            message.port_name = payload.port_name;
+            message.data = restored_data;
+            notify_observers(
+                COMMUNICATION_CHANNEL_EVENT_TYPE::MESSAGE_RECEIVED,
+                static_cast<Message*>(&message));
+
+            mmi_data_destroy(restored_data);
+        }
+        break;
         case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_ACTIVATE:
         {
             struct workflow_instance_activate_payload {
                 int local_workflow_instance_id;
             } payload;
-            if (size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
-                _E("Data Size too small : %d", size)
+            if (data_size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
+                _E("Data Size too small : %zu", data_size)
                 return;
             }
-            memcpy(&payload, data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
+            memcpy(&payload, (unsigned char*)data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
             ClientMessageWorkflowInstanceActivate message;
             message.sender = sender;
             message.local_workflow_instance_id = payload.local_workflow_instance_id;
@@ -328,11 +372,11 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
             struct workflow_instance_deactivate_payload {
                 int local_workflow_instance_id;
             } payload;
-            if (size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
-                _E("Data Size too small : %d", size)
+            if (data_size < sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload)) {
+                _E("Data Size too small : %zu", data_size)
                 return;
             }
-            memcpy(&payload, data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
+            memcpy(&payload, (unsigned char*)data + sizeof(CLIENT_MESSAGE_TYPE), sizeof(payload));
             ClientMessageWorkflowInstanceDeactivate message;
             message.sender = sender;
             message.local_workflow_instance_id = payload.local_workflow_instance_id;
@@ -341,6 +385,11 @@ void CommunicationChannelEcoreIPC::on_client_message(Ecore_Ipc_Client *client, v
                 static_cast<Message*>(&message));
         }
         break;
+        case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_OUTPUT:
+        {
+            _E("Error : Manager to Client message received");
+        }
+        break;
     }
 }
 
index 70f571a9456272b3007cdbd2ddaad8e696e3d217..c66ae2875cc967bab57c4be7d7ead8db242c187f 100644 (file)
@@ -70,6 +70,7 @@ int CommunicationChannelTIDL::connect() {
         workflow_instance_destroy,
         workflow_instance_set_attribute,
         workflow_instance_emit_signal,
+        workflow_instance_feed_data,
         workflow_instance_activate,
         workflow_instance_deactivate,
         workflow_instance_register_result_callback,
@@ -177,7 +178,8 @@ void CommunicationChannelTIDL::on_terminate(rpc_port_stub_mmi_context_h context,
 }
 
 int CommunicationChannelTIDL::workflow_instance_create(rpc_port_stub_mmi_context_h context,
-        int local_workflow_instance_id, int workflow_type, void *user_data) {
+        int local_workflow_instance_id, int workflow_type, bool script_from_file,
+        const char *script_info, void *user_data) {
     CommunicationChannelTIDL *channel = static_cast<CommunicationChannelTIDL*>(user_data);
 
     std::string sender;
@@ -188,6 +190,8 @@ int CommunicationChannelTIDL::workflow_instance_create(rpc_port_stub_mmi_context
     msg.sender = sender;
     msg.local_workflow_instance_id = local_workflow_instance_id;
     msg.workflow_type = static_cast<mmi_standard_workflow_type_e>(workflow_type);
+    msg.script_from_file = script_from_file;
+    msg.script_info = script_info ? std::string{script_info} : std::string();
 
     return notify_message_received(channel, static_cast<Message*>(&msg));
 }
@@ -309,6 +313,39 @@ int CommunicationChannelTIDL::workflow_instance_emit_signal(rpc_port_stub_mmi_co
     return MMI_ERROR_NONE;
 }
 
+int CommunicationChannelTIDL::workflow_instance_feed_data(rpc_port_stub_mmi_context_h context,
+        int local_workflow_instance_id, const char *node_name, const char *port_name, bundle *data, void *user_data) {
+    CommunicationChannelTIDL *channel = static_cast<CommunicationChannelTIDL*>(user_data);
+
+    std::string sender;
+    if (!get_sender_string(context, channel, sender))
+        return MMI_ERROR_INVALID_PARAMETER;
+
+    size_t byte_size;
+
+    size_t *value_size = nullptr;
+    bundle_get_byte(data, "size", (void **)&value_size, &byte_size);
+
+    unsigned char *value_bytes = nullptr;
+    bundle_get_byte(data, "data", (void **)&value_bytes, &byte_size);
+
+    mmi_data_h restored_data;
+    mmi_data_from_bytes(value_bytes, *value_size, &restored_data);
+
+    ClientMessageWorkflowInstanceFeedData msg;
+    msg.sender = sender;
+    msg.local_workflow_instance_id = local_workflow_instance_id;
+    if (node_name) msg.node_name = node_name;
+    if (port_name) msg.port_name = port_name;
+    msg.data = restored_data;
+
+    notify_message_received(channel, static_cast<Message*>(&msg));
+
+    mmi_data_destroy(restored_data);
+
+    return MMI_ERROR_NONE;
+}
+
 int CommunicationChannelTIDL::workflow_instance_activate(rpc_port_stub_mmi_context_h context,
         int local_workflow_instance_id, void *user_data) {
     CommunicationChannelTIDL *channel = static_cast<CommunicationChannelTIDL*>(user_data);
index 22c32cc999eb2b6612e53ba9fc98915c0369aa72..c569c6b3a0d81efc5df70dcc313b206384867679 100644 (file)
@@ -50,13 +50,15 @@ private:
     static void on_terminate(rpc_port_stub_mmi_context_h context, void *user_data);
 
     static int workflow_instance_create(rpc_port_stub_mmi_context_h context,
-        int local_workflow_instance_id, int workflow_type, void *user_data);
+        int local_workflow_instance_id, int workflow_type, bool script_from_file, const char *script_info, void *user_data);
     static int workflow_instance_destroy(rpc_port_stub_mmi_context_h context,
         int local_workflow_instance_id, void *user_data);
     static int workflow_instance_set_attribute(rpc_port_stub_mmi_context_h context,
         int workflow_instance, bundle *attribute, void *user_data);
     static int workflow_instance_emit_signal(rpc_port_stub_mmi_context_h context,
         int workflow_instance, bundle *signal, void *user_data);
+    static int workflow_instance_feed_data(rpc_port_stub_mmi_context_h context,
+        int workflow_instance, const char *node_name, const char *port_name, bundle *signal, void *user_data);
     static int workflow_instance_activate(rpc_port_stub_mmi_context_h context,
         int local_workflow_instance_id, void *user_data);
     static int workflow_instance_deactivate(rpc_port_stub_mmi_context_h context,
index 00178d0de313a62f747fd43f997917956d3fa74d..470e356c8994bd411a4968d9c2e3c7e0fe4c53b6 100644 (file)
@@ -36,8 +36,8 @@ NodeInstanceManager::~NodeInstanceManager() {
 }
 
 std::shared_ptr<NodeInstance> NodeInstanceManager::create_node_instance(
-    mmi_standard_node_type_e node_type,
-    mmi_standard_node_sub_type_e node_sub_type) {
+    mmi_node_type_e node_type,
+    mmi_node_sub_type_e node_sub_type) {
     std::shared_ptr<NodeInstance> ret;
 
     ret = std::make_shared<NodeInstance>(node_type, node_sub_type);
index 3a6f613074cdeb17370d295b2cdd577ef2a3b10b..e1005b1348f51e0d4843933026dfe18b8e4acb69 100644 (file)
@@ -41,8 +41,8 @@ public:
     virtual ~INodeInstanceManager() = default;
 
     virtual std::shared_ptr<NodeInstance> create_node_instance(
-        mmi_standard_node_type_e node_type,
-        mmi_standard_node_sub_type_e node_sub_type) = 0;
+        mmi_node_type_e node_type,
+        mmi_node_sub_type_e node_sub_type) = 0;
     virtual bool destroy_node_instance(
         std::shared_ptr<NodeInstance> node_instance) = 0;
     virtual bool link_node_instances(
@@ -61,8 +61,8 @@ public:
     virtual ~NodeInstanceManager();
 
     virtual std::shared_ptr<NodeInstance> create_node_instance(
-        mmi_standard_node_type_e node_type,
-        mmi_standard_node_sub_type_e node_sub_type) override;
+        mmi_node_type_e node_type,
+        mmi_node_sub_type_e node_sub_type) override;
     virtual bool destroy_node_instance(
         std::shared_ptr<NodeInstance> node_instance) override;
     virtual bool link_node_instances(
index f754f2a9f6a3a08ce6f766728e63415263dd2a9e..73ae100e74d87b54dada4fab44b384b73975b8c7 100644 (file)
@@ -28,8 +28,8 @@
 namespace mmi {
 
 NodeInstance::NodeInstance(
-    mmi_standard_node_type_e node_type,
-    mmi_standard_node_sub_type_e node_sub_type)
+    mmi_node_type_e node_type,
+    mmi_node_sub_type_e node_sub_type)
     : m_node_type(node_type)
     , m_node_sub_type(node_sub_type) {
     _D("Node instance is created : %s %s",
@@ -43,9 +43,9 @@ NodeInstance::~NodeInstance() {
 
 static bool node_type_and_subtype_matches(
     mmi_node_h node,
-    mmi_standard_node_type_e node_type,
-    mmi_standard_node_sub_type_e node_sub_type) {
-    mmi_standard_node_type_e type;
+    mmi_node_type_e node_type,
+    mmi_node_sub_type_e node_sub_type) {
+    mmi_node_type_e type;
     mmi_node_get_type(node, &type);
 
     if (type != node_type) {
@@ -53,26 +53,31 @@ static bool node_type_and_subtype_matches(
     }
 
     try {
-        if (node_type == MMI_STANDARD_NODE_TYPE_SOURCE) {
-            mmi_standard_node_source_type_e source_type;
-            mmi_standard_node_get_source_type(node, &source_type);
-            return source_type == std::get<mmi_standard_node_source_type_e>(node_sub_type);
-        } else if (node_type == MMI_STANDARD_NODE_TYPE_PROCESSOR) {
-            mmi_standard_node_processor_type_e processor_type;
-            mmi_standard_node_get_processor_type(node, &processor_type);
-            return processor_type == std::get<mmi_standard_node_processor_type_e>(node_sub_type);
-        } else if (node_type == MMI_STANDARD_NODE_TYPE_LOGIC) {
-            mmi_standard_node_logic_type_e logic_type;
-            mmi_standard_node_get_logic_type(node, &logic_type);
-            return logic_type == std::get<mmi_standard_node_logic_type_e>(node_sub_type);
-        } else if (node_type == MMI_STANDARD_NODE_TYPE_CONTROLLER) {
-            mmi_standard_node_controller_type_e controller_type;
-            mmi_standard_node_get_controller_type(node, &controller_type);
-            return controller_type == std::get<mmi_standard_node_controller_type_e>(node_sub_type);
-        } else if (node_type == MMI_STANDARD_NODE_TYPE_ACTION) {
-            mmi_standard_node_action_type_e action_type;
-            mmi_standard_node_get_action_type(node, &action_type);
-            return action_type == std::get<mmi_standard_node_action_type_e>(node_sub_type);
+        if (node_type == MMI_NODE_TYPE_SOURCE) {
+            mmi_node_source_type_e source_type;
+            mmi_node_get_source_type(node, &source_type);
+            return source_type == std::get<mmi_node_source_type_e>(node_sub_type);
+        } else if (node_type == MMI_NODE_TYPE_PROCESSOR) {
+            mmi_node_processor_type_e processor_type;
+            mmi_node_get_processor_type(node, &processor_type);
+            return processor_type == std::get<mmi_node_processor_type_e>(node_sub_type);
+        } else if (node_type == MMI_NODE_TYPE_LOGIC) {
+            mmi_node_logic_type_e logic_type;
+            mmi_node_get_logic_type(node, &logic_type);
+            return logic_type == std::get<mmi_node_logic_type_e>(node_sub_type);
+        } else if (node_type == MMI_NODE_TYPE_CONTROLLER) {
+            mmi_node_controller_type_e controller_type;
+            mmi_node_get_controller_type(node, &controller_type);
+            return controller_type == std::get<mmi_node_controller_type_e>(node_sub_type);
+        } else if (node_type == MMI_NODE_TYPE_ACTION) {
+            mmi_node_action_type_e action_type;
+            mmi_node_get_action_type(node, &action_type);
+            return action_type == std::get<mmi_node_action_type_e>(node_sub_type);
+        } else if (node_type == MMI_NODE_TYPE_CUSTOM) {
+            const char *custom_type_id = nullptr;
+            mmi_node_get_custom_type(node, &custom_type_id);
+            if (custom_type_id == nullptr) return false;
+            return (std::get<std::string>(node_sub_type).compare(std::string(custom_type_id)) == 0);
         }
     } catch (const std::bad_variant_access &e) {
         _E("Failed to get node sub type : %s", e.what());
@@ -114,14 +119,14 @@ bool NodeInstance::initialize() {
     size_t port_count = 0;
 
     mmi_plugin_module_node_list_s node_list_s = m_plugin_module_proxy->load_node_prototypes();
-    for (int i = 0; i < node_list_s.node_count; i++) {
+    for (size_t i = 0; i < node_list_s.node_count; i++) {
         mmi_node_h node = node_list_s.nodes[i];
         if (node_type_and_subtype_matches(node, m_node_type, m_node_sub_type)) {
             mmi_node_get_callbacks(node, &m_callbacks);
             mmi_node_get_port_count(node, &port_count);
-            for (size_t i = 0; i < port_count; i++) {
+            for (size_t j = 0; j < port_count; j++) {
                 mmi_port_h port;
-                mmi_node_get_port(node, i, &port);
+                mmi_node_get_port(node, j, &port);
                 ports.push_back(port);
             }
             break;
@@ -222,11 +227,11 @@ void NodeInstance::add_data_gateway(std::string port_name,
     }
 }
 
-mmi_standard_node_type_e NodeInstance::get_node_type() {
+mmi_node_type_e NodeInstance::get_node_type() {
     return m_node_type;
 }
 
-mmi_standard_node_sub_type_e NodeInstance::get_node_sub_type() {
+mmi_node_sub_type_e NodeInstance::get_node_sub_type() {
     return m_node_sub_type;
 }
 
@@ -321,6 +326,24 @@ bool NodeInstance::handle_signal(mmi_signal_h signal)
     m_callbacks.signal_received_cb(static_cast<mmi_node_instance_h>(this), signal);
     return true;
 }
+
+bool NodeInstance::feed_data(std::string port_name, mmi_data_h data)
+{
+    try {
+        std::shared_ptr<PortInstance> target_port_instance =
+            m_port_instances.at(port_name);
+        if (target_port_instance) {
+            target_port_instance->on_output_data_received(data);
+        } else {
+            _E("Could not find target port instance : %s", port_name.c_str());
+        }
+    } catch (std::out_of_range& e) {
+        _E("Failed to find port instance : %s", port_name.c_str());
+    }
+
+    return true;
+}
+
 } // namespace mmi
 
 
index 99c66f5b64e97f5e838487eefe1f5fab0457a206..2f56da13c3cddc816fdc8645e22834141382a2eb 100644 (file)
@@ -36,8 +36,8 @@ namespace mmi {
 
 class NodeInstance {
 public:
-    NodeInstance(mmi_standard_node_type_e node_type,
-                 mmi_standard_node_sub_type_e node_sub_type);
+    NodeInstance(mmi_node_type_e node_type,
+                 mmi_node_sub_type_e node_sub_type);
     virtual ~NodeInstance();
 
     bool initialize();
@@ -53,8 +53,8 @@ public:
     void add_data_gateway(std::string port_name,
                           std::shared_ptr<DataGateway> gateway);
 
-    mmi_standard_node_type_e get_node_type();
-    mmi_standard_node_sub_type_e get_node_sub_type();
+    mmi_node_type_e get_node_type();
+    mmi_node_sub_type_e get_node_sub_type();
 
     bool activate();
     bool deactivate();
@@ -67,6 +67,7 @@ public:
 
     virtual bool set_attribute(mmi_attribute_h attribute);
     virtual bool handle_signal(mmi_signal_h signal);
+    virtual bool feed_data(std::string port_name, mmi_data_h data);
 protected:
     std::shared_ptr<INodePrototypeStore> m_prototype_store;
     std::shared_ptr<IPluginModuleProxyProvider> m_plugin_module_proxy_provider;
@@ -76,8 +77,8 @@ protected:
     std::shared_ptr<IPluginModuleProxy> m_plugin_module_proxy;
     std::map<std::string, std::shared_ptr<PortInstance>> m_port_instances;
 
-    mmi_standard_node_type_e m_node_type;
-    mmi_standard_node_sub_type_e m_node_sub_type;
+    mmi_node_type_e m_node_type;
+    mmi_node_sub_type_e m_node_sub_type;
 
     mmi_node_callbacks m_callbacks{nullptr,};
 
index f86eec9cd11041fca89811a986b4da5d41f50572..0b9f01881f93308603a0c04d807a9832fc94546e 100644 (file)
 
 namespace mmi {
 
+std::shared_ptr<NodePrototype> NodePrototypeHelper::create_node_prototype(mmi_node_h node) {
+    if (!node) {
+        _E("Invalid argument");
+        return nullptr;
+    }
+
+    auto prototype = std::make_shared<NodePrototype>();
+
+    if (prototype) {
+        mmi_node_type_e type;
+        mmi_node_get_type(node, &type);
+
+        prototype->set_type(type);
+        switch (type) {
+        case MMI_NODE_TYPE_NONE: {
+            _E("Node type is NONE");
+            return nullptr;
+            break;
+        }
+        case MMI_NODE_TYPE_SOURCE: {
+            mmi_node_source_type_e source_type;
+            mmi_node_get_source_type(node, &source_type);
+            prototype->set_sub_type(source_type);
+            break;
+        }
+        case MMI_NODE_TYPE_PROCESSOR: {
+            mmi_node_processor_type_e processor_type;
+            mmi_node_get_processor_type(node, &processor_type);
+            prototype->set_sub_type(processor_type);
+            break;
+        }
+        case MMI_NODE_TYPE_LOGIC: {
+            mmi_node_logic_type_e logic_type;
+            mmi_node_get_logic_type(node, &logic_type);
+            prototype->set_sub_type(logic_type);
+            break;
+        }
+        case MMI_NODE_TYPE_CONTROLLER: {
+            mmi_node_controller_type_e controller_type;
+            mmi_node_get_controller_type(node, &controller_type);
+            prototype->set_sub_type(controller_type);
+            break;
+        }
+        case MMI_NODE_TYPE_ACTION: {
+            mmi_node_action_type_e action_type;
+            mmi_node_get_action_type(node, &action_type);
+            prototype->set_sub_type(action_type);
+            break;
+        }
+        case MMI_NODE_TYPE_CUSTOM: {
+            const char *custom_type_id = nullptr;
+            mmi_node_get_custom_type(node, &custom_type_id);
+            if (custom_type_id) {
+                prototype->set_sub_type(std::string(custom_type_id));
+            }
+            break;
+        }
+        }
+
+        size_t port_count;
+        mmi_node_get_port_count(node, &port_count);
+        for (size_t i = 0; i < port_count; i++) {
+            mmi_port_h port;
+            mmi_node_get_port(node, i, &port);
+
+            char *name = nullptr;
+            size_t name_length = 0;
+            mmi_port_get_name(port, &name, &name_length);
+
+            mmi_port_type_e type;
+            mmi_port_get_type(port, &type);
+
+            mmi_data_type_e data_type;
+            mmi_port_get_data_type(port, &data_type);
+
+            PortInfo port_info;
+            port_info.name = name;
+            port_info.port_type = type;
+            port_info.data_type = data_type;
+            prototype->add_port_info(port_info);
+        }
+    } else {
+        _E("Failed to create node prototype");
+    }
+
+    return prototype;
+}
+
 NodePrototypeManager::NodePrototypeManager() {
 }
 
@@ -54,7 +142,7 @@ bool NodePrototypeManager::add_node_prototype(std::shared_ptr<NodePrototype> pro
 }
 
 std::shared_ptr<NodePrototype> NodePrototypeManager::get_node_prototype(
-    mmi_standard_node_type_e type, mmi_standard_node_sub_type_e sub_type) {
+    mmi_node_type_e type, mmi_node_sub_type_e sub_type) {
     std::shared_ptr<NodePrototype> ret;
 
     for (auto& elem : m_prototypes) {
index 4794c9003aa15932087a2811785db2eb8941ae7c..90599407f0574174de76b2d76932e8f32c543b6d 100644 (file)
 namespace mmi {
 
 struct INodePrototypeStore {
+    INodePrototypeStore() {}
+    virtual ~INodePrototypeStore() {}
     virtual bool add_node_prototype(std::shared_ptr<NodePrototype> prototype) = 0;
     virtual std::shared_ptr<NodePrototype> get_node_prototype(
-        mmi_standard_node_type_e type, mmi_standard_node_sub_type_e sub_type) = 0;
+        mmi_node_type_e type, mmi_node_sub_type_e sub_type) = 0;
+};
+
+struct NodePrototypeHelper {
+    static std::shared_ptr<NodePrototype> create_node_prototype(mmi_node_h node);
 };
 
 class NodePrototypeManager : public INodePrototypeStore {
@@ -44,7 +50,7 @@ public:
 
     virtual bool add_node_prototype(std::shared_ptr<NodePrototype> prototype) override;
     virtual std::shared_ptr<NodePrototype> get_node_prototype(
-        mmi_standard_node_type_e type, mmi_standard_node_sub_type_e sub_type) override;
+        mmi_node_type_e type, mmi_node_sub_type_e sub_type) override;
 
     void initialize();
     void deinitialize();
index 892617043807e7c2f7db13dca0d0a296ad1a22ce..afee03a8801c6c8e54ce3148bcfe388fc8721b3d 100644 (file)
@@ -43,39 +43,36 @@ bool NodePrototype::is_valid() {
     /* Make sure that the m_sub_type is a valid match for m_type */
     try {
         switch (m_type.value()) {
-        case mmi_standard_node_type_e::MMI_STANDARD_NODE_TYPE_SOURCE: {
-            auto subclass =
-                std::get<mmi_standard_node_source_type_e>(m_sub_type.value());
-            valid = true;
+        case mmi_node_type_e::MMI_NODE_TYPE_NONE: {
+            _E("Node Type is NONE");
+            return false;
+        }
+        break;
+        case mmi_node_type_e::MMI_NODE_TYPE_SOURCE: {
+            valid = std::holds_alternative<mmi_node_source_type_e>(m_sub_type.value());
+        }
+        break;
+        case mmi_node_type_e::MMI_NODE_TYPE_PROCESSOR: {
+            valid = std::holds_alternative<mmi_node_processor_type_e>(m_sub_type.value());
         }
         break;
-        case mmi_standard_node_type_e::MMI_STANDARD_NODE_TYPE_PROCESSOR: {
-            auto subclass =
-                std::get<mmi_standard_node_processor_type_e>(m_sub_type.value());
-            valid = true;
+        case mmi_node_type_e::MMI_NODE_TYPE_LOGIC: {
+            valid = std::holds_alternative<mmi_node_logic_type_e>(m_sub_type.value());
         }
         break;
-        case mmi_standard_node_type_e::MMI_STANDARD_NODE_TYPE_LOGIC: {
-            auto subclass =
-                std::get<mmi_standard_node_logic_type_e>(m_sub_type.value());
-            valid = true;
+        case mmi_node_type_e::MMI_NODE_TYPE_CONTROLLER: {
+            valid = std::holds_alternative<mmi_node_controller_type_e>(m_sub_type.value());
         }
         break;
-        case mmi_standard_node_type_e::MMI_STANDARD_NODE_TYPE_CONTROLLER: {
-            auto subclass =
-                std::get<mmi_standard_node_controller_type_e>(m_sub_type.value());
-            valid = true;
+        case mmi_node_type_e::MMI_NODE_TYPE_ACTION: {
+            valid = std::holds_alternative<mmi_node_action_type_e>(m_sub_type.value());
         }
         break;
-        case mmi_standard_node_type_e::MMI_STANDARD_NODE_TYPE_ACTION: {
-            auto subclass =
-                std::get<mmi_standard_node_action_type_e>(m_sub_type.value());
-            valid = true;
+        case mmi_node_type_e::MMI_NODE_TYPE_CUSTOM: {
+            valid = std::holds_alternative<std::string>(m_sub_type.value());
         }
         break;
         }
-    } catch (const std::bad_variant_access& e) {
-        _E("[std::bad_variant_access] Failed to create node prototype: %s", e.what());
     } catch (const std::bad_optional_access& e) {
         _E("[std::bad_optional_access] Failed to create node prototype: %s", e.what());
     }
@@ -88,11 +85,11 @@ bool NodePrototype::is_valid() {
     return valid;
 }
 
-void NodePrototype::set_type(mmi_standard_node_type_e type) {
+void NodePrototype::set_type(mmi_node_type_e type) {
     m_type = type;
 }
 
-void NodePrototype::set_sub_type(mmi_standard_node_sub_type_e sub_type) {
+void NodePrototype::set_sub_type(mmi_node_sub_type_e sub_type) {
     m_sub_type = sub_type;
 }
 
@@ -121,8 +118,8 @@ bool NodePrototype::add_attribute_info(AttributeInfo &attribute_info) {
     return true;
 }
 
-mmi_standard_node_type_e NodePrototype::get_type() {
-    mmi_standard_node_type_e ret = MMI_STANDARD_NODE_TYPE_NONE;
+mmi_node_type_e NodePrototype::get_type() {
+    mmi_node_type_e ret = MMI_NODE_TYPE_NONE;
     try {
         ret = m_type.value();
     } catch (const std::bad_optional_access &e) {
@@ -131,8 +128,8 @@ mmi_standard_node_type_e NodePrototype::get_type() {
     return ret;
 }
 
-mmi_standard_node_sub_type_e NodePrototype::get_sub_type() {
-    mmi_standard_node_sub_type_e ret = std::monostate{};
+mmi_node_sub_type_e NodePrototype::get_sub_type() {
+    mmi_node_sub_type_e ret = std::monostate{};
     try {
         ret = m_sub_type.value();
     } catch (const std::bad_optional_access &e) {
index 2870d2fd5a05d514d4c7df4cd2905c9c3c34464f..2a001ef593f8c10a776cdcc1b0d51dd621ea3c13 100644 (file)
@@ -31,6 +31,7 @@
 #include "mmi-node-logic.h"
 #include "mmi-node-controller.h"
 #include "mmi-node-action.h"
+#include "mmi-node-custom.h"
 #include "mmi-plugin-module-proxy.h"
 #include "mmi-manager-log.h"
 
@@ -43,19 +44,22 @@ namespace mmi {
 
 typedef std::variant<
     std::monostate,
-    mmi_standard_node_source_type_e,
-    mmi_standard_node_processor_type_e,
-    mmi_standard_node_logic_type_e,
-    mmi_standard_node_controller_type_e,
-    mmi_standard_node_action_type_e
-    > mmi_standard_node_sub_type_e;
-
-static std::string to_string(mmi_standard_node_sub_type_e sub_type) {
+    mmi_node_source_type_e,
+    mmi_node_processor_type_e,
+    mmi_node_logic_type_e,
+    mmi_node_controller_type_e,
+    mmi_node_action_type_e,
+    std::string /* custom type id */
+    > mmi_node_sub_type_e;
+
+[[maybe_unused]] static std::string to_string(mmi_node_sub_type_e sub_type) {
     try {
         return std::visit([](auto&& arg) -> std::string {
             using T = std::decay_t<decltype(arg)>;
             if constexpr (std::is_same_v<T, std::monostate>)
                 return std::string("Unknown");
+            else if constexpr (std::is_same_v<T, std::string>)
+                return arg;
             else
                 return enum_to_string(arg);
         }, sub_type);
@@ -90,14 +94,14 @@ public:
         return m_plugin_module_info;
     }
 
-    void set_type(mmi_standard_node_type_e type);
-    void set_sub_type(mmi_standard_node_sub_type_e sub_type);
+    void set_type(mmi_node_type_e type);
+    void set_sub_type(mmi_node_sub_type_e sub_type);
 
     bool add_port_info(PortInfo &port_info);
     bool add_attribute_info(AttributeInfo &attribute_info);
 
-    mmi_standard_node_type_e get_type();
-    mmi_standard_node_sub_type_e get_sub_type();
+    mmi_node_type_e get_type();
+    mmi_node_sub_type_e get_sub_type();
 
     std::vector<PortInfo> get_port_infos();
     std::vector<AttributeInfo> get_attribute_infos();
@@ -106,8 +110,8 @@ public:
 private:
     PluginModuleInfo m_plugin_module_info;
 
-    std::optional<mmi_standard_node_type_e> m_type;
-    std::optional<mmi_standard_node_sub_type_e> m_sub_type;
+    std::optional<mmi_node_type_e> m_type;
+    std::optional<mmi_node_sub_type_e> m_sub_type;
 
     std::vector<PortInfo> m_port_infos;
     std::vector<AttributeInfo> m_attribute_infos;
index 6cadc2946380ed0ce116dde2e7f1bff2e8675cee..36afcb67628651d3d063133731be796d34f79dc4 100644 (file)
@@ -109,7 +109,7 @@ mmi_plugin_module_node_list_s PluginModuleProxySharedLibrary::load_node_prototyp
     _D("node_list.count: %zu", node_list.node_count);
     for (size_t i = 0;i < node_list.node_count;i++) {
         mmi_node_h node = node_list.nodes[i];
-        mmi_standard_node_type_e type;
+        mmi_node_type_e type;
         mmi_node_get_type(node, &type);
         mmi_node_callbacks callbacks;
         mmi_node_get_callbacks(node, &callbacks);
@@ -176,7 +176,7 @@ mmi_plugin_module_workflow_list_s PluginModuleProxySharedLibrary::load_workflow_
         _D("workflow_info[%zu].node_info_count: %zu", i, workflow_info->node_info_count);
         for (size_t j = 0;j < workflow_info->node_info_count;j++) {
             mmi_workflow_node_info_s *node_info = &(workflow_info->node_infos[j]);
-            mmi_standard_node_type_e type;
+            mmi_node_type_e type;
             mmi_node_get_type(workflow_info->node_infos[j].node, &type);
             _D("workflow_info[%zu].node_info[%zu].name: %s", i, j, node_info->name);
             _D("workflow_info[%zu].node_info[%zu].type: %d", i, j, type);
index 1a56c43865e0b02bd7b4453fecdf5fde27f52db5..622275d1c533c53ea264738fa0e41ad5074f6e6f 100644 (file)
@@ -65,6 +65,8 @@ struct IPluginModuleProxy : public SimpleEventObservable<PLUGIN_MODULE_EVENT_TYP
 };
 
 struct IPluginModuleProxyProvider {
+    IPluginModuleProxyProvider() {}
+    virtual ~IPluginModuleProxyProvider() {}
     virtual std::shared_ptr<IPluginModuleProxy> get_plugin_module_proxy(
         const PluginModuleInfo plugin_module_info) = 0;
 };
index 29e0b8faa44184f2ab64839f1c95bfbb2d14d55f..5dd64d5b8fdaa114656af11c8c878b21d63e9da4 100644 (file)
@@ -59,82 +59,6 @@ void PluginModuleRegistry::set_workflow_prototype_store(std::shared_ptr<IWorkflo
     m_workflow_prototype_store = workflow_prototype_store;
 }
 
-/* FIXME : Check if this function needs to be moved to INodePrototypeStore */
-static std::shared_ptr<NodePrototype> create_node_prototype(mmi_node_h node) {
-    if (!node) {
-        _E("Invalid argument");
-        return nullptr;
-    }
-
-    auto prototype = std::make_shared<NodePrototype>();
-
-    if (prototype) {
-        mmi_standard_node_type_e type;
-        mmi_node_get_type(node, &type);
-
-        prototype->set_type(type);
-        switch (type) {
-        case MMI_STANDARD_NODE_TYPE_SOURCE: {
-            mmi_standard_node_source_type_e source_type;
-            mmi_standard_node_get_source_type(node, &source_type);
-            prototype->set_sub_type(source_type);
-            break;
-        }
-        case MMI_STANDARD_NODE_TYPE_PROCESSOR: {
-            mmi_standard_node_processor_type_e processor_type;
-            mmi_standard_node_get_processor_type(node, &processor_type);
-            prototype->set_sub_type(processor_type);
-            break;
-        }
-        case MMI_STANDARD_NODE_TYPE_LOGIC: {
-            mmi_standard_node_logic_type_e logic_type;
-            mmi_standard_node_get_logic_type(node, &logic_type);
-            prototype->set_sub_type(logic_type);
-            break;
-        }
-        case MMI_STANDARD_NODE_TYPE_CONTROLLER: {
-            mmi_standard_node_controller_type_e controller_type;
-            mmi_standard_node_get_controller_type(node, &controller_type);
-            prototype->set_sub_type(controller_type);
-            break;
-        }
-        case MMI_STANDARD_NODE_TYPE_ACTION: {
-            mmi_standard_node_action_type_e action_type;
-            mmi_standard_node_get_action_type(node, &action_type);
-            prototype->set_sub_type(action_type);
-            break;
-        }
-        }
-
-        size_t port_count;
-        mmi_node_get_port_count(node, &port_count);
-        for (size_t i = 0; i < port_count; i++) {
-            mmi_port_h port;
-            mmi_node_get_port(node, i, &port);
-
-            char *name = nullptr;
-            size_t name_length = 0;
-            mmi_port_get_name(port, &name, &name_length);
-
-            mmi_port_type_e type;
-            mmi_port_get_type(port, &type);
-
-            mmi_data_type_e data_type;
-            mmi_port_get_data_type(port, &data_type);
-
-            PortInfo port_info;
-            port_info.name = name;
-            port_info.port_type = type;
-            port_info.data_type = data_type;
-            prototype->add_port_info(port_info);
-        }
-    } else {
-        _E("Failed to create node prototype");
-    }
-
-    return prototype;
-}
-
 bool PluginModuleRegistry::load_node_prototypes() {
     if (!m_node_prototype_store) {
         _E("Node prototype store is not set");
@@ -148,7 +72,7 @@ bool PluginModuleRegistry::load_node_prototypes() {
         if (ptr) {
             mmi_plugin_module_node_list_s node_list = ptr->load_node_prototypes();
             for (size_t i = 0; i < node_list.node_count; i++) {
-                auto prototype = create_node_prototype(node_list.nodes[i]);
+                auto prototype = NodePrototypeHelper::create_node_prototype(node_list.nodes[i]);
                 if (prototype) {
                     prototype->set_plugin_module_info(plugin_module_info);
                     bool ret = m_node_prototype_store->add_node_prototype(prototype);
@@ -166,126 +90,6 @@ bool PluginModuleRegistry::load_node_prototypes() {
     return true;
 }
 
-/* FIXME : Check if this function needs to be moved to IWorkflowPrototypeStore */
-static std::shared_ptr<WorkflowPrototype> create_workflow_prototype(mmi_workflow_h workflow) {
-    if (!workflow) {
-        _E("Invalid argument");
-        return nullptr;
-    }
-
-    auto prototype = std::make_shared<WorkflowPrototype>();
-
-    if (prototype) {
-        mmi_standard_workflow_type_e type;
-        mmi_workflow_get_type(workflow, &type);
-
-        prototype->set_type(type);
-
-        mmi_workflow_s *workflow_info = static_cast<mmi_workflow_s*>(workflow);
-        for (size_t i = 0; i < workflow_info->node_info_count; i++) {
-            NodeInfo node_info;
-            node_info.name = workflow_info->node_infos[i].name;
-            mmi_node_get_type(workflow_info->node_infos[i].node, &node_info.node_type);
-            switch (node_info.node_type) {
-            case MMI_STANDARD_NODE_TYPE_SOURCE: {
-                mmi_standard_node_source_type_e source_type;
-                mmi_standard_node_get_source_type(workflow_info->node_infos[i].node, &source_type);
-                node_info.node_sub_type = source_type;
-            }
-            break;
-            case MMI_STANDARD_NODE_TYPE_PROCESSOR: {
-                mmi_standard_node_processor_type_e processor_type;
-                mmi_standard_node_get_processor_type(workflow_info->node_infos[i].node, &processor_type);
-                node_info.node_sub_type = processor_type;
-            }
-            break;
-            case MMI_STANDARD_NODE_TYPE_LOGIC: {
-                mmi_standard_node_logic_type_e logic_type;
-                mmi_standard_node_get_logic_type(workflow_info->node_infos[i].node, &logic_type);
-                node_info.node_sub_type = logic_type;
-            }
-            break;
-            case MMI_STANDARD_NODE_TYPE_CONTROLLER: {
-                mmi_standard_node_controller_type_e controller_type;
-                mmi_standard_node_get_controller_type(workflow_info->node_infos[i].node, &controller_type);
-                node_info.node_sub_type = controller_type;
-            }
-            break;
-            case MMI_STANDARD_NODE_TYPE_ACTION: {
-                mmi_standard_node_action_type_e action_type;
-                mmi_standard_node_get_action_type(workflow_info->node_infos[i].node, &action_type);
-                node_info.node_sub_type = action_type;
-            }
-            break;
-            default: {
-                _E("Invalid node type");
-                return nullptr;
-            }
-            }
-
-            prototype->add_node_info(node_info);
-        }
-
-        for (size_t i = 0; i < workflow_info->link_info_count; i++) {
-            LinkInfo link_info;
-            link_info.from_node_name = workflow_info->link_infos[i].from_node_name;
-            link_info.from_port_name = workflow_info->link_infos[i].from_port_name;
-            link_info.to_node_name = workflow_info->link_infos[i].to_node_name;
-            link_info.to_port_name = workflow_info->link_infos[i].to_port_name;
-
-            prototype->add_link_info(link_info);
-        }
-
-        for (size_t i = 0; i < workflow_info->attribute_assignment_info_count; i++) {
-            AttributeAssignmentInfo attribute_assignment_info;
-            attribute_assignment_info.attribute_name = workflow_info->attribute_assignment_infos[i].attribute_name;
-            attribute_assignment_info.target_node_name = workflow_info->attribute_assignment_infos[i].target_node_name;
-            attribute_assignment_info.target_attribute_name = workflow_info->attribute_assignment_infos[i].target_attribute_name;
-
-            prototype->add_attribute_assignment_info(attribute_assignment_info);
-        }
-
-        for (size_t i = 0; i < workflow_info->attribute_default_value_info_count; i++) {
-            AttributeDefaultValueInfo attribute_default_value_info;
-            mmi_attribute_h default_value = nullptr;
-            int ret = mmi_attribute_from_bytes(
-                workflow_info->attribute_default_value_infos[i].serialized_default_value,
-                workflow_info->attribute_default_value_infos[i].serialized_default_value_size,
-                &default_value);
-            if (MMI_ERROR_NONE != ret) {
-                _E("Failed to create attribute from bytes");
-            }
-            attribute_default_value_info.default_value = default_value;
-
-            prototype->add_attribute_default_value_info(attribute_default_value_info);
-
-            mmi_attribute_destroy(default_value);
-        }
-
-        for (size_t i = 0; i < workflow_info->signal_assignment_info_count; i++) {
-            SignalAssignmentInfo signal_assignment_info;
-            signal_assignment_info.signal_name = workflow_info->signal_assignment_infos[i].signal_name;
-            signal_assignment_info.target_node_name = workflow_info->signal_assignment_infos[i].target_node_name;
-            signal_assignment_info.target_signal_name = workflow_info->signal_assignment_infos[i].target_signal_name;
-
-            prototype->add_signal_assignment_info(signal_assignment_info);
-        }
-
-        for (size_t i = 0; i < workflow_info->output_assignment_info_count; i++) {
-            OutputAssignmentInfo output_assignment_info;
-            output_assignment_info.output_name = workflow_info->output_assignment_infos[i].output_name;
-            output_assignment_info.from_node_name = workflow_info->output_assignment_infos[i].from_node_name;
-            output_assignment_info.from_port_name = workflow_info->output_assignment_infos[i].from_port_name;
-
-            prototype->add_output_assignment_info(output_assignment_info);
-        }
-    } else {
-        _E("Failed to create workflow prototype");
-    }
-
-    return prototype;
-}
-
 bool PluginModuleRegistry::load_workflow_prototypes() {
     if (!m_workflow_prototype_store) {
         _E("Workflow prototype store is not set");
@@ -299,7 +103,7 @@ bool PluginModuleRegistry::load_workflow_prototypes() {
         if (ptr) {
             mmi_plugin_module_workflow_list_s workflow_list = ptr->load_workflow_prototypes();
             for (size_t i = 0; i < workflow_list.workflow_count; i++) {
-                auto prototype = create_workflow_prototype(workflow_list.workflows[i]);
+                auto prototype = WorkflowPrototypeHelper::create_workflow_prototype(workflow_list.workflows[i]);
                 if (prototype) {
                     prototype->set_plugin_module_info(plugin_module_info);
                     m_workflow_prototype_store->add_workflow_prototype(prototype);
index 558a1f4c98f6efcc215a719bb92bb805f7013c9d..14afa30ceb5368f7b6a669fc1da619687bd58eda 100644 (file)
@@ -115,8 +115,6 @@ int TestNodePluginModuleMIC::node_activated_cb(mmi_node_instance_h instance) {
         }
     }
 
-    auto plugin_module = reinterpret_cast<TestNodePluginModuleMIC*>(instance);
-
     int value = 100;
     mmi_data_h output_data = reinterpret_cast<mmi_data_h>(&value);
 
@@ -245,7 +243,7 @@ mmi_plugin_module_node_list_s PluginModuleProxySelfContainerTest::load_node_prot
     mmi_port_set_callbacks(mic_audio_port, m_node_mic.m_audio_port_callbacks);
 
     mmi_node_h mic_node = nullptr;
-    mmi_standard_node_create_source(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT, &mic_node);
+    mmi_node_create_source(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT, &mic_node);
     mmi_node_add_port(mic_node, mic_audio_port);
     mmi_node_set_callbacks(mic_node, m_node_mic.m_node_callbacks);
     mmi_node_register(mic_node);
@@ -274,7 +272,7 @@ mmi_plugin_module_node_list_s PluginModuleProxySelfContainerTest::load_node_prot
     mmi_port_set_callbacks(asr_final_result_port, m_node_asr.m_audio_port_callbacks);
 
     mmi_node_h asr_node = nullptr;
-    mmi_standard_node_create_processor(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR, &asr_node);
+    mmi_node_create_processor(MMI_NODE_PROCESSOR_TYPE_ASR, &asr_node);
     mmi_node_add_port(asr_node, asr_audio_port);
     mmi_node_add_port(asr_node, asr_partial_result_port);
     mmi_node_add_port(asr_node, asr_final_result_port);
@@ -298,7 +296,7 @@ mmi_plugin_module_node_list_s PluginModuleProxySelfContainerTest::load_node_prot
     mmi_port_set_callbacks(match_candidate_port, m_node_match.m_text_port_callbacks);
 
     mmi_node_h match_node = nullptr;
-    mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &match_node);
+    mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &match_node);
     mmi_node_add_port(match_node, match_text_port);
     mmi_node_add_port(match_node, match_candidate_port);
     mmi_node_set_callbacks(match_node, m_node_match.m_node_callbacks);
@@ -321,15 +319,15 @@ mmi_plugin_module_workflow_list_s PluginModuleProxySelfContainerTest::load_workf
     mmi_workflow_set_type(workflow, MMI_STANDARD_WORKFLOW_WAKEUPLESS_COMMAND);
 
     mmi_node_h node_mic = nullptr;
-    mmi_standard_node_create_source(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
+    mmi_node_create_source(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
     mmi_workflow_node_add(workflow, "MIC", node_mic);
 
     mmi_node_h node_asr = nullptr;
-    mmi_standard_node_create_processor(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR, &node_asr);
+    mmi_node_create_processor(MMI_NODE_PROCESSOR_TYPE_ASR, &node_asr);
     mmi_workflow_node_add(workflow, "ASR", node_asr);
 
     mmi_node_h node_match = nullptr;
-    mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match);
+    mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match);
     mmi_workflow_node_add(workflow, "MATCH", node_match);
 
     mmi_workflow_link_nodes_by_names(workflow, "MIC", "AUDIO", "ASR", "AUDIO");
index c32996ecdb3ed4e894e51c81503e1963c0e613d2..672f19eb4b76b0386798bf86e032d2fb5805f7d4 100644 (file)
@@ -23,6 +23,9 @@
 
 #include "mmi-workflow-instance-manager.h"
 
+#include <fstream>
+#include <sstream>
+
 #include "mmi-manager-log.h"
 
 namespace mmi {
@@ -119,6 +122,11 @@ void WorkflowInstanceManager::handle_client_message(ClientMessage *message) {
         handle_emit_signal(msg);
     }
     break;
+    case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_FEED_DATA: {
+        auto *msg = static_cast<ClientMessageWorkflowInstanceFeedData*>(message);
+        handle_feed_data(msg);
+    }
+    break;
     case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_ACTIVATE: {
         auto *msg = static_cast<ClientMessageWorkflowInstanceActivate*>(message);
         handle_activate(msg);
@@ -129,6 +137,10 @@ void WorkflowInstanceManager::handle_client_message(ClientMessage *message) {
         handle_deactivate(msg);
     }
     break;
+    case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_OUTPUT: {
+        LOGE("Error : Manager to Client message is received");
+    }
+    break;
     }
 }
 
@@ -181,7 +193,25 @@ void WorkflowInstanceManager::handle_create(
         instance->set_local_workflow_instance_id(message->local_workflow_instance_id);
         instance->set_type(message->workflow_type);
 
-        instance->set_workflow_prototype_store(m_prototype_store);
+        if (message->workflow_type == MMI_STANDARD_WORKFLOW_NONE) {
+            mmi_workflow_h workflow = nullptr;
+            if (message->script_from_file) {
+                mmi_workflow_create_from_script_file(message->script_info.c_str(), &workflow);
+            } else {
+                mmi_workflow_create_from_script(message->script_info.c_str(), &workflow);
+            }
+
+            std::shared_ptr<IWorkflowPrototypeStore> prototype_store = 
+                std::make_shared<WorkflowPrototypeScriptStore>();
+
+            auto prototype = WorkflowPrototypeHelper::create_workflow_prototype(workflow);
+            prototype_store->add_workflow_prototype(prototype);
+            instance->set_workflow_prototype_store(prototype_store);
+            mmi_workflow_destroy(workflow);
+        } else {
+            instance->set_workflow_prototype_store(m_prototype_store);
+        }
+
         instance->set_plugin_module_proxy_provider(m_plugin_module_proxy_provider);
         instance->set_node_instance_manager(m_node_instance_manager);
 
@@ -210,6 +240,11 @@ void WorkflowInstanceManager::handle_destroy(
         instance->deinitialize();
     }
 
+    auto custom_prototype_it = m_custom_prototype_store.find(instance);
+    if (custom_prototype_it!= m_custom_prototype_store.end()) {
+        m_custom_prototype_store.erase(custom_prototype_it);
+    }
+
     auto it = m_workflow_instances.begin();
     while (it != m_workflow_instances.end()) {
         if ((*it)->get_client_id() == message->sender &&
@@ -249,6 +284,20 @@ void WorkflowInstanceManager::handle_emit_signal(
     }
 }
 
+void WorkflowInstanceManager::handle_feed_data(
+    ClientMessageWorkflowInstanceFeedData *message) {
+    if (nullptr == message) {
+        LOGE("Message is null");
+        return;
+    }
+
+    std::shared_ptr<WorkflowInstance> instance =
+        get_workflow_instance(message->sender, message->local_workflow_instance_id);
+    if (instance) {
+        instance->feed_data(message->node_name, message->port_name, message->data);
+    }
+}
+
 void WorkflowInstanceManager::handle_activate(
     ClientMessageWorkflowInstanceActivate *message) {
     if (nullptr == message) {
index e4b50c8caeda325ae3e44cf0ff6491e1e66e8f30..d9569f5e56fd9716c030425975c624583639d89b 100644 (file)
@@ -40,6 +40,20 @@ namespace mmi {
 
 using namespace communication;
 
+class WorkflowPrototypeScriptStore : public IWorkflowPrototypeStore {
+public:
+    WorkflowPrototypeScriptStore() {}
+    virtual ~WorkflowPrototypeScriptStore() {}
+    bool add_workflow_prototype(std::shared_ptr<WorkflowPrototype> prototype) override {
+        m_workflow_prototype = prototype;
+        return true;
+    }
+    std::shared_ptr<WorkflowPrototype> get_workflow_prototype(mmi_standard_workflow_type_e type) override {
+        return m_workflow_prototype;
+    }
+    std::shared_ptr<WorkflowPrototype> m_workflow_prototype;
+};
+
 class WorkflowInstanceManager :
     public SimpleEventObserver<COMMUNICATION_CHANNEL_EVENT_TYPE>,
     public SimpleEventObservable<WORKFLOW_EVENT_TYPE> {
@@ -73,6 +87,7 @@ private:
     void handle_destroy(ClientMessageWorkflowInstanceDestroy *message);
     void handle_set_attribute(ClientMessageWorkflowInstanceSetAttribute *message);
     void handle_emit_signal(ClientMessageWorkflowInstanceEmitSignal *message);
+    void handle_feed_data(ClientMessageWorkflowInstanceFeedData *message);
     void handle_activate(ClientMessageWorkflowInstanceActivate *message);
     void handle_deactivate(ClientMessageWorkflowInstanceDeactivate *message);
 protected:
@@ -81,6 +96,8 @@ protected:
     std::shared_ptr<INodeInstanceManager> m_node_instance_manager;
 
     std::vector<std::shared_ptr<WorkflowInstance>> m_workflow_instances;
+    std::map<std::shared_ptr<WorkflowInstance>, std::shared_ptr<IWorkflowPrototypeStore>>
+        m_custom_prototype_store;
 };
 
 } // namespace mmi
index 24c7143a64dfe7a8cd7ae4599d09434b3cf02236..e53fa7ee193f7891f49820d82ca1671ab5cf9b1b 100644 (file)
@@ -349,6 +349,24 @@ bool WorkflowInstance::handle_signal(mmi_signal_h signal) {
     return true;
 }
 
+bool WorkflowInstance::feed_data(std::string node_name, std::string port_name, mmi_data_h data) {
+    _D("Feeding Data : %s %s %p", node_name.c_str(), port_name.c_str(), data);
+
+    try {
+        std::shared_ptr<NodeInstance> target_node_instance =
+            m_node_instances.at(node_name);
+        if (target_node_instance) {
+            target_node_instance->feed_data(port_name, data);
+        } else {
+            _E("Could not find target node instance : %s", node_name.c_str());
+        }
+    } catch (std::out_of_range& e) {
+        _E("Failed to find node instance : %s", node_name.c_str());
+    }
+
+    return true;
+}
+
 // LCOV_EXCL_START
 void WorkflowInstance::on_observer_event(
     const PLUGIN_MODULE_EVENT_TYPE &event, std::any data) {
index dd80d8f489656a198089e6204ab325f709600869..4bdeac93d82ef52589b73d160e54c03ee3ed6bd5 100644 (file)
@@ -75,6 +75,7 @@ public:
     bool set_attribute_default_values();
 
     bool handle_signal(mmi_signal_h signal);
+    bool feed_data(std::string node_name, std::string port_name, mmi_data_h data);
 
     void on_observer_event(
         const PLUGIN_MODULE_EVENT_TYPE &event, std::any data) override;
index c5d89f3575d8ce1f8b3d13ae2466d1394ef5ddcc..353a1a143780924f2143c5300911557bbed7eef0 100644 (file)
 
 namespace mmi {
 
+std::shared_ptr<WorkflowPrototype> WorkflowPrototypeHelper::create_workflow_prototype(mmi_workflow_h workflow) {
+    if (!workflow) {
+        _E("Invalid argument");
+        return nullptr;
+    }
+
+    auto prototype = std::make_shared<WorkflowPrototype>();
+
+    if (prototype) {
+        mmi_standard_workflow_type_e type;
+        mmi_workflow_get_type(workflow, &type);
+
+        prototype->set_type(type);
+
+        mmi_workflow_s *workflow_info = static_cast<mmi_workflow_s*>(workflow);
+        for (size_t i = 0; i < workflow_info->node_info_count; i++) {
+            NodeInfo node_info;
+            node_info.name = workflow_info->node_infos[i].name;
+            mmi_node_get_type(workflow_info->node_infos[i].node, &node_info.node_type);
+            switch (node_info.node_type) {
+            case MMI_NODE_TYPE_SOURCE: {
+                mmi_node_source_type_e source_type;
+                mmi_node_get_source_type(workflow_info->node_infos[i].node, &source_type);
+                node_info.node_sub_type = source_type;
+            }
+            break;
+            case MMI_NODE_TYPE_PROCESSOR: {
+                mmi_node_processor_type_e processor_type;
+                mmi_node_get_processor_type(workflow_info->node_infos[i].node, &processor_type);
+                node_info.node_sub_type = processor_type;
+            }
+            break;
+            case MMI_NODE_TYPE_LOGIC: {
+                mmi_node_logic_type_e logic_type;
+                mmi_node_get_logic_type(workflow_info->node_infos[i].node, &logic_type);
+                node_info.node_sub_type = logic_type;
+            }
+            break;
+            case MMI_NODE_TYPE_CONTROLLER: {
+                mmi_node_controller_type_e controller_type;
+                mmi_node_get_controller_type(workflow_info->node_infos[i].node, &controller_type);
+                node_info.node_sub_type = controller_type;
+            }
+            break;
+            case MMI_NODE_TYPE_ACTION: {
+                mmi_node_action_type_e action_type;
+                mmi_node_get_action_type(workflow_info->node_infos[i].node, &action_type);
+                node_info.node_sub_type = action_type;
+            }
+            break;
+            case MMI_NODE_TYPE_CUSTOM: {
+                const char *custom_type_id = nullptr;
+                mmi_node_get_custom_type(workflow_info->node_infos[i].node, &custom_type_id);
+                if (custom_type_id) {
+                    node_info.node_sub_type = std::string(custom_type_id);
+                }
+            }
+            break;
+            default: {
+                _E("Invalid node type");
+                return nullptr;
+            }
+            }
+
+            prototype->add_node_info(node_info);
+        }
+
+        for (size_t i = 0; i < workflow_info->link_info_count; i++) {
+            LinkInfo link_info;
+            link_info.from_node_name = workflow_info->link_infos[i].from_node_name;
+            link_info.from_port_name = workflow_info->link_infos[i].from_port_name;
+            link_info.to_node_name = workflow_info->link_infos[i].to_node_name;
+            link_info.to_port_name = workflow_info->link_infos[i].to_port_name;
+
+            prototype->add_link_info(link_info);
+        }
+
+        for (size_t i = 0; i < workflow_info->attribute_assignment_info_count; i++) {
+            AttributeAssignmentInfo attribute_assignment_info;
+            attribute_assignment_info.attribute_name = workflow_info->attribute_assignment_infos[i].attribute_name;
+            attribute_assignment_info.target_node_name = workflow_info->attribute_assignment_infos[i].target_node_name;
+            attribute_assignment_info.target_attribute_name = workflow_info->attribute_assignment_infos[i].target_attribute_name;
+
+            prototype->add_attribute_assignment_info(attribute_assignment_info);
+        }
+
+        for (size_t i = 0; i < workflow_info->attribute_default_value_info_count; i++) {
+            AttributeDefaultValueInfo attribute_default_value_info;
+            mmi_attribute_h default_value = nullptr;
+            int ret = mmi_attribute_from_bytes(
+                workflow_info->attribute_default_value_infos[i].serialized_default_value,
+                workflow_info->attribute_default_value_infos[i].serialized_default_value_size,
+                &default_value);
+            if (MMI_ERROR_NONE != ret) {
+                _E("Failed to create attribute from bytes");
+            }
+            attribute_default_value_info.default_value = default_value;
+
+            prototype->add_attribute_default_value_info(attribute_default_value_info);
+
+            mmi_attribute_destroy(default_value);
+        }
+
+        for (size_t i = 0; i < workflow_info->signal_assignment_info_count; i++) {
+            SignalAssignmentInfo signal_assignment_info;
+            signal_assignment_info.signal_name = workflow_info->signal_assignment_infos[i].signal_name;
+            signal_assignment_info.target_node_name = workflow_info->signal_assignment_infos[i].target_node_name;
+            signal_assignment_info.target_signal_name = workflow_info->signal_assignment_infos[i].target_signal_name;
+
+            prototype->add_signal_assignment_info(signal_assignment_info);
+        }
+
+        for (size_t i = 0; i < workflow_info->output_assignment_info_count; i++) {
+            OutputAssignmentInfo output_assignment_info;
+            output_assignment_info.output_name = workflow_info->output_assignment_infos[i].output_name;
+            output_assignment_info.from_node_name = workflow_info->output_assignment_infos[i].from_node_name;
+            output_assignment_info.from_port_name = workflow_info->output_assignment_infos[i].from_port_name;
+
+            prototype->add_output_assignment_info(output_assignment_info);
+        }
+    } else {
+        _E("Failed to create workflow prototype");
+    }
+
+    return prototype;
+}
 WorkflowPrototypeManager::WorkflowPrototypeManager() {
 }
 
index 270ed4ca4534d6c5fd92d11dadce144de526736b..b8ede345a8abca41301863aa4b29e604a0a626c3 100644 (file)
 namespace mmi {
 
 struct IWorkflowPrototypeStore {
+    IWorkflowPrototypeStore() {}
+    virtual ~IWorkflowPrototypeStore() {}
     virtual bool add_workflow_prototype(std::shared_ptr<WorkflowPrototype> prototype) = 0;
     virtual std::shared_ptr<WorkflowPrototype> get_workflow_prototype(mmi_standard_workflow_type_e type) = 0;
 };
 
+struct WorkflowPrototypeHelper {
+    static std::shared_ptr<WorkflowPrototype> create_workflow_prototype(mmi_workflow_h workflow);
+};
+
 class WorkflowPrototypeManager : public IWorkflowPrototypeStore {
 public:
     WorkflowPrototypeManager();
index 14a397c819c5ae05df6d7436b50c3e415e527c91..903ed9caa7d77b7b428c625538ac7f97d8372931 100644 (file)
@@ -33,8 +33,8 @@ namespace mmi {
 
 typedef struct {
     std::string name;
-    mmi_standard_node_type_e node_type;
-    mmi_standard_node_sub_type_e node_sub_type;
+    mmi_node_type_e node_type;
+    mmi_node_sub_type_e node_sub_type;
 } NodeInfo;
 
 typedef struct {
index 11613ef38dbb04ac3edc4a2723c83c0332065273..8a83424dd1c1a881b17580305c2f81554af29c27 100644 (file)
@@ -13,6 +13,7 @@ mmi_srcs = [
        'mmi-node-logic.cpp',
        'mmi-node-controller.cpp',
        'mmi-node-action.cpp',
+       'mmi-node-custom.cpp',
        'mmi-port.cpp',
        'mmi-signal.cpp',
        'mmi-plugin-storage.cpp',
index f49bc0ca822c4495455e857a0353d416fc12c9c9..e230ce8961ab5689143188d85566d06124974f70 100644 (file)
@@ -86,6 +86,7 @@ int mmi_attribute_get_name(mmi_attribute_h attribute, char **name) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
+
     *name = strdup(attribute->name);
     if (nullptr == *name) {
         _E("[ERROR] Fail to allocate memory for name string");
index 985172656382b77f3cebc32c1e0072b765dbd013..02bc70d1b54d24ed350dd70863a476ff45dfc1da 100644 (file)
@@ -27,6 +27,8 @@ using namespace mmi;
 using namespace mmi::communication;
 
 struct ICommunicationChannelFactory {
+    ICommunicationChannelFactory() {}
+    virtual ~ICommunicationChannelFactory() {}
     virtual CommunicationChannel* create_channel() = 0;
     virtual void destroy_channel(CommunicationChannel* channel) = 0;
 };
@@ -94,11 +96,9 @@ public:
                     return;
                 }
                 auto client_message = static_cast<ClientMessage*>(message);
-                switch (client_message->message_type) {
-                    case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_OUTPUT: {
+                if (client_message->message_type ==
+                    CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_OUTPUT) {
                         handle_output(static_cast<ClientMessageWorkflowInstanceOutput*>(message));
-                    }
-                    break;
                 }
             } catch (const std::bad_any_cast &e) {
                 LOGE("Failed to cast message data: %s", e.what());
index f12867bfa87ac61c8555a4849ac73346cb246c18..1f70892e3d9ada029581fe61b60da6cdda09729d 100644 (file)
@@ -883,7 +883,6 @@ int mmi_data_from_bytes(unsigned char *bytes, size_t length, mmi_data_h *data) {
         size_t datalen = 0;
         memcpy(&datalen, current, sizeof(size_t));
         current += sizeof(size_t);
-        void *buf = nullptr;
         auto value = reinterpret_cast<mmi_data_h>(malloc(sizeof(mmi_data_s)));
         value->type = type;
         value->datalen = 0;
index cb1fca30240da2f9a8a7dcb82ed8bf54fcf51f4b..ca7b9e890a2e363eb2894c6e24f779ce843acef8 100644 (file)
@@ -25,7 +25,8 @@ int CommunicationChannelEcoreIPC::connect() {
     if (m_server) {
         return MMI_ERROR_OPERATION_FAILED;
     }
-    m_server = ecore_ipc_server_connect(ECORE_IPC_REMOTE_SYSTEM, "localhost", 9999, this);
+    char addr[] = {"localhost"};
+    m_server = ecore_ipc_server_connect(ECORE_IPC_REMOTE_SYSTEM, addr, 9999, this);
     ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, handler_server_add, this);
     ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, handler_server_del, this);
     ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, handler_server_data, this);
@@ -52,14 +53,23 @@ int CommunicationChannelEcoreIPC::send(Message *message) {
             struct workflow_instance_create_payload {
                 int local_workflow_instance_id;
                 mmi_standard_workflow_type_e workflow_type;
+                bool script_from_file;
+                size_t script_info_size;
             } payload;
             payload.local_workflow_instance_id = subclass->local_workflow_instance_id;
             payload.workflow_type = subclass->workflow_type;
-            size_t byte_size = sizeof(CLIENT_MESSAGE_TYPE) + sizeof(workflow_instance_create_payload);
+            payload.script_from_file = subclass->script_from_file;
+            payload.script_info_size = subclass->script_info.size();
+            size_t byte_size = sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload);
+            byte_size += payload.script_info_size;
             unsigned char *bytes = (unsigned char*)(malloc(byte_size));
+            size_t index = 0;
             if (bytes) {
                 memcpy(bytes, &type, sizeof(CLIENT_MESSAGE_TYPE));
-                memcpy(bytes + sizeof(CLIENT_MESSAGE_TYPE), &payload, sizeof(payload));
+                index += sizeof(CLIENT_MESSAGE_TYPE);
+                memcpy(bytes + index, &payload, sizeof(payload));
+                index += sizeof(payload);
+                memcpy(bytes + index, subclass->script_info.c_str(), payload.script_info_size);
                 ecore_ipc_server_send(m_server, 0, 0, 0, 0, 0, bytes, byte_size);
                 free(bytes);
             }
@@ -189,6 +199,49 @@ int CommunicationChannelEcoreIPC::send(Message *message) {
             free(signal_name);
         }
         break;
+        case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_FEED_DATA:
+        {
+            auto subclass = static_cast<ClientMessageWorkflowInstanceFeedData *>(message);
+
+            struct workflow_instance_feed_data_payload {
+                int local_workflow_instance_id;
+                char node_name[MMI_NAME_MAX_LENGTH];
+                char port_name[MMI_NAME_MAX_LENGTH];
+            } payload;
+
+            payload.local_workflow_instance_id = subclass->local_workflow_instance_id;
+            strncpy(payload.node_name, subclass->node_name.c_str(), MMI_NAME_MAX_LENGTH - 1);
+            payload.node_name[MMI_NAME_MAX_LENGTH - 1] = '\0';
+            strncpy(payload.port_name, subclass->port_name.c_str(), MMI_NAME_MAX_LENGTH - 1);
+            payload.port_name[MMI_NAME_MAX_LENGTH - 1] = '\0';
+
+            unsigned char *data_bytes = nullptr;
+            size_t data_size = 0;
+            mmi_data_to_bytes(subclass->data, &data_bytes, &data_size);
+
+            int index = 0;
+            size_t byte_size = sizeof(CLIENT_MESSAGE_TYPE) + sizeof(payload) + sizeof(size_t) + data_size;
+            unsigned char *bytes = (unsigned char*)(malloc(byte_size));
+            if (!bytes) return MMI_ERROR_OPERATION_FAILED;
+
+            memcpy(bytes, &type, sizeof(CLIENT_MESSAGE_TYPE));
+            index = sizeof(CLIENT_MESSAGE_TYPE);
+            memcpy(bytes + index, &payload, sizeof(payload));
+            index += sizeof(payload);
+
+            memcpy(bytes + index, &data_size, sizeof(size_t));
+            index += (sizeof(size_t));
+            memcpy(bytes + index, data_bytes, data_size);
+            index += (data_size);
+
+            free(data_bytes);
+
+            if (bytes) {
+                ecore_ipc_server_send(m_server, 0, 0, 0, 0, 0, bytes, byte_size);
+                free(bytes);
+            }
+        }
+        break;
         case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_ACTIVATE:
         {
             auto subclass = static_cast<ClientMessageWorkflowInstanceActivate *>(message);
@@ -223,6 +276,11 @@ int CommunicationChannelEcoreIPC::send(Message *message) {
             }
         }
         break;
+        case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_OUTPUT:
+        {
+            _E("Error : Manager to Client message is requested");
+        }
+        break;
     };
     return 0;
 }
@@ -260,15 +318,18 @@ Eina_Bool CommunicationChannelEcoreIPC::handler_server_data(void *data, int ev_t
     ClientMessageWorkflowInstanceOutput message;
     
     size_t index = 0;
-    memcpy(&(message.local_workflow_instance_id), e->data + index, sizeof(int));
+    memcpy(&(message.local_workflow_instance_id),
+        (unsigned char*)(e->data) + index, sizeof(int));
     index += sizeof(int);
 
     size_t source_name_length = 0;
-    memcpy(&(source_name_length), e->data + index, sizeof(size_t));
+    memcpy(&(source_name_length),
+        (unsigned char*)(e->data) + index, sizeof(size_t));
     index += sizeof(size_t);
 
     char *bytes = (char*)(malloc(source_name_length + 1));
-    memcpy(bytes, e->data + index, source_name_length);
+    memcpy(bytes,
+        (unsigned char*)(e->data) + index, source_name_length);
     bytes[source_name_length] = '\0';
 
     message.source_name = (char*)bytes;
@@ -277,12 +338,13 @@ Eina_Bool CommunicationChannelEcoreIPC::handler_server_data(void *data, int ev_t
     free(bytes);
 
     size_t data_size = 0;
-    memcpy(&(data_size), e->data + index, sizeof(size_t));
+    memcpy(&(data_size),
+        (unsigned char*)(e->data) + index, sizeof(size_t));
     index += sizeof(size_t);
-    
+
     mmi_data_h output_data = nullptr;
     if (MMI_ERROR_NONE !=
-        mmi_data_from_bytes((unsigned char*)(e->data + index), data_size, &(output_data))) {
+        mmi_data_from_bytes((unsigned char*)(e->data) + index, data_size, &(output_data))) {
         LOGE("[ERROR] Failed to restore data from bytes");
         return EINA_TRUE;
     }
index bffcb936ede1c417678c8e0b84ac1a25ec0baa6e..20c431cf6e958a699ef0ab2bdfedc85a83041e66 100644 (file)
@@ -157,7 +157,8 @@ int CommunicationChannelTIDL::send(Message *message) {
     switch(type) {
     case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_CREATE: {
         auto subclass = static_cast<ClientMessageWorkflowInstanceCreate*>(message);
-        workflow_instance_create(subclass->local_workflow_instance_id, subclass->workflow_type, subclass->user_data);
+        workflow_instance_create(subclass->local_workflow_instance_id, subclass->workflow_type,
+            subclass->script_from_file, subclass->script_info, subclass->user_data);
     }
     break;
     case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_DESTROY: {
@@ -175,6 +176,12 @@ int CommunicationChannelTIDL::send(Message *message) {
         workflow_instance_emit_signal(subclass->local_workflow_instance_id, subclass->signal);
     }
     break;
+    case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_FEED_DATA: {
+        auto subclass = static_cast<ClientMessageWorkflowInstanceFeedData*>(message);
+        workflow_instance_feed_data(
+            subclass->local_workflow_instance_id, subclass->node_name, subclass->port_name, subclass->data);
+    }
+    break;
     case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_ACTIVATE: {
         auto subclass = static_cast<ClientMessageWorkflowInstanceActivate*>(message);
         workflow_instance_activate(subclass->local_workflow_instance_id);
@@ -185,6 +192,10 @@ int CommunicationChannelTIDL::send(Message *message) {
         workflow_instance_deactivate(subclass->local_workflow_instance_id);
     }
     break;
+    case CLIENT_MESSAGE_TYPE::WORKFLOW_INSTANCE_OUTPUT: {
+        LOGE("Error : Manager to Client message requested");
+    }
+    break;
     };
 
     return MMI_ERROR_NONE;
@@ -206,7 +217,8 @@ int CommunicationChannelTIDL::retry_connection(rpc_port_proxy_mmi_h h) {
     return MMI_ERROR_NONE;
 }
 
-int CommunicationChannelTIDL::workflow_instance_create(int local_workflow_instance_id, mmi_standard_workflow_type_e workflow_type, void *user_data) {
+int CommunicationChannelTIDL::workflow_instance_create(int local_workflow_instance_id,
+    mmi_standard_workflow_type_e workflow_type, bool script_from_file, std::string script_info, void *user_data) {
     LOGI("Creating workflow instance of type (%d) for id (%d)",
          workflow_type, local_workflow_instance_id);
 
@@ -226,7 +238,7 @@ int CommunicationChannelTIDL::workflow_instance_create(int local_workflow_instan
     }
 
     int ret = rpc_port_proxy_mmi_invoke_workflow_instance_create(
-                  rpc_h, local_workflow_instance_id, workflow_type);
+                  rpc_h, local_workflow_instance_id, workflow_type, script_from_file, script_info.c_str());
     if (RPC_PORT_ERROR_NONE != ret) {
         LOGE("Failed to create workflow instance(%d)\n", ret);
         return MMI_ERROR_OPERATION_FAILED;
@@ -371,6 +383,7 @@ int CommunicationChannelTIDL::workflow_instance_emit_signal(int local_workflow_i
         std::string data_string = std::string("parameter_data_") + std::to_string(loop);
         bundle_add_byte(encoded, data_string.c_str(), value_bytes, value_size);
 
+        free(value_bytes);
         mmi_primitive_value_destroy(value);
         mmi_signal_parameter_destroy(parameter);
     }
@@ -389,6 +402,56 @@ int CommunicationChannelTIDL::workflow_instance_emit_signal(int local_workflow_i
     return ret;
 }
 
+int CommunicationChannelTIDL::workflow_instance_feed_data(
+    int local_workflow_instance_id, std::string node_name, std::string port_name, mmi_data_h data) {
+    LOGI("Feeding data for workflow instance (%d), %s %s", local_workflow_instance_id, node_name.c_str(), port_name.c_str());
+    int ret = MMI_ERROR_NONE;
+
+    if (NULL == data) {
+        LOGE("Parameter is NULL or empty");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
+    rpc_port_proxy_mmi_h rpc_h = static_cast<rpc_port_proxy_mmi_h>(m_rpc_h);
+    if (NULL == rpc_h) {
+        LOGE("Fail to get tidl rpc info");
+        return MMI_ERROR_OPERATION_FAILED;
+    }
+
+    if (false == is_connected()) {
+        LOGE("Try to connect again");
+        int ret = retry_connection(rpc_h);
+        if (RPC_PORT_ERROR_NONE != ret) {
+            LOGE("Fail to retry connection(%d)", ret);
+            return MMI_ERROR_OPERATION_FAILED;
+        }
+    }
+
+    bundle *encoded = bundle_create();
+
+    unsigned char *data_bytes = nullptr;
+    size_t data_size = 0;
+
+    mmi_data_to_bytes(data, &data_bytes, &data_size);
+
+    bundle_add_byte(encoded, "size", &data_size, sizeof(size_t));
+    bundle_add_byte(encoded, "data", data_bytes, data_size);
+
+    if (encoded) {
+        int ret = rpc_port_proxy_mmi_invoke_workflow_instance_feed_data(rpc_h,
+            local_workflow_instance_id, node_name.c_str(), port_name.c_str(), encoded);
+        bundle_free(encoded);
+
+        if (RPC_PORT_ERROR_NONE != ret) {
+            LOGE("Failed to feed data to workflow (%d)\n", ret);
+            ret = MMI_ERROR_OPERATION_FAILED;
+        }
+    }
+
+    free(data_bytes);
+    return ret;
+}
+
 int CommunicationChannelTIDL::workflow_instance_activate(int local_workflow_instance_id) {
     LOGI("Activating workflow instance of id (%d)", local_workflow_instance_id);
 
index c603998ae8fb24459f55092ef8a8150624e3799b..9d242141ab68e11e82dea5a8460293ebe2a30004 100644 (file)
@@ -38,10 +38,12 @@ public:
     int send(communication::Message *message) override;
 
 private:
-    int workflow_instance_create(int local_workflow_instance_id, mmi_standard_workflow_type_e workflow_type, void *user_data);
+    int workflow_instance_create(int local_workflow_instance_id, mmi_standard_workflow_type_e workflow_type,
+        bool script_from_file, std::string script_info, void *user_data);
     int workflow_instance_destroy(int local_workflow_instance_id);
     int workflow_instance_set_attribute(int local_workflow_instance_id, mmi_attribute_h attribute);
     int workflow_instance_emit_signal(int local_workflow_instance_id, mmi_signal_h signal);
+    int workflow_instance_feed_data(int local_workflow_instance_id, std::string node_name, std::string port_name, mmi_data_h data);
     int workflow_instance_activate(int local_workflow_instance_id);
     int workflow_instance_deactivate(int local_workflow_instance_id);
     int workflow_instance_register_result_callback(int local_workflow_instance_id, void *user_data);
index 91e62e376c9ba17fa34e40a0ff03addded4ee82e..f5291ccf00909871141b70da6385cc46f50a21e0 100644 (file)
 
 #include "mmi-log.h"
 
-int mmi_standard_node_create_action(mmi_standard_node_action_type_e type, mmi_node_h *node) {
+int mmi_node_create_action(mmi_node_action_type_e type, mmi_node_h *node) {
     if (nullptr == node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
     *node = new mmi_node_s;
-    (*node)->type = MMI_STANDARD_NODE_TYPE_ACTION;
+    (*node)->type = MMI_NODE_TYPE_ACTION;
     (*node)->sub_type = (int)type;
+    (*node)->custom_type_id[0] = '\0';
     (*node)->ports = nullptr;
     (*node)->port_count = 0;
     memset(&(*node)->callbacks, 0, sizeof(mmi_node_callbacks));
     return MMI_ERROR_NONE;
 }
 
-int mmi_standard_node_get_action_type(mmi_node_h node, mmi_standard_node_action_type_e *type) {
+int mmi_node_get_action_type(mmi_node_h node, mmi_node_action_type_e *type) {
     if (nullptr == node || nullptr == type) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
-    *type = (mmi_standard_node_action_type_e)node->sub_type;
-    return MMI_ERROR_NONE;
-}
-
-int mmi_standard_node_register_action(mmi_standard_node_action_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node) {
-    if (nullptr == callbacks || nullptr == node) {
-        return MMI_ERROR_INVALID_PARAMETER;
-    }
+    *type = (mmi_node_action_type_e)node->sub_type;
     return MMI_ERROR_NONE;
 }
 
index a65db4970f2cd46e0e9d7b60b43742e4e01464b1..f9a7363c61ba40f9f42d8d31fbcf6282797f71b0 100644 (file)
 
 #include "mmi-log.h"
 
-int mmi_standard_node_create_controller(mmi_standard_node_controller_type_e type, mmi_node_h *node) {
+int mmi_node_create_controller(mmi_node_controller_type_e type, mmi_node_h *node) {
     if (nullptr == node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
     *node = new mmi_node_s;
-    (*node)->type = MMI_STANDARD_NODE_TYPE_CONTROLLER;
+    (*node)->type = MMI_NODE_TYPE_CONTROLLER;
     (*node)->sub_type = (int)type;
+    (*node)->custom_type_id[0] = '\0';
     (*node)->ports = nullptr;
     (*node)->port_count = 0;
     memset(&(*node)->callbacks, 0, sizeof(mmi_node_callbacks));
     return MMI_ERROR_NONE;
 }
 
-int mmi_standard_node_get_controller_type(mmi_node_h node, mmi_standard_node_controller_type_e *type) {
+int mmi_node_get_controller_type(mmi_node_h node, mmi_node_controller_type_e *type) {
     if (nullptr == node || nullptr == type) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
-    *type = (mmi_standard_node_controller_type_e)node->sub_type;
-    return MMI_ERROR_NONE;
-}
-
-int mmi_standard_node_register_controller(mmi_standard_node_controller_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node) {
-    if (nullptr == callbacks || nullptr == node) {
-        return MMI_ERROR_INVALID_PARAMETER;
-    }
+    *type = (mmi_node_controller_type_e)node->sub_type;
     return MMI_ERROR_NONE;
 }
 
diff --git a/src/mmi/mmi-node-custom.cpp b/src/mmi/mmi-node-custom.cpp
new file mode 100644 (file)
index 0000000..bd1420c
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd 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 "mmi.h"
+#include "mmi-node-custom.h"
+
+#include "mmi-log.h"
+
+
+
+int mmi_node_create_custom(const char *custom_type_id, mmi_node_h *node) {
+    if (nullptr == node) {
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+    *node = new mmi_node_s;
+    (*node)->type = MMI_NODE_TYPE_CUSTOM;
+    (*node)->sub_type = 0;
+    strncpy((*node)->custom_type_id, custom_type_id, MMI_NAME_MAX_LENGTH);
+    (*node)->custom_type_id[MMI_NAME_MAX_LENGTH - 1] = '\0';
+    (*node)->ports = nullptr;
+    (*node)->port_count = 0;
+    memset(&(*node)->callbacks, 0, sizeof(mmi_node_callbacks));
+    return MMI_ERROR_NONE;
+}
+
+int mmi_node_get_custom_type(mmi_node_h node, const char **custom_type_id) {
+    if (nullptr == node || nullptr == custom_type_id) {
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+    *custom_type_id = node->custom_type_id;
+    return MMI_ERROR_NONE;
+}
+
index f859186646d466c5f005cbc1763be571d04eca3c..2ef2a80f48664f952cf33951c64afe79dd85431e 100644 (file)
 
 #include "mmi-log.h"
 
-int mmi_standard_node_create_logic(mmi_standard_node_logic_type_e type, mmi_node_h *node) {
+int mmi_node_create_logic(mmi_node_logic_type_e type, mmi_node_h *node) {
     if (nullptr == node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
     *node = new mmi_node_s;
-    (*node)->type = MMI_STANDARD_NODE_TYPE_LOGIC;
+    (*node)->type = MMI_NODE_TYPE_LOGIC;
     (*node)->sub_type = (int)type;
+    (*node)->custom_type_id[0] = '\0';
     (*node)->ports = nullptr;
     (*node)->port_count = 0;
     memset(&(*node)->callbacks, 0, sizeof(mmi_node_callbacks));
     return MMI_ERROR_NONE;
 }
 
-int mmi_standard_node_get_logic_type(mmi_node_h node, mmi_standard_node_logic_type_e *type) {
+int mmi_node_get_logic_type(mmi_node_h node, mmi_node_logic_type_e *type) {
     if (nullptr == node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
-    *type = (mmi_standard_node_logic_type_e)node->sub_type;
+    *type = (mmi_node_logic_type_e)node->sub_type;
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
-int mmi_standard_node_register_logic(mmi_standard_node_logic_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node) {
-    if (nullptr == callbacks || nullptr == node) {
-        return MMI_ERROR_INVALID_PARAMETER;
-    }
-    return MMI_ERROR_NONE;
-}
-// LCOV_EXCL_STOP
-
index d94a7fed93c07b3391718b3d9d5441199d958748..c3851dcd756590b84e5f141c1a260da538dd1858 100644 (file)
 
 #include "mmi-log.h"
 
-int mmi_standard_node_create_processor(mmi_standard_node_processor_type_e type, mmi_node_h *node) {
+int mmi_node_create_processor(mmi_node_processor_type_e type, mmi_node_h *node) {
     if (nullptr == node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
     *node = new mmi_node_s;
-    (*node)->type = MMI_STANDARD_NODE_TYPE_PROCESSOR;
+    (*node)->type = MMI_NODE_TYPE_PROCESSOR;
     (*node)->sub_type = (int)type;
+    (*node)->custom_type_id[0] = '\0';
     (*node)->ports = nullptr;
     (*node)->port_count = 0;
     memset(&(*node)->callbacks, 0, sizeof(mmi_node_callbacks));
     return MMI_ERROR_NONE;
 }
 
-int mmi_standard_node_get_processor_type(mmi_node_h node, mmi_standard_node_processor_type_e *type) {
+int mmi_node_get_processor_type(mmi_node_h node, mmi_node_processor_type_e *type) {
     if (nullptr == node || nullptr == type) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
-    *type = (mmi_standard_node_processor_type_e)node->sub_type;
+    *type = (mmi_node_processor_type_e)node->sub_type;
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
-int mmi_standard_node_register_processor(mmi_standard_node_processor_type_e type, mmi_node_callbacks *callbacks, mmi_node_h node) {
-    if (nullptr == callbacks || nullptr == node) {
-        return MMI_ERROR_INVALID_PARAMETER;
-    }
-    return MMI_ERROR_NONE;
-}
-// LCOV_EXCL_STOP
-
index 30abd0de392103dc4f78ea40c46351c21dfd2039..c2e455d948ec854f0d3056f72ba7dc2d39d5d3d2 100644 (file)
 
 #include "mmi-log.h"
 
-int mmi_standard_node_create_source(mmi_standard_node_source_type_e type, mmi_node_h *node) {
+int mmi_node_create_source(mmi_node_source_type_e type, mmi_node_h *node) {
     if (nullptr == node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
     *node = new mmi_node_s;
-    (*node)->type = MMI_STANDARD_NODE_TYPE_SOURCE;
+    (*node)->type = MMI_NODE_TYPE_SOURCE;
     (*node)->sub_type = (int)type;
+    (*node)->custom_type_id[0] = '\0';
     (*node)->ports = nullptr;
     (*node)->port_count = 0;
     memset(&(*node)->callbacks, 0, sizeof(mmi_node_callbacks));
     return MMI_ERROR_NONE;
 }
 
-int mmi_standard_node_get_source_type(mmi_node_h node, mmi_standard_node_source_type_e *type) {
+int mmi_node_get_source_type(mmi_node_h node, mmi_node_source_type_e *type) {
     if (nullptr == type || nullptr == node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
-    *type = (mmi_standard_node_source_type_e)node->sub_type;
+    *type = (mmi_node_source_type_e)node->sub_type;
     return MMI_ERROR_NONE;
 }
 
index 47f7affad938615c12b9392ef767bb88281b449b..c5d0df6e9ddcc4da5272ea1b399fc94fcc12f935 100644 (file)
@@ -78,12 +78,12 @@ int mmi_node_link_by_name(mmi_node_h from_node, const char *from_port_name, mmi_
 }
 // LCOV_EXCL_STOP
 
-int mmi_node_get_type(mmi_node_h node, mmi_standard_node_type_e *type) {
+int mmi_node_get_type(mmi_node_h node, mmi_node_type_e *type) {
     if (nullptr == node || nullptr == type) {
         LOGE("[ERROR] parameter is null");
         return MMI_ERROR_INVALID_PARAMETER;
     }
-    *type = (mmi_standard_node_type_e)node->type;
+    *type = (mmi_node_type_e)node->type;
     return MMI_ERROR_NONE;
 }
 
@@ -133,7 +133,7 @@ int mmi_node_register(mmi_node_h node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
-    mmi_standard_node_type_e node_type;
+    mmi_node_type_e node_type;
     mmi_node_get_type(node, &node_type);
 
     const char *identifier = mmi_plugin_storage_get_current_module_identifier();
@@ -149,62 +149,76 @@ int mmi_node_register(mmi_node_h node) {
 
     bool duplicated = false;
     for (size_t i = 0; i < node_count; i++) {
-        mmi_standard_node_type_e type;
+        mmi_node_type_e type;
         mmi_node_get_type(nodes[i], &type);
 
         if (type == node_type) {
             switch (type) {
-            case MMI_STANDARD_NODE_TYPE_SOURCE: {
-                mmi_standard_node_source_type_e node_source_type;
-                mmi_standard_node_get_source_type(node, &node_source_type);
-                mmi_standard_node_source_type_e source_type;
-                mmi_standard_node_get_source_type(nodes[i], &source_type);
+            case MMI_NODE_TYPE_NONE: {
+                LOGE("[ERROR] Node Type is NONE");
+                break;
+            }
+            case MMI_NODE_TYPE_SOURCE: {
+                mmi_node_source_type_e node_source_type;
+                mmi_node_get_source_type(node, &node_source_type);
+                mmi_node_source_type_e source_type;
+                mmi_node_get_source_type(nodes[i], &source_type);
                 if (node_source_type == source_type) {
                     duplicated = true;
                 }
                 break;
             }
-            case MMI_STANDARD_NODE_TYPE_PROCESSOR: {
-                mmi_standard_node_processor_type_e node_processor_type;
-                mmi_standard_node_get_processor_type(node, &node_processor_type);
-                mmi_standard_node_processor_type_e processor_type;
-                mmi_standard_node_get_processor_type(nodes[i], &processor_type);
+            case MMI_NODE_TYPE_PROCESSOR: {
+                mmi_node_processor_type_e node_processor_type;
+                mmi_node_get_processor_type(node, &node_processor_type);
+                mmi_node_processor_type_e processor_type;
+                mmi_node_get_processor_type(nodes[i], &processor_type);
                 if (node_processor_type == processor_type) {
                     duplicated = true;
                 }
                 break;
             }
-            case MMI_STANDARD_NODE_TYPE_LOGIC: {
-                mmi_standard_node_logic_type_e node_logic_type;
-                mmi_standard_node_get_logic_type(node, &node_logic_type);
-                mmi_standard_node_logic_type_e logic_type;
-                mmi_standard_node_get_logic_type(nodes[i], &logic_type);
+            case MMI_NODE_TYPE_LOGIC: {
+                mmi_node_logic_type_e node_logic_type;
+                mmi_node_get_logic_type(node, &node_logic_type);
+                mmi_node_logic_type_e logic_type;
+                mmi_node_get_logic_type(nodes[i], &logic_type);
                 if (node_logic_type == logic_type) {
                     duplicated = true;
                 }
                 break;
             }
 // LCOV_EXCL_START
-            case MMI_STANDARD_NODE_TYPE_CONTROLLER: {
-                mmi_standard_node_controller_type_e node_controller_type;
-                mmi_standard_node_get_controller_type(node, &node_controller_type);
-                mmi_standard_node_controller_type_e controller_type;
-                mmi_standard_node_get_controller_type(nodes[i], &controller_type);
+            case MMI_NODE_TYPE_CONTROLLER: {
+                mmi_node_controller_type_e node_controller_type;
+                mmi_node_get_controller_type(node, &node_controller_type);
+                mmi_node_controller_type_e controller_type;
+                mmi_node_get_controller_type(nodes[i], &controller_type);
                 if (node_controller_type == controller_type) {
                     duplicated = true;
                 }
                 break;
             }
-            case MMI_STANDARD_NODE_TYPE_ACTION: {
-                mmi_standard_node_action_type_e node_action_type;
-                mmi_standard_node_get_action_type(node, &node_action_type);
-                mmi_standard_node_action_type_e action_type;
-                mmi_standard_node_get_action_type(nodes[i], &action_type);
+            case MMI_NODE_TYPE_ACTION: {
+                mmi_node_action_type_e node_action_type;
+                mmi_node_get_action_type(node, &node_action_type);
+                mmi_node_action_type_e action_type;
+                mmi_node_get_action_type(nodes[i], &action_type);
                 if (node_action_type == action_type) {
                     duplicated = true;
                 }
                 break;
             }
+            case MMI_NODE_TYPE_CUSTOM: {
+                const char *node_custom_type_id = nullptr;
+                mmi_node_get_custom_type(node, &node_custom_type_id);
+                const char *custom_type_id = nullptr;
+                mmi_node_get_custom_type(nodes[i], &custom_type_id);
+                if (strncmp(node_custom_type_id, custom_type_id, MMI_NAME_MAX_LENGTH) == 0) {
+                    duplicated = true;
+                }
+                break;
+            }
 // LCOV_EXCL_STOP
             }
         }
@@ -254,6 +268,7 @@ int mmi_node_clone(mmi_node_h node, mmi_node_h *cloned) {
 
     cloned_ptr->type = node_ptr->type;
     cloned_ptr->sub_type = node_ptr->sub_type;
+    memcpy(cloned_ptr->custom_type_id, node_ptr->custom_type_id, MMI_NAME_MAX_LENGTH);
     cloned_ptr->port_count = node_ptr->port_count;
     cloned_ptr->callbacks = node_ptr->callbacks;
 
@@ -264,7 +279,7 @@ int mmi_node_clone(mmi_node_h node, mmi_node_h *cloned) {
         return MMI_ERROR_OUT_OF_MEMORY;
     }
 
-    for (int i = 0; i < node_ptr->port_count; i++) {
+    for (size_t i = 0; i < node_ptr->port_count; i++) {
         mmi_port_clone(node_ptr->ports[i], &cloned_ptr->ports[i]);
     }
 
@@ -279,7 +294,7 @@ int mmi_node_destroy(mmi_node_h node) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
-    for (int i = 0; i < node->port_count; i++) {
+    for (size_t i = 0; i < node->port_count; i++) {
         mmi_port_destroy(node->ports[i]);
     }
     delete [] node->ports;
index da08c77620faebf710c97381a79368a771a26fce..b959bbf0c5e0e0eaad150e636a14f4724af92636 100644 (file)
@@ -32,13 +32,13 @@ public:
 
     ~PluginStorageImpl() {
         for (auto &it : m_node_lists) {
-            for (int loop = 0; loop < it.second.node_count; loop++) {
+            for (size_t loop = 0; loop < it.second.node_count; loop++) {
                 mmi_node_destroy(it.second.nodes[loop]);
             }
             delete [] it.second.nodes;
         }
         for (auto &it : m_workflow_lists) {
-            for (int loop = 0; loop < it.second.workflow_count; loop++) {
+            for (size_t loop = 0; loop < it.second.workflow_count; loop++) {
                 mmi_workflow_destroy(it.second.workflows[loop]);
             }
             delete [] it.second.workflows;
@@ -89,7 +89,7 @@ public:
     mmi_port_instance_h find_port_instance(mmi_node_instance_h node_instance, const char *port_name) {
         for (auto &info : m_node_instance_infos) {
             if (info.node == node_instance) {
-                for (int loop = 0; loop < info.port_info_count; loop++) {
+                for (size_t loop = 0; loop < info.port_info_count; loop++) {
                     if (strncmp(info.port_infos[loop].name, port_name, MMI_NAME_MAX_LENGTH) == 0) {
                         return info.port_infos[loop].port;
                     }
@@ -101,7 +101,7 @@ public:
 
     mmi_node_instance_h find_node_instance_by_port_instance(mmi_port_instance_h port_instance) {
         for (auto &info : m_node_instance_infos) {
-            for (int loop = 0; loop < info.port_info_count; loop++) {
+            for (size_t loop = 0; loop < info.port_info_count; loop++) {
                 if (info.port_infos[loop].port == port_instance) {
                     return info.node;
                 }
index 529086b2d1e0523df8e878d8598711a715a89bfe..645a3d1ebd4d8f28140aa7ea0ace522210ebfac7 100644 (file)
@@ -476,7 +476,6 @@ int mmi_primitive_value_from_bytes(unsigned char *bytes, size_t size, mmi_primit
         /* This datalen variable will not be used for array type */
         memcpy(&datalen, current, sizeof(size_t));
         current += sizeof(size_t);
-        void *data = nullptr;
         auto value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
         value->type = type;
         value->datalen = 0;
index f286cbb188fc51c23254edd0a0db16009fac3312..ff7fab6a0a9347ee9dd242eb906ad9b93e3cea13 100644 (file)
@@ -27,8 +27,8 @@ namespace mmi {
 
 class WorkflowInstance {
 public:
-    WorkflowInstance(int local_workflow_instance_id, mmi_standard_workflow_type_e workflow_type)
-        : m_local_workflow_instance_id(local_workflow_instance_id), m_workflow_type(workflow_type) {
+    WorkflowInstance(int local_workflow_instance_id)
+        : m_local_workflow_instance_id(local_workflow_instance_id) {
     }
     virtual ~WorkflowInstance() {}
 
@@ -44,10 +44,6 @@ public:
         return m_local_workflow_instance_id;
     }
 
-    mmi_standard_workflow_type_e get_workflow_type() {
-        return m_workflow_type;
-    }
-
 // LCOV_EXCL_START
     bool add_output_callback(std::string key, mmi_workflow_output_cb callback, void *user_data) {
         bool ret = false;
@@ -71,7 +67,6 @@ public:
 
 private:
     int m_local_workflow_instance_id;
-    mmi_standard_workflow_type_e m_workflow_type;
     // TODO: make duplicate possible
     std::map<std::string, std::pair<mmi_workflow_output_cb, void *>> callbacks;
 };
@@ -93,8 +88,8 @@ public:
         return true;
     }
 
-    WorkflowInstance* create(mmi_standard_workflow_type_e type) {
-        WorkflowInstance *newInstance = new(std::nothrow) WorkflowInstance(m_last_local_workflow_instance_id++, type);
+    WorkflowInstance* create() {
+        WorkflowInstance *newInstance = new(std::nothrow) WorkflowInstance(m_last_local_workflow_instance_id++);
         m_instances.push_back(newInstance);
         return newInstance;
     }
index fb2cea4b7177a0d32eec118cefb9fee3703289ef..b434ebf7a002e98fcb29e71eb0b72fc3647408ac 100644 (file)
@@ -47,7 +47,7 @@ MMI_API int mmi_standard_workflow_instance_create(mmi_standard_workflow_type_e t
         return MMI_ERROR_OPERATION_FAILED;
     }
 
-    WorkflowInstance *workflow_instance = workflow_instance_manager->create(type);
+    WorkflowInstance *workflow_instance = workflow_instance_manager->create();
     if (workflow_instance) {
         *instance = static_cast<void*>(workflow_instance);
 
@@ -68,6 +68,78 @@ MMI_API int mmi_standard_workflow_instance_create(mmi_standard_workflow_type_e t
     return MMI_ERROR_NONE;
 }
 
+MMI_API int mmi_custom_workflow_instance_create_from_script(const char *workflow_script, mmi_workflow_instance_h *instance)
+{
+    if (nullptr == instance || nullptr == workflow_script) {
+        LOGE("[ERROR] parameter is null");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
+    WorkflowInstanceManager *workflow_instance_manager = g_mmi_client_manager.get_workflow_instance_manager();
+    if (nullptr == workflow_instance_manager) {
+        LOGE("[ERROR] Failed to get workflow instance manager");
+        return MMI_ERROR_OPERATION_FAILED;
+    }
+
+    WorkflowInstance *workflow_instance = workflow_instance_manager->create();
+    if (workflow_instance) {
+        *instance = static_cast<void*>(workflow_instance);
+
+        std::shared_ptr<CommunicationChannelClient> channel = g_mmi_client_manager.get_communication_channel();
+        if (channel) {
+            ClientMessageWorkflowInstanceCreate msg;
+            msg.local_workflow_instance_id =
+                workflow_instance->get_local_workflow_instance_id();
+            msg.workflow_type = MMI_STANDARD_WORKFLOW_NONE;
+            msg.script_from_file = false;
+            msg.script_info = std::string{workflow_script};
+            msg.user_data = workflow_instance;
+
+            channel->send(&msg);
+        }
+    } else {
+        return MMI_ERROR_OUT_OF_MEMORY;
+    }
+
+    return MMI_ERROR_NONE;
+}
+
+MMI_API int mmi_custom_workflow_instance_create_from_script_file(const char *workflow_script_path, mmi_workflow_instance_h *instance)
+{
+    if (nullptr == instance || nullptr == workflow_script_path) {
+        LOGE("[ERROR] parameter is null");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
+    WorkflowInstanceManager *workflow_instance_manager = g_mmi_client_manager.get_workflow_instance_manager();
+    if (nullptr == workflow_instance_manager) {
+        LOGE("[ERROR] Failed to get workflow instance manager");
+        return MMI_ERROR_OPERATION_FAILED;
+    }
+
+    WorkflowInstance *workflow_instance = workflow_instance_manager->create();
+    if (workflow_instance) {
+        *instance = static_cast<void*>(workflow_instance);
+
+        std::shared_ptr<CommunicationChannelClient> channel = g_mmi_client_manager.get_communication_channel();
+        if (channel) {
+            ClientMessageWorkflowInstanceCreate msg;
+            msg.local_workflow_instance_id =
+                workflow_instance->get_local_workflow_instance_id();
+            msg.workflow_type = MMI_STANDARD_WORKFLOW_NONE;
+            msg.script_from_file = true;
+            msg.script_info = std::string{workflow_script_path};
+            msg.user_data = workflow_instance;
+
+            channel->send(&msg);
+        }
+    } else {
+        return MMI_ERROR_OUT_OF_MEMORY;
+    }
+
+    return MMI_ERROR_NONE;
+}
+
 // LCOV_EXCL_START
 MMI_API int mmi_workflow_instance_destroy(mmi_workflow_instance_h instance) {
     if (nullptr == instance) {
@@ -188,6 +260,31 @@ MMI_API int mmi_workflow_instance_emit_signal(mmi_workflow_instance_h instance,
     return MMI_ERROR_NONE;
 }
 
+MMI_API int mmi_workflow_instance_feed_data(mmi_workflow_instance_h instance, const char *node_name, const char *port_name, mmi_data_h data) {
+    if (nullptr == instance || nullptr == node_name || nullptr == port_name) {
+        LOGE("[ERROR] parameter is null");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
+    std::shared_ptr<CommunicationChannelClient> channel = g_mmi_client_manager.get_communication_channel();
+    if (nullptr == channel) {
+        LOGE("[ERROR] Failed to get channel");
+        return MMI_ERROR_OPERATION_FAILED;
+    }
+
+    WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
+
+    ClientMessageWorkflowInstanceFeedData msg;
+    msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+    msg.node_name = node_name;
+    msg.port_name = port_name;
+    msg.data = data;
+
+    channel->send(&msg);
+
+    return MMI_ERROR_NONE;
+}
+
 // LCOV_EXCL_START
 MMI_API int mmi_workflow_instance_set_output_callback(mmi_workflow_instance_h instance, const char *name, mmi_workflow_output_cb callback, void *user_data) {
     if (nullptr == instance) {
index 0f20bfec0fefd21f9d9024b465f1dbba86ccc2a6..0f0b1700c825a9d2fb5934d3aa138beb9af0540c 100644 (file)
@@ -29,6 +29,7 @@
 #include "mmi-node-logic.h"
 #include "mmi-node-controller.h"
 #include "mmi-node-action.h"
+#include "mmi-node-custom.h"
 
 enum class WorkflowScriptSection {
     NONE,
@@ -55,25 +56,30 @@ typedef struct {
 } StandardWorkflowName;
 
 typedef struct {
-    mmi_standard_node_source_type_e type;
+    mmi_node_source_type_e type;
     std::string name;
 } StandardNodeSourceName;
 
 typedef struct {
-    mmi_standard_node_processor_type_e type;
+    mmi_node_processor_type_e type;
     std::string name;
 } StandardNodeProcessorName;
 
 typedef struct {
-    mmi_standard_node_logic_type_e type;
+    mmi_node_logic_type_e type;
     std::string name;
 } StandardNodeLogicName;
 
 typedef struct {
-    mmi_standard_node_controller_type_e type;
+    mmi_node_controller_type_e type;
     std::string name;
 } StandardNodeControllerName;
 
+typedef struct {
+    mmi_node_action_type_e type;
+    std::string name;
+} StandardNodeActionName;
+
 // trim from start (in place)
 static inline void ltrim(std::string &s) {
     s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
@@ -104,7 +110,7 @@ public:
         m_section_names.push_back({WorkflowScriptSection::OUTPUT_LIST, "@output-list"});
 
         m_section_patterns.push_back({WorkflowScriptSection::WORKFLOW_INFO, std::regex("^name : ([a-zA-Z_]+)$")});
-        m_section_patterns.push_back({WorkflowScriptSection::NODE_LIST, std::regex("^\\[([a-zA-Z]+)\\] ([a-zA-Z_]+) as ([a-zA-Z0-9_]+)$")});
+        m_section_patterns.push_back({WorkflowScriptSection::NODE_LIST, std::regex("^\\[([a-zA-Z]+)\\] ([a-zA-Z_\\-.]+) as ([a-zA-Z0-9_]+)$")});
         m_section_patterns.push_back({WorkflowScriptSection::LINK_LIST, std::regex("^([a-zA-Z0-9_.]+) -> ([a-zA-Z0-9_.]+)$")});
         m_section_patterns.push_back({WorkflowScriptSection::ATTRIBUTE_LIST, std::regex("^([a-zA-Z0-9_.]+) as ([a-zA-Z0-9_]+)$")});
         m_section_patterns.push_back({WorkflowScriptSection::OUTPUT_LIST, std::regex("^([a-zA-Z0-9_.]+) as ([a-zA-Z0-9_]+)$")});
@@ -113,18 +119,18 @@ public:
         m_standard_workflow_names.push_back({MMI_STANDARD_WORKFLOW_VOICE_TOUCH, "VOICE_TOUCH"});
         m_standard_workflow_names.push_back({MMI_STANDARD_WORKFLOW_USER_RECOGNITION, "USER_RECOGNITION"});
 
-        m_standard_node_source_names.push_back({MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT, "MIC_AMBIENT"});
-        m_standard_node_source_names.push_back({MMI_STANDARD_NODE_SOURCE_TYPE_CAMERA, "CAMERA"});
+        m_node_source_names.push_back({MMI_NODE_SOURCE_TYPE_MIC_AMBIENT, "MIC_AMBIENT"});
+        m_node_source_names.push_back({MMI_NODE_SOURCE_TYPE_CAMERA, "CAMERA"});
 
-        m_standard_node_processor_names.push_back({MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR, "ASR"});
-        m_standard_node_processor_names.push_back({MMI_STANDARD_NODE_PROCESSOR_TYPE_VIDEO_CONVERTER, "VIDEO_CONVERTER"});
-        m_standard_node_processor_names.push_back({MMI_STANDARD_NODE_PROCESSOR_TYPE_FACE_RECOGNITION, "FACE_RECOGNITION"});
-        m_standard_node_processor_names.push_back({MMI_STANDARD_NODE_PROCESSOR_TYPE_SPEAKER_RECOGNITION, "SPEAKER_RECOGNITION"});
+        m_node_processor_names.push_back({MMI_NODE_PROCESSOR_TYPE_ASR, "ASR"});
+        m_node_processor_names.push_back({MMI_NODE_PROCESSOR_TYPE_VIDEO_CONVERTER, "VIDEO_CONVERTER"});
+        m_node_processor_names.push_back({MMI_NODE_PROCESSOR_TYPE_FACE_RECOGNITION, "FACE_RECOGNITION"});
+        m_node_processor_names.push_back({MMI_NODE_PROCESSOR_TYPE_SPEAKER_RECOGNITION, "SPEAKER_RECOGNITION"});
 
-        m_standard_node_logic_names.push_back({MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, "FIXED_STRING_MATCH"});
-        m_standard_node_logic_names.push_back({MMI_STANDARD_NODE_LOGIC_TYPE_USER_COMPARISON, "USER_COMPARISON"});
+        m_node_logic_names.push_back({MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, "FIXED_STRING_MATCH"});
+        m_node_logic_names.push_back({MMI_NODE_LOGIC_TYPE_USER_COMPARISON, "USER_COMPARISON"});
 
-        m_standard_node_controller_names.push_back({MMI_STANDARD_NODE_CONTROLLER_TYPE_SWITCH, "SWITCH"});
+        m_node_controller_names.push_back({MMI_NODE_CONTROLLER_TYPE_SWITCH, "SWITCH"});
     }
     virtual ~WorkflowScriptParser() {
     }
@@ -164,19 +170,19 @@ public:
             std::ssub_match sub_match_type = matches[1];
             std::string type = sub_match_type.str();
 
-            if (type.compare("Source") == 0) {
-                std::ssub_match sub_match_name = matches[2];
-                std::string name = sub_match_name.str();
+            std::ssub_match sub_match_name = matches[2];
+            std::string name = sub_match_name.str();
 
-                std::ssub_match sub_match_alias = matches[3];
-                std::string alias = sub_match_alias.str();
+            std::ssub_match sub_match_alias = matches[3];
+            std::string alias = sub_match_alias.str();
 
-                for (auto &standard_node_source_name : m_standard_node_source_names) {
-                    if (name == standard_node_source_name.name) {
+            if (type.compare(m_node_source_identifier) == 0) {
+                for (auto &node_source_name : m_node_source_names) {
+                    if (name == node_source_name.name) {
                         LOGD("standard node source name matched: %s", name.c_str());
-                        mmi_standard_node_source_type_e sub_type = standard_node_source_name.type;
+                        mmi_node_source_type_e sub_type = node_source_name.type;
                         mmi_node_h node = nullptr;
-                        if (mmi_standard_node_create_source(sub_type, &node) != MMI_ERROR_NONE) {
+                        if (mmi_node_create_source(sub_type, &node) != MMI_ERROR_NONE) {
                             LOGE("[ERROR] Failed to create standard node source");
                             return false;
                         }
@@ -185,19 +191,13 @@ public:
                         break;
                     }
                 }
-            } else if (type.compare("Processor") == 0) {
-                std::ssub_match sub_match_name = matches[2];
-                std::string name = sub_match_name.str();
-
-                std::ssub_match sub_match_alias = matches[3];
-                std::string alias = sub_match_alias.str();
-
-                for (auto &standard_node_processor_name : m_standard_node_processor_names) {
-                    if (name == standard_node_processor_name.name) {
+            } else if (type.compare(m_node_processor_identifier) == 0) {
+                for (auto &node_processor_name : m_node_processor_names) {
+                    if (name == node_processor_name.name) {
                         LOGD("standard node processor name matched: %s", name.c_str());
-                        mmi_standard_node_processor_type_e sub_type = standard_node_processor_name.type;
+                        mmi_node_processor_type_e sub_type = node_processor_name.type;
                         mmi_node_h node = nullptr;
-                        if (mmi_standard_node_create_processor(sub_type, &node) != MMI_ERROR_NONE) {
+                        if (mmi_node_create_processor(sub_type, &node) != MMI_ERROR_NONE) {
                             LOGE("[ERROR] Failed to create standard node processor");
                             return false;
                         }
@@ -207,19 +207,13 @@ public:
                         break;
                     }
                 }
-            } else if (type.compare("Logic") == 0) {
-                std::ssub_match sub_match_name = matches[2];
-                std::string name = sub_match_name.str();
-
-                std::ssub_match sub_match_alias = matches[3];
-                std::string alias = sub_match_alias.str();
-
-                for (auto &standard_node_logic_name : m_standard_node_logic_names) {
-                    if (name == standard_node_logic_name.name) {
+            } else if (type.compare(m_node_logic_identifier) == 0) {
+                for (auto &node_logic_name : m_node_logic_names) {
+                    if (name == node_logic_name.name) {
                         LOGD("standard node logic name matched: %s", name.c_str());
-                        mmi_standard_node_logic_type_e sub_type = standard_node_logic_name.type;
+                        mmi_node_logic_type_e sub_type = node_logic_name.type;
                         mmi_node_h node = nullptr;
-                        if (mmi_standard_node_create_logic(sub_type, &node) != MMI_ERROR_NONE) {
+                        if (mmi_node_create_logic(sub_type, &node) != MMI_ERROR_NONE) {
                             LOGE("[ERROR] Failed to create standard node logic");
                             return false;
                         }
@@ -229,19 +223,13 @@ public:
                         break;
                     }
                 }
-            } else if (type.compare("Controller") == 0) {
-                std::ssub_match sub_match_name = matches[2];
-                std::string name = sub_match_name.str();
-
-                std::ssub_match sub_match_alias = matches[3];
-                std::string alias = sub_match_alias.str();
-
-                for (auto &standard_node_controller_name : m_standard_node_controller_names) {
-                    if (name == standard_node_controller_name.name) {
+            } else if (type.compare(m_node_controller_identifier) == 0) {
+                for (auto &node_controller_name : m_node_controller_names) {
+                    if (name == node_controller_name.name) {
                         LOGD("standard node controller name matched: %s", name.c_str());
-                        mmi_standard_node_controller_type_e sub_type = standard_node_controller_name.type;
+                        mmi_node_controller_type_e sub_type = node_controller_name.type;
                         mmi_node_h node = nullptr;
-                        if (mmi_standard_node_create_controller(sub_type, &node) != MMI_ERROR_NONE) {
+                        if (mmi_node_create_controller(sub_type, &node) != MMI_ERROR_NONE) {
                             LOGE("[ERROR] Failed to create standard node controller");
                             return false;
                         }
@@ -251,6 +239,31 @@ public:
                         break;
                     }
                 }
+            } else if (type.compare(m_node_action_identifier) == 0) {
+                for (auto &node_action_name : m_node_action_names) {
+                    if (name == node_action_name.name) {
+                        LOGD("standard node action name matched: %s", name.c_str());
+                        mmi_node_action_type_e sub_type = node_action_name.type;
+                        mmi_node_h node = nullptr;
+                        if (mmi_node_create_action(sub_type, &node) != MMI_ERROR_NONE) {
+                            LOGE("[ERROR] Failed to create standard node action");
+                            return false;
+                        }
+                        LOGD("Adding action node %s as %s", name.c_str(), alias.c_str());
+                        mmi_workflow_node_add(workflow, alias.c_str(), node);
+                        mmi_node_destroy(node);
+                        break;
+                    }
+                }
+            } else if (type.compare(m_node_custom_identifier) == 0) {
+                mmi_node_h node = nullptr;
+                if (mmi_node_create_custom(name.c_str(), &node) != MMI_ERROR_NONE) {
+                    LOGE("[ERROR] Failed to create standard node custom");
+                    return false;
+                }
+                LOGD("Adding custom node %s as %s", name.c_str(), alias.c_str());
+                mmi_workflow_node_add(workflow, alias.c_str(), node);
+                mmi_node_destroy(node);
             }
         }
         return true;
@@ -476,10 +489,17 @@ private:
 
     std::vector<StandardWorkflowName> m_standard_workflow_names;
 
-    std::vector<StandardNodeSourceName> m_standard_node_source_names;
-    std::vector<StandardNodeProcessorName> m_standard_node_processor_names;
-    std::vector<StandardNodeLogicName> m_standard_node_logic_names;
-    std::vector<StandardNodeControllerName> m_standard_node_controller_names;
+    std::string m_node_source_identifier{"Source"};
+    std::vector<StandardNodeSourceName> m_node_source_names;
+    std::string m_node_processor_identifier{"Processor"};
+    std::vector<StandardNodeProcessorName> m_node_processor_names;
+    std::string m_node_logic_identifier{"Logic"};
+    std::vector<StandardNodeLogicName> m_node_logic_names;
+    std::string m_node_controller_identifier{"Controller"};
+    std::vector<StandardNodeControllerName> m_node_controller_names;
+    std::string m_node_action_identifier{"Action"};
+    std::vector<StandardNodeActionName> m_node_action_names;
+    std::string m_node_custom_identifier{"Custom"};
 
 };
 
index 9be277ae2220191d12d8d519c3a3520fe98cb0d3..b3de785c963947c2a29eb7a4bf6b309eea2f4b95 100644 (file)
 #include "mmi-workflow-script-parser.h"
 
 #include <fstream>
+#include <sstream>
 
-MMI_API int mmi_workflow_create_from_script(const char *script_path, mmi_workflow_h *workflow) {
+MMI_API int mmi_workflow_create_from_script(const char *script, mmi_workflow_h *workflow) {
+    if (script == nullptr || workflow == nullptr) {
+        LOGE("[ERROR] parameter is null");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
+    std::istringstream iss(script);
+    std::vector<std::string> lines;
+
+    std::string line;
+    while (getline(iss, line)) {
+        lines.push_back(line);
+    }
+
+    WorkflowScriptParser parser;
+    *workflow = nullptr;
+    bool result = parser.parse(lines, workflow);
+    if (!result || *workflow == nullptr) {
+        LOGE("[ERROR] Failed to create workflow from data");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
+    return MMI_ERROR_NONE;
+}
+
+
+MMI_API int mmi_workflow_create_from_script_file(const char *script_path, mmi_workflow_h *workflow) {
     if (script_path == nullptr || workflow == nullptr) {
         LOGE("[ERROR] parameter is null");
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
     std::ifstream script_file(script_path);
+    std::vector<std::string> lines;
     if (!script_file.is_open()) {
         LOGE("[ERROR] Failed to open script file");
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
     std::string line;
-    std::vector<std::string> lines;
     while (std::getline(script_file, line)) {
         lines.push_back(line);
     }
index db6843acdb4ea2278c5516deea08ae3d901eaa2d..77f913b65c894b1fa857f187dfadfa95e5813be4 100644 (file)
@@ -325,7 +325,7 @@ MMI_API int mmi_workflow_clone(mmi_workflow_h workflow, mmi_workflow_h *cloned)
 
     cloned_s->node_infos = new(std::nothrow) mmi_workflow_node_info_s[workflow_s->node_info_count];
     memcpy(cloned_s->node_infos, workflow_s->node_infos, sizeof(mmi_workflow_node_info_s) * workflow_s->node_info_count);
-    for (int i = 0; i < workflow_s->node_info_count; i++) {
+    for (size_t i = 0; i < workflow_s->node_info_count; i++) {
         mmi_node_clone(workflow_s->node_infos[i].node, &(cloned_s->node_infos[i].node));
     }
 
@@ -342,7 +342,7 @@ MMI_API int mmi_workflow_clone(mmi_workflow_h workflow, mmi_workflow_h *cloned)
 
     if (workflow_s->attribute_default_value_info_count > 0) {
         cloned_s->attribute_default_value_infos = new(std::nothrow) mmi_workflow_attribute_default_value_info_s[workflow_s->attribute_default_value_info_count];
-        for (int i = 0; i < workflow_s->attribute_default_value_info_count; i++) {
+        for (size_t i = 0; i < workflow_s->attribute_default_value_info_count; i++) {
             cloned_s->attribute_default_value_infos[i].serialized_default_value =
                 new(std::nothrow) unsigned char[workflow_s->attribute_default_value_infos[i].serialized_default_value_size];
             memcpy(cloned_s->attribute_default_value_infos[i].serialized_default_value,
@@ -370,7 +370,7 @@ MMI_API int mmi_workflow_destroy(mmi_workflow_h workflow) {
 
     mmi_workflow_s *workflow_s = static_cast<mmi_workflow_s*>(workflow);
 
-    for (int i = 0; i < workflow_s->node_info_count; i++) {
+    for (size_t i = 0; i < workflow_s->node_info_count; i++) {
         mmi_node_destroy(workflow_s->node_infos[i].node);
     }
     delete [] workflow_s->node_infos;
index 28cfeeefc99d8d995db40e41c89ec4ea06488bf6..646c427f72f830a1fa1befa7f1b8735c2ba239b0 100644 (file)
@@ -30,12 +30,12 @@ public:
         return true;
     }
     virtual std::shared_ptr<NodePrototype> get_node_prototype(
-        mmi_standard_node_type_e type, mmi_standard_node_sub_type_e sub_type) override {
+        mmi_node_type_e type, mmi_node_sub_type_e sub_type) override {
         last_query = std::make_pair(type, sub_type);
         return nullptr;
     }
 
-    std::pair<mmi_standard_node_type_e, mmi_standard_node_sub_type_e> last_query;
+    std::pair<mmi_node_type_e, mmi_node_sub_type_e> last_query;
 };
 
 class PluginModuleProxyProviderDummy : public IPluginModuleProxyProvider {
@@ -80,13 +80,13 @@ public:
 
 TEST_F(NodeInstanceManagerTest, ProperNodePrototypeQueriedWhenCreatingNodeInstance) {
     prototype_store->last_query = std::make_pair(
-                                      MMI_STANDARD_NODE_TYPE_NONE, std::monostate{});
+                                      MMI_NODE_TYPE_NONE, std::monostate{});
 
     std::shared_ptr<NodeInstance> instance = manager.create_node_instance(
-                MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR );
+                MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR );
 
-    ASSERT_EQ(prototype_store->last_query.first, MMI_STANDARD_NODE_TYPE_PROCESSOR);
-    ASSERT_EQ(prototype_store->last_query.second, mmi_standard_node_sub_type_e{MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+    ASSERT_EQ(prototype_store->last_query.first, MMI_NODE_TYPE_PROCESSOR);
+    ASSERT_EQ(prototype_store->last_query.second, mmi_node_sub_type_e{MMI_NODE_PROCESSOR_TYPE_ASR});
 }
 
 } // namespace
index 80a930e91b48af4739eb2c325ca5d454d8a17de5..82a0c3c1062f1a9a10a69cb902a1c45c1171face 100644 (file)
@@ -36,8 +36,8 @@ public:
         valid_prototype->set_plugin_module_info(
             PluginModuleInfo{mmi_plugin_module_type_e::SHARED_LIBRARY, "test.so"});
 
-        valid_prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
-        valid_prototype->set_sub_type(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT);
+        valid_prototype->set_type(MMI_NODE_TYPE_SOURCE);
+        valid_prototype->set_sub_type(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT);
 
         ASSERT_TRUE(valid_prototype->is_valid());
     }
@@ -61,8 +61,8 @@ TEST_F(NodePrototypeManagerTest, NodePrototypeManagerProperlyAddedAndRetrieved_p
 TEST_F(NodePrototypeManagerTest, NodePrototypeManagerRefusesInvalidPrototype_n) {
     auto invalid_prototype = std::make_shared<NodePrototype>();
 
-    invalid_prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
-    invalid_prototype->set_sub_type(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    invalid_prototype->set_type(MMI_NODE_TYPE_SOURCE);
+    invalid_prototype->set_sub_type(MMI_NODE_PROCESSOR_TYPE_ASR);
 
     manager.add_node_prototype(invalid_prototype);
 
index bc90e8f28eadd8fc8ab56cbc8eda6e14aaa1d306..22d8305fede1f3b7f2aa104b715ba508f82a77da 100644 (file)
@@ -42,16 +42,20 @@ TEST_F(NodePrototypeTest, NodePrototypeValidationSucceedsForDifferentNodeTypes_p
     prototype->set_plugin_module_info(
         PluginModuleInfo{mmi_plugin_module_type_e::SHARED_LIBRARY, "test.so"});
 
-    prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
-    prototype->set_sub_type(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT);
+    prototype->set_type(MMI_NODE_TYPE_SOURCE);
+    prototype->set_sub_type(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT);
     ASSERT_TRUE(prototype->is_valid());
 
-    prototype->set_type(MMI_STANDARD_NODE_TYPE_PROCESSOR);
-    prototype->set_sub_type(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    prototype->set_type(MMI_NODE_TYPE_PROCESSOR);
+    prototype->set_sub_type(MMI_NODE_PROCESSOR_TYPE_ASR);
     ASSERT_TRUE(prototype->is_valid());
 
-    prototype->set_type(MMI_STANDARD_NODE_TYPE_LOGIC);
-    prototype->set_sub_type(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH);
+    prototype->set_type(MMI_NODE_TYPE_LOGIC);
+    prototype->set_sub_type(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH);
+    ASSERT_TRUE(prototype->is_valid());
+
+    prototype->set_type(MMI_NODE_TYPE_CUSTOM);
+    prototype->set_sub_type("com.samsung.tizen.custom-node-llm");
     ASSERT_TRUE(prototype->is_valid());
 }
 
@@ -59,7 +63,7 @@ TEST_F(NodePrototypeTest, NodePrototypeValidationFailsWithNoSubtype_n) {
     prototype->set_plugin_module_info(
         PluginModuleInfo{mmi_plugin_module_type_e::SHARED_LIBRARY, "test.so"});
 
-    prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
+    prototype->set_type(MMI_NODE_TYPE_SOURCE);
     /* No sub type provided */
 
     ASSERT_FALSE(prototype->is_valid());
@@ -69,9 +73,9 @@ TEST_F(NodePrototypeTest, NodePrototypeValidationFailsWithIncorrectSubtype_n) {
     prototype->set_plugin_module_info(
         PluginModuleInfo{mmi_plugin_module_type_e::SHARED_LIBRARY, "test.so"});
 
-    prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
+    prototype->set_type(MMI_NODE_TYPE_SOURCE);
     /* PROCESSOR sub type for SOURCE type */
-    prototype->set_sub_type(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    prototype->set_sub_type(MMI_NODE_PROCESSOR_TYPE_ASR);
 
     ASSERT_FALSE(prototype->is_valid());
 }
@@ -81,12 +85,48 @@ TEST_F(NodePrototypeTest, NodePrototypeValidationFailsWithNoPluginModuleInfo_n)
         PluginModuleInfo{mmi_plugin_module_type_e::SHARED_LIBRARY, ""});
     /* No plugin module identifier provided */
 
-    prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
-    prototype->set_sub_type(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT);
+    prototype->set_type(MMI_NODE_TYPE_SOURCE);
+    prototype->set_sub_type(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT);
 
     ASSERT_FALSE(prototype->is_valid());
 }
 
+TEST_F(NodePrototypeTest, NodePrototypeContainsCorrectSubType_p) {
+    prototype->set_plugin_module_info(
+        PluginModuleInfo{mmi_plugin_module_type_e::SHARED_LIBRARY, "test.so"});
+
+    mmi_node_type_e type;
+    mmi_node_sub_type_e sub_type;
+
+    prototype->set_type(MMI_NODE_TYPE_SOURCE);
+    prototype->set_sub_type(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT);
+    type = prototype->get_type();
+    sub_type = prototype->get_sub_type();
+    ASSERT_EQ(type, MMI_NODE_TYPE_SOURCE);
+    ASSERT_EQ(std::get<mmi_node_source_type_e>(sub_type), MMI_NODE_SOURCE_TYPE_MIC_AMBIENT);
+
+    prototype->set_type(MMI_NODE_TYPE_PROCESSOR);
+    prototype->set_sub_type(MMI_NODE_PROCESSOR_TYPE_ASR);
+    type = prototype->get_type();
+    sub_type = prototype->get_sub_type();
+    ASSERT_EQ(type, MMI_NODE_TYPE_PROCESSOR);
+    ASSERT_EQ(std::get<mmi_node_processor_type_e>(sub_type), MMI_NODE_PROCESSOR_TYPE_ASR);
+
+    prototype->set_type(MMI_NODE_TYPE_LOGIC);
+    prototype->set_sub_type(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH);
+    type = prototype->get_type();
+    sub_type = prototype->get_sub_type();
+    ASSERT_EQ(type, MMI_NODE_TYPE_LOGIC);
+    ASSERT_EQ(std::get<mmi_node_logic_type_e>(sub_type), MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH);
+
+    prototype->set_type(MMI_NODE_TYPE_CUSTOM);
+    prototype->set_sub_type("com.samsung.tizen.custom-node-llm");
+    type = prototype->get_type();
+    sub_type = prototype->get_sub_type();
+    ASSERT_EQ(type, MMI_NODE_TYPE_CUSTOM);
+    ASSERT_EQ(std::get<std::string>(sub_type).compare("com.samsung.tizen.custom-node-llm"), 0);
+}
+
 TEST_F(NodePrototypeTest, PortInfoProperlyAdded_p) {
     ASSERT_TRUE(prototype->get_port_infos().size() == 0);
 
index 66bc567aab418cfa2fab0aae0dd2d28ab325f003..45093c4a3c0498bb0529a23b17287689a5008810 100644 (file)
@@ -49,7 +49,7 @@ public:
         return true;
     }
     virtual std::shared_ptr<NodePrototype> get_node_prototype(
-        mmi_standard_node_type_e type, mmi_standard_node_sub_type_e sub_type) override {
+        mmi_node_type_e type, mmi_node_sub_type_e sub_type) override {
         for (auto &prototype : m_prototypes) {
             if (prototype->get_type() == type && prototype->get_sub_type() == sub_type) {
                 return prototype;
@@ -225,10 +225,10 @@ TEST_F(PluginModuleRegistryTest, DummyNodeInfoProperlyCreatedAndRetrieved_p) {
     bool ret = registry.load_node_prototypes();
     ASSERT_TRUE(ret);
 
-    auto asr_node = node_prototype_store->get_node_prototype(MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    auto asr_node = node_prototype_store->get_node_prototype(MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR);
     ASSERT_NE(nullptr, asr_node);
 
-    auto match_node = node_prototype_store->get_node_prototype(MMI_STANDARD_NODE_TYPE_LOGIC, MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH);
+    auto match_node = node_prototype_store->get_node_prototype(MMI_NODE_TYPE_LOGIC, MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH);
     ASSERT_NE(nullptr, match_node);
 
     registry.deinitialize();
@@ -240,7 +240,7 @@ TEST_F(PluginModuleRegistryTest, NonExistingNodeNotRetrieved_n) {
     bool ret = registry.load_node_prototypes();
     ASSERT_TRUE(ret);
 
-    auto node = node_prototype_store->get_node_prototype(MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_NONE);
+    auto node = node_prototype_store->get_node_prototype(MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_NONE);
     ASSERT_EQ(nullptr, node);
 
     registry.deinitialize();
index 957c5374ec8480101b516bd551c8c62ecdc94234..cff4c25ffb992ca0f94233670c425b29ade86c66 100644 (file)
@@ -46,7 +46,7 @@ public:
         return true;
     }
     virtual std::shared_ptr<NodePrototype> get_node_prototype(
-        mmi_standard_node_type_e type, mmi_standard_node_sub_type_e sub_type) override {
+        mmi_node_type_e type, mmi_node_sub_type_e sub_type) override {
         for (auto& prototype : node_prototypes) {
             if (prototype->get_type() == type &&
                     prototype->get_sub_type() == sub_type) {
@@ -64,23 +64,23 @@ public:
         node_prototype_store = std::make_shared<NodePrototypeStoreDummy>();
 
         auto mic_prototype = std::make_shared<NodePrototype>();
-        mic_prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
-        mic_prototype->set_sub_type(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT);
+        mic_prototype->set_type(MMI_NODE_TYPE_SOURCE);
+        mic_prototype->set_sub_type(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT);
         PortInfo mic_audio{"AUDIO", MMI_PORT_TYPE_OUT, MMI_DATA_TYPE_AUDIO, "audio data"};
         mic_prototype->add_port_info(mic_audio);
         node_prototype_store->add_node_prototype(mic_prototype);
 
         auto asr_prototype = std::make_shared<NodePrototype>();
-        asr_prototype->set_type(MMI_STANDARD_NODE_TYPE_PROCESSOR);
-        asr_prototype->set_sub_type(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+        asr_prototype->set_type(MMI_NODE_TYPE_PROCESSOR);
+        asr_prototype->set_sub_type(MMI_NODE_PROCESSOR_TYPE_ASR);
         PortInfo asr_audio{"AUDIO", MMI_PORT_TYPE_IN, MMI_DATA_TYPE_AUDIO, "audio data"};
         asr_prototype->add_port_info(asr_audio);
         node_prototype_store->add_node_prototype(asr_prototype);
     }
 
     virtual std::shared_ptr<NodeInstance> create_node_instance(
-        mmi_standard_node_type_e node_type,
-        mmi_standard_node_sub_type_e node_sub_type) override {
+        mmi_node_type_e node_type,
+        mmi_node_sub_type_e node_sub_type) override {
         create_requests.push_back(std::make_pair(node_type, node_sub_type));
         auto node_instance = std::make_shared<NodeInstance>(node_type, node_sub_type);
         if (node_instance) {
@@ -119,7 +119,7 @@ public:
     }
     std::shared_ptr<NodePrototypeStoreDummy> node_prototype_store;
     std::shared_ptr<IPluginModuleProxyProvider> plugin_module_proxy_provider;
-    std::vector<std::pair<mmi_standard_node_type_e, mmi_standard_node_sub_type_e>> create_requests;
+    std::vector<std::pair<mmi_node_type_e, mmi_node_sub_type_e>> create_requests;
     size_t destroy_requests{0};
     size_t valid_link_requests{0};
 };
@@ -272,9 +272,9 @@ TEST_F(WorkflowInstanceManagerTest, NodeInstanceCreationRequestedForWorkflowInst
 
     /* Add 2 nodes to the workflow prototype */
     prototype->add_node_info(mmi::NodeInfo{
-        "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+        "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
     prototype->add_node_info(mmi::NodeInfo{
-        "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+        "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
     workflow_prototype_store->add_workflow_prototype(prototype);
 
     ClientMessageWorkflowInstanceCreate msg;
@@ -294,9 +294,9 @@ TEST_F(WorkflowInstanceManagerTest, NodeInstanceDestroyRequestedOnWorkflowDestru
 
     /* Add 2 nodes to the workflow prototype */
     prototype->add_node_info(mmi::NodeInfo{
-        "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+        "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
     prototype->add_node_info(mmi::NodeInfo{
-        "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+        "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
     workflow_prototype_store->add_workflow_prototype(prototype);
 
     ClientMessageWorkflowInstanceCreate create_msg;
@@ -324,9 +324,9 @@ TEST_F(WorkflowInstanceManagerTest, NodeInstanceDestroyRequestedOnClientDisconne
 
     /* Add 2 nodes to the workflow prototype */
     prototype->add_node_info(mmi::NodeInfo{
-        "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+        "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
     prototype->add_node_info(mmi::NodeInfo{
-        "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+        "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
     workflow_prototype_store->add_workflow_prototype(prototype);
 
     ClientMessageWorkflowInstanceCreate create_msg;
@@ -351,9 +351,9 @@ TEST_F(WorkflowInstanceManagerTest, LinkCreatedIfLinkInfoIsProvided_p) {
 
     /* Add 2 nodes to the workflow prototype */
     prototype->add_node_info(mmi::NodeInfo{
-        "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+        "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
     prototype->add_node_info(mmi::NodeInfo{
-        "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+        "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
     prototype->add_link_info(mmi::LinkInfo{
         "MIC", "AUDIO", "ASR", "AUDIO"});
     workflow_prototype_store->add_workflow_prototype(prototype);
@@ -375,9 +375,9 @@ TEST_F(WorkflowInstanceManagerTest, LinkNotCreatedIfLinkInfoIsNotProvided_n) {
 
     /* Add 2 nodes to the workflow prototype */
     prototype->add_node_info(mmi::NodeInfo{
-        "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+        "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
     prototype->add_node_info(mmi::NodeInfo{
-        "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+        "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
     workflow_prototype_store->add_workflow_prototype(prototype);
 
     ClientMessageWorkflowInstanceCreate create_msg;
@@ -397,9 +397,9 @@ TEST_F(WorkflowInstanceManagerTest, LinkNotCreatedIfPortNameIsInvalid_n) {
 
     /* Add 2 nodes to the workflow prototype */
     prototype->add_node_info(mmi::NodeInfo{
-        "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+        "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
     prototype->add_node_info(mmi::NodeInfo{
-        "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+        "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
     prototype->add_link_info(mmi::LinkInfo{
         "MIC", "UNKNOWN_PORT", "ASR", "AUDIO"});
     workflow_prototype_store->add_workflow_prototype(prototype);
@@ -421,9 +421,9 @@ TEST_F(WorkflowInstanceManagerTest, LinkNotCreatedIfNodeNameIsInvalid_n) {
 
     /* Add 2 nodes to the workflow prototype */
     prototype->add_node_info(mmi::NodeInfo{
-        "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+        "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
     prototype->add_node_info(mmi::NodeInfo{
-        "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+        "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
     prototype->add_link_info(mmi::LinkInfo{
         "UNKNOWN_NODE", "AUDIO", "ASR", "AUDIO"});
     workflow_prototype_store->add_workflow_prototype(prototype);
index 50cc71849bb780c9b71a6606f2559be24c612841..63bc62e7fd5ad712e0dbd5cd1a03e7f417f638fd 100644 (file)
@@ -39,9 +39,9 @@ public:
 
         /* Add 2 nodes to the workflow prototype */
         prototype->add_node_info(mmi::NodeInfo{
-            "MIC", MMI_STANDARD_NODE_TYPE_SOURCE, MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT});
+            "MIC", MMI_NODE_TYPE_SOURCE, MMI_NODE_SOURCE_TYPE_MIC_AMBIENT});
         prototype->add_node_info(mmi::NodeInfo{
-            "ASR", MMI_STANDARD_NODE_TYPE_PROCESSOR, MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR});
+            "ASR", MMI_NODE_TYPE_PROCESSOR, MMI_NODE_PROCESSOR_TYPE_ASR});
         AttributeAssignmentInfo attribute_assignment_info;
         attribute_assignment_info.attribute_name = "COMMAND";
         attribute_assignment_info.target_node_name = "ASR";
@@ -74,7 +74,7 @@ public:
         return true;
     }
     virtual std::shared_ptr<NodePrototype> get_node_prototype(
-        mmi_standard_node_type_e type, mmi_standard_node_sub_type_e sub_type) override {
+        mmi_node_type_e type, mmi_node_sub_type_e sub_type) override {
         for (auto& prototype : node_prototypes) {
             if (prototype->get_type() == type &&
                     prototype->get_sub_type() == sub_type) {
@@ -95,7 +95,7 @@ public:
         }
     }
     void reset() {
-        type = MMI_STANDARD_NODE_TYPE_NONE;
+        type = MMI_NODE_TYPE_NONE;
         sub_type = std::monostate();
         if (attribute) {
             mmi_attribute_destroy(attribute);
@@ -103,8 +103,8 @@ public:
         }
     }
     void set_item(
-        mmi_standard_node_type_e type,
-        mmi_standard_node_sub_type_e sub_type,
+        mmi_node_type_e type,
+        mmi_node_sub_type_e sub_type,
         mmi_attribute_h attribute) {
         this->type = type;
         this->sub_type = sub_type;
@@ -113,8 +113,8 @@ public:
         }
         mmi_attribute_clone(attribute, &(this->attribute));
     }
-    mmi_standard_node_type_e type{MMI_STANDARD_NODE_TYPE_NONE};
-    mmi_standard_node_sub_type_e sub_type{std::monostate()};
+    mmi_node_type_e type{MMI_NODE_TYPE_NONE};
+    mmi_node_sub_type_e sub_type{std::monostate()};
     mmi_attribute_h attribute{nullptr};
 };
 
@@ -123,7 +123,7 @@ static NodeAttributeSetHistoryItem g_last_node_attribute_set_history;
 class NodeInstanceTest : public NodeInstance
 {
 public:
-    NodeInstanceTest(mmi_standard_node_type_e node_type, mmi_standard_node_sub_type_e node_sub_type) :
+    NodeInstanceTest(mmi_node_type_e node_type, mmi_node_sub_type_e node_sub_type) :
         NodeInstance(node_type, node_sub_type) {
     }
     virtual ~NodeInstanceTest() {
@@ -141,23 +141,23 @@ public:
         node_prototype_store = std::make_shared<NodePrototypeStoreDummy>();
 
         auto mic_prototype = std::make_shared<NodePrototype>();
-        mic_prototype->set_type(MMI_STANDARD_NODE_TYPE_SOURCE);
-        mic_prototype->set_sub_type(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT);
+        mic_prototype->set_type(MMI_NODE_TYPE_SOURCE);
+        mic_prototype->set_sub_type(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT);
         PortInfo mic_audio{"AUDIO", MMI_PORT_TYPE_OUT, MMI_DATA_TYPE_AUDIO, "audio data"};
         mic_prototype->add_port_info(mic_audio);
         node_prototype_store->add_node_prototype(mic_prototype);
 
         auto asr_prototype = std::make_shared<NodePrototype>();
-        asr_prototype->set_type(MMI_STANDARD_NODE_TYPE_PROCESSOR);
-        asr_prototype->set_sub_type(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+        asr_prototype->set_type(MMI_NODE_TYPE_PROCESSOR);
+        asr_prototype->set_sub_type(MMI_NODE_PROCESSOR_TYPE_ASR);
         PortInfo asr_audio{"AUDIO", MMI_PORT_TYPE_IN, MMI_DATA_TYPE_AUDIO, "audio data"};
         asr_prototype->add_port_info(asr_audio);
         node_prototype_store->add_node_prototype(asr_prototype);
     }
 
     virtual std::shared_ptr<NodeInstance> create_node_instance(
-        mmi_standard_node_type_e node_type,
-        mmi_standard_node_sub_type_e node_sub_type) override {
+        mmi_node_type_e node_type,
+        mmi_node_sub_type_e node_sub_type) override {
         auto node_instance = std::make_shared<NodeInstanceTest>(node_type, node_sub_type);
         if (node_instance) {
             node_instance->set_node_prototype_store(node_prototype_store);
@@ -238,10 +238,10 @@ TEST_F(WorkflowInstanceTest, WorkflowAttributePassedToNodeAttribute_p) {
     mmi_attribute_h attribute = nullptr;
     mmi_attribute_create(value, "COMMAND", &attribute);
     EXPECT_TRUE(workflow_instance->set_attribute(attribute));
-    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_STANDARD_NODE_TYPE_PROCESSOR);
-    EXPECT_TRUE(std::holds_alternative<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
-    EXPECT_EQ(std::get<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
-        MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_NODE_TYPE_PROCESSOR);
+    EXPECT_TRUE(std::holds_alternative<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
+    EXPECT_EQ(std::get<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
+        MMI_NODE_PROCESSOR_TYPE_ASR);
     EXPECT_TRUE(g_last_node_attribute_set_history.attribute != nullptr);
 
     mmi_primitive_value_h history_item_value;
@@ -280,10 +280,10 @@ TEST_F(WorkflowInstanceTest, WorkflowAttributePassedProperlyAfter2ndInitializati
     mmi_attribute_h attribute = nullptr;
     mmi_attribute_create(value, "COMMAND", &attribute);
     EXPECT_TRUE(workflow_instance->set_attribute(attribute));
-    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_STANDARD_NODE_TYPE_PROCESSOR);
-    EXPECT_TRUE(std::holds_alternative<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
-    EXPECT_EQ(std::get<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
-        MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_NODE_TYPE_PROCESSOR);
+    EXPECT_TRUE(std::holds_alternative<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
+    EXPECT_EQ(std::get<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
+        MMI_NODE_PROCESSOR_TYPE_ASR);
     EXPECT_TRUE(g_last_node_attribute_set_history.attribute != nullptr);
 
     mmi_primitive_value_h history_item_value;
@@ -309,10 +309,10 @@ TEST_F(WorkflowInstanceTest, WorkflowDefaultAttributePassedToNodeAttribute_p) {
 
     EXPECT_NE(workflow_instance, nullptr);
     workflow_instance->initialize();
-    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_STANDARD_NODE_TYPE_PROCESSOR);
-    EXPECT_TRUE(std::holds_alternative<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
-    EXPECT_EQ(std::get<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
-        MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_NODE_TYPE_PROCESSOR);
+    EXPECT_TRUE(std::holds_alternative<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
+    EXPECT_EQ(std::get<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
+        MMI_NODE_PROCESSOR_TYPE_ASR);
     EXPECT_TRUE(g_last_node_attribute_set_history.attribute != nullptr);
 
     mmi_primitive_value_h history_item_value;
@@ -341,10 +341,10 @@ TEST_F(WorkflowInstanceTest, WorkflowDefaultAttributePassedProperlyAfter2ndIniti
     EXPECT_NE(workflow_instance, nullptr);
     workflow_instance->initialize();
 
-    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_STANDARD_NODE_TYPE_PROCESSOR);
-    EXPECT_TRUE(std::holds_alternative<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
-    EXPECT_EQ(std::get<mmi_standard_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
-        MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR);
+    EXPECT_EQ(g_last_node_attribute_set_history.type, MMI_NODE_TYPE_PROCESSOR);
+    EXPECT_TRUE(std::holds_alternative<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type));
+    EXPECT_EQ(std::get<mmi_node_processor_type_e>(g_last_node_attribute_set_history.sub_type),
+        MMI_NODE_PROCESSOR_TYPE_ASR);
     EXPECT_TRUE(g_last_node_attribute_set_history.attribute != nullptr);
 
     char *name = nullptr;
index aec1353be556a47f37c91c3d12bfebb88cbe6d2d..92bac78d977bc484ed1a889264593c985c04f21f 100644 (file)
 
 #include <Ecore.h>
 
-static int state_changed_cb(mmi_state_e state, void *user_data) {
-    return MMI_ERROR_NONE;
-}
-
 class MMIMainTest : public ::testing::Test {
 public:
     void SetUp(void) override {
index 04ecc949681200e4fd4b18098660929b4807196b..29b52bffd8b1eb333bb296f553bfe104b006935f 100644 (file)
@@ -37,15 +37,15 @@ public:
 
         m_node_mic = nullptr;
         /* FIXME: node should be 'found' instead of 'created' */
-        mmi_standard_node_create_source(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT, &m_node_mic);
+        mmi_node_create_source(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT, &m_node_mic);
         mmi_workflow_node_add(m_workflow, "MIC", m_node_mic);
 
         m_node_asr = nullptr;
-        mmi_standard_node_create_processor(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR, &m_node_asr);
+        mmi_node_create_processor(MMI_NODE_PROCESSOR_TYPE_ASR, &m_node_asr);
         mmi_workflow_node_add(m_workflow, "ASR", m_node_asr);
 
         m_node_match = nullptr;
-        mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &m_node_match);
+        mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &m_node_match);
         mmi_workflow_node_add(m_workflow, "MATCH", m_node_match);
 
         mmi_workflow_link_nodes_by_names(m_workflow, "MIC", "AUDIO", "ASR", "AUDIO");
@@ -90,8 +90,8 @@ static bool compare_workflow_prototype(mmi_workflow_h first, mmi_workflow_h seco
             return false;
         }
 
-        mmi_standard_node_type_e first_type;
-        mmi_standard_node_type_e second_type;
+        mmi_node_type_e first_type;
+        mmi_node_type_e second_type;
         mmi_node_get_type(first_workflow->node_infos[i].node, &first_type);
         mmi_node_get_type(second_workflow->node_infos[i].node, &second_type);
 
@@ -100,36 +100,36 @@ static bool compare_workflow_prototype(mmi_workflow_h first, mmi_workflow_h seco
         }
 
         switch(first_type) {
-            case MMI_STANDARD_NODE_TYPE_SOURCE:
+            case MMI_NODE_TYPE_SOURCE:
                 {
-                    mmi_standard_node_source_type_e first_source_type;
-                    mmi_standard_node_source_type_e second_source_type;
-                    mmi_standard_node_get_source_type(first_workflow->node_infos[i].node, &first_source_type);
-                    mmi_standard_node_get_source_type(second_workflow->node_infos[i].node, &second_source_type);
+                    mmi_node_source_type_e first_source_type;
+                    mmi_node_source_type_e second_source_type;
+                    mmi_node_get_source_type(first_workflow->node_infos[i].node, &first_source_type);
+                    mmi_node_get_source_type(second_workflow->node_infos[i].node, &second_source_type);
 
                     if (first_source_type != second_source_type) {
                         return false;
                     }
                 }
                 break;
-            case MMI_STANDARD_NODE_TYPE_PROCESSOR:
+            case MMI_NODE_TYPE_PROCESSOR:
                 {
-                    mmi_standard_node_processor_type_e first_processor_type;
-                    mmi_standard_node_processor_type_e second_processor_type;
-                    mmi_standard_node_get_processor_type(first_workflow->node_infos[i].node, &first_processor_type);
-                    mmi_standard_node_get_processor_type(second_workflow->node_infos[i].node, &second_processor_type);
+                    mmi_node_processor_type_e first_processor_type;
+                    mmi_node_processor_type_e second_processor_type;
+                    mmi_node_get_processor_type(first_workflow->node_infos[i].node, &first_processor_type);
+                    mmi_node_get_processor_type(second_workflow->node_infos[i].node, &second_processor_type);
 
                     if (first_processor_type != second_processor_type) {
                         return false;
                     }
                 }
                 break;
-            case MMI_STANDARD_NODE_TYPE_LOGIC:
+            case MMI_NODE_TYPE_LOGIC:
                 {
-                    mmi_standard_node_logic_type_e first_logic_type;
-                    mmi_standard_node_logic_type_e second_logic_type;
-                    mmi_standard_node_get_logic_type(first_workflow->node_infos[i].node, &first_logic_type);
-                    mmi_standard_node_get_logic_type(second_workflow->node_infos[i].node, &second_logic_type);
+                    mmi_node_logic_type_e first_logic_type;
+                    mmi_node_logic_type_e second_logic_type;
+                    mmi_node_get_logic_type(first_workflow->node_infos[i].node, &first_logic_type);
+                    mmi_node_get_logic_type(second_workflow->node_infos[i].node, &second_logic_type);
 
                     if (first_logic_type != second_logic_type) {
                         return false;
@@ -204,15 +204,15 @@ TEST_F(MMIWorkflowTest, TestCompareFunction_p1) {
 
     mmi_node_h node_mic = nullptr;
     /* FIXME: node should be 'found' instead of 'created' */
-    mmi_standard_node_create_source(MMI_STANDARD_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
+    mmi_node_create_source(MMI_NODE_SOURCE_TYPE_MIC_AMBIENT, &node_mic);
     mmi_workflow_node_add(workflow, "MIC", node_mic);
 
     mmi_node_h node_asr = nullptr;
-    mmi_standard_node_create_processor(MMI_STANDARD_NODE_PROCESSOR_TYPE_ASR, &node_asr);
+    mmi_node_create_processor(MMI_NODE_PROCESSOR_TYPE_ASR, &node_asr);
     mmi_workflow_node_add(workflow, "ASR", node_asr);
 
     mmi_node_h node_match = nullptr;
-    mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match);
+    mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, &node_match);
     mmi_workflow_node_add(workflow, "MATCH", node_match);
 
     mmi_workflow_link_nodes_by_names(workflow, "MIC", "AUDIO", "ASR", "AUDIO");
@@ -247,7 +247,7 @@ TEST_F(MMIWorkflowTest, TestCompareFunction_n1) {
     mmi_workflow_clone(m_workflow, &workflow);
 
     mmi_node_h node_regex_match = nullptr;
-    mmi_standard_node_create_logic(MMI_STANDARD_NODE_LOGIC_TYPE_REGEX_STRING_MATCH, &node_regex_match);
+    mmi_node_create_logic(MMI_NODE_LOGIC_TYPE_REGEX_STRING_MATCH, &node_regex_match);
     mmi_workflow_node_add(workflow, "REGEX_MATCH", node_regex_match);
 
     EXPECT_FALSE(compare_workflow_prototype(m_workflow, workflow));
@@ -259,8 +259,6 @@ TEST_F(MMIWorkflowTest, TestCompareFunction_n1) {
 
 TEST_F(MMIWorkflowTest, MMIWorkflowCreateFromScript_p1) {
     mmi_workflow_h workflow = NULL;
-    const char *script = NULL;
-    int ret = MMI_ERROR_NONE;
 
     std::string script_data = R"(
 @workflow
index aec62ab9a63ecd6a8696be46d71bb1ea06ef16ec..d3ec98efef2a91a0be804e1490efff5e9a020ac6 100644 (file)
@@ -1,10 +1,11 @@
 interface mmi {
        void result_cb(string source_name, bundle data) delegate;
 
-       int workflow_instance_create(in int local_workflow_instance_id, in int workflow_type);
+       int workflow_instance_create(in int local_workflow_instance_id, in int workflow_type, in bool script_from_file, in string script_info);
        int workflow_instance_destroy(in int local_workflow_instance_id);
        int workflow_instance_set_attribute(in int local_workflow_instance_id, in bundle attribute);
        int workflow_instance_emit_signal(in int local_workflow_instance_id, in bundle signal);
+       int workflow_instance_feed_data(in int local_workflow_instance_id, in string node_name, in string port_name, in bundle data);
        int workflow_instance_activate(in int local_workflow_instance_id);
        int workflow_instance_deactivate(in int local_workflow_instance_id);
        int workflow_instance_register_result_callback(in int local_workflow_instance_id, result_cb callback);