if (getuid() >= REGULAR_UID_MIN)
endpoint += ":" + std::to_string(getuid());
- int ret = aul_app_com_create(endpoint.c_str(), nullptr, OnAppStatusCb,
+ int ret = aul_app_com_create_async(endpoint.c_str(), nullptr, OnAppStatusCb,
this, &handle_);
if (ret != AUL_R_OK) {
_E("aul_app_com_create(%s) is failed. error(%d)", endpoint.c_str(), ret);
if (getuid() >= REGULAR_UID_MIN)
endpoint += ":" + std::to_string(getuid());
- int ret = aul_app_com_create(endpoint.c_str(), nullptr, OnAppStatusCb,
+ int ret = aul_app_com_create_async(endpoint.c_str(), nullptr, OnAppStatusCb,
this, &handle_);
if (ret != AUL_R_OK) {
_E("aul_app_com_create(%s) is failed. error(%d)", endpoint.c_str(), ret);
int aul_app_com_permission_set_propagation(aul_app_com_permission_h permission, aul_app_com_propagate_option_e option);
int aul_app_com_permission_set_privilege(aul_app_com_permission_h permission, const char *privilege);
-
int aul_app_com_create(const char *endpoint, aul_app_com_permission_h permission, app_com_cb callback, void *user_data, aul_app_com_connection_h *connection);
int aul_app_com_join(const char *endpoint, const char *filter, app_com_cb callback, void *user_data, aul_app_com_connection_h *connection);
int aul_app_com_leave(aul_app_com_connection_h connection);
int aul_app_com_send(const char *endpoint, bundle *envelope);
+int aul_app_com_create_async(const char *endpoint,
+ aul_app_com_permission_h permission,
+ app_com_cb callback,
+ void *user_data,
+ aul_app_com_connection_h *connection);
+
#ifdef __cplusplus
}
#endif
return h;
}
-API int aul_app_com_create(const char *endpoint,
- aul_app_com_permission_h permission, app_com_cb callback,
- void *user_data, aul_app_com_connection_h *connection)
+static int __create_app_com(const char *endpoint,
+ aul_app_com_permission_h permission,
+ app_com_cb callback,
+ void *user_data,
+ bool sync,
+ aul_app_com_connection_h *connection)
{
bundle *b;
int ret;
}
}
- ret = app_send_cmd(AUL_UTIL_PID, APP_COM_CREATE, b);
+ if (sync) {
+ ret = app_send_cmd(AUL_UTIL_PID, APP_COM_CREATE, b);
+ } else {
+ ret = app_send_cmd_with_noreply(AUL_UTIL_PID,
+ APP_COM_CREATE, b);
+ }
bundle_free(b);
if (ret == 0)
return ret;
}
+API int aul_app_com_create(const char *endpoint,
+ aul_app_com_permission_h permission,
+ app_com_cb callback,
+ void *user_data,
+ aul_app_com_connection_h *connection)
+{
+ return __create_app_com(endpoint, permission, callback, user_data,
+ true, connection);
+}
+
+API int aul_app_com_create_async(const char *endpoint,
+ aul_app_com_permission_h permission,
+ app_com_cb callback,
+ void *user_data,
+ aul_app_com_connection_h *connection)
+{
+ return __create_app_com(endpoint, permission, callback, user_data,
+ false, connection);
+}
+
API int aul_app_com_join(const char *endpoint, const char *filter,
app_com_cb callback, void *user_data,
aul_app_com_connection_h *connection)