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.putExtra("extra.ip.address", state.getIpAddress());
|
||||
serviceIntent.putExtra("extra.ip.port", state.getPort());
|
||||
serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.COIL.getStartReference());
|
||||
serviceIntent.putExtra("extra.count", GlobalState.InputConfig.COIL.getCount());
|
||||
serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.Q_COIL.getStartReference());
|
||||
serviceIntent.putExtra("extra.count", GlobalState.InputConfig.Q_COIL.getCount());
|
||||
serviceIntent.putExtra("extra.intent.name", "readOnlyCoil");
|
||||
getApplicationContext().startService(serviceIntent);
|
||||
|
||||
@@ -69,8 +69,8 @@ public class DisplayMessageActivity extends AppCompatActivity {
|
||||
serviceIntent.setAction("read.discrete.input");
|
||||
serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
|
||||
serviceIntent.putExtra("extra.ip.port", state.getPort());
|
||||
serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.DISCRETE_INPUT.getStartReference());
|
||||
serviceIntent.putExtra("extra.count", GlobalState.InputConfig.DISCRETE_INPUT.getCount());
|
||||
serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.I_DI.getStartReference());
|
||||
serviceIntent.putExtra("extra.count", GlobalState.InputConfig.I_DI.getCount());
|
||||
serviceIntent.putExtra("extra.intent.name", "readOnlyDiscreteInput");
|
||||
getApplicationContext().startService(serviceIntent);
|
||||
|
||||
@@ -85,8 +85,8 @@ public class DisplayMessageActivity extends AppCompatActivity {
|
||||
serviceIntent.setAction("read.input.register");
|
||||
serviceIntent.putExtra("extra.ip.address", state.getIpAddress());
|
||||
serviceIntent.putExtra("extra.ip.port", state.getPort());
|
||||
serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.INPUT_REGISTER.getStartReference());
|
||||
serviceIntent.putExtra("extra.count", GlobalState.InputConfig.INPUT_REGISTER.getCount());
|
||||
serviceIntent.putExtra("extra.ref", GlobalState.InputConfig.AI_IR.getStartReference());
|
||||
serviceIntent.putExtra("extra.count", GlobalState.InputConfig.AI_IR.getCount());
|
||||
serviceIntent.putExtra("extra.intent.name", "readOnlyInputRegister");
|
||||
getApplicationContext().startService(serviceIntent);
|
||||
|
||||
|
@@ -18,13 +18,15 @@ public class GlobalState extends Application {
|
||||
|
||||
//
|
||||
public enum InputConfig {
|
||||
/* COIL (8192, 8),
|
||||
INPUT_REGISTER (1, 1),
|
||||
DISCRETE_INPUT(1, 12);
|
||||
/* Q_COIL (8192, 8),
|
||||
AI_IR (1, 1),
|
||||
I_DI(1, 12);
|
||||
*/
|
||||
COIL (8192, 8),
|
||||
INPUT_REGISTER (0, 2),
|
||||
DISCRETE_INPUT(0, 12);
|
||||
Q_COIL(8192, 8),
|
||||
VM_COIL2 (1, 8),
|
||||
VM_COIL3 (65, 8),
|
||||
AI_IR(0, 2),
|
||||
I_DI(0, 12);
|
||||
|
||||
private int startReference;
|
||||
private int count;
|
||||
|
@@ -4,7 +4,6 @@ import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@@ -35,8 +34,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
coilServiceIntent.setAction("read.coil");
|
||||
coilServiceIntent.putExtra("extra.ip.address", ipAddress);
|
||||
coilServiceIntent.putExtra("extra.ip.port", port);
|
||||
coilServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.COIL.getStartReference());
|
||||
coilServiceIntent.putExtra("extra.count", GlobalState.InputConfig.COIL.getCount());
|
||||
coilServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.Q_COIL.getStartReference());
|
||||
coilServiceIntent.putExtra("extra.count", GlobalState.InputConfig.Q_COIL.getCount());
|
||||
coilServiceIntent.putExtra("extra.intent.name", "readOnlyCoil");
|
||||
this.startService(coilServiceIntent);
|
||||
|
||||
@@ -44,8 +43,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
discretInputserviceIntent.setAction("read.discrete.input");
|
||||
discretInputserviceIntent.putExtra("extra.ip.address", ipAddress);
|
||||
discretInputserviceIntent.putExtra("extra.ip.port", port);
|
||||
discretInputserviceIntent.putExtra("extra.ref", GlobalState.InputConfig.DISCRETE_INPUT.getStartReference());
|
||||
discretInputserviceIntent.putExtra("extra.count", GlobalState.InputConfig.DISCRETE_INPUT.getCount());
|
||||
discretInputserviceIntent.putExtra("extra.ref", GlobalState.InputConfig.I_DI.getStartReference());
|
||||
discretInputserviceIntent.putExtra("extra.count", GlobalState.InputConfig.I_DI.getCount());
|
||||
discretInputserviceIntent.putExtra("extra.intent.name", "readOnlyDiscreteInput");
|
||||
this.startService(discretInputserviceIntent);
|
||||
|
||||
@@ -53,8 +52,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
inputRegisterServiceIntent.setAction("read.input.register");
|
||||
inputRegisterServiceIntent.putExtra("extra.ip.address", ipAddress);
|
||||
inputRegisterServiceIntent.putExtra("extra.ip.port", port);
|
||||
inputRegisterServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.INPUT_REGISTER.getStartReference());
|
||||
inputRegisterServiceIntent.putExtra("extra.count", GlobalState.InputConfig.INPUT_REGISTER.getCount());
|
||||
inputRegisterServiceIntent.putExtra("extra.ref", GlobalState.InputConfig.AI_IR.getStartReference());
|
||||
inputRegisterServiceIntent.putExtra("extra.count", GlobalState.InputConfig.AI_IR.getCount());
|
||||
inputRegisterServiceIntent.putExtra("extra.intent.name", "readOnlyInputRegister");
|
||||
this.startService(inputRegisterServiceIntent);
|
||||
|
||||
|
Reference in New Issue
Block a user