示例#1
0
JNIEXPORT jboolean JNICALL
Java_org_supla_android_lib_SuplaClient_scIterate(JNIEnv* env, jobject thiz, jlong _asc, jint wait_usec) {
    
    void *supla_client = supla_client_ptr(_asc);

    return supla_client && supla_client_iterate(supla_client, wait_usec) == 1 ? JNI_TRUE : JNI_FALSE;
};
示例#2
0
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);


}