changed names for modbus reading writing states
This commit is contained in:
		@@ -53,8 +53,8 @@ public class DisplayMessageActivity extends AppCompatActivity {
 | 
				
			|||||||
        serviceIntent.setAction("read.coil");
 | 
					        serviceIntent.setAction("read.coil");
 | 
				
			||||||
        serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
 | 
					        serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
 | 
				
			||||||
        serviceIntent.putExtra("extra.ip.port", state.getPort());
 | 
					        serviceIntent.putExtra("extra.ip.port", state.getPort());
 | 
				
			||||||
        serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.COIL.getStartReference());
 | 
					        serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.Q_COIL.getStartReference());
 | 
				
			||||||
        serviceIntent.putExtra("extra.count", GlobalState.InputConfig.COIL.getCount());
 | 
					        serviceIntent.putExtra("extra.count", GlobalState.InputConfig.Q_COIL.getCount());
 | 
				
			||||||
        serviceIntent.putExtra("extra.intent.name", "readOnlyCoil");
 | 
					        serviceIntent.putExtra("extra.intent.name", "readOnlyCoil");
 | 
				
			||||||
        getApplicationContext().startService(serviceIntent);
 | 
					        getApplicationContext().startService(serviceIntent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -69,8 +69,8 @@ public class DisplayMessageActivity extends AppCompatActivity {
 | 
				
			|||||||
            serviceIntent.setAction("read.discrete.input");
 | 
					            serviceIntent.setAction("read.discrete.input");
 | 
				
			||||||
            serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
 | 
					            serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
 | 
				
			||||||
            serviceIntent.putExtra("extra.ip.port", state.getPort());
 | 
					            serviceIntent.putExtra("extra.ip.port", state.getPort());
 | 
				
			||||||
            serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.DISCRETE_INPUT.getStartReference());
 | 
					            serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.I_DI.getStartReference());
 | 
				
			||||||
            serviceIntent.putExtra("extra.count", GlobalState.InputConfig.DISCRETE_INPUT.getCount());
 | 
					            serviceIntent.putExtra("extra.count", GlobalState.InputConfig.I_DI.getCount());
 | 
				
			||||||
            serviceIntent.putExtra("extra.intent.name", "readOnlyDiscreteInput");
 | 
					            serviceIntent.putExtra("extra.intent.name", "readOnlyDiscreteInput");
 | 
				
			||||||
            getApplicationContext().startService(serviceIntent);
 | 
					            getApplicationContext().startService(serviceIntent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -85,8 +85,8 @@ public class DisplayMessageActivity extends AppCompatActivity {
 | 
				
			|||||||
            serviceIntent.setAction("read.input.register");
 | 
					            serviceIntent.setAction("read.input.register");
 | 
				
			||||||
            serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
 | 
					            serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
 | 
				
			||||||
            serviceIntent.putExtra("extra.ip.port", state.getPort());
 | 
					            serviceIntent.putExtra("extra.ip.port", state.getPort());
 | 
				
			||||||
            serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.INPUT_REGISTER.getStartReference());
 | 
					            serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.AI_IR.getStartReference());
 | 
				
			||||||
            serviceIntent.putExtra("extra.count", GlobalState.InputConfig.INPUT_REGISTER.getCount());
 | 
					            serviceIntent.putExtra("extra.count", GlobalState.InputConfig.AI_IR.getCount());
 | 
				
			||||||
            serviceIntent.putExtra("extra.intent.name", "readOnlyInputRegister");
 | 
					            serviceIntent.putExtra("extra.intent.name", "readOnlyInputRegister");
 | 
				
			||||||
            getApplicationContext().startService(serviceIntent);
 | 
					            getApplicationContext().startService(serviceIntent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,13 +18,15 @@ public class GlobalState extends Application {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    public enum InputConfig {
 | 
					    public enum InputConfig {
 | 
				
			||||||
     /*   COIL (8192, 8),
 | 
					     /*   Q_COIL (8192, 8),
 | 
				
			||||||
        INPUT_REGISTER (1, 1),
 | 
					        AI_IR (1, 1),
 | 
				
			||||||
        DISCRETE_INPUT(1, 12);
 | 
					        I_DI(1, 12);
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
        COIL (8192, 8),
 | 
					        Q_COIL(8192, 8),
 | 
				
			||||||
        INPUT_REGISTER (0, 2),
 | 
					        VM_COIL2 (1, 8),
 | 
				
			||||||
        DISCRETE_INPUT(0, 12);
 | 
					        VM_COIL3 (65, 8),
 | 
				
			||||||
 | 
					        AI_IR(0, 2),
 | 
				
			||||||
 | 
					        I_DI(0, 12);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private int startReference;
 | 
					        private int startReference;
 | 
				
			||||||
        private int count;
 | 
					        private int count;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,6 @@ import android.content.Intent;
 | 
				
			|||||||
import android.support.v7.app.AppCompatActivity;
 | 
					import android.support.v7.app.AppCompatActivity;
 | 
				
			||||||
import android.os.Bundle;
 | 
					import android.os.Bundle;
 | 
				
			||||||
import android.view.View;
 | 
					import android.view.View;
 | 
				
			||||||
import android.widget.EditText;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class MainActivity extends AppCompatActivity {
 | 
					public class MainActivity extends AppCompatActivity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -35,8 +34,8 @@ public class MainActivity extends AppCompatActivity {
 | 
				
			|||||||
        coilServiceIntent.setAction("read.coil");
 | 
					        coilServiceIntent.setAction("read.coil");
 | 
				
			||||||
        coilServiceIntent.putExtra("extra.ip.address", ipAddress);
 | 
					        coilServiceIntent.putExtra("extra.ip.address", ipAddress);
 | 
				
			||||||
        coilServiceIntent.putExtra("extra.ip.port", port);
 | 
					        coilServiceIntent.putExtra("extra.ip.port", port);
 | 
				
			||||||
        coilServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.COIL.getStartReference());
 | 
					        coilServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.Q_COIL.getStartReference());
 | 
				
			||||||
        coilServiceIntent.putExtra("extra.count", GlobalState.InputConfig.COIL.getCount());
 | 
					        coilServiceIntent.putExtra("extra.count", GlobalState.InputConfig.Q_COIL.getCount());
 | 
				
			||||||
        coilServiceIntent.putExtra("extra.intent.name", "readOnlyCoil");
 | 
					        coilServiceIntent.putExtra("extra.intent.name", "readOnlyCoil");
 | 
				
			||||||
        this.startService(coilServiceIntent);
 | 
					        this.startService(coilServiceIntent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,8 +43,8 @@ public class MainActivity extends AppCompatActivity {
 | 
				
			|||||||
        discretInputserviceIntent.setAction("read.discrete.input");
 | 
					        discretInputserviceIntent.setAction("read.discrete.input");
 | 
				
			||||||
        discretInputserviceIntent.putExtra("extra.ip.address", ipAddress);
 | 
					        discretInputserviceIntent.putExtra("extra.ip.address", ipAddress);
 | 
				
			||||||
        discretInputserviceIntent.putExtra("extra.ip.port", port);
 | 
					        discretInputserviceIntent.putExtra("extra.ip.port", port);
 | 
				
			||||||
        discretInputserviceIntent.putExtra("extra.ref", GlobalState.InputConfig.DISCRETE_INPUT.getStartReference());
 | 
					        discretInputserviceIntent.putExtra("extra.ref", GlobalState.InputConfig.I_DI.getStartReference());
 | 
				
			||||||
        discretInputserviceIntent.putExtra("extra.count", GlobalState.InputConfig.DISCRETE_INPUT.getCount());
 | 
					        discretInputserviceIntent.putExtra("extra.count", GlobalState.InputConfig.I_DI.getCount());
 | 
				
			||||||
        discretInputserviceIntent.putExtra("extra.intent.name", "readOnlyDiscreteInput");
 | 
					        discretInputserviceIntent.putExtra("extra.intent.name", "readOnlyDiscreteInput");
 | 
				
			||||||
        this.startService(discretInputserviceIntent);
 | 
					        this.startService(discretInputserviceIntent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -53,8 +52,8 @@ public class MainActivity extends AppCompatActivity {
 | 
				
			|||||||
        inputRegisterServiceIntent.setAction("read.input.register");
 | 
					        inputRegisterServiceIntent.setAction("read.input.register");
 | 
				
			||||||
        inputRegisterServiceIntent.putExtra("extra.ip.address", ipAddress);
 | 
					        inputRegisterServiceIntent.putExtra("extra.ip.address", ipAddress);
 | 
				
			||||||
        inputRegisterServiceIntent.putExtra("extra.ip.port", port);
 | 
					        inputRegisterServiceIntent.putExtra("extra.ip.port", port);
 | 
				
			||||||
        inputRegisterServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.INPUT_REGISTER.getStartReference());
 | 
					        inputRegisterServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.AI_IR.getStartReference());
 | 
				
			||||||
        inputRegisterServiceIntent.putExtra("extra.count", GlobalState.InputConfig.INPUT_REGISTER.getCount());
 | 
					        inputRegisterServiceIntent.putExtra("extra.count", GlobalState.InputConfig.AI_IR.getCount());
 | 
				
			||||||
        inputRegisterServiceIntent.putExtra("extra.intent.name", "readOnlyInputRegister");
 | 
					        inputRegisterServiceIntent.putExtra("extra.intent.name", "readOnlyInputRegister");
 | 
				
			||||||
        this.startService(inputRegisterServiceIntent);
 | 
					        this.startService(inputRegisterServiceIntent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,4 +19,31 @@
 | 
				
			|||||||
        app:layout_constraintEnd_toEndOf="parent"
 | 
					        app:layout_constraintEnd_toEndOf="parent"
 | 
				
			||||||
        app:layout_constraintStart_toStartOf="parent" />
 | 
					        app:layout_constraintStart_toStartOf="parent" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <ToggleButton
 | 
				
			||||||
 | 
					        android:id="@+id/toggleButton"
 | 
				
			||||||
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:checked="true"
 | 
				
			||||||
 | 
					        android:text="ToggleButton"
 | 
				
			||||||
 | 
					        tools:layout_editor_absoluteX="77dp"
 | 
				
			||||||
 | 
					        tools:layout_editor_absoluteY="96dp" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <ImageView
 | 
				
			||||||
 | 
					        android:id="@+id/imageView"
 | 
				
			||||||
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:visibility="invisible"
 | 
				
			||||||
 | 
					        app:srcCompat="@android:drawable/presence_invisible"
 | 
				
			||||||
 | 
					        tools:layout_editor_absoluteX="205dp"
 | 
				
			||||||
 | 
					        tools:layout_editor_absoluteY="96dp" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <ImageView
 | 
				
			||||||
 | 
					        android:id="@+id/imageView2"
 | 
				
			||||||
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:visibility="visible"
 | 
				
			||||||
 | 
					        app:srcCompat="@android:drawable/presence_online"
 | 
				
			||||||
 | 
					        tools:layout_editor_absoluteX="176dp"
 | 
				
			||||||
 | 
					        tools:layout_editor_absoluteY="96dp" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</android.support.constraint.ConstraintLayout>
 | 
					</android.support.constraint.ConstraintLayout>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user