|
@@ -2078,7 +2078,6 @@ public class DataSenderService extends Service {
|
|
|
|| Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
|
|
|
|| Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF) {
|
|
|
strResult += " <devinfo name=\"light\" value=\"0\" order=\"1\" floor=\"" + index + "\"/>\r\n";
|
|
|
- Log.w(TAG, "[iCMDProcDevList] Not supported!!");
|
|
|
}
|
|
|
} catch (RuntimeException re) {
|
|
|
LogUtil.errorLogInfo("", TAG, re);
|
|
@@ -2422,38 +2421,6 @@ public class DataSenderService extends Service {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public String SendData(String ui, String type, String menu, String function, Object value, int valueType) {
|
|
|
- String ret = null;
|
|
|
- String strValue = null;
|
|
|
-
|
|
|
- if (thread == null) {
|
|
|
- thread = new ServerThread();
|
|
|
- thread.start();
|
|
|
- }
|
|
|
-
|
|
|
- if (valueType == 0) {
|
|
|
- strValue = String.valueOf(value);
|
|
|
- } else if (valueType == 1) {
|
|
|
- strValue = String.valueOf(value);
|
|
|
- } else if (valueType == 2) {
|
|
|
- strValue = value.toString();
|
|
|
- } else if (valueType == 3) {
|
|
|
- strValue = value.toString();
|
|
|
- }
|
|
|
-
|
|
|
- String addData = String.format("%s;%s;%s;%s;%s;%s;%s", String.valueOf(valueType), ui, type, menu, function, strValue, "param4");
|
|
|
-
|
|
|
- Log.d("AIDLTEST", "addData : " + addData);
|
|
|
-
|
|
|
- try {
|
|
|
- //this.mBinder.sendEventData(addData);
|
|
|
- return "Success";
|
|
|
- } catch (Exception var7) {
|
|
|
- Log.e("AIDLTEST", "Catch Exception Afer Send Data to Service");
|
|
|
- return "EXCEPTION";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public void saveChangedEnergyMeterStatus() {
|
|
|
try {
|
|
|
for (int i = 0; i < mEnergyMeterAPI.data.RoomCnt; i++) {
|
|
@@ -2535,80 +2502,7 @@ public class DataSenderService extends Service {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
- * 거실 조명 제어기기의 상태를 비교하여 데이터 수집 연동 서버로 전송한다.
|
|
|
- * 변경된 상태는 백업한다.
|
|
|
- */
|
|
|
- public void checkChangedSdbLivingLight() {
|
|
|
- try {
|
|
|
- if (mSdb_LivingRoomLightAPI != null) {
|
|
|
- mSdb_LivingRoomLightAPI.Refresh();
|
|
|
- boolean bChangeState = false;
|
|
|
-
|
|
|
- for (int i = 0; i < mSdb_LivingRoomLightAPI.data.Info.LightCount; i++) {
|
|
|
- Log.d(TAG, "[checkChangedSdbLivingLight] mSdb_LivingRoomLightAPI.data.Data.LedLight[" + i + "].Data.OnOff = " + mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.OnOff + ", mSDBEMInfo.LivingRoom.Light_bOnOff[" + i + "] = " + mSDBEMInfo.LivingRoom.Light_bOnOff[i]);
|
|
|
- Log.d(TAG, "[checkChangedSdbLivingLight] mSdb_LivingRoomLightAPI.data.Data.LedLight[" + i + "].Data.Dimming = " + mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Dimming + ", mSDBEMInfo.LivingRoom.Light_hDim[" + i + "] = " + mSDBEMInfo.LivingRoom.Light_hDim[i]);
|
|
|
- Log.d(TAG, "[checkChangedSdbLivingLight] mSdb_LivingRoomLightAPI.data.Data.LedLight[" + i + "].Data.Color = " + mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Color + ", mSDBEMInfo.LivingRoom.Light_hColor[" + i + "] = " + mSDBEMInfo.LivingRoom.Light_hColor[i]);
|
|
|
-
|
|
|
- if (mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.OnOff != mSDBEMInfo.LivingRoom.Light_bOnOff[i]
|
|
|
- || mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Dimming != mSDBEMInfo.LivingRoom.Light_hDim[i]
|
|
|
- || mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Color != mSDBEMInfo.LivingRoom.Light_hColor[i]) {
|
|
|
- // 조명값이 변경된 경우
|
|
|
-
|
|
|
- String status_power = "off";
|
|
|
- int status_dim = 0, status_color = 0;
|
|
|
-
|
|
|
- if (mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Info.Support.OnOff) {
|
|
|
- status_power = (mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.OnOff) ? "on" : "off";
|
|
|
- } else {
|
|
|
- status_power = "null";
|
|
|
- }
|
|
|
-
|
|
|
- if (mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Info.Support.Dimming) {
|
|
|
- status_dim = mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Dimming;
|
|
|
- } else {
|
|
|
- status_dim = 0;
|
|
|
- }
|
|
|
-
|
|
|
- if (mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Info.Support.Color) {
|
|
|
- status_color = mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Color;
|
|
|
- } else {
|
|
|
- status_color = 0;
|
|
|
- }
|
|
|
- bChangeState = true;
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- try {
|
|
|
- if (i == 0) {
|
|
|
- jsonObject.accumulate("category", "livingroom");
|
|
|
- } else {
|
|
|
- jsonObject.accumulate("category", "hall");
|
|
|
- }
|
|
|
- jsonObject.accumulate("state", status_power);
|
|
|
- jsonObject.accumulate("dimming", status_dim);
|
|
|
- jsonObject.accumulate("colorTemperature", status_color);
|
|
|
- } catch (JSONException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- SendData("icon", "device", "light", "each_control", jsonObject, 2);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if (bChangeState == true) {
|
|
|
- for (int i = 0; i < mSdb_LivingRoomLightAPI.data.Info.LightCount; i++) {
|
|
|
- mSDBEMInfo.LivingRoom.Light_bOnOff[i] = mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.OnOff;
|
|
|
- mSDBEMInfo.LivingRoom.Light_hDim[i] = mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Dimming;
|
|
|
- mSDBEMInfo.LivingRoom.Light_hColor[i] = mSdb_LivingRoomLightAPI.data.Data.LedLight[i].Data.Color;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- mSdb_LivingRoomLightAPI = mWallPadAPI.Get_Sdb_LivingRoomLightAPI();
|
|
|
- Log.d(TAG, "[checkChangedSdbLivingLight] mSdb_LivingRoomLightAPI == null");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- Log.e(TAG, "[Exception] checkChangedSdbLivingLight()");
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/*
|
|
|
* 환기 제어기기의 상태를 비교하여 데이터 수집 연동 서버로 전송한다.
|
|
@@ -2748,113 +2642,6 @@ public class DataSenderService extends Service {
|
|
|
* 에너지미터의 조명과 콘센트의 상태를 비교하여 변경되었으면 데이터 수집 연동 서버로 메세지를 전송한다.
|
|
|
* 변경된 상태는 백업한다.
|
|
|
*/
|
|
|
- public void checkChangedEnergyMeter() {
|
|
|
- String installed, comm, relay;
|
|
|
- String constantOutlet;
|
|
|
- int lightCount;
|
|
|
-
|
|
|
- try {
|
|
|
- if (mEnergyMeterAPI != null) {
|
|
|
- mEnergyMeterAPI.Refresh((byte) 0xFF, false);
|
|
|
- boolean bChangeState = false;
|
|
|
-
|
|
|
- for (int i = 0; i < mEnergyMeterAPI.data.RoomCnt; i++) {
|
|
|
- JSONArray state = new JSONArray();
|
|
|
- JSONArray lightState = new JSONArray();
|
|
|
- JSONArray outletState = new JSONArray();
|
|
|
- //installed
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].Install) {
|
|
|
- installed = "installed";
|
|
|
- } else {
|
|
|
- installed = "not_installed";
|
|
|
- }
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].CommStatus) {
|
|
|
- comm = "comm_ok";
|
|
|
- } else {
|
|
|
- comm = "comm_error";
|
|
|
- }
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].AllLightRelay_Use) {
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].AllLightRelay_OnOff) {
|
|
|
- relay = "relay_on";
|
|
|
- } else {
|
|
|
- relay = "relay_off";
|
|
|
- }
|
|
|
- } else {
|
|
|
- relay = "relay_not_supported";
|
|
|
- }
|
|
|
- state.put(installed);
|
|
|
- state.put(comm);
|
|
|
- state.put(relay);
|
|
|
-
|
|
|
- lightCount = mEnergyMeterAPI.data.Em.eachRoom[i].LightCnt;
|
|
|
- // 각 에너지미터에 대한 조명 갯수
|
|
|
- for (int j = 0; j < mEnergyMeterAPI.data.Em.eachRoom[i].LightCnt; j++) {
|
|
|
- if (mSDBEMInfo.EachRoom[i].Light_bOnOff[j] != mEnergyMeterAPI.data.Em.eachRoom[i].LightOnOff[j]) {
|
|
|
- // 같지 않다면 각각에 대해서 상태 메세지를 보낸다.
|
|
|
- bChangeState = true;
|
|
|
- String status = "off";
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].LightOnOff[j] == true)
|
|
|
- status = "on";
|
|
|
-
|
|
|
- lightState.put(status);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].ConMode) {
|
|
|
- constantOutlet = "disable";
|
|
|
- } else {
|
|
|
- constantOutlet = "enable";
|
|
|
- }
|
|
|
- // 각 에너지미터에 대한 콘센트 갯수
|
|
|
-
|
|
|
- int concentCount = mEnergyMeterAPI.data.Em.eachRoom[i].ConCnt;
|
|
|
-
|
|
|
- if (concentCount >= 3) concentCount = 2;
|
|
|
-
|
|
|
- for (int j = 0; j < concentCount; j++) {
|
|
|
- String conMode = "set/";
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].ConMode == false)
|
|
|
- conMode = "unset/";
|
|
|
-
|
|
|
- Log.d(TAG, "before => room number : " + i + ", switch : " + j + ", status : " + mEMeter.eachRoom[i].concentStatus[j]);
|
|
|
- Log.d(TAG, "current => room number : " + i + ", switch : " + j + ", status : " + mEnergyMeterAPI.data.Em.eachRoom[i].ConOnOff[j]);
|
|
|
-
|
|
|
- // 콘센트 자동/수동에 대한 변경 이벤트도 보내달라 함
|
|
|
- /** 콘센트 모드상태 (true : 자동 ,false : 상시) C1, C2에 일괄적용 */
|
|
|
- //boolean ConMode;
|
|
|
-
|
|
|
- if (mEMeter.eachRoom[i].concentStatus[j] != mEnergyMeterAPI.data.Em.eachRoom[i].ConOnOff[j] || mEMeter.eachRoom[i].ConMode[j] != mEnergyMeterAPI.data.Em.eachRoom[i].ConMode) {
|
|
|
- // 같지 않다면 각각에 대해서 상태 메세지를 보낸다.
|
|
|
- bChangeState = true;
|
|
|
- String status = "off";
|
|
|
- if (mEnergyMeterAPI.data.Em.eachRoom[i].ConOnOff[j] == true)
|
|
|
- status = "on";
|
|
|
-
|
|
|
- outletState.put(status);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- try {
|
|
|
- jsonObject.accumulate("roomNumber", (i + 1));
|
|
|
- jsonObject.accumulate("state", state);
|
|
|
- jsonObject.accumulate("lightCount", lightCount);
|
|
|
- jsonObject.accumulate("lightState", lightState);
|
|
|
- jsonObject.accumulate("constantOutlet", constantOutlet);
|
|
|
- jsonObject.accumulate("outletState", outletState);
|
|
|
- } catch (JSONException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- SendData("icon", "meter", "energyMeter", "each_control", jsonObject, 2);
|
|
|
-
|
|
|
- }
|
|
|
- if (bChangeState == true) saveChangedEnergyMeterStatus();
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- Log.e(TAG, "[Exception] checkChangedEnergyMeter()");
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 디바이스 API 를 Load 한다.
|
|
@@ -3027,11 +2814,6 @@ public class DataSenderService extends Service {
|
|
|
} else if (strActionName.equals(BrID.BR_SDB_LIVING_EVENT)) {
|
|
|
// Log.d(TAG, "********************* DataSenderService.BR_SDB_LIVING_EVENT ******************** -> bDeviceInitComplete [" + bDeviceInitComplete + "]");
|
|
|
//checkChangedSdbLivingLight();
|
|
|
- } else if (strActionName.equals(BrID.BR_ENERGY_METER)) {
|
|
|
- // Log.d(TAG, "********************* BR DataSenderService.BR_ENERGY_METER ********************");
|
|
|
- if (bDeviceInitComplete) {
|
|
|
- checkChangedEnergyMeter();
|
|
|
- }
|
|
|
} else if (strActionName.equals(BrID.BR_VENTIL)) {
|
|
|
// Log.d(TAG, "********************* BR DataSenderService.BR_VENTIL ********************");
|
|
|
checkChangedVentilation();
|
|
@@ -3042,25 +2824,21 @@ public class DataSenderService extends Service {
|
|
|
// 일괄소등 상태 업데이트
|
|
|
case define.NOTIFY_ALL_LIGHT_OFF:
|
|
|
Log.i(TAG, "[mSendDataEventBR] define.NOTIFY_ALL_LIGHT_OFF");
|
|
|
- SendData("icon", "switch", "smart_switch", "turnoffalllight", "on", 1);
|
|
|
break;
|
|
|
|
|
|
// 일괄소등 해제 (조명 ON)
|
|
|
case define.NOTIFY_ALL_LIGHT_ON:
|
|
|
Log.i(TAG, "[mSendDataEventBR] define.NOTIFY_ALL_LIGHT_ON");
|
|
|
- SendData("icon", "switch", "smart_switch", "turnoffalllight", "off", 1);
|
|
|
break;
|
|
|
case define.NOTIFY_DEVICE_ELE_CALL_UP:
|
|
|
// 제어기기 엘리베이터 상향 호출 요청
|
|
|
Log.i(TAG, "[mWallPadNotifyBR] define.NOTIFY_DEVICE_ELE_CALL_UP");
|
|
|
- SendData("icon", "switch", "elevator", "call", "up", 1);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case define.NOTIFY_DEVICE_ELE_CALL_DOWN:
|
|
|
// 제어기기에서 엘리베이터 하향 호출 요청
|
|
|
Log.i(TAG, "[mWallPadNotifyBR] define.NOTIFY_DEVICE_ELE_CALL_DOWN");
|
|
|
- SendData("icon", "switch", "elevator", "call", "down", 1);
|
|
|
break;
|
|
|
|
|
|
// 방범상태 변경
|
|
@@ -3084,14 +2862,12 @@ public class DataSenderService extends Service {
|
|
|
case define.NOTIFY_SMARTSW_SET_OUTING:
|
|
|
// 485 대외향 스마트스위치 외출모드
|
|
|
Log.i(TAG, "[mSendDataEventBR] define.NOTIFY_SMARTSW_SET_OUTING");
|
|
|
- SendData("icon", "switch", "smart_switch", "awaymode", "on", 1);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case define.NOTIFY_SMARTSW_FREE_OUTING:
|
|
|
//대외향 485 스마트스위치 외출모드 해제
|
|
|
Log.i(TAG, "[mSendDataEventBR] define.NOTIFY_SMARTSW_FREE_OUTING");
|
|
|
- SendData("icon", "switch", "smart_switch", "awaymode", "off", 1);
|
|
|
break;
|
|
|
|
|
|
}
|
|
@@ -3099,29 +2875,6 @@ public class DataSenderService extends Service {
|
|
|
int nKind = intent.getIntExtra(Common.BR_MAIN_NOTI.KIND, 0);
|
|
|
Log.d(TAG, "[mSendDataEventBR] nKind =" + nKind);
|
|
|
if (nKind == Common.BR_MAIN_NOTI.RET_ELEVATOR_CALL_STATE) {
|
|
|
- //엘리베이터 월패드 이벤트는 터치만 적용.
|
|
|
- /*
|
|
|
- String strElevatorFloor = intent.getStringExtra("ElevatorFloor");
|
|
|
- Log.d(TAG, "[mSendDataEventBR] RET_ELEVATOR_CALL_STATE -> strElevatorFloor [" + strElevatorFloor + "]");
|
|
|
-
|
|
|
- Common.ELEV_STATUS eElevCallStatus = Common.ELEV_STATUS.getEnum(intent.getStringExtra("ElevatorFloor"));
|
|
|
- Log.d(TAG, "[mSendDataEventBR] RET_ELEVATOR_CALL_STATE -> eElevCallStatus [" + eElevCallStatus + "]");
|
|
|
- try {
|
|
|
- if (eElevCallStatus == Common.ELEV_STATUS.DOWN) {
|
|
|
- SendData("null", "control", "elevator", "call", "down", 1);
|
|
|
- } else if (eElevCallStatus == Common.ELEV_STATUS.UP) {
|
|
|
- SendData("null", "control", "elevator", "call", "up", 1);
|
|
|
- } else if (eElevCallStatus == Common.ELEV_STATUS.UP_DOWN) {
|
|
|
- SendData("null", "control", "elevator", "call", "updown", 1);
|
|
|
- } else {
|
|
|
- //SendData("null", "switch", "elevator", "call", "none", 1);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- Log.e(TAG, "[Exception] displayElevCallStatus(ELEV_STATUS ElevStatus)");
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- */
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3155,48 +2908,6 @@ public class DataSenderService extends Service {
|
|
|
return iGW300API.data;
|
|
|
}
|
|
|
|
|
|
- private void checkGWSensorEvent() {
|
|
|
- try {
|
|
|
- if (mWallPadAPI.getGatewayType() == Version.GATEWAY_MODEL.IGW_300) {
|
|
|
- if (iGW300API == null) {
|
|
|
- Log.w(TAG, "[checkGWSensorEvent] iGW300API is null!!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (iGW300API.data == null) {
|
|
|
- Log.w(TAG, "[checkGWSensorEvent] iGW300API.data is null!!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 내부 동체 (동체감지기 2) 2
|
|
|
- if (bIn_Motion != iGW300API.data.senIn.In_Motion) {
|
|
|
- Log.w(TAG, "[checkGWSensorEvent] iGW300API.iGW300API.data.senIn.In_Motion is check!!");
|
|
|
- bIn_Motion = iGW300API.data.senIn.In_Motion;
|
|
|
- SendData("icon", "sensor", "motion", bIn_Motion == true ? "detection" : "release", (String) null, 1);
|
|
|
- }
|
|
|
-
|
|
|
- // 외부 동체 (동체감지기 1) 1
|
|
|
- if (bOut_Motion != iGW300API.data.senIn.Out_Motion) {
|
|
|
- Log.w(TAG, "[checkGWSensorEvent] iGW300API.iGW300API.data.senIn.Out_Motion is check!!");
|
|
|
- bOut_Motion = iGW300API.data.senIn.Out_Motion;
|
|
|
- SendData("icon", "sensor", "motion", bOut_Motion == true ? "detection" : "release", (String) null, 1);
|
|
|
- }
|
|
|
-
|
|
|
- // 마그네틱 0
|
|
|
- if (bMagnetic_Motion != iGW300API.data.senIn.Magnetic == true) {
|
|
|
- Log.w(TAG, "[checkGWSensorEvent] iGW300API.iGW300API.data.senIn.Magnetic is check!!");
|
|
|
- bMagnetic_Motion = iGW300API.data.senIn.Magnetic;
|
|
|
- SendData("icon", "sensor", "magnetic", bMagnetic_Motion == true ? "detection" : "release", (String) null, 1);
|
|
|
- }
|
|
|
- } else {
|
|
|
- Log.w(TAG, "[checkGWSensorEvent] Not supported gateway model -> " + mWallPadAPI.getGatewayType());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- Log.e(TAG, "[Exception] checkGWSensorEvent()");
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
BroadcastReceiver mSendDataSensorBR = new BroadcastReceiver() {
|
|
|
@Override
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
@@ -3204,7 +2915,6 @@ public class DataSenderService extends Service {
|
|
|
Log.i(TAG, "[IGW300InterfaceBR.onReceive] strActionName [" + strActionName + "]");
|
|
|
if (strActionName.equals(IGW300API.SENSOR_BR_NAME)) {
|
|
|
getIGW300UpdateData();
|
|
|
- checkGWSensorEvent();
|
|
|
}
|
|
|
}
|
|
|
};
|