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 jboolean JNICALL Java_org_supla_android_lib_SuplaClient_scConnect(JNIEnv* env, jobject thiz, jlong _asc) { void *supla_client = supla_client_ptr(_asc); if ( supla_client ) return supla_client_connect(supla_client) == 1 ? JNI_TRUE : JNI_FALSE; return JNI_FALSE; };