void client_loop(void *user_data, void *sthread) { void *sclient = client_loop_init(sthread); if ( sclient == NULL ) { st_app_terminate = 1; return; } if ( user_data ) *(void**)user_data = sclient; while(sthread_isterminated(sthread) == 0) { supla_log(LOG_INFO, "Connecting..."); if ( 0 == supla_client_connect(sclient) ) { usleep(2000000); } else { while( sthread_isterminated(sthread) == 0 && supla_client_iterate(sclient, 10000000) == 1 ) { } } } if ( user_data ) *(void**)user_data =NULL; supla_client_free(sclient); }
JNIEXPORT void JNICALL Java_org_supla_android_lib_SuplaClient_scFree(JNIEnv* env, jobject thiz, jlong _asc) { #ifdef _LP64 TAndroidSuplaClient *asc = (void*)_asc; #else TAndroidSuplaClient *asc = (void*)(int)_asc; #endif if ( asc ) { if ( asc->_supla_client ) { supla_client_free(asc->_supla_client); asc->_supla_client = NULL; } if ( asc->j_obj ) { (*env)->DeleteGlobalRef(env, asc->j_obj); asc->j_obj = NULL; } } };