{
Eldbus_Message *reply = eldbus_message_method_return_new(msg);
Eldbus_Message_Iter *iter, *array;
- int i;
+ int numbers[] = { 10, 9, 8, 7, 6, 5 };
printf("- sendArrayInt\n\n");
iter = eldbus_message_iter_get(reply);
array = eldbus_message_iter_container_new(iter, 'a', "i");
- for (i = 0; i < 5; i++)
- eldbus_message_iter_arguments_append(array, "i", i);
+ eldbus_message_iter_fixed_array_append(array, 'i', numbers, EINA_C_ARRAY_LENGTH(numbers));
eldbus_message_iter_container_close(iter, array);
return reply;
return r;
}
+EAPI Eina_Bool
+eldbus_message_iter_fixed_array_append(Eldbus_Message_Iter *iter, int type, const void *array, unsigned int size)
+{
+ ELDBUS_MESSAGE_ITERATOR_CHECK_RETVAL(iter, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(array, EINA_FALSE);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(iter->writable, EINA_FALSE);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(dbus_type_is_basic(type), EINA_FALSE);
+ return dbus_message_iter_append_fixed_array(&iter->dbus_iterator, type, &array, (int)size);
+}
+
EAPI void
eldbus_message_iter_basic_get(Eldbus_Message_Iter *iter, void *value)
{
*/
EAPI Eina_Bool eldbus_message_iter_arguments_vappend(Eldbus_Message_Iter *iter, const char *signature, va_list ap) EINA_ARG_NONNULL(1, 2, 3);
+
+/**
+ * Append a array of basic type with fixed size to Eldbus_Message_Iter.
+ *
+ * @param iter iterator
+ * @param type basic type that will be appended
+ * @param array data to append
+ * @param size of array
+ */
+EAPI Eina_Bool eldbus_message_iter_fixed_array_append(Eldbus_Message_Iter *iter, int type, const void *array, unsigned int size);
+
/**
* @brief Closes a container-typed value appended to the message.
*