private void submitButton() { if (edtText_ipSet.getText().toString().equals("")) { ToastUtils.showShort(this, "请输入服务器IP地址!"); return; } if (edtText_portSet.getText().toString().equals("")) { ToastUtils.showShort(this, "请输入端口号!"); return; } String ip = edtText_ipSet.getText().toString(); String port = edtText_portSet.getText().toString(); SPUtils.put(this, Constants.SERVERIP, ip); SPUtils.put(this, Constants.SERVERPORT, port); ToastUtils.showShort(this, "设置成功!"); mIpSetDialog.dismiss(); }
@Override // 成功接收到数据 public void onSuccessData(String msg) { String orderCode = msg.substring(51, 56).replaceAll(" ", ""); // 场景模式控制命令 if (orderCode.equalsIgnoreCase(UdpSend.SITUATION_CONTROL_ORDER_CODE)) { } // 获取场景模式命令 else if (orderCode.equalsIgnoreCase(UdpSend.GET_SITUATION_ORDER_CODE)) { SPUtils.put(IndexActivity.this, "situationMode", msg); Intent intent = new Intent("txPark.updateSituation"); intent.putExtra("updateSituation", msg); LocalBroadcastManager.getInstance(IndexActivity.this).sendBroadcast(intent); } // 获取设备状态命令 else if (orderCode.equalsIgnoreCase(UdpSend.GET_EQUIPMENT_STATUS_ORDER_CODE)) { SPUtils.put(IndexActivity.this, "equipStatus", msg); // 保存到SP Intent intent = new Intent("txPark.updateEquipStatus"); intent.putExtra("equipStatus", msg); LocalBroadcastManager.getInstance(IndexActivity.this).sendBroadcast(intent); } // 灯光控制命令 else if (orderCode.equalsIgnoreCase(UdpSend.LIGHT_CONTROL_ORDER_CODE)) { } // 红外控制命令 else if (orderCode.equalsIgnoreCase(UdpSend.INFRARED_CONTROL_ORDER_CODE)) { } // 窗帘控制命令 else if (orderCode.equalsIgnoreCase(UdpSend.CURTAIN_CONTROL_ORDER_CODE)) { } // IP设置命令 else if (orderCode.equalsIgnoreCase(UdpSend.IP_SET_ORDER_CODE)) { } }