From 91a18eedf21dbdf0b5903c1d46416e04cfa9c7b0 Mon Sep 17 00:00:00 2001
From: BB <boqi.ren@tu-dresden.de>
Date: Fri, 26 Apr 2019 15:46:10 +0200
Subject: [PATCH] new sensor values and lights control

---
 .../st/sensorsharing/common/Constants.java    |   9 +
 .../java/com/example/gui/LoginActivity.java   | 390 --------------
 gui/src/main/res/layout/activity_login.xml    |  78 ---
 mobile/src/main/AndroidManifest.xml           |   6 -
 .../inf/st/sensorsharing/MainActivity.java    | 485 +++++++++---------
 .../inf/st/sensorsharing/MqttTopics.java      |   7 +
 mobile/src/main/res/layout/activity_main.xml  |   5 +-
 mobile/src/main/res/layout/fragment_first.xml |  64 ++-
 .../src/main/res/layout/fragment_second.xml   |  34 +-
 mobile/src/main/res/layout/fragment_third.xml | 220 +++-----
 mobile/src/main/res/values/strings.xml        |   1 +
 .../inf/st/sensorsharing/MainActivity.java    |  55 +-
 wear/src/main/res/layout/activity_main.xml    |  89 ++--
 wear/src/main/res/values/strings.xml          |   3 +
 14 files changed, 539 insertions(+), 907 deletions(-)
 delete mode 100644 gui/src/main/java/com/example/gui/LoginActivity.java
 delete mode 100644 gui/src/main/res/layout/activity_login.xml

diff --git a/common/src/main/java/de/tudresden/inf/st/sensorsharing/common/Constants.java b/common/src/main/java/de/tudresden/inf/st/sensorsharing/common/Constants.java
index d816dd8..1223da4 100644
--- a/common/src/main/java/de/tudresden/inf/st/sensorsharing/common/Constants.java
+++ b/common/src/main/java/de/tudresden/inf/st/sensorsharing/common/Constants.java
@@ -16,6 +16,15 @@ public class Constants {
     public static final String SUB_KEY_ROTATION_VECTOR = "rotation";
     public static final String KEY_ROTATION_VECTOR = BASE_KEY + SUB_KEY_ROTATION_VECTOR;
 
+    public static final String SUB_KEY_HEART_RATE = "hear_rate";
+    public static final String KEY_HEART_RATE = BASE_KEY + SUB_KEY_HEART_RATE;
+
+    public static final String SUB_KEY_AMBIENT_PRESSURE = "hear_pressure";
+    public static final String KEY_AMBIENT_PRESSURE = BASE_KEY + SUB_KEY_AMBIENT_PRESSURE;
+
+    public static final String SUB_KEY_COUNTER = "hear_counter";
+    public static final String KEY_COUNTER = BASE_KEY + SUB_KEY_COUNTER;
+
     public static final String SUB_KEY_NAME = "name";
     public static final String KEY_NAME = BASE_KEY + SUB_KEY_NAME;
 
diff --git a/gui/src/main/java/com/example/gui/LoginActivity.java b/gui/src/main/java/com/example/gui/LoginActivity.java
deleted file mode 100644
index 0401583..0000000
--- a/gui/src/main/java/com/example/gui/LoginActivity.java
+++ /dev/null
@@ -1,390 +0,0 @@
-package com.example.gui;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.annotation.TargetApi;
-import android.content.pm.PackageManager;
-import android.support.annotation.NonNull;
-import android.support.design.widget.Snackbar;
-import android.support.v7.app.AppCompatActivity;
-import android.app.LoaderManager.LoaderCallbacks;
-
-import android.content.CursorLoader;
-import android.content.Loader;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.AsyncTask;
-
-import android.os.Build;
-import android.os.Bundle;
-import android.provider.ContactsContract;
-import android.text.TextUtils;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.inputmethod.EditorInfo;
-import android.widget.ArrayAdapter;
-import android.widget.AutoCompleteTextView;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.java_websocket.client.WebSocketClient;
-import org.java_websocket.handshake.ServerHandshake;
-import org.java_websocket.drafts.Draft_10;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import static android.Manifest.permission.READ_CONTACTS;
-
-/**
- * A login screen that offers login via email/password.
- */
-public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> {
-
-    /**
-     * Id to identity READ_CONTACTS permission request.
-     */
-    private static final int REQUEST_READ_CONTACTS = 0;
-
-    /**
-     * A dummy authentication store containing known user names and passwords.
-     * TODO: remove after connecting to a real authentication system.
-     */
-    private static final String[] DUMMY_CREDENTIALS = new String[]{
-            "foo@example.com:hello", "bar@example.com:world"
-    };
-    /**
-     * Keep track of the login task to ensure we can cancel it if requested.
-     */
-    private UserLoginTask mAuthTask = null;
-
-    // UI references.
-    private AutoCompleteTextView mEmailView;
-    private EditText mPasswordView;
-    private View mProgressView;
-    private View mLoginFormView;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_login);
-        // Set up the login form.
-        mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
-        populateAutoComplete();
-
-        mPasswordView = (EditText) findViewById(R.id.password);
-        mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
-            @Override
-            public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
-                if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL) {
-                    attemptLogin();
-                    return true;
-                }
-                return false;
-            }
-        });
-
-        Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
-        mEmailSignInButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                attemptLogin();
-            }
-        });
-
-        mLoginFormView = findViewById(R.id.login_form);
-        mProgressView = findViewById(R.id.login_progress);
-
-
-        WebSocketClient mWs = new WebSocketClient( new URI( "ws://192.168.3.7:9999" ), new Draft_10() )
-        {
-            @Override
-            public void onMessage( String message ) {
-                JSONObject obj = new JSONObject(message)
-                String channel = obj.getString("channel");
-            }
-
-            @Override
-            public void onOpen( ServerHandshake handshake ) {
-                System.out.println( "opened connection" );
-            }
-
-            @Override
-            public void onClose( int code, String reason, boolean remote ) {
-                System.out.println( "closed connection" );
-            }
-
-            @Override
-            public void onError( Exception ex ) {
-                ex.printStackTrace();
-            }
-
-        };
-        //open websocket
-        mWs.connect();
-        JSONObject obj = new JSONObject();
-        obj.put("event", "addChannel");
-        obj.put("channel", "ok_btccny_ticker");
-        String message = obj.toString();
-        //send message
-        mWs.send(message);
-    }
-
-    private void populateAutoComplete() {
-        if (!mayRequestContacts()) {
-            return;
-        }
-
-        getLoaderManager().initLoader(0, null, this);
-    }
-
-    private boolean mayRequestContacts() {
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
-            return true;
-        }
-        if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) {
-            return true;
-        }
-        if (shouldShowRequestPermissionRationale(READ_CONTACTS)) {
-            Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE)
-                    .setAction(android.R.string.ok, new View.OnClickListener() {
-                        @Override
-                        @TargetApi(Build.VERSION_CODES.M)
-                        public void onClick(View v) {
-                            requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
-                        }
-                    });
-        } else {
-            requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
-        }
-        return false;
-    }
-
-    /**
-     * Callback received when a permissions request has been completed.
-     */
-    @Override
-    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
-                                           @NonNull int[] grantResults) {
-        if (requestCode == REQUEST_READ_CONTACTS) {
-            if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-                populateAutoComplete();
-            }
-        }
-    }
-
-
-    /**
-     * Attempts to sign in or register the account specified by the login form.
-     * If there are form errors (invalid email, missing fields, etc.), the
-     * errors are presented and no actual login attempt is made.
-     */
-    private void attemptLogin() {
-        if (mAuthTask != null) {
-            return;
-        }
-
-        // Reset errors.
-        mEmailView.setError(null);
-        mPasswordView.setError(null);
-
-        // Store values at the time of the login attempt.
-        String email = mEmailView.getText().toString();
-        String password = mPasswordView.getText().toString();
-
-        boolean cancel = false;
-        View focusView = null;
-
-        // Check for a valid password, if the user entered one.
-        if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
-            mPasswordView.setError(getString(R.string.error_invalid_password));
-            focusView = mPasswordView;
-            cancel = true;
-        }
-
-        // Check for a valid email address.
-        if (TextUtils.isEmpty(email)) {
-            mEmailView.setError(getString(R.string.error_field_required));
-            focusView = mEmailView;
-            cancel = true;
-        } else if (!isEmailValid(email)) {
-            mEmailView.setError(getString(R.string.error_invalid_email));
-            focusView = mEmailView;
-            cancel = true;
-        }
-
-        if (cancel) {
-            // There was an error; don't attempt login and focus the first
-            // form field with an error.
-            focusView.requestFocus();
-        } else {
-            // Show a progress spinner, and kick off a background task to
-            // perform the user login attempt.
-            showProgress(true);
-            mAuthTask = new UserLoginTask(email, password);
-            mAuthTask.execute((Void) null);
-        }
-    }
-
-    private boolean isEmailValid(String email) {
-        //TODO: Replace this with your own logic
-        return email.contains("@");
-    }
-
-    private boolean isPasswordValid(String password) {
-        //TODO: Replace this with your own logic
-        return password.length() > 4;
-    }
-
-    /**
-     * Shows the progress UI and hides the login form.
-     */
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
-    private void showProgress(final boolean show) {
-        // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
-        // for very easy animations. If available, use these APIs to fade-in
-        // the progress spinner.
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
-            int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
-
-            mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
-            mLoginFormView.animate().setDuration(shortAnimTime).alpha(
-                    show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationEnd(Animator animation) {
-                    mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
-                }
-            });
-
-            mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
-            mProgressView.animate().setDuration(shortAnimTime).alpha(
-                    show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationEnd(Animator animation) {
-                    mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
-                }
-            });
-        } else {
-            // The ViewPropertyAnimator APIs are not available, so simply show
-            // and hide the relevant UI components.
-            mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
-            mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
-        }
-    }
-
-    @Override
-    public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
-        return new CursorLoader(this,
-                // Retrieve data rows for the device user's 'profile' contact.
-                Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
-                        ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
-
-                // Select only email addresses.
-                ContactsContract.Contacts.Data.MIMETYPE +
-                        " = ?", new String[]{ContactsContract.CommonDataKinds.Email
-                .CONTENT_ITEM_TYPE},
-
-                // Show primary email addresses first. Note that there won't be
-                // a primary email address if the user hasn't specified one.
-                ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
-    }
-
-    @Override
-    public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
-        List<String> emails = new ArrayList<>();
-        cursor.moveToFirst();
-        while (!cursor.isAfterLast()) {
-            emails.add(cursor.getString(ProfileQuery.ADDRESS));
-            cursor.moveToNext();
-        }
-
-        addEmailsToAutoComplete(emails);
-    }
-
-    @Override
-    public void onLoaderReset(Loader<Cursor> cursorLoader) {
-
-    }
-
-    private void addEmailsToAutoComplete(List<String> emailAddressCollection) {
-        //Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
-        ArrayAdapter<String> adapter =
-                new ArrayAdapter<>(LoginActivity.this,
-                        android.R.layout.simple_dropdown_item_1line, emailAddressCollection);
-
-        mEmailView.setAdapter(adapter);
-    }
-
-
-    private interface ProfileQuery {
-        String[] PROJECTION = {
-                ContactsContract.CommonDataKinds.Email.ADDRESS,
-                ContactsContract.CommonDataKinds.Email.IS_PRIMARY,
-        };
-
-        int ADDRESS = 0;
-        int IS_PRIMARY = 1;
-    }
-
-    /**
-     * Represents an asynchronous login/registration task used to authenticate
-     * the user.
-     */
-    public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
-
-        private final String mEmail;
-        private final String mPassword;
-
-        UserLoginTask(String email, String password) {
-            mEmail = email;
-            mPassword = password;
-        }
-
-        @Override
-        protected Boolean doInBackground(Void... params) {
-            // TODO: attempt authentication against a network service.
-
-            try {
-                // Simulate network access.
-                Thread.sleep(2000);
-            } catch (InterruptedException e) {
-                return false;
-            }
-
-            for (String credential : DUMMY_CREDENTIALS) {
-                String[] pieces = credential.split(":");
-                if (pieces[0].equals(mEmail)) {
-                    // Account exists, return true if the password matches.
-                    return pieces[1].equals(mPassword);
-                }
-            }
-
-            // TODO: register the new account here.
-            return true;
-        }
-
-        @Override
-        protected void onPostExecute(final Boolean success) {
-            mAuthTask = null;
-            showProgress(false);
-
-            if (success) {
-                finish();
-            } else {
-                mPasswordView.setError(getString(R.string.error_incorrect_password));
-                mPasswordView.requestFocus();
-            }
-        }
-
-        @Override
-        protected void onCancelled() {
-            mAuthTask = null;
-            showProgress(false);
-        }
-    }
-}
-
diff --git a/gui/src/main/res/layout/activity_login.xml b/gui/src/main/res/layout/activity_login.xml
deleted file mode 100644
index 2f36eb6..0000000
--- a/gui/src/main/res/layout/activity_login.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:gravity="center_horizontal"
-    android:orientation="vertical"
-    android:paddingLeft="@dimen/activity_horizontal_margin"
-    android:paddingTop="@dimen/activity_vertical_margin"
-    android:paddingRight="@dimen/activity_horizontal_margin"
-    android:paddingBottom="@dimen/activity_vertical_margin"
-    tools:context=".LoginActivity">
-
-    <!-- Login progress -->
-    <ProgressBar
-        android:id="@+id/login_progress"
-        style="?android:attr/progressBarStyleLarge"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginBottom="8dp"
-        android:visibility="gone" />
-
-    <ScrollView
-        android:id="@+id/login_form"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <LinearLayout
-            android:id="@+id/email_login_form"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical">
-
-            <android.support.design.widget.TextInputLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-
-                <AutoCompleteTextView
-                    android:id="@+id/email"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:hint="@string/prompt_email"
-                    android:inputType="textEmailAddress"
-                    android:maxLines="1"
-                    android:singleLine="true" />
-
-            </android.support.design.widget.TextInputLayout>
-
-            <android.support.design.widget.TextInputLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-
-                <EditText
-                    android:id="@+id/password"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:hint="@string/prompt_password"
-                    android:imeActionId="6"
-                    android:imeActionLabel="@string/action_sign_in_short"
-                    android:imeOptions="actionUnspecified"
-                    android:inputType="textPassword"
-                    android:maxLines="1"
-                    android:singleLine="true" />
-
-            </android.support.design.widget.TextInputLayout>
-
-            <Button
-                android:id="@+id/email_sign_in_button"
-                style="?android:textAppearanceSmall"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="16dp"
-                android:text="@string/action_sign_in"
-                android:textStyle="bold" />
-
-        </LinearLayout>
-    </ScrollView>
-</LinearLayout>
\ No newline at end of file
diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml
index 7ee1bcd..dac7f3a 100644
--- a/mobile/src/main/AndroidManifest.xml
+++ b/mobile/src/main/AndroidManifest.xml
@@ -24,12 +24,6 @@
         </activity>
 
         <service android:name="org.eclipse.paho.android.service.MqttService" />
-
-        <activity
-            android:name=".Main2Activity"
-            android:label="SensorSharing" />
-        <activity android:name=".Main3Activity" />
-        <activity android:name=".content_main" />
     </application>
 
 </manifest>
\ No newline at end of file
diff --git a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java
index b13723a..4914e90 100644
--- a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java
+++ b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java
@@ -23,7 +23,9 @@ import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.EditText;
+import android.widget.SeekBar;
 import android.widget.Spinner;
+import android.widget.Switch;
 import android.widget.TextView;
 import android.widget.Toast;
 import android.widget.ToggleButton;
@@ -51,6 +53,7 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -70,7 +73,10 @@ import de.tudresden.inf.st.sensorsharing.settings.AppSettings;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.BASE_KEY;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.BASE_KEY_LENGTH;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.MQTT_CHARSET;
+import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_AMBIENT_PRESSURE;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_BRIGHTNESS;
+import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_COUNTER;
+import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_HEART_RATE;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_LINEAR_ACCELERATION;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_NAME;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_ROTATION_VECTOR;
@@ -92,24 +98,11 @@ public class MainActivity extends AppCompatActivity implements
 
     }
 
+    //in/E_Motion_Detector/state CLOSED
+
     private static final String TAG = "SensorSharing";
 //    private static final String MQTT_TOPIC_SAMSUNG = "sensors/samsung/brightness";
-    //boqi add
-    private static final String MQTT_TOPIC_USER1 = "oh2/in/user1/state";
-    private static final String MQTT_TOPIC_USER2 = "oh2/in/user2/state";
-    //private static final String MQTT_TOPIC_USER1_BRIGHTNESS = "oh2/in/user1_brightness/state";
-    //private static final String MQTT_TOPIC_USER2_BRIGHTNESS = "oh2/in/user1_brightness/state";
-    private static final String MQTT_TOPIC_IRIS1_ITEM = "oh2/in/iris1_item/state";
-    private static final String MQTT_TOPIC_DATETIME_MONTH = "oh2/in/datetime/month";
-    private static final String MQTT_TOPIC_DATETIME_DAY = "oh2/in/datetime/day";
-    private static final String MQTT_TOPIC_DATETIME_HOUR = "oh2/in/datetime/hour";
-    private static final String MQTT_TOPIC_DATETIME_MINUTE = "oh2/in/datetime/minute";
-    //variable for the on/off user
-    private static String user1_status = "off";
-    private static String user2_status = "off";
-    //for shake action
-    private static int i = 0; //user 1 shake action
-    private static int j = 0; //user 2 shake action
+    private static int return_value_seekbar = 0;
     // sensor management
     private SensorManager mSensorManager;
     private Sensor mLight;
@@ -144,13 +137,6 @@ public class MainActivity extends AppCompatActivity implements
     private String clientId;
     private AppSettings settings;
     MadgwickAHRS filter;
-    //BOQI ADD
-    ToggleButton user1;
-    ToggleButton user2;
-    Button sendbutton1;
-    Button sendbutton2;
-    Spinner drop1;
-    Spinner drop2;
     Button mqtt_button;
 
     private EditText valueServerURI;
@@ -235,7 +221,6 @@ public class MainActivity extends AppCompatActivity implements
         super.onStart();
         initViews();
         updateWearStatus(false);
-
     }
 
     @Override
@@ -271,7 +256,7 @@ public class MainActivity extends AppCompatActivity implements
     };
 
     private void initViews() {
-        //setName();
+        setName();
         valueServerURI = findViewById(R.id.value_server_uri);
 
         String mqttServer = settings.get(SETTINGS_MQTT_SERVER, getResources().getString(R.string.default_mqtt_server_uri));
@@ -284,160 +269,140 @@ public class MainActivity extends AppCompatActivity implements
                 connectMqtt(view);
             }
         });
-        //inital for the drop box menu
-        user1=findViewById(R.id.user_1_button);
-        user2=findViewById(R.id.user_2_button);
-        sendbutton1 =findViewById(R.id.send_button_1);
-        sendbutton2=findViewById(R.id.send_button_2);
-        drop1=findViewById(R.id.drop_1);
-        drop2=findViewById(R.id.drop_2);
-        String[] items = new String[]{"OFF", "DIM", "MEDIUM", "BRIGHT"};
-        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items);
-        drop1.setAdapter(adapter);
-        drop2.setAdapter(adapter);
-        drop1.setEnabled(false);
-        drop2.setEnabled(false);
-        sendbutton1.setEnabled(false);
-        sendbutton2.setEnabled(false);
-
-        user1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
-            @Override
-            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-                if (isChecked){
-                    user1_status="on";
-                    sendMqttUpdates.put(MQTT_TOPIC_USER1,true);
-                    sendUpdate(MQTT_TOPIC_USER1, "ON");
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MONTH,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[0]);
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_DAY,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[1]);
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_HOUR,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[2]);
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[3]);
-                    //set up for buttons
-                    user2.setEnabled(false);
-                    sendbutton2.setEnabled(false);
-                    sendbutton1.setEnabled(true);
-                    drop1.setEnabled(true);
-                    sendbutton1.setOnClickListener(new View.OnClickListener() {
-                        @Override
-                        public void onClick(View view) {
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MONTH,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[0]);
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_DAY,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[1]);
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_HOUR,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[2]);
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[3]);
-                            //send datetime
-                            String userBrightness= drop1.getSelectedItem().toString();
-                            //sendUserId("user1",edittext1.getText().toString());
-                            sendMqttUpdates.put(MQTT_TOPIC_IRIS1_ITEM,true);
-                            sendUpdate(MQTT_TOPIC_IRIS1_ITEM, getBrigtnessValue(userBrightness));
-                        }
-                    });
+        setupLightsController();
+        setupSendUpdatesCheckbox();
+        setupLightsController();
+    }
 
-                }else{
-                        user1_status="off";
-                        sendMqttUpdates.put(MQTT_TOPIC_USER1,true);
-                        sendUpdate(MQTT_TOPIC_USER1, "OFF");
-                        user2.setEnabled(true);
-                        drop1.setEnabled(false);
-                        drop2.setEnabled(false);
-                        sendbutton1.setEnabled(false);
-                        sendbutton2.setEnabled(false);}
-            }
+    private void setupLightsController(){
 
+        final String openhab_topic = "oh2/out/iris1_item/state";
+        final String home_e_lights_topic = "out/E_Lights_Analog/state";
+        final String home_d_lights_1_topic = "out/D_Lights_1_Analog/state";
+        final String home_d_lights_2_topic = "out/D_Lights_2_Analog/state";
+        final String home_g_lights_topic = "out/G_Lights_Analog/state";
 
-        });
-        user2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+        final CheckBox hue_1 = findViewById(R.id.checkbox_openhab_light_1);
+        final CheckBox e_lights = findViewById(R.id.checkbox_e_lights);
+        final CheckBox d_lights1 = findViewById(R.id.checkbox_d_lights_1);
+        final CheckBox d_lights2= findViewById(R.id.checkbox_d_lights_2);
+        final CheckBox g_lights = findViewById(R.id.checkbox_g_lights);
+
+        CompoundButton.OnCheckedChangeListener onCheckedChangeListener= new CompoundButton.OnCheckedChangeListener() {
             @Override
-            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-                if (isChecked){
-                    user2_status="on";
-                    sendMqttUpdates.put(MQTT_TOPIC_USER2,true);
-                    sendUpdate(MQTT_TOPIC_USER2, "ON");
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MONTH,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[0]);
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_DAY,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[1]);
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_HOUR,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[2]);
-                    sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true);
-                    sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[3]);
-                    user1.setEnabled(false);
-                    sendbutton1.setEnabled(false);
-                    sendbutton2.setEnabled(true);
-                    drop2.setEnabled(true);
-                    sendbutton2.setOnClickListener(new View.OnClickListener() {
-                        @Override
-                        public void onClick(View view) {
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MONTH,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[0]);
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_DAY,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[1]);
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_HOUR,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[2]);
-                            sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true);
-                            sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[3]);
-                            //send preferences
-                            String userBrightness= drop2.getSelectedItem().toString();
-                            sendMqttUpdates.put(MQTT_TOPIC_IRIS1_ITEM,true);
-                            sendUpdate(MQTT_TOPIC_IRIS1_ITEM, getBrigtnessValue(userBrightness));
-                        }
-                    });
-                }else {
-                        user2_status="off";
-                        sendMqttUpdates.put(MQTT_TOPIC_USER2,true);
-                        sendUpdate(MQTT_TOPIC_USER2, "OFF");
-                        user1.setEnabled(true);
-                        drop1.setEnabled(false);
-                        drop2.setEnabled(false);
-                        sendbutton1.setEnabled(false);
-                        sendbutton2.setEnabled(false);}
-            }
-        });
-        setupSendUpdatesCheckbox();
-    }
+            public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
+                switch (compoundButton.getId()){
+                    case R.id.checkbox_openhab_light_1:
+                        sendMqttUpdates.put(openhab_topic, isChecked);
+                        SeekBar openhab_seekbar = findViewById(R.id.openhab_seekBar_1);
+                        openhab_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+                            @Override
+                            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                                System.out.println("seekbar:" +i);
+                                sendUpdate(openhab_topic,String.valueOf(i));
+                            }
+
+                            @Override
+                            public void onStartTrackingTouch(SeekBar seekBar) {
+                                System.out.println("start tracking");
+                            }
+
+                            @Override
+                            public void onStopTrackingTouch(SeekBar seekBar) {
+                                System.out.println("stop tracking");
+                            }
+                        });
+                        break;
+                    case R.id.checkbox_e_lights:
+                        sendMqttUpdates.put(home_e_lights_topic, isChecked);
+                        SeekBar e_lights_seekbar = findViewById(R.id.e_lights_seekbar);
+                        e_lights_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+                            @Override
+                            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                                sendUpdate(home_e_lights_topic,String.valueOf(i));
+                            }
 
- //the value for send to iris hue
-    private String getBrigtnessValue(String Brightness){
-        String BrightnessValue= "";
-        if(Brightness.equals("OFF")){
-            BrightnessValue="0";
-        }else if(Brightness.equals("DIM")){
-            BrightnessValue="25";
-        }
-        else if(Brightness.equals("MEDIUM")){
-            BrightnessValue="60";
-        }
-        else if(Brightness.equals("BRIGHT")) {
-            BrightnessValue="90";}
-        return BrightnessValue;
-    }
+                            @Override
+                            public void onStartTrackingTouch(SeekBar seekBar) {
 
- //get input datas from mobil in system month
-    private String [] getDateTime(){
-        DateFormat df = new SimpleDateFormat("MM:dd:HH:mm");
-        String date = df.format(Calendar.getInstance().getTime());
-        String[] datetime_split= new String[5];
-        datetime_split=date.split(":");
-        return datetime_split;
-    }
+                            }
 
-    /**private void sendLightOnOffUpdateOfSmartphone(boolean state) {
-        ObjectMapper mapper = new ObjectMapper();
-        HashMap<String, Boolean> dataLight = new HashMap<>();
-        dataLight.put("on", state);
-        try {
-            String s = mapper.writeValueAsString(dataLight);
-            sendUpdate(phoneTopics.mqtt_topic_onoff, s);
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-        }
-    }*/
+                            @Override
+                            public void onStopTrackingTouch(SeekBar seekBar) {
+
+                            }
+                        });
+                        break;
+                    case R.id.checkbox_d_lights_1:
+                        SeekBar d_lights1_seekbar = findViewById(R.id.d_lights1_seekbar);
+                        d_lights1_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+                            @Override
+                            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                                sendUpdate(home_d_lights_1_topic, String.valueOf(i));
+                            }
+
+                            @Override
+                            public void onStartTrackingTouch(SeekBar seekBar) {
+
+                            }
+
+                            @Override
+                            public void onStopTrackingTouch(SeekBar seekBar) {
+
+                            }
+                        });
+                        sendMqttUpdates.put(home_d_lights_1_topic, isChecked);
+                        break;
+                    case R.id.checkbox_d_lights_2:
+                        SeekBar d_lights2_seebar = findViewById(R.id.d_lights2_seekbar);
+                        d_lights2_seebar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+                            @Override
+                            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                                sendUpdate(home_d_lights_2_topic, String.valueOf(i));
+                            }
+
+                            @Override
+                            public void onStartTrackingTouch(SeekBar seekBar) {
+
+                            }
+
+                            @Override
+                            public void onStopTrackingTouch(SeekBar seekBar) {
+
+                            }
+                        });
+                        sendMqttUpdates.put(home_d_lights_2_topic, isChecked);
+                        break;
+                    case R.id.checkbox_g_lights:
+                        SeekBar g_lights_seekbar = findViewById(R.id.g_lights_seekbar);
+                        g_lights_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+                            @Override
+                            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                                sendUpdate(home_g_lights_topic, String.valueOf(i));
+                            }
+
+                            @Override
+                            public void onStartTrackingTouch(SeekBar seekBar) {
+
+                            }
+
+                            @Override
+                            public void onStopTrackingTouch(SeekBar seekBar) {
+
+                            }
+                        });
+                        sendMqttUpdates.put(home_g_lights_topic, isChecked);
+                        break;
+
+                }
+            }
+        };
+        hue_1.setOnCheckedChangeListener(onCheckedChangeListener);
+        e_lights.setOnCheckedChangeListener(onCheckedChangeListener);
+        d_lights1.setOnCheckedChangeListener(onCheckedChangeListener);
+        d_lights2.setOnCheckedChangeListener(onCheckedChangeListener);
+        g_lights.setOnCheckedChangeListener(onCheckedChangeListener);
+    }
 
     private void updateMqttTopics(String wearableName) {
         // moto: "Moto 360"
@@ -460,19 +425,23 @@ public class MainActivity extends AppCompatActivity implements
         final CheckBox sendUpdates = findViewById(R.id.checkBox_send_brightness);
         final CheckBox sendUpdatesRotation = findViewById(R.id.checkBox_send_rotation_ahrs);
         final CheckBox sendUpdatesRotationQuat = findViewById(R.id.checkBox_send_rotation_quaternion);
-        //checkbox for wearable
+
         final CheckBox sendUpdatesWearBrightness = findViewById(R.id.checkBox_send_wear_brightness);
         final CheckBox sendUpdatesWearAcc= findViewById(R.id.checkBox_send_wear_acceleration);
         final CheckBox sendUpdatesWearRotation= findViewById(R.id.checkBox_send_wear_rotation);
+        final CheckBox sendUpdatesWearAirPressure = findViewById(R.id.checkBox_send_wear_air_pressure);
+        final CheckBox sendUpdatesWearHeartRate = findViewById(R.id.checkBox_send_wear_heart_rate);
+        final CheckBox sendUpdatesStepCounter = findViewById(R.id.checkBox_send_wear_counter);
 
         sendMqttUpdates.put(phoneTopics.mqtt_topic_brightness, sendUpdates.isChecked());
         sendMqttUpdates.put(phoneTopics.mqtt_topic_rotation_ahrs, sendUpdatesRotation.isChecked());
         sendMqttUpdates.put(phoneTopics.mqtt_topic_rotation, sendUpdatesRotationQuat.isChecked());
-        //checkbox for wearable
+
         sendMqttUpdates.put(wearTopics.mqtt_topic_brightness, sendUpdatesWearBrightness.isChecked());
         sendMqttUpdates.put(wearTopics.mqtt_topic_acceleration, sendUpdatesWearAcc.isChecked());
         sendMqttUpdates.put(wearTopics.mqtt_topic_rotation, sendUpdatesWearRotation.isChecked());
-
+        sendMqttUpdates.put(wearTopics.mqtt_topic_air_pressure, sendUpdatesWearAirPressure.isChecked());
+        sendMqttUpdates.put(wearTopics.mqtt_topic_step_counter, sendUpdatesStepCounter.isChecked());
 
         CompoundButton.OnCheckedChangeListener onCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
             @Override
@@ -492,10 +461,19 @@ public class MainActivity extends AppCompatActivity implements
                         sendMqttUpdates.put(wearTopics.mqtt_topic_brightness, sendUpdatesWearBrightness.isChecked());
                         break;
                     case R.id.checkBox_send_wear_acceleration:
-                        sendMqttUpdates.put(wearTopics.mqtt_topic_acceleration, sendUpdatesWearBrightness.isChecked());
+                        sendMqttUpdates.put(wearTopics.mqtt_topic_acceleration, sendUpdatesWearAcc.isChecked());
                         break;
                     case R.id.checkBox_send_wear_rotation:
-                        sendMqttUpdates.put(wearTopics.mqtt_topic_rotation, sendUpdatesWearBrightness.isChecked());
+                        sendMqttUpdates.put(wearTopics.mqtt_topic_rotation, sendUpdatesWearRotation.isChecked());
+                        break;
+                    case R.id.checkBox_send_wear_air_pressure:
+                        sendMqttUpdates.put(wearTopics.mqtt_topic_air_pressure, sendUpdatesWearAirPressure.isChecked());
+                        break;
+                    case R.id.checkBox_send_wear_heart_rate:
+                        sendMqttUpdates.put(wearTopics.mqtt_topic_wear_hear_rate, sendUpdatesWearHeartRate.isChecked());
+                        break;
+                    case R.id.checkBox_send_wear_counter:
+                        sendMqttUpdates.put(wearTopics.mqtt_topic_step_counter, sendUpdatesStepCounter.isChecked());
                         break;
                 }
             }
@@ -506,11 +484,15 @@ public class MainActivity extends AppCompatActivity implements
         sendUpdatesWearBrightness.setOnCheckedChangeListener(onCheckedChangeListener);
         sendUpdatesWearAcc.setOnCheckedChangeListener(onCheckedChangeListener);
         sendUpdatesWearRotation.setOnCheckedChangeListener(onCheckedChangeListener);
+        sendUpdatesStepCounter.setOnCheckedChangeListener(onCheckedChangeListener);
+        sendUpdatesWearHeartRate.setOnCheckedChangeListener(onCheckedChangeListener);
+        sendUpdatesWearAirPressure.setOnCheckedChangeListener(onCheckedChangeListener);
     }
 
     private void setName() {
         TextView ownName = findViewById(R.id.value_own_name);
         TextView wearName = findViewById(R.id.value_wear_name);
+        System.out.println("test model"+Build.MODEL);
         ownName.setText(Build.MODEL);
 
     }
@@ -544,6 +526,7 @@ public class MainActivity extends AppCompatActivity implements
         Toast.makeText(MainActivity.this, "Connecting to " + serverURI,
                 Toast.LENGTH_SHORT).show();
         mqttAndroidClient = new MqttAndroidClient(this, serverURI, clientId);
+
         mqttAndroidClient.setCallback(new MqttCallback() {
             @Override
             public void connectionLost(Throwable cause) {
@@ -571,6 +554,73 @@ public class MainActivity extends AppCompatActivity implements
                         @Override
                         public void onSuccess(IMqttToken asyncActionToken) {
                             Log.i(TAG, "Successfully connected to " + serverURI);
+
+                            try{mqttAndroidClient.subscribe("in/#",MQTT_DEFAULT_QOS);}catch (MqttException e){
+                               System.out.println("subscribe not successful");
+                            }
+                           mqttAndroidClient.setCallback(new MqttCallback() {
+                                @Override
+                                public void connectionLost(Throwable cause) {
+
+                                }
+
+                                @Override
+                                public void messageArrived(String topic, MqttMessage message) throws Exception {
+                                    String status_message= new String(message.getPayload());
+
+                                    System.out.println(" Topic:\t" + topic +
+                                            " Message:\t" + status_message +" QoS:\t" + message.getQos() );
+                                    if (topic.equals("in/E_Motion_Detector/state") && status_message.equals("OPEN")){
+                                        System.out.println("hhhhhhh");
+                                        TextView textView = findViewById(R.id.room_name);
+                                        textView.setText("Entrance Room");
+                                    } else if (topic.equals("in/G_Motion_Detector/state") && status_message.equals("OPEN")){
+                                        System.out.println("uuuuu");
+                                        TextView textView = findViewById(R.id.room_name);
+                                        textView.setText("Bedroom Corridor");
+                                    } else if(topic.equals("in/D_Motion_Detector/state") && status_message.equals("OPEN")){
+                                        TextView textView = findViewById(R.id.room_name);
+                                        textView.setText("Kitchen");
+                                    }
+                                    SeekBar current_seekbar = findViewById(R.id.seekBar1);
+                                    current_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+                                        @Override
+                                        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                                            TextView textView = findViewById(R.id.room_name);
+                                            String room = textView.getText().toString();
+                                            if(room.equals("Entrance Room")){
+                                                System.out.println("i want control entrance room" + String.valueOf(i));
+                                                sendMqttUpdates.put("out/E_Lights_Analog/state",true);
+                                                sendUpdate("out/E_Lights_Analog/state",String.valueOf(i));
+                                            }else if(room.equals("Bedroom Corridor")){
+                                                sendMqttUpdates.put("out/G_Lights_Analog/state",true);
+                                                sendUpdate("out/G_Lights_Analog/state",String.valueOf(i));
+                                            }else if(room.equals("Kitchen")){
+                                                sendMqttUpdates.put("out/D_Lights_1_Analog/state",true);
+                                                sendMqttUpdates.put("out/D_Lights_2_Analog/state",true);
+                                                sendUpdate("out/D_Lights_1_Analog/state",String.valueOf(i));
+                                                sendUpdate("out/D_Lights_2_Analog/state",String.valueOf(i));
+                                            }
+                                        }
+
+                                        @Override
+                                        public void onStartTrackingTouch(SeekBar seekBar) {
+
+                                        }
+
+                                        @Override
+                                        public void onStopTrackingTouch(SeekBar seekBar) {
+
+                                        }
+                                    });
+                                }
+
+
+                                @Override
+                                public void deliveryComplete(IMqttDeliveryToken token) {
+
+                                }
+                            });
                         }
 
                         @Override
@@ -596,7 +646,13 @@ public class MainActivity extends AppCompatActivity implements
             text = "Disconnected since %s";
         }
         TextView wearStatus = findViewById(R.id.value_wear_status);
-        wearStatus.setText(String.format(text, dateTimeFormat.format(lastMessageFromWearable)));
+        System.out.println("Test debug"+String.format(text, dateTimeFormat.format(lastMessageFromWearable)));
+        System.out.println("wear status object"+wearStatus);
+        //TODO:
+        try{
+            wearStatus.setText(String.format(text, dateTimeFormat.format(lastMessageFromWearable)));
+        }catch (NullPointerException e){System.out.println(e);}
+
     }
 
     @Override
@@ -616,60 +672,6 @@ public class MainActivity extends AppCompatActivity implements
                 break;
             case Sensor.TYPE_ACCELEROMETER:
                 accelVectorValues = sensorEvent.values;
-                //boqi
-                float x = accelVectorValues[0];
-                float y = accelVectorValues[1];
-                float z = accelVectorValues[2];
-                if (Math.abs(x) > 17 || Math.abs(y) > 17 || Math
-                    .abs(z) > 17){
-                    drop1=findViewById(R.id.drop_1);
-                    drop2=findViewById(R.id.drop_2);
-                    if (user1_status.equals("on")){
-                        i++;
-                        if (i==1){
-                            drop1.setSelection(0);
-
-                        }else if(i==2){
-                            drop1.setSelection(1);
-                        }
-                        else if (i==3){
-                            drop1.setSelection(2);
-                        }
-                        else if (i==4){
-                            drop1.setSelection(3);
-                        }
-                        else {
-                            i=0;
-                            drop1.setSelection(0);}
-                    }else if (user1_status.equals("off")){
-                        i=0;
-                        drop1.setSelection(0);
-                    }
-                    if(user2_status.equals("on")){
-                        j++;
-                        if (j == 1){
-                            drop2.setSelection(0);
-
-                        }else if(j == 2){
-                            drop2.setSelection(1);
-
-                        }
-                        else if (j == 3){
-                            drop2.setSelection(2);
-
-                        }
-                        else if (j == 4){
-                            drop2.setSelection(3);
-                        }
-                        else {j=0;
-                            drop2.setSelection(0);}
-
-                    }else if (user2_status.equals("off")){
-                        j = 0;
-                        drop2.setSelection(0);
-                    }
-                }
-                break;
             case Sensor.TYPE_GYROSCOPE:
                 gyroVectorValues = sensorEvent.values;
                 break;
@@ -726,6 +728,24 @@ public class MainActivity extends AppCompatActivity implements
             final byte[] bytesToSendViaMqtt = messageEvent.getData();
 
             switch (path.substring(BASE_KEY_LENGTH)) {
+                case SUB_KEY_COUNTER:
+                    float mCounter = ByteBuffer.wrap(messageEvent.getData()).getFloat();
+                    updatedValue = Float.toString(mCounter);
+                    textViewToUpdate = findViewById(R.id.value_wear_counter);
+                    topic = wearTopics.mqtt_topic_step_counter;
+                    break;
+                case SUB_KEY_AMBIENT_PRESSURE:
+                    float mAmbientPressure = ByteBuffer.wrap(messageEvent.getData()).getFloat();
+                    updatedValue = Float.toString(mAmbientPressure);
+                    textViewToUpdate = findViewById(R.id.value_wear_pressure);
+                    topic = wearTopics.mqtt_topic_air_pressure;
+                    break;
+                case SUB_KEY_HEART_RATE:
+                    float mHeatBeatValues = ByteBuffer.wrap(messageEvent.getData()).getFloat();
+                    updatedValue=Float.toString(mHeatBeatValues);
+                    textViewToUpdate = findViewById(R.id.value_wear_heart_rate);
+                    topic = wearTopics.mqtt_topic_wear_hear_rate;
+                    break;
                 case SUB_KEY_BRIGHTNESS:
                     float mWearBrightness = ByteBuffer.wrap(messageEvent.getData()).getFloat();
                     updatedValue = Float.toString(mWearBrightness);
@@ -864,6 +884,7 @@ public class MainActivity extends AppCompatActivity implements
 
     private void sendUpdate(String topic, byte[] bytes) {
         if (sendMqttUpdates.get(topic) == null || !sendMqttUpdates.get(topic)) {
+
             return;
         }
         if (mqttAndroidClient == null) {
diff --git a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MqttTopics.java b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MqttTopics.java
index 4ada913..f0c940d 100644
--- a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MqttTopics.java
+++ b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MqttTopics.java
@@ -6,6 +6,9 @@ public class MqttTopics {
     public final String mqtt_topic_acceleration;
     public final String mqtt_topic_rotation;
     public final String mqtt_topic_rotation_ahrs;
+    public final String mqtt_topic_wear_hear_rate;
+    public final String mqtt_topic_air_pressure;
+    public final String mqtt_topic_step_counter;
     public final String mqtt_topic_onoff;
 
     public MqttTopics(String subTopic) {
@@ -14,5 +17,9 @@ public class MqttTopics {
         mqtt_topic_rotation = MQTT_TOPIC_BASE + subTopic + "/rotation";
         mqtt_topic_rotation_ahrs = MQTT_TOPIC_BASE + subTopic + "/rotationahrs";
         mqtt_topic_onoff = MQTT_TOPIC_BASE + subTopic + "/onoff";
+        // wear topic
+        mqtt_topic_wear_hear_rate = MQTT_TOPIC_BASE + subTopic +"/heart_rate";
+        mqtt_topic_air_pressure = MQTT_TOPIC_BASE + subTopic + "/air_pressure";
+        mqtt_topic_step_counter =MQTT_TOPIC_BASE +subTopic+"/step_counter";
     }
 }
diff --git a/mobile/src/main/res/layout/activity_main.xml b/mobile/src/main/res/layout/activity_main.xml
index 70cd76e..f2f3183 100644
--- a/mobile/src/main/res/layout/activity_main.xml
+++ b/mobile/src/main/res/layout/activity_main.xml
@@ -7,7 +7,9 @@
     tools:context="de.tudresden.inf.st.sensorsharing.MainActivity">
         <ScrollView
             android:layout_width="match_parent"
-            android:layout_height="wrap_content">
+            android:layout_height="wrap_content"
+
+            app:layout_constraintTop_toTopOf="parent">
                 <!-- Fragments Container -->
                 <include
                     layout="@layout/fragment_content_main"
@@ -24,5 +26,6 @@
             android:background="?android:attr/windowBackground"
             app:menu="@menu/navigation"
             app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
             tools:layout_editor_absoluteY="396dp" />
     </android.support.constraint.ConstraintLayout>
diff --git a/mobile/src/main/res/layout/fragment_first.xml b/mobile/src/main/res/layout/fragment_first.xml
index 773be68..1522056 100644
--- a/mobile/src/main/res/layout/fragment_first.xml
+++ b/mobile/src/main/res/layout/fragment_first.xml
@@ -77,9 +77,11 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="8dp"
-            android:background="@android:color/darker_gray"
+            android:background="@android:color/holo_blue_light"
+            android:textColor="@android:color/white"
             android:text="@string/text_separator_smartphone_values"
             app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toTopOf="@id/label_own_name"
             app:layout_constraintHorizontal_bias="0.0"
             app:layout_constraintStart_toStartOf="parent" />
 
@@ -89,7 +91,8 @@
             android:layout_width="match_parent"
             android:layout_height="21dp"
             android:layout_marginTop="32dp"
-            android:background="@android:color/darker_gray"
+            android:background="@android:color/holo_blue_light"
+            android:textColor="@android:color/white"
             android:text="@string/text_separator_wear_values"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintHorizontal_bias="0.0"
@@ -196,6 +199,63 @@
             android:text="@string/status"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/separator_wear" />
+        <TextView
+            android:id="@+id/label_wear_heart_rate"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:text="@string/heart_rate"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/label_wear_rotation" />
+        <TextView
+            android:id="@+id/value_wear_heart_rate"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:text="@android:string/unknownName"
+            app:layout_constraintTop_toBottomOf="@+id/label_wear_rotation"
+            app:layout_constraintLeft_toRightOf="@id/label_wear_heart_rate"/>
+
+        <TextView
+            android:id="@+id/label_wear_pressure"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:text="Air Pressure"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/label_wear_heart_rate" />
+        <TextView
+            android:id="@+id/value_wear_pressure"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:text="@android:string/unknownName"
+            app:layout_constraintTop_toBottomOf="@+id/label_wear_heart_rate"
+            app:layout_constraintLeft_toRightOf="@id/label_wear_pressure"/>
+        <TextView
+            android:id="@+id/label_wear_counter"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:text="Step Counter"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/label_wear_pressure" />
+
+        <TextView
+            android:id="@+id/value_wear_counter"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:text="@android:string/unknownName"
+            app:layout_constraintTop_toBottomOf="@+id/label_wear_pressure"
+            app:layout_constraintLeft_toRightOf="@id/label_wear_counter"/>
+
     </android.support.constraint.ConstraintLayout>
 
 </FrameLayout>
\ No newline at end of file
diff --git a/mobile/src/main/res/layout/fragment_second.xml b/mobile/src/main/res/layout/fragment_second.xml
index a8c27d2..ecca488 100644
--- a/mobile/src/main/res/layout/fragment_second.xml
+++ b/mobile/src/main/res/layout/fragment_second.xml
@@ -15,11 +15,13 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="8dp"
-            android:background="@android:color/darker_gray"
+            android:background="@android:color/holo_blue_light"
+            android:textColor="@android:color/white"
             android:text="@string/text_mqtt_server_uri"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintHorizontal_bias="0.0"
-            app:layout_constraintStart_toStartOf="parent" />
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintBottom_toTopOf="@id/button"/>
         <Button
             android:id="@+id/button"
             android:layout_width="wrap_content"
@@ -27,6 +29,8 @@
             android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
             android:text="@android:string/ok"
+            android:background="@android:color/holo_blue_light"
+            android:textColor="@android:color/white"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/separator_mqtt" />
         <EditText
@@ -95,7 +99,6 @@
             android:text="@string/send_updates_wear_acceleration"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_brightness" />
-
         <CheckBox
             android:id="@+id/checkBox_send_wear_rotation"
             android:layout_width="wrap_content"
@@ -104,6 +107,31 @@
             android:text="@string/send_updates_wear_rotation"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_acceleration" />
+
+        <CheckBox
+            android:id="@+id/checkBox_send_wear_air_pressure"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:text="Send Updates Wearable Air Pressure"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_rotation" />
+        <CheckBox
+            android:id="@+id/checkBox_send_wear_counter"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:text="Send Updates Wearable Step Counter"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_air_pressure" />
+        <CheckBox
+            android:id="@+id/checkBox_send_wear_heart_rate"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:text="Send Updates Wearable Heart Rate"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_counter" />
     </android.support.constraint.ConstraintLayout>
 
 </FrameLayout>
\ No newline at end of file
diff --git a/mobile/src/main/res/layout/fragment_third.xml b/mobile/src/main/res/layout/fragment_third.xml
index 0efaec4..5d141c0 100644
--- a/mobile/src/main/res/layout/fragment_third.xml
+++ b/mobile/src/main/res/layout/fragment_third.xml
@@ -9,39 +9,19 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
         <!-- TODO: Update blank fragment layout -->
-        <TextView
-            android:id="@+id/user_identification"
-            style="?android:attr/listSeparatorTextViewStyle"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:background="@android:color/darker_gray"
-            android:text="User Identification and Control"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintHorizontal_bias="0.0"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/seekBar"/>
+
         <TextView
             android:id="@+id/current_separator"
             style="?android:attr/listSeparatorTextViewStyle"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@android:color/darker_gray"
-            android:text="CURRENT LIGHTS Control"
+            android:background="@android:color/holo_blue_dark"
+            android:text="CURRENT LIGHTS Control in HOME I/O"
+            android:textColor="@android:color/white"
+            app:layout_constraintBottom_toTopOf="@+id/current_room_text"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintHorizontal_bias="0.0"
             app:layout_constraintStart_toStartOf="parent" />
-
-        <TextView
-            android:id="@+id/user_separator"
-            style="?android:attr/listSeparatorTextViewStyle"
-            android:layout_width="match_parent"
-            android:layout_height="2dp"
-            android:background="@android:color/white"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintHorizontal_bias="0.0"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/send_button_1"/>
         <TextView
             android:id="@+id/current_room_text"
             android:layout_width="wrap_content"
@@ -92,14 +72,6 @@
             android:src="@drawable/ic_light"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@id/current_content" />
-        <Switch
-            android:id="@+id/current_lights_switch"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="8dp"
-            android:layout_marginTop="8dp"
-            app:layout_constraintLeft_toRightOf="@id/current_light"
-            app:layout_constraintTop_toBottomOf="@id/current_content" />
 
         <SeekBar
             android:id="@+id/seekBar1"
@@ -107,7 +79,7 @@
             android:layout_height="26dp"
             android:layout_marginTop="10dp"
             android:layout_marginLeft="8dp"
-            app:layout_constraintLeft_toRightOf="@id/current_lights_switch"
+            app:layout_constraintLeft_toRightOf="@id/current_light"
             app:layout_constraintBottom_toTopOf="@+id/separator1"
             app:layout_constraintTop_toBottomOf="@id/current_content" />
 
@@ -127,24 +99,13 @@
             style="?android:attr/listSeparatorTextViewStyle"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@android:color/darker_gray"
-            android:text="Lights in HOME I/O"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintHorizontal_bias="0.0"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/separator1"/>
-
-        <TextView
-            android:id="@+id/home_control_separator"
-            style="?android:attr/listSeparatorTextViewStyle"
-            android:layout_width="match_parent"
-            android:layout_height="20dp"
-            android:background="@android:color/white"
+            android:background="@android:color/holo_blue_dark"
             android:text="Lights Control in HOME I/O"
+            android:textColor="@android:color/white"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintHorizontal_bias="0.0"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/checkbox_d_lights_2" />
+            app:layout_constraintTop_toBottomOf="@id/separator1"/>
         <CheckBox
             android:id="@+id/checkbox_e_lights"
             android:layout_width="wrap_content"
@@ -154,6 +115,15 @@
             android:text="Entrance Room Lights"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/light_separator" />
+
+        <SeekBar
+            android:id="@+id/e_lights_seekbar"
+            android:layout_width="match_parent"
+            android:layout_height="24dp"
+            android:layout_marginTop="5dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/checkbox_e_lights"
+            app:layout_constraintBottom_toTopOf="@id/checkbox_g_lights" />
         <CheckBox
             android:id="@+id/checkbox_g_lights"
             android:layout_width="wrap_content"
@@ -161,7 +131,15 @@
             android:layout_marginStart="8dp"
             android:text="Bedroom Corridor Lights"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/checkbox_e_lights" />
+            app:layout_constraintTop_toBottomOf="@+id/e_lights_seekbar" />
+        <SeekBar
+            android:id="@+id/g_lights_seekbar"
+            android:layout_width="match_parent"
+            android:layout_height="24dp"
+            android:layout_marginTop="5dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/checkbox_g_lights"
+            app:layout_constraintBottom_toTopOf="@id/checkbox_d_lights_1" />
         <CheckBox
             android:id="@+id/checkbox_d_lights_1"
             android:layout_width="wrap_content"
@@ -169,7 +147,15 @@
             android:layout_marginStart="8dp"
             android:text="Kitchen Lights 1"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/checkbox_g_lights" />
+            app:layout_constraintTop_toBottomOf="@+id/g_lights_seekbar" />
+        <SeekBar
+            android:id="@+id/d_lights1_seekbar"
+            android:layout_width="match_parent"
+            android:layout_height="24dp"
+            android:layout_marginTop="5dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/checkbox_d_lights_1"
+            app:layout_constraintBottom_toTopOf="@id/checkbox_d_lights_2" />
         <CheckBox
             android:id="@+id/checkbox_d_lights_2"
             android:layout_width="wrap_content"
@@ -177,121 +163,63 @@
             android:layout_marginStart="8dp"
             android:text="Kitchen Lights 2"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/checkbox_d_lights_1" />
+            app:layout_constraintTop_toBottomOf="@+id/d_lights1_seekbar" />
 
-        <ImageView
-            android:id="@+id/light"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="11dp"
-            android:layout_marginTop="8dp"
-            android:src="@drawable/ic_light"
+        <SeekBar
+            android:id="@+id/d_lights2_seekbar"
+            android:layout_width="match_parent"
+            android:layout_height="24dp"
+            android:layout_marginTop="5dp"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/home_control_separator" />
-
+            app:layout_constraintTop_toBottomOf="@id/checkbox_d_lights_2"
+            app:layout_constraintBottom_toTopOf="@id/openhab_separator" />
 
         <TextView
-            android:id="@+id/label_user_1"
+            android:id="@+id/openhab_separator"
+            style="?android:attr/listSeparatorTextViewStyle"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:background="@android:color/holo_red_dark"
+            android:text="lights Control in Openhab"
+            android:textColor="@android:color/white"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintHorizontal_bias="0.0"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/d_lights2_seekbar"/>
+        <CheckBox
+            android:id="@+id/checkbox_openhab_light_1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginStart="8dp"
-            android:layout_marginTop="24dp"
-            android:text="User 1: "
-            app:layout_constraintLeft_toLeftOf="parent"
+            android:text="Irims TODO"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/user_identification" />
+            app:layout_constraintTop_toBottomOf="@+id/openhab_separator" />
 
-        <ToggleButton
-            android:id="@+id/user_1_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="User 1"
-            android:textOff="on"
-            android:textOn="off"
-            app:layout_constraintLeft_toRightOf="@+id/label_user_1"
-            app:layout_constraintRight_toLeftOf="@+id/drop_1"
-            app:layout_constraintTop_toBottomOf="@id/user_identification"/>
+        <SeekBar
+            android:id="@+id/openhab_seekBar_1"
+            android:layout_width="200dp"
+            android:layout_height="24dp"
+            android:layout_marginTop="5dp"
+            app:layout_constraintLeft_toRightOf="@+id/checkbox_openhab_light_1"
+            app:layout_constraintTop_toBottomOf="@id/openhab_separator" />
 
         <TextView
-            android:id="@+id/label_user_2"
+            android:id="@+id/label_openhab_button"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="24dp"
-            android:text="User 2: "
-            app:layout_constraintLeft_toLeftOf="parent"
+            android:layout_marginStart="10dp"
+            android:layout_marginTop="8dp"
+            android:text="Light Color Control via Watch:"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/user_separator" />
-
+            app:layout_constraintTop_toBottomOf="@id/checkbox_openhab_light_1" />
         <ToggleButton
-            android:id="@+id/user_2_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="User 2"
-            android:textOff="on"
-            android:textOn="off"
-            app:layout_constraintLeft_toRightOf="@+id/label_user_2"
-            app:layout_constraintRight_toLeftOf="@+id/drop_2"
-            app:layout_constraintStart_toStartOf="@id/user_1_button"
-            app:layout_constraintTop_toBottomOf="@id/user_separator" />
-
-        <Spinner
-            android:id="@+id/drop_1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            app:layout_constraintEnd_toStartOf="@id/send_button_1"
-            app:layout_constraintLeft_toRightOf="@+id/user_1_button"
-            app:layout_constraintRight_toLeftOf="@+id/send_button_1"
-            app:layout_constraintTop_toBottomOf="@+id/user_identification" />
-
-        <Spinner
-            android:id="@+id/drop_2"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            app:layout_constraintEnd_toStartOf="@id/send_button_2"
-            app:layout_constraintLeft_toRightOf="@+id/user_2_button"
-            app:layout_constraintRight_toLeftOf="@+id/send_button_2"
-            app:layout_constraintStart_toStartOf="@id/drop_1"
-            app:layout_constraintTop_toBottomOf="@id/user_separator">
-
-        </Spinner>
-
-        <Button
-            android:id="@+id/send_button_1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="0dp"
-            android:text="SEND"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintLeft_toRightOf="@id/drop_1"
-            app:layout_constraintTop_toBottomOf="@+id/user_identification" />
-
-        <Button
-            android:id="@+id/send_button_2"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="SEND"
-            app:layout_constraintLeft_toRightOf="@+id/drop_2"
-            app:layout_constraintStart_toStartOf="@id/send_button_1"
-            app:layout_constraintTop_toBottomOf="@id/user_separator" />
+            app:layout_constraintLeft_toRightOf="@+id/label_openhab_button"
+            app:layout_constraintTop_toBottomOf="@+id/openhab_seekBar_1"/>
 
-        <Switch
-            android:id="@+id/e_lights_switch"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:layout_marginLeft="8dp"
-            app:layout_constraintLeft_toRightOf="@+id/light"
-            app:layout_constraintTop_toBottomOf="@id/home_control_separator" />
 
-        <SeekBar
-            android:id="@+id/seekBar"
-            android:layout_width="209dp"
-            android:layout_height="24dp"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="10dp"
-            app:layout_constraintStart_toEndOf="@id/e_lights_switch"
-            app:layout_constraintTop_toBottomOf="@id/home_control_separator" />
     </android.support.constraint.ConstraintLayout>
 
 </FrameLayout>
\ No newline at end of file
diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml
index ab69251..36401c8 100644
--- a/mobile/src/main/res/values/strings.xml
+++ b/mobile/src/main/res/values/strings.xml
@@ -40,4 +40,5 @@
 
     <!-- TODO: Remove or change this placeholder text -->
     <string name="hello_blank_fragment">Hello blank fragment</string>
+    <string name="heart_rate">Heart Rate</string>
 </resources>
diff --git a/wear/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java b/wear/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java
index 092fe2f..a634e21 100644
--- a/wear/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java
+++ b/wear/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java
@@ -5,6 +5,7 @@ import android.hardware.Sensor;
 import android.hardware.SensorEvent;
 import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
+import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.wearable.activity.WearableActivity;
@@ -23,11 +24,15 @@ import java.util.List;
 
 import de.tudresden.inf.st.sensorsharing.common.Utils;
 
+import static de.tudresden.inf.st.sensorsharing.common.Constants.KEY_AMBIENT_PRESSURE;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.KEY_BRIGHTNESS;
+import static de.tudresden.inf.st.sensorsharing.common.Constants.KEY_COUNTER;
+import static de.tudresden.inf.st.sensorsharing.common.Constants.KEY_HEART_RATE;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.KEY_LINEAR_ACCELERATION;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.KEY_NAME;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.KEY_ROTATION_VECTOR;
 import static de.tudresden.inf.st.sensorsharing.common.Constants.MQTT_CHARSET;
+import static de.tudresden.inf.st.sensorsharing.common.Constants.SUB_KEY_AMBIENT_PRESSURE;
 
 import org.eclipse.paho.android.service.MqttAndroidClient;
 import org.eclipse.paho.client.mqttv3.IMqttActionListener;
@@ -40,7 +45,6 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
 
 
 public class MainActivity extends WearableActivity implements SensorEventListener {
-
     private static final String TAG = "SensorSharing";
 
     private SensorManager mSensorManager;
@@ -51,8 +55,13 @@ public class MainActivity extends WearableActivity implements SensorEventListene
     private Sensor mRotationVector;
     private float[] mRotationVectorValues;
     private boolean sendName = true;
-    private Sensor mHeartRates;
+    private Sensor mHeartRate;
     private float mHeartRateVaules;
+    private Sensor mPressure;
+    private float mPressureValues;
+    private Sensor mCounter;
+    private float mCounterValues;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -65,7 +74,6 @@ public class MainActivity extends WearableActivity implements SensorEventListene
             textView.setText(R.string.error_sensormanager_null);
             return;
         }
-
         // log available sensors
         List<Sensor> allSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
         StringBuilder sb = new StringBuilder();
@@ -76,9 +84,16 @@ public class MainActivity extends WearableActivity implements SensorEventListene
         Log.i(TAG, "Avail: able sensors: " + sb.toString());
 
         // initialize sensors
+
         mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
         mLinearAcceleration = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
-        mHeartRates = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
+        mHeartRate = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
+        mPressure = mSensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE);
+        mCounter = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER);
+
+        if (mCounter ==null){System.out.println("not found counter");}
+        if (mPressure ==null){System.out.println("not found pressure");}
+
         if (mLinearAcceleration == null) {
             mLinearAcceleration = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
             if (mRotationVector == null) {
@@ -89,6 +104,9 @@ public class MainActivity extends WearableActivity implements SensorEventListene
                 Log.w(TAG, "Using alternative accelerometer sensor!");
             }
         }
+        if(mHeartRate == null){
+            System.out.println("not found Heart Rate Sensor");
+        }
         mRotationVector = mSensorManager.getDefaultSensor(Sensor.TYPE_GAME_ROTATION_VECTOR);
         if (mRotationVector == null) {
             mRotationVector = mSensorManager.getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR);
@@ -103,7 +121,6 @@ public class MainActivity extends WearableActivity implements SensorEventListene
         // initialize sensor values
         mLinearAccelerationValues = new float[3];
         mRotationVectorValues = new float[3];
-
         // enables Always-on
         setAmbientEnabled();
     }
@@ -111,11 +128,22 @@ public class MainActivity extends WearableActivity implements SensorEventListene
     @Override
     public void onSensorChanged(SensorEvent sensorEvent) {
         TextView textView;
+
         switch(sensorEvent.sensor.getType()) {
-            case Sensor.TYPE_HEART_RATE:
 
+            case Sensor.TYPE_PRESSURE:
+                mPressureValues =sensorEvent.values[0];
+                System.out.print("PRESSURE: "+sensorEvent.values[0]);
+                break;
+
+            case Sensor.TYPE_STEP_COUNTER:
+                mCounterValues = sensorEvent.values[0];
+                System.out.print("Counter: "+sensorEvent.values[0]);
+                break;
+            case Sensor.TYPE_HEART_RATE:
                 mHeartRateVaules = sensorEvent.values[0];
-                System.out.println("HeartBeatValue:" + mHeartRateVaules);
+                System.out.println("HeartRateValue:" + mHeartRateVaules);
+                break;
             case Sensor.TYPE_LIGHT:
                 mLightValue = sensorEvent.values[0];
                 textView = findViewById(R.id.brightness_value);
@@ -135,7 +163,6 @@ public class MainActivity extends WearableActivity implements SensorEventListene
                 textView = findViewById(R.id.rotation_value);
                 textView.setText(Utils.formatArray3(mRotationVectorValues));
                 break;
-
         }
     }
 
@@ -148,6 +175,11 @@ public class MainActivity extends WearableActivity implements SensorEventListene
                 final byte[] brightnessData = ByteBuffer.allocate(4).putFloat(mLightValue).array();
                 final byte[] accelerationData = Utils.floatArray2ByteArray(mLinearAccelerationValues);
                 final byte[] rotationData = Utils.floatArray2ByteArray(mRotationVectorValues);
+                final byte[] heartRateData = ByteBuffer.allocate(4).putFloat(mHeartRateVaules).array();
+                final byte[] pressure = ByteBuffer.allocate(4).putFloat(mPressureValues).array();
+                final byte[] counter = ByteBuffer.allocate(4).putFloat(mCounterValues).array();
+
+
                 for (Node node : nodes) {
                     if (sendName) {
                         final byte[] nameData = Build.MODEL.getBytes(MQTT_CHARSET);
@@ -157,6 +189,9 @@ public class MainActivity extends WearableActivity implements SensorEventListene
                     messageClient.sendMessage(node.getId(), KEY_BRIGHTNESS, brightnessData);
                     messageClient.sendMessage(node.getId(), KEY_LINEAR_ACCELERATION, accelerationData);
                     messageClient.sendMessage(node.getId(), KEY_ROTATION_VECTOR, rotationData);
+                    messageClient.sendMessage(node.getId(), KEY_HEART_RATE, heartRateData);
+                    messageClient.sendMessage(node.getId(),KEY_COUNTER,counter);
+                    messageClient.sendMessage(node.getId(), KEY_AMBIENT_PRESSURE, pressure);
                 }
             }
         });
@@ -173,6 +208,10 @@ public class MainActivity extends WearableActivity implements SensorEventListene
         mSensorManager.registerListener(this, mLight, SensorManager.SENSOR_DELAY_NORMAL);
         mSensorManager.registerListener(this, mLinearAcceleration, SensorManager.SENSOR_DELAY_NORMAL);
         mSensorManager.registerListener(this, mRotationVector, SensorManager.SENSOR_DELAY_NORMAL);
+        mSensorManager.registerListener(this, mHeartRate,SensorManager.SENSOR_DELAY_FASTEST);
+        mSensorManager.registerListener(this, mPressure, SensorManager.SENSOR_DELAY_NORMAL);
+        mSensorManager.registerListener(this,mCounter, SensorManager.SENSOR_DELAY_NORMAL);
+
     }
 
     @Override
diff --git a/wear/src/main/res/layout/activity_main.xml b/wear/src/main/res/layout/activity_main.xml
index b1964e6..32ed4de 100644
--- a/wear/src/main/res/layout/activity_main.xml
+++ b/wear/src/main/res/layout/activity_main.xml
@@ -10,7 +10,6 @@
     tools:ignore="MissingPrefix"
     tools:context="de.tudresden.inf.st.sensorsharing.MainActivity"
     tools:deviceIds="wear">
-
     <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
@@ -18,50 +17,58 @@
         app:layout_box="all"
         app:boxedEdges="all">
 
-        <TextView
-            android:id="@+id/brightness_value"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/white"
-            android:layout_gravity="top|end" />
-
-        <TextView
-            android:id="@+id/brightness_label"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/white"
-            android:layout_gravity="top|start"
-            android:text="@string/text_brightness" />
+            <TextView
+                android:id="@+id/brightness_value"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/white"
+                android:layout_gravity="top|end"/>
+            <TextView
+                android:id="@+id/brightness_label"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/white"
+                android:layout_gravity="top|start"
+                android:text="@string/text_brightness" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="100dp"/>
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="0dp"/>
 
-        <TextView
-            android:id="@+id/acceleration_value"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/white"
-            android:layout_gravity="center|end" />
+            <TextView
+                android:id="@+id/acceleration_value"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/white"
+                android:layout_gravity="center|end" />
 
-        <TextView
-            android:id="@+id/acceleration_label"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/white"
-            android:layout_gravity="center|start"
-            android:text="@string/text_acceleration" />
+            <TextView
+                android:id="@+id/acceleration_label"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/white"
+                android:layout_gravity="center|start"
+                android:text="@string/text_acceleration" />
 
-        <TextView
-            android:id="@+id/rotation_value"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/white"
-            android:layout_gravity="bottom|end" />
+            <TextView
+                android:id="@+id/rotation_value"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/white"
+                android:layout_gravity="bottom|end" />
 
-        <TextView
-            android:id="@+id/rotation_label"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/white"
-            android:layout_gravity="bottom|start"
-            android:text="@string/text_rotation" />
+            <TextView
+                android:id="@+id/rotation_label"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/white"
+                android:layout_gravity="bottom|start"
+                android:text="@string/text_rotation" />
     </FrameLayout>
+
 </android.support.wear.widget.BoxInsetLayout>
 
diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml
index a1f444b..844eea9 100644
--- a/wear/src/main/res/values/strings.xml
+++ b/wear/src/main/res/values/strings.xml
@@ -11,4 +11,7 @@
     <string name="pose">Pose</string>
     <string name="error_sensormanager_null">Could not fetch sensor manager</string>
     <string name="title_activity_main2">Main2Activity</string>
+
+    <!-- TODO: Remove or change this placeholder text -->
+    <string name="hello_blank_fragment">Hello blank fragment</string>
 </resources>
-- 
GitLab