if (!watch_base_check_feature())
return APP_ERROR_NOT_SUPPORTED;
+ if (argc <= 0 || argv == NULL || callback == NULL) {
+ return watch_base_set_error(APP_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ }
+
+ if (callback->create == NULL) {
+ return watch_base_set_error(APP_ERROR_INVALID_PARAMETER,
+ __FUNCTION__,
+ "watch_base_create_cb() callback must be "
+ "registered");
+ }
+
+ if (__context.state != WATCH_BASE_STATE_NOT_RUNNING) {
+ return watch_base_set_error(APP_ERROR_ALREADY_RUNNING,
+ __FUNCTION__, NULL);
+ }
+
+ if (app_get_id(&(__context.appid)) != APP_ERROR_NONE) {
+ return watch_base_set_error(APP_ERROR_INVALID_CONTEXT,
+ __FUNCTION__, "failed to get the appid");
+ }
+
/* override methods */
ops.base.create = __on_ui_base_create;
ops.base.control = __on_ui_base_control;
_E("failed to get launch argv");
}
- if (argc <= 0 || argv == NULL || callback == NULL)
- return watch_base_set_error(APP_ERROR_INVALID_PARAMETER,
- __FUNCTION__, NULL);
-
- if (callback->create == NULL)
- return watch_base_set_error(APP_ERROR_INVALID_PARAMETER,
- __FUNCTION__,
- "watch_base_create_cb() callback must be "
- "registered");
-
- if (__context.state != WATCH_BASE_STATE_NOT_RUNNING)
- return watch_base_set_error(APP_ERROR_ALREADY_RUNNING, __FUNCTION__,
- NULL);
-
- if (app_get_id(&(__context.appid)) != APP_ERROR_NONE)
- return watch_base_set_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__,
- "failed to get the appid");
-
ret = aul_app_com_create(__context.appid, NULL, __viewer_state_handler,
NULL, &__conn_viewer_state);
if (ret < 0) {
free(__context.appid);
__context.appid = NULL;
- return watch_base_set_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__,
- "Failed to create app com");
+ return watch_base_set_error(APP_ERROR_INVALID_CONTEXT,
+ __FUNCTION__, "Failed to create app com");
}
__context.callback = *callback;