|
@@ -51,7 +51,7 @@ import kr.co.icontrols.wallpadsupport.WpadTextView;
|
|
|
|
|
|
public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
|
|
|
- private final String TAG = "KnxSysAirconMainTestScrn";
|
|
|
+ private final String TAG = "KnxAirconMainTestScrn";
|
|
|
private Context mContext;
|
|
|
|
|
|
private final boolean DEBUG_LOG_ON = true;
|
|
@@ -233,7 +233,6 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
ViewRegistration(getLayout(), VolumeImg, Common.ImgPosion.GetX(left + mVolumePos[UX_MODE][0]), Common.ImgPosion.GetY(top + mVolumePos[UX_MODE][1]));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public void setVisible(boolean set) {
|
|
|
if (set) {
|
|
|
Background.setVisibility(View.VISIBLE);
|
|
@@ -316,7 +315,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
//info.Support.bModeFan = airconData.getSupportFan();
|
|
|
//info.Support.bModeHeating = airconData.getSupportHeating();
|
|
|
|
|
|
- DebugLogOutput("[Sample_DataDefaultSetting] info.RoomCount [" + mData.systemAircon.Device.info.InsideAirconCount + "]");
|
|
|
+ DebugLogOutput("aircontest--[makeDeviceData] info.RoomCount [" + mData.systemAircon.Device.info.InsideAirconCount + "]");
|
|
|
for (byte i = 0; i < mData.systemAircon.Device.info.InsideAirconCount; i++) {
|
|
|
KnxSystemAircon.AirData roomData = mData.systemAircon.Device.Aircon[i];
|
|
|
AirconArrayData airconDataArray = gson.fromJson(jsonArray.get(i).toString(), AirconArrayData.class);
|
|
@@ -346,7 +345,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
|
|
|
AllRoomTxt = new WpadTextView(mContext, false, 210, 56, Gravity.CENTER, Color.WHITE, Common.fontsize._36, true, ID.KnxSystemAirconMain.text.TITLE);
|
|
|
ViewRegistration(getLayout(), AllRoomTxt, Common.ImgPosion.GetX(990), Common.ImgPosion.GetY(179 - yMarginWithPage));
|
|
|
- AllRoomTxt.setText("[전체 방]");
|
|
|
+ AllRoomTxt.setText("[전체]");
|
|
|
|
|
|
AllOnOffBtn = new WpadImageView(getContext(), WpadImageView.TOUCH_KIND.BUTTON, 140, 100,
|
|
|
new int[]{R.drawable.btn_heat_onoff_off, R.drawable.btn_heat_onoff_off},
|
|
@@ -414,9 +413,9 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
{
|
|
|
// 6.3. update
|
|
|
if (OPERATION_MODE == Common.MODE_NOMAL) {
|
|
|
- if (louverAPI != null) {
|
|
|
- Draw_Update(INDEX_LOUVER);
|
|
|
- }
|
|
|
+ //if (louverAPI != null) {
|
|
|
+ // Draw_Update(INDEX_LOUVER);
|
|
|
+ //}
|
|
|
}
|
|
|
}
|
|
|
catch(Exception e)
|
|
@@ -434,10 +433,14 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
}
|
|
|
|
|
|
private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state){
|
|
|
+ if (timer != null)
|
|
|
+ timer.cancel();
|
|
|
((MainActivity) mContext).requestMultiControl(handler, JSON.MENU.AIRCON, kind, reason, position, category, number, state);
|
|
|
}
|
|
|
|
|
|
private void requestMultiCommand(int kind, int reason, int position, String category, int number, double state) {
|
|
|
+ if (timer != null)
|
|
|
+ timer.cancel();
|
|
|
((MainActivity) mContext).requestMultiControl(handler, JSON.MENU.AIRCON, kind, reason, position, category, number, state);
|
|
|
}
|
|
|
|
|
@@ -459,6 +462,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
}
|
|
|
|
|
|
Timer timer;
|
|
|
+ TimerTask TT;
|
|
|
|
|
|
@SuppressLint("HandlerLeak")
|
|
|
final Handler handler = new Handler() {
|
|
@@ -476,15 +480,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
if(resultData.getType().equals("controlResponse")&&resultData.getResult().equals("ok")) {
|
|
|
//제어 명령을 내리고 제대로 응답이 오면 상태를 다시 조회해서 UI 갱신하도록 한다.
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
- timer = new Timer();
|
|
|
- TimerTask TT = new TimerTask() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- // 반복실행할 구문
|
|
|
- updateData();
|
|
|
- }
|
|
|
- };
|
|
|
- timer.schedule(TT, 500, 4000); //Timer 실행
|
|
|
+ startRefreshTimer(2000);
|
|
|
}
|
|
|
else if(resultData.getType().equals("updateResponse")) {
|
|
|
//상태 조회 응답이 오면, data를 갱신한다.
|
|
@@ -542,22 +538,26 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
}
|
|
|
|
|
|
//에어컨 전체 상태 조회. 조회해서 data에 대입해준다.
|
|
|
- updateData();
|
|
|
+ startRefreshTimer(300);
|
|
|
+ //updateData();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void startRefreshTimer(int delay){
|
|
|
+ timer = new Timer();
|
|
|
+ TT = new TimerTask() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ // 반복실행할 구문
|
|
|
+ updateData();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ timer.schedule(TT, delay, 4000); //Timer 실행
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
protected void onClose() {
|
|
|
super.onClose();
|
|
|
- ((MainActivity) getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
|
-
|
|
|
- WallpadStatusData wd = new WallpadStatusData(this.getContext());
|
|
|
- Log.d(TAG, "close db val = " + wd.GetCurrentScreenIDValue());
|
|
|
-
|
|
|
- wd.SetCurrentScreenIDValue(0);
|
|
|
- Log.d(TAG, "change close db val = " + wd.GetCurrentScreenIDValue());
|
|
|
-
|
|
|
- wd.closeDB();
|
|
|
|
|
|
if (timer != null)
|
|
|
timer.cancel();
|
|
@@ -596,11 +596,8 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
}
|
|
|
if (nTargetId == ID.KnxSystemAirconMain.button.ALL_ONOFF) {
|
|
|
DebugLogOutput("onTouchEvent [ALL_ONOFF] BUTTON !!!");
|
|
|
- if (timer != null)
|
|
|
- timer.cancel();
|
|
|
if (OPERATION_MODE == Common.MODE_NOMAL) {
|
|
|
byte onoff = KnxSystemAircon.ONOFF.AirconON;
|
|
|
- //madeinLab**
|
|
|
if(bCurrentAllOnOff) {
|
|
|
onoff = KnxSystemAircon.ONOFF.AirconOFF;
|
|
|
}
|
|
@@ -618,7 +615,8 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
//Sample_AllControl(!bCurrentAllOnOff, true, nCurrentAllModeIdx);
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
}
|
|
|
- } else if ((nTargetId >= ID.KnxSystemAirconMain.button.ROOM_TITLE_1) && (nTargetId <= ID.KnxSystemAirconMain.button.ROOM_TITLE_MAX)) {
|
|
|
+ }
|
|
|
+ else if ((nTargetId >= ID.KnxSystemAirconMain.button.ROOM_TITLE_1) && (nTargetId <= ID.KnxSystemAirconMain.button.ROOM_TITLE_MAX)) {
|
|
|
if (timer != null)
|
|
|
timer.cancel();
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
@@ -679,14 +677,12 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
|
|
|
((MainActivity) (getContext())).StartPopup(ID.screen.SystemAirconPopupTestScreen, data);
|
|
|
}
|
|
|
- } else if ((nTargetId >= ID.KnxSystemAirconMain.button.ROOM_ONOFF_1) && (nTargetId <= ID.KnxSystemAirconMain.button.ROOM_ONOFF_MAX))
|
|
|
+ }
|
|
|
+ else if ((nTargetId >= ID.KnxSystemAirconMain.button.ROOM_ONOFF_1) && (nTargetId <= ID.KnxSystemAirconMain.button.ROOM_ONOFF_MAX))
|
|
|
{
|
|
|
// 각방 ON/OFF 클릭
|
|
|
int index = nTargetId - ID.KnxSystemAirconMain.button.ROOM_ONOFF_1;
|
|
|
DebugLogOutput("onTouchEvent [ROOM_ONOFF_" + (index+1) + "] BUTTON !!!");
|
|
|
- if (timer != null)
|
|
|
- timer.cancel();
|
|
|
-
|
|
|
if (OPERATION_MODE == Common.MODE_NOMAL)
|
|
|
{
|
|
|
int pos = ROOM_POS[index];
|
|
@@ -728,20 +724,16 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
}
|
|
|
else if((nTargetId >= ID.KnxSystemAirconMain.button.AUTO_MODE) && (nTargetId <= ID.KnxSystemAirconMain.button.HEAT_MODE))
|
|
|
{
|
|
|
- if (timer != null)
|
|
|
- timer.cancel();
|
|
|
int mode = nTargetId - ID.KnxSystemAirconMain.button.AUTO_MODE;
|
|
|
int ret = Device_AllMode((byte)mode);
|
|
|
- if (ret >= 0) {
|
|
|
- Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
- savedMode = (byte)mode; //모드저장
|
|
|
- }
|
|
|
- else Sound().Play(SND.effect.TOUCH_UNLATCHED);
|
|
|
+ //if (ret >= 0) {
|
|
|
+ // Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ // savedMode = (byte)mode; //모드저장
|
|
|
+ //}
|
|
|
+ //else Sound().Play(SND.effect.TOUCH_UNLATCHED);
|
|
|
}
|
|
|
else if((nTargetId >= ID.KnxSystemAirconMain.button.AUTO_VOLUME) && (nTargetId <= ID.KnxSystemAirconMain.button.STRONG_VOLUME))
|
|
|
{
|
|
|
- if (timer != null)
|
|
|
- timer.cancel();
|
|
|
int volume = nTargetId - ID.KnxSystemAirconMain.button.AUTO_VOLUME;
|
|
|
int ret = Device_AllVolume((byte)volume);
|
|
|
if (ret >= 0) {
|
|
@@ -749,8 +741,6 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
}
|
|
|
else Sound().Play(SND.effect.TOUCH_UNLATCHED);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -764,7 +754,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
public void run() {
|
|
|
updateData();
|
|
|
}
|
|
|
- }, 5000);
|
|
|
+ }, 2000);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -779,6 +769,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
|
|
|
|
|
|
private void Draw_Update(byte index) {
|
|
|
+ DebugLogOutput("aircontest--[Draw_Update]" );
|
|
|
int startIdx = (CurrentPageNum - 1) * ROOM_CNT;
|
|
|
KnxSystemAircon.Info info = mData.systemAircon.Device.info;
|
|
|
//에어컨 연동상태를 체크해서 에어컨 연동완료 일때만 UI를 그려준다. 그 이전에 alarm 문구 노출.
|
|
@@ -850,8 +841,8 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
|
|
|
|
|
|
//루버 상태 update draw
|
|
|
- LouverAPI.Data louverData = mDataLouver.louver;
|
|
|
- Draw_LouverStatusChange(louverData.LouverStatus);
|
|
|
+ //LouverAPI.Data louverData = mDataLouver.louver;
|
|
|
+ //Draw_LouverStatusChange(louverData.LouverStatus);
|
|
|
} else if(index == INDEX_LOUVER){
|
|
|
//루버 상태 update draw
|
|
|
LouverAPI.Data louverData = mDataLouver.louver;
|
|
@@ -869,6 +860,8 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
}
|
|
|
|
|
|
private void Draw_CurrentPage(KnxSystemAircon.Info info, int startIdx) {
|
|
|
+ Log.e(TAG, "aircontest--Draw_CurrentPage(int startIdx)" + startIdx + "(int CurrentPageNum)" + CurrentPageNum);
|
|
|
+
|
|
|
try {
|
|
|
//에어컨 연동상태를 체크해서 에어컨 연동완료 일때만 UI를 그려준다. 그 이전에 alarm 문구 노출.
|
|
|
if(info.AirconStatus!= KnxSystemAircon.Status.COMPLETE){
|
|
@@ -906,10 +899,11 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
RightMoveBtn.setVisibility(View.INVISIBLE);
|
|
|
PageNumText.setVisibility(View.INVISIBLE);
|
|
|
}
|
|
|
-
|
|
|
+/*
|
|
|
if (startIdx > 0 && startIdx % ROOM_CNT == 0) {
|
|
|
for (int j = 0; j < startIdx; j++) {
|
|
|
- roomView[j].setVisible(false);
|
|
|
+ if (roomView[j] != null)
|
|
|
+ roomView[j].setVisible(false);
|
|
|
}
|
|
|
} else {
|
|
|
for (int j = ROOM_CNT; j < info.InsideAirconCount; j++) {
|
|
@@ -917,6 +911,12 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
roomView[j].setVisible(false);
|
|
|
}
|
|
|
}
|
|
|
+*/
|
|
|
+ if (startIdx >= 0 && startIdx % ROOM_CNT == 0) {
|
|
|
+ for (int j = 0; j < roomView.length; j++) {
|
|
|
+ if (roomView[j] != null) roomView[j].setVisible(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
int left, top;
|
|
|
for (int i = startIdx; i < info.InsideAirconCount && i < startIdx + ROOM_CNT; i++) {
|
|
@@ -928,7 +928,6 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
Draw_TitleUpdate(i);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- Log.e(TAG, "[Exception] Draw_CurrentPage(HeatingV2.Info info, int startIdx)");
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
@@ -939,6 +938,8 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
* @param bNext - (boolean) true이면 다음 이동, false이면 이전 이동
|
|
|
*/
|
|
|
private void MovePage(boolean bNext) {
|
|
|
+ //if (timer != null)
|
|
|
+ // timer.cancel();
|
|
|
try {
|
|
|
if (bNext) {
|
|
|
CurrentPageNum++;
|
|
@@ -982,6 +983,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
if (!Draw_RangeChecker(index)) return;
|
|
|
|
|
|
DebugLogOutput("[Draw_ModeChange] Aircon[" + index + "].OnOff = " + mData.systemAircon.Device.Aircon[index].OnOff);
|
|
|
+ DebugLogOutput("aircontest--[Draw_OnOffChange]" );
|
|
|
int pos = ROOM_POS[index];
|
|
|
if (mData.systemAircon.Device.Aircon[pos].OnOff == KnxSystemAircon.ONOFF.AirconON)
|
|
|
roomView[index].OnOffBtn.setButtonRearImage();
|
|
@@ -1139,6 +1141,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
private void Draw_TitleChange(int index, String value)
|
|
|
{
|
|
|
if(!Draw_RangeChecker(index)) return;
|
|
|
+ roomView[index].TitleText.setText(value);
|
|
|
roomView[index].TitleText.setTextSize(0, Common.fontsize._30);
|
|
|
if(value.length() == 6)
|
|
|
{
|
|
@@ -1331,6 +1334,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
|
|
|
byte vVolume = KnxSystemAircon.VOLUME.Auto;
|
|
|
byte vMode = mode;
|
|
|
byte controlValue = (byte) (vOnOff+(vVolume<<2)+(vMode<<4));
|
|
|
+ savedMode = (byte)mode; //모드저장
|
|
|
requestMultiCommand(JSON.KIND.All,JSON.REASON.Control,0, "switch",0, controlValue);
|
|
|
//ret = Device_AllControl(controlValue);
|
|
|
}
|