|
@@ -167,6 +167,7 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
public String ReserveUse = "";
|
|
|
|
|
|
private final int DEVICE_CMD_TEMP_CHANGE = 10000;
|
|
|
+ private final int DRAW_CMD_DELAY_CHANGE = 10000;
|
|
|
|
|
|
HeatingData heatingData;
|
|
|
|
|
@@ -175,9 +176,26 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
// =================================================================================================
|
|
|
|
|
|
/**
|
|
|
- * 제어함수 시작
|
|
|
+ * 화면갱신이 응답 딜레이로 인해 늦게 반영되는 경우를 막기위해 반복적으로 응답이 오는 경우 스킵함
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
*/
|
|
|
+ private boolean drawSetDelayed(int delayTime) {
|
|
|
+ // 1. 핸들러 null 체크
|
|
|
+ if (mDrawSetHandler == null) return false;
|
|
|
+
|
|
|
+ // 2. 이전 기록이 있을 경우 메시지를 삭제한다.
|
|
|
+ mDrawSetHandler.removeMessages(DRAW_CMD_DELAY_CHANGE);
|
|
|
+
|
|
|
+ // 4. 핸들러에 메시지 전송
|
|
|
+ mDrawSetHandler.sendEmptyMessageDelayed(DRAW_CMD_DELAY_CHANGE, delayTime);
|
|
|
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 제어함수 시작
|
|
|
+ */
|
|
|
private void makeDeviceData(JSONObject jsonObject) {
|
|
|
try {
|
|
|
Gson gson = new Gson();
|
|
@@ -214,7 +232,6 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
info.Support.OutsideTempUse = heatingData.getSupportOutSideTempUse();
|
|
|
info.Support.Boiler = heatingData.getSupportBoiler();
|
|
|
|
|
|
- DebugLogOutput("[Sample_DataDefaultSetting] info.RoomCount [" + mData.heatingV2.Device.info.RoomCount + "]");
|
|
|
for (byte i = 0; i < mData.heatingV2.Device.info.RoomCount; i++) {
|
|
|
DataClasses.HeatingV2.RoomData roomData = mData.heatingV2.Device.Room[i];
|
|
|
HeatingArrayData heatingArrayData = gson.fromJson(jsonArray.get(i).toString(), HeatingArrayData.class);
|
|
@@ -234,7 +251,7 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
} catch (RuntimeException re) {
|
|
|
LogUtil.errorLogInfo("", TAG, re);
|
|
|
} catch (Exception e) {
|
|
|
- Log.e(TAG, "[Exception] Sample_DataDefaultSetting()");
|
|
|
+ Log.e(TAG, "[Exception] makeDeviceData()");
|
|
|
//e.printStackTrace();
|
|
|
LogUtil.errorLogInfo("", TAG, e);
|
|
|
}
|
|
@@ -263,7 +280,6 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
timer.purge();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state) {
|
|
|
resetTimer();
|
|
|
position = ROOM_POS[position];
|
|
@@ -295,6 +311,8 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
Timer timer;
|
|
|
TimerTask TT;
|
|
|
|
|
|
+ static int delayTime = 800;
|
|
|
+
|
|
|
@SuppressLint("HandlerLeak")
|
|
|
final Handler handler = new Handler() {
|
|
|
Gson gson = new Gson();
|
|
@@ -310,9 +328,10 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
ResultData resultData = gson.fromJson(jsonObject.toString(), ResultData.class);
|
|
|
if (resultData.getType().equals("controlResponse") && resultData.getResult().equals("ok")) {
|
|
|
//제어 명령을 내리고 제대로 응답이 오면 상태를 다시 조회해서 UI 갱신하도록 한다.
|
|
|
- Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ //Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
//startRefreshTimer(500);
|
|
|
- updateData();
|
|
|
+ //updateData();
|
|
|
+ drawSetDelayed(delayTime);
|
|
|
} else if (resultData.getType().equals("updateResponse")) {
|
|
|
//상태 조회 응답이 오면, data를 갱신한다.
|
|
|
makeDeviceData(jsonObject);
|
|
@@ -834,72 +853,66 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
////////////////////////////////////////////////////
|
|
|
if (MoveEvent == MotionEvent.ACTION_UP) {
|
|
|
if (TargetId == ID.heatingV2Popup.tabDefault.button.ONOFF) {
|
|
|
- DebugLogOutput("onTouchEvent [DefaultTab-ONOFF] BUTTON !!!");
|
|
|
-
|
|
|
-
|
|
|
byte ChangeMode = HeatingV2.MODE.HeatingOFF;
|
|
|
if (!Data_DriveModeConverterOnOff((byte) this.mCurrentRoomIndex))
|
|
|
ChangeMode = HeatingV2.MODE.HeatingON;
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 100;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, this.mCurrentRoomIndex, "set_mode", 0, ChangeMode);
|
|
|
//Sample_ControlMode((byte) this.mCurrentRoomIndex, ChangeMode);
|
|
|
- } else if (TargetId == ID.heatingV2Popup.tabDefault.button.HEATING) {
|
|
|
- DebugLogOutput("onTouchEvent [DefaultTab-HEATING] BUTTON !!!");
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+ else if (TargetId == ID.heatingV2Popup.tabDefault.button.HEATING) {
|
|
|
if (Data_getDriveMode((byte) mCurrentRoomIndex) != HeatingV2.MODE.HeatingON) {
|
|
|
|
|
|
byte ChangeMode = HeatingV2.MODE.HeatingON;
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 100;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, this.mCurrentRoomIndex, "set_mode", 0, ChangeMode);
|
|
|
//Sample_ControlMode((byte) this.mCurrentRoomIndex, ChangeMode);
|
|
|
}
|
|
|
- } else if (TargetId == ID.heatingV2Popup.tabDefault.button.RESERVATION) {
|
|
|
- DebugLogOutput("onTouchEvent [DefaultTab-RESERVATION] BUTTON !!!");
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+ else if (TargetId == ID.heatingV2Popup.tabDefault.button.RESERVATION) {
|
|
|
if (Data_getDriveMode((byte) mCurrentRoomIndex) != HeatingV2.MODE.Reservation) {
|
|
|
byte ChangeMode = HeatingV2.MODE.Reservation;
|
|
|
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 100;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, this.mCurrentRoomIndex, "set_mode", 0, ChangeMode);
|
|
|
//Sample_ControlMode((byte) this.mCurrentRoomIndex, ChangeMode);
|
|
|
}
|
|
|
- } else if (TargetId == ID.heatingV2Popup.tabDefault.button.SLEEP) {
|
|
|
- DebugLogOutput("onTouchEvent [DefaultTab-SLEEP] BUTTON !!!");
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+ else if (TargetId == ID.heatingV2Popup.tabDefault.button.SLEEP) {
|
|
|
if (Data_getDriveMode((byte) mCurrentRoomIndex) != HeatingV2.MODE.Sleep) {
|
|
|
byte ChangeMode = HeatingV2.MODE.Sleep;
|
|
|
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 100;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, this.mCurrentRoomIndex, "set_mode", 0, ChangeMode);
|
|
|
//Sample_ControlMode((byte) this.mCurrentRoomIndex, ChangeMode);
|
|
|
}
|
|
|
- } else if (TargetId == ID.heatingV2Popup.tabDefault.button.OUTING) {
|
|
|
- DebugLogOutput("onTouchEvent [DefaultTab-OUTING] BUTTON !!!");
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+ else if (TargetId == ID.heatingV2Popup.tabDefault.button.OUTING) {
|
|
|
if (Data_getDriveMode((byte) mCurrentRoomIndex) != HeatingV2.MODE.Outing) {
|
|
|
byte ChangeMode = HeatingV2.MODE.Outing;
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 100;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, this.mCurrentRoomIndex, "set_mode", 0, ChangeMode);
|
|
|
//Sample_ControlMode((byte) this.mCurrentRoomIndex, ChangeMode);
|
|
|
}
|
|
|
- } else if (TargetId == ID.heatingV2Popup.tabDefault.button.TEMP_UP) {
|
|
|
+ }
|
|
|
+ else if (TargetId == ID.heatingV2Popup.tabDefault.button.TEMP_UP) {
|
|
|
DebugLogOutput("onTouchEvent [DefaultTab-TEMP_UP(short)] BUTTON !!!");
|
|
|
//Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
Data_TempUpDn(true);
|
|
|
Device_TempSetDelayed(10);
|
|
|
- //Sample_ChangeValveReflect();
|
|
|
- //drawUpdate((byte) mCurrentRoomIndex);
|
|
|
- } else if (TargetId == ID.heatingV2Popup.tabDefault.button.TEMP_DN) {
|
|
|
+ drawUpdate((byte) mCurrentRoomIndex);
|
|
|
+ }
|
|
|
+ else if (TargetId == ID.heatingV2Popup.tabDefault.button.TEMP_DN) {
|
|
|
DebugLogOutput("onTouchEvent [DefaultTab-TEMP_DN(short)] BUTTON !!!");
|
|
|
//Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
Data_TempUpDn(false);
|
|
|
Device_TempSetDelayed(10);
|
|
|
- //Sample_ChangeValveReflect();
|
|
|
- //drawUpdate((byte) mCurrentRoomIndex);
|
|
|
+ drawUpdate((byte) mCurrentRoomIndex);
|
|
|
}
|
|
|
} else if (MoveEvent == MotionEvent.ACTION_POINTER_DOWN) {
|
|
|
if (TargetId == ID.heatingV2Popup.tabDefault.button.TEMP_UP) {
|
|
@@ -1408,6 +1421,7 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
private void Device_ControlTemp(byte RoomIdx, double setTemp) {
|
|
|
DebugLogOutput("[Device_ControlTemp] - (RoomIdx:" + RoomIdx + ", setTemp:" + setTemp + ")");
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 800;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, RoomIdx, "set_temp", 0, setTemp);
|
|
|
//return Device_SetEachRoomStatus(RoomIdx, HeatingV2.MODE.Idle, setTemp);
|
|
|
}
|
|
@@ -1456,6 +1470,27 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 화면 갱신을 일정시간 이후 제어할수 있도록 만드는 핸들러
|
|
|
+ */
|
|
|
+ private Handler mDrawSetHandler = new Handler() {
|
|
|
+ @SuppressLint("HandlerLeak")
|
|
|
+ @Override
|
|
|
+ public void handleMessage(Message msg) {
|
|
|
+ try {
|
|
|
+ if (msg.what == DRAW_CMD_DELAY_CHANGE) {
|
|
|
+ Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ updateData();
|
|
|
+ }
|
|
|
+ } catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", TAG, re);
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.w(TAG, "[mDrawSetHandler] - Exception");
|
|
|
+ LogUtil.errorLogInfo("", TAG, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* 설정온도제어를 일정시간 이후 제어할수 있도록 만드는 핸들러
|
|
|
*/
|
|
@@ -1565,6 +1600,7 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
int newIndex = ROOM_POS[mCurrentRoomIndex];
|
|
|
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 100;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, mCurrentRoomIndex, "set_reservation", 0,
|
|
|
mData.heatingV2.Device.Room[newIndex].Reservation.getInt());
|
|
|
//Device_SetReservation((byte) mCurrentRoomIndex,
|
|
@@ -1592,6 +1628,7 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
|
|
|
mData.ChangeSleepTime = false;
|
|
|
|
|
|
//난방 개별 제어.
|
|
|
+ delayTime = 100;
|
|
|
requestMultiCommand(JSON.KIND.Individual, JSON.REASON.Control, mCurrentRoomIndex, "set_sleep", SetTime, SetTemp);
|
|
|
|
|
|
//Device_SetSleep((byte) mCurrentRoomIndex, SetTemp, SetTime);
|