* @details This enumeration defines the different source node types supported by the MMI framework.
* @since_tizen 9.0
*/
-enum mmi_node_source_type_e {
+typedef enum {
MMI_NODE_SOURCE_TYPE_NONE, /**< Indicates that there is no source node type. */
MMI_NODE_SOURCE_TYPE_SCREEN_ANALYZER, /**< Represents a screen analyzer node type. */
-};
+} mmi_node_source_type_e;
/**
* @brief Enumeration for MMI processor node type.
* @details This enumeration defines the different processor node types supported by the MMI framework.
* @since_tizen 9.0
*/
-enum mmi_node_processor_type_e {
+typedef enum {
MMI_NODE_PROCESSOR_TYPE_NONE /**< Indicates that there is no processor node type. */
-};
+} mmi_node_processor_type_e;
/**
* @brief Enumeration for MMI logic node type.
* @details This enumeration defines the different logic node types supported by the MMI framework.
* @since_tizen 9.0
*/
-enum mmi_node_logic_type_e {
+typedef enum {
MMI_NODE_LOGIC_TYPE_NONE, /**< Indicates that there is no logic node type. */
MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH, /**< Represents a fixed string match logic node type. */
-};
+} mmi_node_logic_type_e;
/**
* @brief Enumeration for MMI controller node type.
* @details This enumeration defines the different controller node types supported by the MMI framework.
* @since_tizen 9.0
*/
-enum mmi_node_controller_type_e {
+typedef enum {
MMI_NODE_CONTROLLER_TYPE_NONE, /**< Indicates that there is no controller node type. */
-};
+} mmi_node_controller_type_e;
/**
* @brief Enumeration for MMI action node type.
* @details This enumeration defines the different action node types supported by the MMI framework.
* @since_tizen 9.0
*/
-enum mmi_node_action_type_e {
+typedef enum {
MMI_NODE_ACTION_TYPE_NONE, /**< Indicates that there is no action node type. */
MMI_NODE_ACTION_TYPE_MOUSE_EVENT, /**< Represents a mouse event action node type. */
MMI_NODE_ACTION_TYPE_KEY_EVENT, /**< Represents a key event action node type. */
-};
+} mmi_node_action_type_e;
/**
* @brief Creates a new source node.
find . -name '*-port-instance*.gcno' -exec rm {} \;
find . -name 'mmi-data-gateway*.gcno' -exec rm {} \;
find . -name 'mmi-node-controller*.gcno' -exec rm {} \;
-find . -name 'mmi-signal*.gcno' -exec rm {} \;
find . -name 'mmi-workflow-script*.gcno' -exec rm {} \;
find . -name 'mmi-plugin*.gcno' -exec rm {} \;
find . -name 'mmi-workflow-output-event*.gcno' -exec rm {} \;
namespace communication {
+// LCOV_EXCL_START
enum class MESSAGE_GROUP {
CLIENT,
WORKFLOW,
std::string source_name;
mmi_data_h data{nullptr};
};
+// LCOV_EXCL_STOP
}; // namespace communication
return get_element_pointer_in_array(struct_handle, index * 2 + 1);
}
-// LCOV_EXCL_START
int mmi_data_create_bool(bool value, mmi_data_h *data) {
if (nullptr == data) {
_E("[ERROR] Some parameters are invalid");
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_BOOLEAN;
- new_data->data = malloc(sizeof(bool));
+ new_data->data = malloc(sizeof(unsigned char));
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
- *(reinterpret_cast<bool *>(new_data->data)) = value;
- new_data->datalen = sizeof(bool);
+ *(reinterpret_cast<unsigned char *>(new_data->data)) = value;
+ new_data->datalen = sizeof(unsigned char);
*data = new_data;
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
int mmi_data_create_int(int value, mmi_data_h *data) {
if (nullptr == data) {
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_INTEGER;
new_data->data = malloc(sizeof(int));
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
*(reinterpret_cast<int *>(new_data->data)) = value;
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_START
+
int mmi_data_create_float(float value, mmi_data_h *data) {
if (nullptr == data) {
_E("[ERROR] Some parameters are invalid");
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_FLOAT;
new_data->data = malloc(sizeof(float));
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
*(reinterpret_cast<float *>(new_data->data)) = value;
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
int mmi_data_create_text(const char *value, mmi_data_h *data) {
if (nullptr == data || nullptr == value) {
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_TEXT;
new_data->datalen = strlen(value) + 1;
new_data->data = reinterpret_cast<void *>(malloc(new_data->datalen));
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
memcpy(new_data->data, value, new_data->datalen);
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_AUDIO;
new_data->data = malloc(len);
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
memcpy(new_data->data, ptr, len);
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_START
int mmi_data_create_video(const void *ptr, size_t len, mmi_data_h *data) {
if (nullptr == data || nullptr == ptr || 0 == len) {
_E("[ERROR] Some parameters are invalid");
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_VIDEO;
new_data->data = malloc(len);
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
memcpy(new_data->data, ptr, len);
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_USER_IDENTIFICATION;
new_data->data = malloc(len);
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
memcpy(new_data->data, ptr, len);
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
int mmi_data_create_coordinate(int x, int y, mmi_data_h *data) {
if (nullptr == data) {
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_COORDINATE;
new_data->data = malloc(sizeof(int) * 2);
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
(reinterpret_cast<int *>(new_data->data))[0] = x;
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for mmi data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_BOUNDING_BOX;
new_data->data = malloc(sizeof(int) * 4);
if (nullptr == new_data->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(new_data);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
(reinterpret_cast<int *>(new_data->data))[0] = x;
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_ARRAY;
array->data = array_data;
array->datalen = array->datalen + g_unit_size;
} else {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for array data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
return MMI_ERROR_NONE;
auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
if (nullptr == new_data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
new_data->type = MMI_DATA_TYPE_STRUCT;
mmi_data_h name_element = nullptr;
int ret = mmi_data_create_text(name, &name_element);
if (MMI_ERROR_NONE != ret) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for name element");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
size_t count = get_count_of_elements(struct_handle);
struct_handle->data = struct_data;
struct_handle->datalen = struct_handle->datalen + g_unit_size * 2;
} else {
+// LCOV_EXCL_START
mmi_data_destroy(name_element);
_E("[ERROR] Fail to allocate memory for struct data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
return MMI_ERROR_NONE;
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_START
int mmi_data_get_bool(mmi_data_h data, bool *value) {
if (nullptr == data || nullptr == value) {
_E("[ERROR] Some parameters are invalid");
return MMI_ERROR_INVALID_PARAMETER;
}
- *value = *(reinterpret_cast<bool *>(data->data));
+ unsigned char temp_value = *(reinterpret_cast<unsigned char *>(data->data));
+ *value = !!(temp_value);
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
int mmi_data_get_int(mmi_data_h data, int *value) {
if (nullptr == data || nullptr == value) {
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_START
int mmi_data_get_float(mmi_data_h data, float *value) {
if (nullptr == data || nullptr == value) {
_E("[ERROR] Some parameters are invalid");
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
int mmi_data_get_text(mmi_data_h data, const char **text) {
if (nullptr == data || nullptr == text) {
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_START
int mmi_data_get_audio(mmi_data_h data, const void **ptr, size_t *len) {
if (nullptr == data || nullptr == ptr || nullptr == len) {
_E("[ERROR] Some parameters are invalid");
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
int mmi_data_get_coordinate(mmi_data_h data, int *x, int *y) {
if (nullptr == data || nullptr == x || nullptr == y) {
mmi_data_to_bytes(*element, &element_bytes, &element_size);
buffer = reinterpret_cast<unsigned char *>(realloc(buffer, current_size + element_size + sizeof(size_t)));
if (nullptr == buffer) {
+// LCOV_EXCL_START
_E("[ERROR] Failed to allocate memory");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
current = buffer + current_size;
memcpy(current, &element_size, sizeof(size_t));
size_t total_size = sizeof(mmi_data_type_e) + sizeof(size_t) + data->datalen;
unsigned char *buffer = reinterpret_cast<unsigned char *>(malloc(total_size));
if (nullptr == buffer) {
+// LCOV_EXCL_START
_E("[ERROR] Failed to allocate memory");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
unsigned char *current = buffer;
memcpy(current, &(data->type), sizeof(mmi_data_type_e));
current += sizeof(size_t);
unsigned char *element_bytes = reinterpret_cast<unsigned char *>(malloc(element_size));
if (nullptr == element_bytes) {
+// LCOV_EXCL_START
_E("[ERROR] Failed to allocate memory");
mmi_data_destroy(value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
memcpy(element_bytes, current, element_size);
mmi_data_from_bytes(element_bytes, element_size, &element);
free(element_bytes);
if (nullptr == element) {
+// LCOV_EXCL_START
_E("[ERROR] Failed to convert bytes to data");
mmi_data_destroy(value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
auto array_data = reinterpret_cast<mmi_data_h *>(value->data);
value->data = array_data;
value->datalen += g_unit_size;
} else {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for array data");
mmi_data_destroy(element);
mmi_data_destroy(value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
num_elements++;
current += sizeof(size_t);
void *buf = calloc(1, datalen);
if (nullptr == buf) {
+// LCOV_EXCL_START
_E("[ERROR] Failed to allocate memory");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
memcpy(buf, current, datalen);
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
// LCOV_EXCL_START
int mmi_node_instance_set_attribute(mmi_node_instance_h instance, mmi_attribute_h attribute) {
+ if (instance == NULL || attribute == NULL) {
+ return MMI_ERROR_INVALID_PARAMETER;
+ }
return MMI_ERROR_NONE;
}
return MMI_ERROR_INVALID_PARAMETER;
}
mmi_node_instance_h node_instance = mmi_plugin_storage_find_node_instance_by_port_instance(instance);
- if (node_instance == NULL) {
- return MMI_ERROR_INVALID_PARAMETER;
+ if (node_instance) {
+ *sibling = mmi_plugin_storage_find_port_instance(node_instance, port_name);
}
- *sibling = mmi_plugin_storage_find_port_instance(node_instance, port_name);
return MMI_ERROR_NONE;
}
// LCOV_EXCL_START
MMI_API int mmi_port_instance_generate_output(mmi_port_instance_h instance, mmi_data_h data) {
+ if (nullptr == instance) {
+ LOGE("[ERROR] parameter is null");
+ return MMI_ERROR_INVALID_PARAMETER;
+ }
+
mmi_plugin_module_event_handler_info_s event_handler_info = mmi_plugin_storage_get_plugin_module_event_handler();
void *user_data = mmi_plugin_storage_get_plugin_module_event_handler_user_data();
auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
if (nullptr == primitive_value) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_INT;
primitive_value->data = reinterpret_cast<void *>(malloc(sizeof(int)));
if (nullptr == primitive_value->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(primitive_value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
*(reinterpret_cast<int *>(primitive_value->data)) = data;
auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
if (nullptr == primitive_value) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_FLOAT;
primitive_value->data = reinterpret_cast<void *>(malloc(sizeof(float)));
if (nullptr == primitive_value->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(primitive_value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
*(reinterpret_cast<float *>(primitive_value->data)) = data;
auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
if (nullptr == primitive_value) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_STRING;
auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
if (nullptr == primitive_value) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_BOOL;
primitive_value->data = reinterpret_cast<void *>(malloc(sizeof(int)));
if (nullptr == primitive_value->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for raw data");
free(primitive_value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
*(reinterpret_cast<int *>(primitive_value->data)) = static_cast<int>(data);
auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
if (nullptr == primitive_value) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for primitive value");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_ARRAY;
array->data = array_data;
array->datalen = array->datalen + g_unit_size;
} else {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for array element");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
_D("[DEBUG] Success to add element(%zu)", get_array_count(array));
cloned_value->datalen = handle->datalen;
cloned_value->data = calloc(1, handle->datalen);
if (nullptr == cloned_value->data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for data");
free(cloned_value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
if (handle->type == MMI_PRIMITIVE_VALUE_TYPE_ARRAY) {
mmi_primitive_value_to_bytes(*element, &element_bytes, &element_size);
buffer = reinterpret_cast<unsigned char *>(realloc(buffer, current_size + element_size + sizeof(size_t)));
if (nullptr == buffer) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for buffer");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
current = buffer + current_size;
memcpy(current, &element_size, sizeof(size_t));
size_t total_size = sizeof(mmi_primitive_value_type_e) + sizeof(size_t) + handle->datalen;
unsigned char *buffer = reinterpret_cast<unsigned char *>(malloc(total_size));
if (nullptr == buffer) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for buffer");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
unsigned char *current = buffer;
memcpy(current, &(handle->type), sizeof(mmi_primitive_value_type_e));
}
if (failed) {
+// LCOV_EXCL_START
/* Since we are in a while loop, value->data should also be freed */
num_elements = value->datalen / sizeof(mmi_primitive_value_h);
for (size_t i = 0; i < num_elements; i++) {
free(value->data);
free(value);
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
mmi_primitive_value_add_array_element(value, element);
current += sizeof(size_t);
void *data = calloc(1, datalen);
if (nullptr == data) {
+// LCOV_EXCL_START
_E("[ERROR] Fail to allocate memory for data");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
memcpy(data, current, datalen);
}
MMI_API int mmi_signal_parameter_clone(mmi_signal_parameter_h signal_parameter, mmi_signal_parameter_h *cloned) {
- if (cloned == NULL) {
+ if (signal_parameter == NULL || cloned == 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);
+ if (channel) {
+ WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
- ClientMessageWorkflowInstanceActivate msg;
- msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+ ClientMessageWorkflowInstanceActivate msg;
+ msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
- channel->send(&msg);
+ channel->send(&msg);
+ }
return MMI_ERROR_NONE;
}
}
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);
+ if (channel) {
+ WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
- ClientMessageWorkflowInstanceDeactivate msg;
- msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+ ClientMessageWorkflowInstanceDeactivate msg;
+ msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
- channel->send(&msg);
+ channel->send(&msg);
+ }
return MMI_ERROR_NONE;
}
}
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);
+ if (channel) {
+ WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
- ClientMessageWorkflowInstanceSetAttribute msg;
- msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
- msg.attribute = attribute;
+ ClientMessageWorkflowInstanceSetAttribute msg;
+ msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+ msg.attribute = attribute;
- channel->send(&msg);
+ channel->send(&msg);
+ }
return MMI_ERROR_NONE;
}
}
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);
+ if (channel) {
+ WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
- ClientMessageWorkflowInstanceEmitSignal msg;
- msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
- msg.signal = signal;
+ ClientMessageWorkflowInstanceEmitSignal msg;
+ msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+ msg.signal = signal;
- channel->send(&msg);
+ channel->send(&msg);
+ }
return MMI_ERROR_NONE;
}
}
// LCOV_EXCL_STOP
-MMI_API int mmi_workflow_instance_unset_output_cb(mmi_workflow_instance_h instance, const char *name, mmi_workflow_output_cb callback) {
+MMI_API int mmi_workflow_instance_unset_output_cb(mmi_workflow_instance_h instance, mmi_workflow_output_cb callback) {
if (nullptr == instance) {
LOGE("[ERROR] parameter is null");
return MMI_ERROR_INVALID_PARAMETER;
}
- if (nullptr == name) {
- LOGE("[ERROR] parameter is null");
- return MMI_ERROR_INVALID_PARAMETER;
- }
-
if (nullptr == callback) {
LOGE("[ERROR] parameter is null");
return MMI_ERROR_INVALID_PARAMETER;
}
- WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
- workflow_instance->remove_output_callback(std::string{name}, callback);
+ //WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
+ //workflow_instance->remove_output_callback(std::string{name}, callback);
return MMI_ERROR_NONE;
}
#include "magic_enum/magic_enum.hpp"
+// LCOV_EXCL_START
class WorkflowScriptGenerator {
public:
WorkflowScriptGenerator() {
private:
WorkflowScriptHelper m_workflow_script_helper;
};
+// LCOV_EXCL_STOP
#endif //__MMI_WORKFLOW_SCRIPT_GENERATOR_H__
mmi_workflow_s *workflow_s = new(std::nothrow) mmi_workflow_s;
if (nullptr == workflow_s) {
+// LCOV_EXCL_START
LOGE("[ERROR] Failed to create workflow");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
workflow_s->type = MMI_STANDARD_WORKFLOW_NONE;
MMI_API int mmi_workflow_link_nodes_by_names(mmi_workflow_h workflow,
const char *from_node_name, const char *from_port_name, const char *to_node_name, const char *to_port_name) {
+ if (nullptr == workflow) {
+ LOGE("[ERROR] parameter is null");
+ return MMI_ERROR_INVALID_PARAMETER;
+ }
if (nullptr == from_node_name || nullptr == from_port_name || nullptr == to_node_name || nullptr == to_port_name) {
LOGE("[ERROR] parameter is null");
return MMI_ERROR_INVALID_PARAMETER;
size_t attribute_assignment_info_count = workflow_s->attribute_assignment_info_count;
workflow_s->attribute_assignment_infos = new(std::nothrow) mmi_workflow_attribute_assignment_info_s[attribute_assignment_info_count + 1];
if (nullptr == workflow_s->attribute_assignment_infos) {
+// LCOV_EXCL_START
LOGE("[ERROR] Failed to allocate memory");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
if (attribute_assignment_info_count > 0) {
memcpy(workflow_s->attribute_assignment_infos, attribute_assignment_infos, sizeof(mmi_workflow_attribute_assignment_info_s) * attribute_assignment_info_count);
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_START
MMI_API int mmi_workflow_attribute_set_default_value(mmi_workflow_h workflow, mmi_attribute_h default_value) {
if (nullptr == workflow || nullptr == default_value) {
LOGE("[ERROR] parameter is null");
size_t attribute_default_value_info_count = workflow_s->attribute_default_value_info_count;
workflow_s->attribute_default_value_infos = new(std::nothrow) mmi_workflow_attribute_default_value_info_s[attribute_default_value_info_count + 1];
if (nullptr == workflow_s->attribute_default_value_infos) {
+// LCOV_EXCL_START
LOGE("[ERROR] Failed to allocate memory");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
if (attribute_default_value_info_count > 0) {
size_t signal_assignment_info_count = workflow_s->signal_assignment_info_count;
workflow_s->signal_assignment_infos = new(std::nothrow) mmi_workflow_signal_assignment_info_s[signal_assignment_info_count + 1];
if (nullptr == workflow_s->signal_assignment_infos) {
+// LCOV_EXCL_START
LOGE("[ERROR] Failed to allocate memory");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
if (signal_assignment_info_count > 0) {
return MMI_ERROR_NONE;
}
-// LCOV_EXCL_STOP
MMI_API int mmi_workflow_output_assign(mmi_workflow_h workflow, const char *workflow_output, const char *out_node_name, const char *node_out_port_name) {
if (nullptr == workflow || nullptr == workflow_output || nullptr == out_node_name || nullptr == node_out_port_name) {
if (!duplicated) {
list.workflows = new(std::nothrow) mmi_workflow_h[workflow_count + 1];
if (nullptr == list.workflows) {
+// LCOV_EXCL_START
LOGE("[ERROR] failed to allocate memory");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
if (workflow_count > 0) {
memcpy(list.workflows, workflows, sizeof(mmi_workflow_h) * workflow_count);
mmi_workflow_s *cloned_s = new(std::nothrow) mmi_workflow_s;
if (nullptr == cloned_s) {
+// LCOV_EXCL_START
LOGE("[ERROR] new mmi_workflow_s failed");
return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
}
mmi_workflow_s *workflow_s = static_cast<mmi_workflow_s *>(workflow);
&g_communication_channel_observer
};
+static bool g_initialized = false;
+
MMI_API int mmi_initialize() {
+ if (g_initialized) {
+ return MMI_ERROR_OPERATION_FAILED;
+ }
LOGE("[SUCCESS] Succeeded to create client");
g_mmi_client_manager.initialize();
+ g_initialized = true;
return MMI_ERROR_NONE;
}
MMI_API int mmi_deinitialize() {
+ if (!g_initialized) {
+ return MMI_ERROR_OPERATION_FAILED;
+ }
g_mmi_client_manager.deinitialize();
+ g_initialized = false;
return MMI_ERROR_NONE;
}
}
MMI_API int mmi_unset_state_changed_cb(mmi_state_changed_cb callback) {
+ if (callback == nullptr) {
+ return MMI_ERROR_INVALID_PARAMETER;
+ }
+
auto it = std::find_if(g_state_changed_cb_list.begin(), g_state_changed_cb_list.end(),
[callback](const std::pair<mmi_state_changed_cb, void*>& item) {
return item.first == callback;
mmi_data_h arrayElement[MAX_ARRAY_LENGTH] = {nullptr, };
};
+TEST_F(MMIDataTest, MMIDataCreateDataByBool_p) {
+ constexpr bool sourceValue = true;
+ ASSERT_EQ(mmi_data_create_bool(sourceValue, &mmiData), MMI_ERROR_NONE);
+ ASSERT_NE(mmiData, nullptr);
+}
+
TEST_F(MMIDataTest, MMIDataCreateDataByInt_p) {
constexpr int sourceValue = 0;
ASSERT_EQ(mmi_data_create_int(sourceValue, &mmiData), MMI_ERROR_NONE);
EXPECT_EQ(mmi_data_create_audio(sourceValue, DATA_LENGTH, nullptr), MMI_ERROR_INVALID_PARAMETER);
}
+TEST_F(MMIDataTest, MMIDataCreateDataByVideo_p) {
+ constexpr size_t DATA_LENGTH = 10;
+ constexpr char sourceValue[DATA_LENGTH] = {1, };
+ ASSERT_EQ(mmi_data_create_video(sourceValue, DATA_LENGTH, &mmiData), MMI_ERROR_NONE);
+ ASSERT_NE(mmiData, nullptr);
+}
+
+TEST_F(MMIDataTest, MMIDataCreateDataByVideo_n) {
+ constexpr size_t DATA_LENGTH = 10;
+ constexpr char sourceValue[DATA_LENGTH] = {1, };
+ EXPECT_EQ(mmi_data_create_video(nullptr, DATA_LENGTH, &mmiData), MMI_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(mmi_data_create_video(sourceValue, 0, &mmiData), MMI_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(mmi_data_create_video(sourceValue, DATA_LENGTH, nullptr), MMI_ERROR_INVALID_PARAMETER);
+}
+
TEST_F(MMIDataTest, MMIDataCreateDataByCoordinate_p) {
constexpr int x = 123;
constexpr int y = 456;
EXPECT_EQ(mmi_data_get_text(mmiData, &textInData), MMI_ERROR_INVALID_PARAMETER);
}
+TEST_F(MMIDataTest, MMIDataGetAudioValue_p) {
+ constexpr size_t DATA_LENGTH = 10;
+ const char sourceValue[DATA_LENGTH] = {1, };
+ ASSERT_EQ(mmi_data_create_audio(sourceValue, DATA_LENGTH, &mmiData), MMI_ERROR_NONE);
+ ASSERT_NE(mmiData, nullptr);
+
+ size_t size;
+ const void *bytes = nullptr;
+ EXPECT_EQ(mmi_data_get_audio(mmiData, &bytes, &size), MMI_ERROR_NONE);
+ EXPECT_EQ(size, DATA_LENGTH);
+ EXPECT_EQ(*((unsigned char*)bytes), 1);
+}
+
+TEST_F(MMIDataTest, MMIDataGetAudioValue_n1) {
+ constexpr size_t DATA_LENGTH = 10;
+ const char sourceValue[DATA_LENGTH] = {1, };
+ ASSERT_EQ(mmi_data_create_audio(sourceValue, DATA_LENGTH, &mmiData), MMI_ERROR_NONE);
+ ASSERT_NE(mmiData, nullptr);
+
+ size_t size;
+ const void *bytes = nullptr;
+ EXPECT_EQ(mmi_data_get_audio(nullptr, &bytes, &size), MMI_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(mmi_data_get_audio(mmiData, nullptr, &size), MMI_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(mmi_data_get_audio(mmiData, &bytes, nullptr), MMI_ERROR_INVALID_PARAMETER);
+}
+
+TEST_F(MMIDataTest, MMIDataGetAudioValue_n2) {
+ constexpr int sourceInt = 1;
+ ASSERT_EQ(mmi_data_create_int(sourceInt, &mmiData), MMI_ERROR_NONE);
+ ASSERT_NE(mmiData, nullptr);
+
+ size_t size;
+ const void *bytes = nullptr;
+ EXPECT_EQ(mmi_data_get_audio(mmiData, &bytes, &size), MMI_ERROR_INVALID_PARAMETER);
+}
+
TEST_F(MMIDataTest, MMIDataGetCoordinateValue_p) {
constexpr int sourceX = 123;
constexpr int sourceY = 456;