<commit_before>package ch.ffhs.esa.bewegungsmelder;

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * Author: <NAME> <<EMAIL>>
 * Contributors:
 * 	- <NAME> <<EMAIL>>
 *  - <NAME> <<EMAIL>> (Implementation)
 * 
 *  Kommuniziert mit dem Ueberwachungsserver.
 */

import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.util.Log;

public class ServerService extends Service {
    Handler handler = new Handler();
    String server = "";
    String port = "";
    int interval = 0;

    private Runnable runnable = new Runnable() {
        @Override
        public void run() {
            Helper.sendPOSTRequest(server, port);
            handler.postDelayed(this, interval);
        }
    };

    /* (non-Javadoc)
	 * @see android.app.Service#onStart(android.content.Intent, int)
	 */
    @Override
    public void onStart(Intent intent, int startId) {
        // Wird nach onCreate ausgefuehrt
        super.onStart(intent, startId);
        getSettingsForServer();
        handler.postDelayed(runnable, interval);
    }

    /**
     * reads and sets the settings from the preferences
     */
    private void getSettingsForServer() {
        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
        server = sharedPref.getString("pref_server_address", "localhost");
        port = sharedPref.getString("pref_server_port", "3001");
        interval = Integer.parseInt(sharedPref.getString("pref_server_ping_intervall", "5")) * 60 * 1000;
        Log.d("ServerService", "Interval: " + interval);
    }
<commit_msg>change default hostname to michaelkohler.info<commit_after>package ch.ffhs.esa.bewegungsmelder;

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * Author: <NAME> <<EMAIL>>
 * Contributors:
 * 	- <NAME> <<EMAIL>>
 *  - <NAME> <<EMAIL>> (Implementation)
 * 
 *  Kommuniziert mit dem Ueberwachungsserver.
 */

import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.util.Log;

public class ServerService extends Service {
    Handler handler = new Handler();
    String server = "";
    String port = "";
    int interval = 0;

    private Runnable runnable = new Runnable() {
        @Override
        public void run() {
            Helper.sendPOSTRequest(server, port);
            handler.postDelayed(this, interval);
        }
    };

    /* (non-Javadoc)
	 * @see android.app.Service#onStart(android.content.Intent, int)
	 */
    @Override
    public void onStart(Intent intent, int startId) {
        // Wird nach onCreate ausgefuehrt
        super.onStart(intent, startId);
        getSettingsForServer();
        handler.postDelayed(runnable, interval);
    }

    /**
     * reads and sets the settings from the preferences
     */
    private void getSettingsForServer() {
        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
        server = sharedPref.getString("pref_server_address", "michaelkohler.info");
        port = sharedPref.getString("pref_server_port", "3001");
        interval = Integer.parseInt(sharedPref.getString("pref_server_ping_intervall", "5")) * 60 * 1000;
        Log.d("ServerService", "Interval: " + interval);
    }

{'fraction_non_alphanumeric': 0.11437648927720413, 'fraction_numerical': 0.008472332539052158, 'mean_word_length': 3.2118171683389076, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4886369', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1089, 'n_words': 284}