VsmStatus status;
VsmClient client;
- status = vsm_start_glib_loop();
- if (VSMCLIENT_SUCCESS != status) {
- throw runtime_error("Can't start glib loop");
- }
-
client = vsm_client_create();
if (NULL == client) {
msg = "Can't create client";
finish:
vsm_client_free(client);
- vsm_stop_glib_loop();
if (! msg.empty()) {
throw runtime_error(msg);
}
} //namespace
-VsmStatus Client::vsm_start_glib_loop() noexcept
-{
- // TPDP: Remove vsm_start_glib_loop from API
- return VSMCLIENT_SUCCESS;
-}
-
-VsmStatus Client::vsm_stop_glib_loop() noexcept
-{
- // TPDP: Remove vsm_stop_glib_loop from API
- return VSMCLIENT_SUCCESS;
-}
-
Client::Status::Status()
: mVsmStatus(VSMCLIENT_SUCCESS), mMsg()
{
*/
VsmStatus vsm_del_notification_callback(VsmSubscriptionId subscriptionId) noexcept;
- /**
- * @see ::vsm_start_glib_loop
- */
- static VsmStatus vsm_start_glib_loop() noexcept;
-
- /**
- * @see ::vsm_stop_glib_loop
- */
- static VsmStatus vsm_stop_glib_loop() noexcept;
private:
typedef vasum::client::HostIPCConnection HostConnection;
struct Status {
} // namespace
-/* external */
-API VsmStatus vsm_start_glib_loop()
-{
- return Client::vsm_start_glib_loop();
-}
-
-API VsmStatus vsm_stop_glib_loop()
-{
- return Client::vsm_stop_glib_loop();
-}
-
API VsmClient vsm_client_create()
{
Client* clientPtr = new(nothrow) Client();
VsmArrayString values = NULL;
int ret = 0;
- status = vsm_start_glib_loop(); // start glib loop (if not started any yet)
- if (VSMCLIENT_SUCCESS != status) {
- // error!
- return 1;
- }
-
client = vsm_client_create(); // create client handle
if (NULL == client) {
// error!
finish:
vsm_array_string_free(values); // free memory
vsm_client_free(client); // destroy client handle
- vsm_stop_glib_loop(); // stop the glib loop (use only with vsm_start_glib_loop)
return ret;
}
@endcode
} VsmFileType;
#ifndef __VASUM_WRAPPER_SOURCE__
-/**
- * Start glib loop.
- *
- * Do not call this function if an application creates a glib loop itself.
- * Otherwise, call it before any other function from this library.
- *
- * @return status of this function call
- */
-VsmStatus vsm_start_glib_loop();
-
-/**
- * Stop glib loop.
- *
- * Call only if vsm_start_glib_loop() was called.
- *
- * @return status of this function call
- */
-VsmStatus vsm_stop_glib_loop();
/**
* Create a new vasum-server's client.
static struct
{
int done;
- int glib_stop;
} wrap;
void wrapper_unload(void)
{
- if (wrap.glib_stop) Client::vsm_stop_glib_loop();
- wrap.glib_stop = 0;
LOGI("wrapper_unload");
}
static void init_context_wrap(WrappedContext *w)
{
- Client::vsm_start_glib_loop();
- wrap.glib_stop = 1;
w->client = new Client();
VsmStatus st = w->client->createSystem();
wrap_error(st, w->client);