|
@@ -17,7 +17,6 @@ import android.view.Window;
|
|
|
import android.widget.AdapterView;
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.ArrayAdapter;
|
|
import android.widget.ArrayAdapter;
|
|
|
import android.widget.Button;
|
|
import android.widget.Button;
|
|
|
-import android.widget.LinearLayout;
|
|
|
|
|
import android.widget.ListView;
|
|
import android.widget.ListView;
|
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.Spinner;
|
|
import android.widget.Spinner;
|
|
@@ -25,6 +24,9 @@ import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import com.ifastore.goodsmanage.models.DeviceResult;
|
|
|
|
|
+import com.ifastore.goodsmanage.models.MotorStart;
|
|
|
|
|
+import com.ifastore.goodsmanage.models.MotorStatus;
|
|
|
import com.ifastore.goodsmanage.models.ObjectBean;
|
|
import com.ifastore.goodsmanage.models.ObjectBean;
|
|
|
import com.ifastore.goodsmanage.serialport.CommTask;
|
|
import com.ifastore.goodsmanage.serialport.CommTask;
|
|
|
import com.ifastore.goodsmanage.utils.Logger;
|
|
import com.ifastore.goodsmanage.utils.Logger;
|
|
@@ -33,7 +35,6 @@ import com.inks.inkslibrary.Popup.PopupSelect;
|
|
|
import com.inks.inkslibrary.Popup.PopupView;
|
|
import com.inks.inkslibrary.Popup.PopupView;
|
|
|
import com.inks.inkslibrary.Popup.PromptSettings;
|
|
import com.inks.inkslibrary.Popup.PromptSettings;
|
|
|
import com.inks.inkslibrary.Popup.SelectListDataBean;
|
|
import com.inks.inkslibrary.Popup.SelectListDataBean;
|
|
|
-import com.inks.inkslibrary.Popup.SelectSettings;
|
|
|
|
|
import com.inks.inkslibrary.Popup.ViewSettings;
|
|
import com.inks.inkslibrary.Popup.ViewSettings;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -80,7 +81,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
RelativeLayout logLayout;
|
|
RelativeLayout logLayout;
|
|
|
|
|
|
|
|
@BindView(R.id.temp)
|
|
@BindView(R.id.temp)
|
|
|
- TextView temp;
|
|
|
|
|
|
|
+ TextView tempTextView;
|
|
|
@BindView(R.id.readAddr)
|
|
@BindView(R.id.readAddr)
|
|
|
Button readAddr;
|
|
Button readAddr;
|
|
|
@BindView(R.id.setAddr)
|
|
@BindView(R.id.setAddr)
|
|
@@ -101,13 +102,27 @@ public class MainActivity extends AppCompatActivity {
|
|
|
private Window window;
|
|
private Window window;
|
|
|
private LayoutInflater inflater;
|
|
private LayoutInflater inflater;
|
|
|
private View linearLayout;
|
|
private View linearLayout;
|
|
|
|
|
+ private View controlInLayout;
|
|
|
|
|
+ private View controlOutLayout;
|
|
|
|
|
+ private View motorTestLayout;
|
|
|
|
|
+ private View setAddrLayout;
|
|
|
private Context context;
|
|
private Context context;
|
|
|
private PopupView popupView;
|
|
private PopupView popupView;
|
|
|
private PopupPrompt popupPrompt;
|
|
private PopupPrompt popupPrompt;
|
|
|
private PopupSelect popupSelect;
|
|
private PopupSelect popupSelect;
|
|
|
- public Spinner xSpinGoodsWay;
|
|
|
|
|
- public Spinner ySpinGoodsWay;
|
|
|
|
|
- public Spinner spinGoodsNum;
|
|
|
|
|
|
|
+ public Spinner motorIndex;
|
|
|
|
|
+ public Spinner motorType;
|
|
|
|
|
+ public Spinner lightMode;
|
|
|
|
|
+ public Spinner maxCurrent;
|
|
|
|
|
+ public Spinner minCurrent;
|
|
|
|
|
+ public Spinner motorTimerOut;
|
|
|
|
|
+
|
|
|
|
|
+ public Spinner controlInSpiner;
|
|
|
|
|
+ public Spinner controlOutSpiner;
|
|
|
|
|
+ public Spinner controlSwitchSpiner;
|
|
|
|
|
+
|
|
|
|
|
+ public Spinner motorTestSpiner;
|
|
|
|
|
+ public Spinner setAddressSpiner;
|
|
|
private TextView textView;
|
|
private TextView textView;
|
|
|
|
|
|
|
|
private SerialPortFinder serialPortFinder;
|
|
private SerialPortFinder serialPortFinder;
|
|
@@ -119,10 +134,17 @@ public class MainActivity extends AppCompatActivity {
|
|
|
private BlockingQueue<ObjectBean> queue;
|
|
private BlockingQueue<ObjectBean> queue;
|
|
|
private static String serialStr = "";
|
|
private static String serialStr = "";
|
|
|
private static int bauteValue = 0;
|
|
private static int bauteValue = 0;
|
|
|
- private static int xGoosdWay = 0;
|
|
|
|
|
- private static int yGoosdWay = 0;
|
|
|
|
|
- private static int goodsNum = 1;
|
|
|
|
|
- private static int choosedLight = 0;
|
|
|
|
|
|
|
+ private static int indexValue = 0;
|
|
|
|
|
+ private static int typeValue = 0;
|
|
|
|
|
+ private static int lightValue = 0;
|
|
|
|
|
+ private static int maxCurrentValue = 0;
|
|
|
|
|
+ private static int minCurrentValue = 0;
|
|
|
|
|
+ private static int motorTimerOutValue = 0;
|
|
|
|
|
+ private static int controlInValue = 0;
|
|
|
|
|
+ private static int controlOutValue = 0;
|
|
|
|
|
+ private static int controlSwitchValue = 0;
|
|
|
|
|
+ private static int motorTestValue = 0;
|
|
|
|
|
+ private static int setAddressValue = 1;
|
|
|
private boolean isFirst = false;
|
|
private boolean isFirst = false;
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -184,35 +206,37 @@ public class MainActivity extends AppCompatActivity {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
switch (id){
|
|
switch (id){
|
|
|
- case R.id.openSerial:
|
|
|
|
|
- openSerial();
|
|
|
|
|
- break;
|
|
|
|
|
- case R.id.closeSerial:
|
|
|
|
|
- closeSerial();
|
|
|
|
|
- break;
|
|
|
|
|
case R.id.motoStart:
|
|
case R.id.motoStart:
|
|
|
if(commTask.isopen){
|
|
if(commTask.isopen){
|
|
|
- setOutGoodsInfo();
|
|
|
|
|
|
|
+ selectMotorStartInfo();
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case R.id.motoTest:
|
|
case R.id.motoTest:
|
|
|
- selectLight();
|
|
|
|
|
|
|
+ selectMotorIndex();
|
|
|
break;
|
|
break;
|
|
|
case R.id.readAddr:
|
|
case R.id.readAddr:
|
|
|
|
|
+ if(commTask.isopen){
|
|
|
|
|
+ commTask.queryAddress();
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case R.id.setAddr:
|
|
case R.id.setAddr:
|
|
|
|
|
+ selectAddress();
|
|
|
break;
|
|
break;
|
|
|
case R.id.querySerial:
|
|
case R.id.querySerial:
|
|
|
- selectLight();
|
|
|
|
|
|
|
+ if(commTask.isopen){
|
|
|
|
|
+ commTask.querySerailNum();
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case R.id.queryStatus:
|
|
case R.id.queryStatus:
|
|
|
- selectLight();
|
|
|
|
|
|
|
+ if(commTask.isopen){
|
|
|
|
|
+ commTask.queryMotorStatus();
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case R.id.controlOut:
|
|
case R.id.controlOut:
|
|
|
- selectLight();
|
|
|
|
|
|
|
+ selectControlOut();
|
|
|
break;
|
|
break;
|
|
|
case R.id.controlIn:
|
|
case R.id.controlIn:
|
|
|
- selectLight();
|
|
|
|
|
|
|
+ selectControlIn();
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -240,72 +264,82 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
|
+ DeviceResult deviceResult;
|
|
|
if (intent != null) {
|
|
if (intent != null) {
|
|
|
switch (Objects.requireNonNull(intent.getAction())) {
|
|
switch (Objects.requireNonNull(intent.getAction())) {
|
|
|
- case RESULT_CONTROL_SALE:
|
|
|
|
|
- int result = intent.getIntExtra(RESULT_CONTROL_SALE, -1);
|
|
|
|
|
- if(result == 0){
|
|
|
|
|
- showLog("售卖成功");
|
|
|
|
|
- pupWindows("售卖成功!");
|
|
|
|
|
- }else {
|
|
|
|
|
- showLog("售卖失败!");
|
|
|
|
|
- pupWindows("售卖失败:"+result);
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- case RESULT_CONTROL_LIGHT:
|
|
|
|
|
- int lightResult = intent.getIntExtra(RESULT_CONTROL_LIGHT, -1);
|
|
|
|
|
- Logger.debug("light result::" +lightResult);
|
|
|
|
|
- if(lightResult == 0){
|
|
|
|
|
- if(choosedLight == 0){
|
|
|
|
|
- showLog("关闭光幕成功");
|
|
|
|
|
- pupWindows("关闭光幕成功");
|
|
|
|
|
- }else {
|
|
|
|
|
- showLog("打开光幕成功");
|
|
|
|
|
- pupWindows("打开光幕成功");
|
|
|
|
|
- }
|
|
|
|
|
- }else {
|
|
|
|
|
- if(choosedLight == 0){
|
|
|
|
|
- showLog("关闭光幕失败");
|
|
|
|
|
- pupWindows("关闭光幕失败");
|
|
|
|
|
- }else {
|
|
|
|
|
- showLog("打开光幕失败");
|
|
|
|
|
- pupWindows("打开光幕失败");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
case SET_DEVICE_ADDR:
|
|
case SET_DEVICE_ADDR:
|
|
|
- int motorResult = intent.getIntExtra(SET_DEVICE_ADDR, -1);
|
|
|
|
|
- Logger.debug("motor error result:" +motorResult);
|
|
|
|
|
- showLog("电机异常:"+motorResult);
|
|
|
|
|
- pupWindows("电机异常:"+motorResult);
|
|
|
|
|
- break;
|
|
|
|
|
- case REPORT_EVENT_GOODS:
|
|
|
|
|
- int outResult = intent.getIntExtra(REPORT_EVENT_GOODS, -1);
|
|
|
|
|
- Logger.debug("out goods result::" +outResult);
|
|
|
|
|
- if(outResult == 0){
|
|
|
|
|
- showLog("出货成功");
|
|
|
|
|
- pupWindows("出货成功");
|
|
|
|
|
|
|
+ deviceResult = (DeviceResult) intent.getSerializableExtra(SET_DEVICE_ADDR);
|
|
|
|
|
+ if(deviceResult.getResult() == 0){
|
|
|
|
|
+ showLog("设置设备地址成功.");
|
|
|
|
|
+ //pupWindows("设置设备地址成功.");
|
|
|
}else {
|
|
}else {
|
|
|
- showLog("出货异常:"+outResult);
|
|
|
|
|
- pupWindows("出货异常:"+outResult);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ showLog("设置设备地址失败.");
|
|
|
|
|
+ //pupWindows("设置设备地址失败.");
|
|
|
}
|
|
}
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 成功
|
|
|
|
|
+ * 失败
|
|
|
|
|
+ * */
|
|
|
break;
|
|
break;
|
|
|
case QUERY_DEVICE_ADDR:
|
|
case QUERY_DEVICE_ADDR:
|
|
|
|
|
+ deviceResult = (DeviceResult) intent.getSerializableExtra(QUERY_DEVICE_ADDR);
|
|
|
|
|
+ if(deviceResult.getResult() == 0){
|
|
|
|
|
+ showLog("设备地址:"+deviceResult.getValue());
|
|
|
|
|
+ //pupWindows("设置设备地址成功.");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ showLog("查询设备地址失败.");
|
|
|
|
|
+ //pupWindows("设置设备地址失败.");
|
|
|
|
|
+ }
|
|
|
|
|
+ //pupWindows("设备地址:"+deviceResult.getResult());
|
|
|
break;
|
|
break;
|
|
|
case QUERY_DEVICE_SERIAL:
|
|
case QUERY_DEVICE_SERIAL:
|
|
|
|
|
+ deviceResult = (DeviceResult) intent.getSerializableExtra(QUERY_DEVICE_SERIAL);
|
|
|
|
|
+ showLog("设备序列号:"+deviceResult.getResult());
|
|
|
|
|
+ //pupWindows("设备序列号:"+deviceResult.getResult());
|
|
|
break;
|
|
break;
|
|
|
case QUERY_MOTOR_STATUS:
|
|
case QUERY_MOTOR_STATUS:
|
|
|
|
|
+ MotorStatus status = (MotorStatus) intent.getSerializableExtra(QUERY_MOTOR_STATUS);
|
|
|
|
|
+ showLog("执行状态:"+status.getStatus());
|
|
|
|
|
+ showLog("电机编号:"+status.getSerialNum());
|
|
|
|
|
+ showLog("执行结果:"+status.getResult());
|
|
|
|
|
+ showLog("峰值电流:"+status.getPeakCurrent());
|
|
|
|
|
+ showLog("平均电流:"+status.getAverageCurrent());
|
|
|
|
|
+ showLog("运行时间:"+status.getRunTime());
|
|
|
|
|
+ showLog("光幕状态:"+status.getLightStatus());
|
|
|
break;
|
|
break;
|
|
|
case QUERY_TEMP:
|
|
case QUERY_TEMP:
|
|
|
|
|
+ float temp = intent.getFloatExtra(QUERY_TEMP,0);
|
|
|
|
|
+ tempTextView.setText(String.valueOf(temp));
|
|
|
break;
|
|
break;
|
|
|
case CONTROL_OUT:
|
|
case CONTROL_OUT:
|
|
|
|
|
+ deviceResult = (DeviceResult) intent.getSerializableExtra(CONTROL_OUT);
|
|
|
|
|
+ showLog("开关量输出 索引:"+deviceResult.getIndex()+" 结果:"+deviceResult.getResult());
|
|
|
|
|
+ //pupWindows("开关量输出 索引:"+deviceResult.getIndex()+" 结果:"+deviceResult.getResult());
|
|
|
break;
|
|
break;
|
|
|
case CONTROL_IN:
|
|
case CONTROL_IN:
|
|
|
|
|
+ deviceResult = (DeviceResult) intent.getSerializableExtra(CONTROL_IN);
|
|
|
|
|
+ showLog("开关量输入 索引:"+deviceResult.getIndex()+" 结果:"+deviceResult.getResult());
|
|
|
|
|
+ //pupWindows("开关量输入 索引:"+deviceResult.getIndex()+" 结果:"+deviceResult.getResult());
|
|
|
break;
|
|
break;
|
|
|
case MOTOR_START:
|
|
case MOTOR_START:
|
|
|
|
|
+ deviceResult = (DeviceResult) intent.getSerializableExtra(MOTOR_START);
|
|
|
|
|
+ if(deviceResult.getResult() == 0){
|
|
|
|
|
+ showLog("启动成功.");
|
|
|
|
|
+ //pupWindows("启动成功.");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ showLog("启动失败.");
|
|
|
|
|
+ //pupWindows("启动失败.");
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case MOTOR_TEST:
|
|
case MOTOR_TEST:
|
|
|
|
|
+ deviceResult = (DeviceResult) intent.getSerializableExtra(MOTOR_TEST);
|
|
|
|
|
+ if(deviceResult.getResult() == 0){
|
|
|
|
|
+ showLog("测试成功.");
|
|
|
|
|
+ //pupWindows("测试成功.");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ showLog("测试失败.");
|
|
|
|
|
+ //pupWindows("测试失败.");
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -341,6 +375,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
closeSerial.setVisibility(View.VISIBLE);
|
|
closeSerial.setVisibility(View.VISIBLE);
|
|
|
pupWindows("打开串口成功");
|
|
pupWindows("打开串口成功");
|
|
|
showLog("打开串口成功!");
|
|
showLog("打开串口成功!");
|
|
|
|
|
+ commTask.queryTemp();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void closeSerial(){
|
|
private void closeSerial(){
|
|
@@ -381,10 +416,24 @@ public class MainActivity extends AppCompatActivity {
|
|
|
textView.setText("售货机测试");
|
|
textView.setText("售货机测试");
|
|
|
textView.setLayoutParams(layoutParams);
|
|
textView.setLayoutParams(layoutParams);
|
|
|
logLayout.addView(textView);
|
|
logLayout.addView(textView);
|
|
|
- linearLayout = (LinearLayout) inflater.inflate(R.layout.scrollviewtest, null, false);
|
|
|
|
|
- xSpinGoodsWay = linearLayout.findViewById(R.id.xNum);
|
|
|
|
|
- ySpinGoodsWay = linearLayout.findViewById(R.id.yNum);
|
|
|
|
|
- spinGoodsNum = linearLayout.findViewById(R.id.goodsNum);
|
|
|
|
|
|
|
+ linearLayout = inflater.inflate(R.layout.scroll_view_motor_start, null, false);
|
|
|
|
|
+ motorIndex = linearLayout.findViewById(R.id.indexSpiner);
|
|
|
|
|
+ motorType = linearLayout.findViewById(R.id.motorTypeSpiner);
|
|
|
|
|
+ lightMode = linearLayout.findViewById(R.id.lightSpiner);
|
|
|
|
|
+ maxCurrent = linearLayout.findViewById(R.id.maxCurrentSpiner);
|
|
|
|
|
+ minCurrent = linearLayout.findViewById(R.id.minCurrentSpiner);
|
|
|
|
|
+ motorTimerOut = linearLayout.findViewById(R.id.timerOutSpiner);
|
|
|
|
|
+
|
|
|
|
|
+ controlInLayout = inflater.inflate(R.layout.scroll_view_control_in, null, false);
|
|
|
|
|
+ controlInSpiner = controlInLayout.findViewById(R.id.controlIn);
|
|
|
|
|
+ controlOutLayout = inflater.inflate(R.layout.scroll_view_control_out, null, false);
|
|
|
|
|
+ controlOutSpiner = controlOutLayout.findViewById(R.id.controlOut);
|
|
|
|
|
+ controlSwitchSpiner = controlOutLayout.findViewById(R.id.controlSwich);
|
|
|
|
|
+
|
|
|
|
|
+ motorTestLayout = inflater.inflate(R.layout.scroll_view_motor_test, null, false);
|
|
|
|
|
+ motorTestSpiner = motorTestLayout.findViewById(R.id.motortest);
|
|
|
|
|
+ setAddrLayout = inflater.inflate(R.layout.scroll_view_set_address, null, false);
|
|
|
|
|
+ setAddressSpiner = setAddrLayout.findViewById(R.id.setAddr);
|
|
|
adapter = new ArrayAdapter<String>(this, R.layout.log_item_layout,logList);
|
|
adapter = new ArrayAdapter<String>(this, R.layout.log_item_layout,logList);
|
|
|
logListView.setAdapter(adapter);
|
|
logListView.setAdapter(adapter);
|
|
|
adapter.notifyDataSetChanged();
|
|
adapter.notifyDataSetChanged();
|
|
@@ -425,21 +474,27 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- final String[] xyNum = new String[]{"0","1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
|
|
|
|
- final String[] selectGoodsNum = new String[]{"1"};
|
|
|
|
|
|
|
+ final String[] selectData1 = new String[101];
|
|
|
|
|
+ final String[] selectData2 = new String[]{"0","1"};
|
|
|
|
|
+ final String[] selectData3 = new String[256];
|
|
|
|
|
+ final String[] selectData4 = new String[]{"0","1", "2"};
|
|
|
|
|
+ final String[] selectData5 = new String[32];
|
|
|
|
|
+ for (int i = 0; i <=100; i++) selectData1[i] = String.valueOf(i);
|
|
|
|
|
+ for (int i = 0; i <=255; i++) selectData3[i] = String.valueOf(i);
|
|
|
|
|
+ for (int i = 0; i <=31; i++) selectData5[i] = String.valueOf(i+1);
|
|
|
SpAdapter spAdapter3 = new SpAdapter(this);
|
|
SpAdapter spAdapter3 = new SpAdapter(this);
|
|
|
- spAdapter3.setDatas(xyNum);
|
|
|
|
|
- if(xSpinGoodsWay == null){
|
|
|
|
|
|
|
+ spAdapter3.setDatas(selectData1);
|
|
|
|
|
+ if(motorIndex == null){
|
|
|
Logger.debug("xSpinGoodsWay");
|
|
Logger.debug("xSpinGoodsWay");
|
|
|
}
|
|
}
|
|
|
- xSpinGoodsWay.setAdapter(spAdapter3);
|
|
|
|
|
- xSpinGoodsWay.setSelection(0,true);
|
|
|
|
|
|
|
+ motorIndex.setAdapter(spAdapter3);
|
|
|
|
|
+ motorIndex.setSelection(0,true);
|
|
|
|
|
|
|
|
- xSpinGoodsWay.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
|
|
+ motorIndex.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- xGoosdWay = Integer.parseInt(xyNum[position]);
|
|
|
|
|
- Logger.debug(">>>>>>>position %s xGoosdWay:%s", position, xGoosdWay);
|
|
|
|
|
|
|
+ indexValue = Integer.parseInt(selectData1[position]);
|
|
|
|
|
+ Logger.debug(">>>>>>>position %s motor Index:%s", position, indexValue);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -448,15 +503,15 @@ public class MainActivity extends AppCompatActivity {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
SpAdapter spAdapter4 = new SpAdapter(this);
|
|
SpAdapter spAdapter4 = new SpAdapter(this);
|
|
|
- spAdapter4.setDatas(xyNum);
|
|
|
|
|
- ySpinGoodsWay.setAdapter(spAdapter4);
|
|
|
|
|
- ySpinGoodsWay.setSelection(0,true);
|
|
|
|
|
|
|
+ spAdapter4.setDatas(selectData2);
|
|
|
|
|
+ motorType.setAdapter(spAdapter4);
|
|
|
|
|
+ motorType.setSelection(0,true);
|
|
|
|
|
|
|
|
- ySpinGoodsWay.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
|
|
+ motorType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- yGoosdWay = Integer.parseInt(xyNum[position]);
|
|
|
|
|
- Logger.debug(">>>>>>>position %s yGoosdWay:%s", position, yGoosdWay);
|
|
|
|
|
|
|
+ typeValue = Integer.parseInt(selectData2[position]);
|
|
|
|
|
+ Logger.debug(">>>>>>>position %s motor type:%s", position, typeValue);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -466,14 +521,151 @@ public class MainActivity extends AppCompatActivity {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
SpAdapter spAdapter5 = new SpAdapter(this);
|
|
SpAdapter spAdapter5 = new SpAdapter(this);
|
|
|
- spAdapter5.setDatas(selectGoodsNum);
|
|
|
|
|
- spinGoodsNum.setAdapter(spAdapter5);
|
|
|
|
|
- spinGoodsNum.setSelection(0,true);
|
|
|
|
|
|
|
+ spAdapter5.setDatas(selectData4);
|
|
|
|
|
+ lightMode.setAdapter(spAdapter5);
|
|
|
|
|
+ lightMode.setSelection(0,true);
|
|
|
|
|
+
|
|
|
|
|
+ lightMode.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ lightValue = Integer.parseInt(selectData4[position]);
|
|
|
|
|
+ Logger.debug(">>>>>>>position %s motor type:%s", position, lightValue);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter6 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter6.setDatas(selectData3);
|
|
|
|
|
+ maxCurrent.setAdapter(spAdapter6);
|
|
|
|
|
+ maxCurrent.setSelection(0,true);
|
|
|
|
|
+
|
|
|
|
|
+ maxCurrent.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ maxCurrentValue = Integer.parseInt(selectData3[position]);
|
|
|
|
|
+ Logger.debug(">>>>>>>position %s maxCurrent Value:%s", position, maxCurrentValue);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter7 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter7.setDatas(selectData3);
|
|
|
|
|
+ minCurrent.setAdapter(spAdapter7);
|
|
|
|
|
+ minCurrent.setSelection(0,true);
|
|
|
|
|
+ minCurrent.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ minCurrentValue = Integer.parseInt(selectData3[position]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter8 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter8.setDatas(selectData1);
|
|
|
|
|
+ motorTimerOut.setAdapter(spAdapter8);
|
|
|
|
|
+ motorTimerOut.setSelection(0,true);
|
|
|
|
|
+ motorTimerOut.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ motorTimerOutValue = Integer.parseInt(selectData1[position]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter9 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter9.setDatas(selectData4);
|
|
|
|
|
+ controlInSpiner.setAdapter(spAdapter9);
|
|
|
|
|
+ controlInSpiner.setSelection(0,true);
|
|
|
|
|
+ controlInSpiner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ controlInValue = Integer.parseInt(selectData4[position]);
|
|
|
|
|
+ Logger.debug(String.format(">>>>>>>position %s control In Value:%s", position, controlInValue));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter10 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter10.setDatas(selectData4);
|
|
|
|
|
+ controlOutSpiner.setAdapter(spAdapter10);
|
|
|
|
|
+ controlOutSpiner.setSelection(0,true);
|
|
|
|
|
+ controlOutSpiner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ controlOutValue = Integer.parseInt(selectData4[position]);
|
|
|
|
|
+ Logger.debug(String.format(">>>>>>>position %s control out Value:%s", position, controlOutValue));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter11 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter11.setDatas(selectData2);
|
|
|
|
|
+ controlSwitchSpiner.setAdapter(spAdapter11);
|
|
|
|
|
+ controlSwitchSpiner.setSelection(0,true);
|
|
|
|
|
+ controlSwitchSpiner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ controlSwitchValue = Integer.parseInt(selectData2[position]);
|
|
|
|
|
+ Logger.debug(String.format(">>>>>>>position %s control out Value:%s", position, controlSwitchValue));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter12 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter12.setDatas(selectData5);
|
|
|
|
|
+ setAddressSpiner.setAdapter(spAdapter12);
|
|
|
|
|
+ setAddressSpiner.setSelection(0,true);
|
|
|
|
|
+ setAddressSpiner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
+ setAddressValue = Integer.parseInt(selectData5[position]);
|
|
|
|
|
+ Logger.debug(String.format(">>>>>>>position %s setAddress Value:%s", position, setAddressValue));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- spinGoodsNum.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ SpAdapter spAdapter13 = new SpAdapter(this);
|
|
|
|
|
+ spAdapter13.setDatas(selectData1);
|
|
|
|
|
+ motorTestSpiner.setAdapter(spAdapter13);
|
|
|
|
|
+ motorTestSpiner.setSelection(0,true);
|
|
|
|
|
+ motorTestSpiner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- goodsNum = Integer.parseInt(selectGoodsNum[position]);
|
|
|
|
|
|
|
+ motorTestValue = Integer.parseInt(selectData1[position]);
|
|
|
|
|
+ Logger.debug(String.format(">>>>>>>position %s motorTest Value:%s", position, motorTestValue));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -483,6 +675,8 @@ public class MainActivity extends AppCompatActivity {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private void pupWindows(String mgs){
|
|
private void pupWindows(String mgs){
|
|
|
popupPrompt.miss();
|
|
popupPrompt.miss();
|
|
|
PromptSettings.Builder builder = new PromptSettings.Builder();
|
|
PromptSettings.Builder builder = new PromptSettings.Builder();
|
|
@@ -498,30 +692,15 @@ public class MainActivity extends AppCompatActivity {
|
|
|
.build();
|
|
.build();
|
|
|
popupPrompt.popupPrompt(window,context,inflater,promptSettings,0);
|
|
popupPrompt.popupPrompt(window,context,inflater,promptSettings,0);
|
|
|
}
|
|
}
|
|
|
- private void selectLight(){
|
|
|
|
|
- SelectSettings.Builder builder = new SelectSettings.Builder();
|
|
|
|
|
- SelectSettings promptSettings =
|
|
|
|
|
- builder.selectListDataBean(selectListDataBeans)
|
|
|
|
|
- .clickListener(selectBackListener)
|
|
|
|
|
- .titleTextStr("光幕控制")
|
|
|
|
|
- .titleTextPaddings(new int[]{10,20,0,20})
|
|
|
|
|
- .showTitleIcon(true)
|
|
|
|
|
- .popupWidth(500)
|
|
|
|
|
- .popupHeight(300)
|
|
|
|
|
- .multipleSelection(false)
|
|
|
|
|
- .showListIcon(true)
|
|
|
|
|
- .build();
|
|
|
|
|
- popupSelect.popupSelect(window,context,inflater,promptSettings,0);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- private void setOutGoodsInfo(){
|
|
|
|
|
|
|
+ private void selectMotorStartInfo(){
|
|
|
ViewSettings.Builder builder = new ViewSettings.Builder();
|
|
ViewSettings.Builder builder = new ViewSettings.Builder();
|
|
|
ViewSettings promptSettings =
|
|
ViewSettings promptSettings =
|
|
|
- builder .clickListener(popupBackListener)
|
|
|
|
|
- .titleTextStr("设置出货信息")
|
|
|
|
|
|
|
+ builder .clickListener(popupStartMotorListener)
|
|
|
|
|
+ .titleTextStr("电机启动")
|
|
|
.titleTextPaddings(new int[]{10,20,0,20})
|
|
.titleTextPaddings(new int[]{10,20,0,20})
|
|
|
.showTitleIcon(true)
|
|
.showTitleIcon(true)
|
|
|
- .popupWidth(500)
|
|
|
|
|
|
|
+ .popupWidth(700)
|
|
|
.popupHeight(300)
|
|
.popupHeight(300)
|
|
|
.build();
|
|
.build();
|
|
|
if(linearLayout.getParent()!=null){
|
|
if(linearLayout.getParent()!=null){
|
|
@@ -530,14 +709,91 @@ public class MainActivity extends AppCompatActivity {
|
|
|
popupView.popupView(window,context,inflater,linearLayout,promptSettings,3);
|
|
popupView.popupView(window,context,inflater,linearLayout,promptSettings,3);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- PopupView.onClickListener popupBackListener = new PopupView.onClickListener() {
|
|
|
|
|
|
|
+ private void selectControlIn(){
|
|
|
|
|
+ ViewSettings.Builder builder = new ViewSettings.Builder();
|
|
|
|
|
+ ViewSettings promptSettings =
|
|
|
|
|
+ builder .clickListener(popupControlInListener)
|
|
|
|
|
+ .titleTextStr("开关量输入")
|
|
|
|
|
+ .titleTextPaddings(new int[]{10,20,0,20})
|
|
|
|
|
+ .showTitleIcon(true)
|
|
|
|
|
+ .popupWidth(500)
|
|
|
|
|
+ .popupHeight(300)
|
|
|
|
|
+ .build();
|
|
|
|
|
+ if(controlInLayout.getParent()!=null){
|
|
|
|
|
+ ((ViewGroup) controlInLayout.getParent()).removeView(controlInLayout);
|
|
|
|
|
+ }
|
|
|
|
|
+ popupView.popupView(window,context,inflater, controlInLayout,promptSettings,3);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private void selectControlOut(){
|
|
|
|
|
+ ViewSettings.Builder builder = new ViewSettings.Builder();
|
|
|
|
|
+ ViewSettings promptSettings =
|
|
|
|
|
+ builder .clickListener(popupControlOutListener)
|
|
|
|
|
+ .titleTextStr("开关量输出")
|
|
|
|
|
+ .titleTextPaddings(new int[]{10,20,0,20})
|
|
|
|
|
+ .showTitleIcon(true)
|
|
|
|
|
+ .popupWidth(500)
|
|
|
|
|
+ .popupHeight(300)
|
|
|
|
|
+ .build();
|
|
|
|
|
+ if(controlOutLayout.getParent()!=null){
|
|
|
|
|
+ ((ViewGroup) controlOutLayout.getParent()).removeView(controlOutLayout);
|
|
|
|
|
+ }
|
|
|
|
|
+ popupView.popupView(window,context,inflater, controlOutLayout,promptSettings,3);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void selectAddress(){
|
|
|
|
|
+ ViewSettings.Builder builder = new ViewSettings.Builder();
|
|
|
|
|
+ ViewSettings promptSettings =
|
|
|
|
|
+ builder .clickListener(popupSetAddrListener)
|
|
|
|
|
+ .titleTextStr("地址:")
|
|
|
|
|
+ .titleTextPaddings(new int[]{10,20,0,20})
|
|
|
|
|
+ .showTitleIcon(true)
|
|
|
|
|
+ .popupWidth(500)
|
|
|
|
|
+ .popupHeight(300)
|
|
|
|
|
+ .build();
|
|
|
|
|
+ if(setAddrLayout.getParent()!=null){
|
|
|
|
|
+ ((ViewGroup) setAddrLayout.getParent()).removeView(setAddrLayout);
|
|
|
|
|
+ }
|
|
|
|
|
+ popupView.popupView(window,context,inflater, setAddrLayout,promptSettings,3);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private void selectMotorIndex(){
|
|
|
|
|
+ ViewSettings.Builder builder = new ViewSettings.Builder();
|
|
|
|
|
+ ViewSettings promptSettings =
|
|
|
|
|
+ builder .clickListener(popupMotorTestListener)
|
|
|
|
|
+ .titleTextStr("电机索引号:")
|
|
|
|
|
+ .titleTextPaddings(new int[]{10,20,0,20})
|
|
|
|
|
+ .showTitleIcon(true)
|
|
|
|
|
+ .popupWidth(500)
|
|
|
|
|
+ .popupHeight(300)
|
|
|
|
|
+ .build();
|
|
|
|
|
+ if(motorTestLayout.getParent()!=null){
|
|
|
|
|
+ ((ViewGroup) motorTestLayout.getParent()).removeView(motorTestLayout);
|
|
|
|
|
+ }
|
|
|
|
|
+ popupView.popupView(window,context,inflater, motorTestLayout,promptSettings,3);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ PopupView.onClickListener popupStartMotorListener = new PopupView.onClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onYesBack(int what) {
|
|
public void onYesBack(int what) {
|
|
|
- pupWindows("X货道:"+xGoosdWay +" Y货道:"+yGoosdWay +" 数量:"+goodsNum);
|
|
|
|
|
- showLog("X货道:"+xGoosdWay +" Y货道:"+yGoosdWay +""+" 数量:"+goodsNum);
|
|
|
|
|
|
|
+ showLog("电机编号:"+indexValue);
|
|
|
|
|
+ showLog("电机类型:"+typeValue);
|
|
|
|
|
+ showLog("光幕模式:"+lightValue);
|
|
|
|
|
+ showLog("过流阈值:"+maxCurrentValue);
|
|
|
|
|
+ showLog("欠流阈值:"+minCurrentValue);
|
|
|
|
|
+ showLog("超时时间:"+motorTimerOutValue);
|
|
|
if(commTask != null){
|
|
if(commTask != null){
|
|
|
- commTask.saleGoods((byte) xGoosdWay, (byte) yGoosdWay, (byte) 1);
|
|
|
|
|
|
|
+ MotorStart motorStart = new MotorStart();
|
|
|
|
|
+ motorStart.setMotorIndex(indexValue);
|
|
|
|
|
+ motorStart.setMotorType(typeValue);
|
|
|
|
|
+ motorStart.setLightMode(lightValue);
|
|
|
|
|
+ motorStart.setCurrentMax(maxCurrentValue);
|
|
|
|
|
+ motorStart.setCurrentMin(minCurrentValue);
|
|
|
|
|
+ motorStart.setMotorTime(motorTimerOutValue);
|
|
|
|
|
+ commTask.startMotor(motorStart);
|
|
|
}else {
|
|
}else {
|
|
|
pupWindows("请打开串口!");
|
|
pupWindows("请打开串口!");
|
|
|
}
|
|
}
|
|
@@ -550,34 +806,79 @@ public class MainActivity extends AppCompatActivity {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- PopupSelect.onClickListener selectBackListener = new PopupSelect.onClickListener() {
|
|
|
|
|
|
|
+ PopupView.onClickListener popupControlOutListener = new PopupView.onClickListener() {
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
- public void onChooseBack(List<SelectListDataBean> selectListDataBeans, int what) {
|
|
|
|
|
- int choosed = -1;
|
|
|
|
|
- for(int i = 0;i<selectListDataBeans.size();i++){
|
|
|
|
|
- if(selectListDataBeans.get(i).isChoosed()){
|
|
|
|
|
- choosedLight = i;
|
|
|
|
|
- Logger.debug("choosed:"+choosedLight);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public void onYesBack(int what) {
|
|
|
|
|
+ showLog("开关量输出:"+ controlOutValue + " 开关:"+ controlSwitchValue);
|
|
|
|
|
+ if(commTask != null){
|
|
|
|
|
+ commTask.controlOut(controlOutValue, controlSwitchValue);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ pupWindows("请打开串口!");
|
|
|
}
|
|
}
|
|
|
- Logger.debug("what:"+what);
|
|
|
|
|
- if(what == 0){
|
|
|
|
|
- if(choosedLight >= 0) {
|
|
|
|
|
- if(commTask == null){
|
|
|
|
|
- pupWindows("请打开串口!");
|
|
|
|
|
- }else {
|
|
|
|
|
- if (commTask.isopen) {
|
|
|
|
|
- commTask.controlLight((byte) choosedLight);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onCancelBack(int what) {
|
|
|
|
|
+ pupWindows("pupWindows"+what+"取消按钮");
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ PopupView.onClickListener popupControlInListener = new PopupView.onClickListener() {
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onYesBack(int what) {
|
|
|
|
|
+ showLog("开关量输入:"+ controlInValue);
|
|
|
|
|
+ if(commTask != null){
|
|
|
|
|
+ commTask.controlIn(controlInValue);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ pupWindows("请打开串口!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onCancelBack(int what) {
|
|
|
|
|
+ pupWindows("pupWindows"+what+"取消按钮");
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ PopupView.onClickListener popupSetAddrListener = new PopupView.onClickListener() {
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onYesBack(int what) {
|
|
|
|
|
+ showLog("设置设备地址:"+ setAddressValue);
|
|
|
|
|
+ if(commTask != null){
|
|
|
|
|
+ commTask.setAddress(setAddressValue);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ pupWindows("请打开串口!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void onCancelBack(List<SelectListDataBean> selectListDataBeans, int what) {
|
|
|
|
|
|
|
+ public void onCancelBack(int what) {
|
|
|
|
|
+ pupWindows("pupWindows"+what+"取消按钮");
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ PopupView.onClickListener popupMotorTestListener = new PopupView.onClickListener() {
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onYesBack(int what) {
|
|
|
|
|
+ showLog("开始测试 电机:"+ motorTestValue);
|
|
|
|
|
+ if(commTask != null){
|
|
|
|
|
+ commTask.testMotor(motorTestValue);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ pupWindows("请打开串口!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onCancelBack(int what) {
|
|
|
|
|
+ pupWindows("pupWindows"+what+"取消按钮");
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|