|
@@ -36,7 +36,7 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
private byte DEVICE_ADDRESS = (byte) 0x80;
|
|
private byte DEVICE_ADDRESS = (byte) 0x80;
|
|
|
|
|
|
/** 최대 기기 개수 1~F */
|
|
/** 최대 기기 개수 1~F */
|
|
- private final byte MAX_DEVICE_CNT = 16;
|
|
|
|
|
|
+ private final byte MAX_DEVICE_CNT = 15; //1~F
|
|
|
|
|
|
/** 초기 기기 검색 횟수 */
|
|
/** 초기 기기 검색 횟수 */
|
|
private final int MAX_SEARCH_COUNT = 3;
|
|
private final int MAX_SEARCH_COUNT = 3;
|
|
@@ -186,10 +186,11 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
// 1. 디바이스 검색
|
|
// 1. 디바이스 검색
|
|
byte MaxDeviceID = 0;
|
|
byte MaxDeviceID = 0;
|
|
for (byte DeviceIdx = 0; DeviceIdx < MAX_DEVICE_CNT; DeviceIdx++) {
|
|
for (byte DeviceIdx = 0; DeviceIdx < MAX_DEVICE_CNT; DeviceIdx++) {
|
|
|
|
+ //1~F 실제 데이터 전송 시, 1을 더함
|
|
DataClasses.CurtainCtrl.Curtain curtain = sendGetUnitCurtainStatus(DEVICE_ADDRESS, DeviceIdx);
|
|
DataClasses.CurtainCtrl.Curtain curtain = sendGetUnitCurtainStatus(DEVICE_ADDRESS, DeviceIdx);
|
|
if (curtain != null) {
|
|
if (curtain != null) {
|
|
MaxDeviceID = (byte) (DeviceIdx+1);
|
|
MaxDeviceID = (byte) (DeviceIdx+1);
|
|
- mDriver.Device[DeviceIdx].crutain = curtain;
|
|
|
|
|
|
+ mDriver.Device[DeviceIdx].curtain = curtain;
|
|
mDriver.Device[DeviceIdx].info = new DataClasses.CurtainCtrl.Info();
|
|
mDriver.Device[DeviceIdx].info = new DataClasses.CurtainCtrl.Info();
|
|
mDriver.Device[DeviceIdx].info.bInstall = true;
|
|
mDriver.Device[DeviceIdx].info.bInstall = true;
|
|
Log.i(TAG, "SearchDevice DeviceNum = " + (byte)(DeviceIdx+1) + " OK!!!");
|
|
Log.i(TAG, "SearchDevice DeviceNum = " + (byte)(DeviceIdx+1) + " OK!!!");
|
|
@@ -229,9 +230,9 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
/* [[ FirstTimeOut ]]
|
|
/* [[ FirstTimeOut ]]
|
|
* 초기 디바이스 검색하지못함. */
|
|
* 초기 디바이스 검색하지못함. */
|
|
else if (mDriver.Polling.Status == Driver.PollingList.STATUS.FirstTimeOut) {
|
|
else if (mDriver.Polling.Status == Driver.PollingList.STATUS.FirstTimeOut) {
|
|
- DataClasses.CurtainCtrl.Curtain curtain = sendGetUnitCurtainStatus(mDriver.Polling.CurrentAddress, (byte) 0);
|
|
|
|
|
|
+ DataClasses.CurtainCtrl.Curtain curtain = sendGetUnitCurtainStatus(DEVICE_ADDRESS, mDriver.Polling.CurrentAddress);
|
|
if (curtain != null) {
|
|
if (curtain != null) {
|
|
- mDriver.Device[mDriver.Polling.CurrentAddress].crutain = curtain;
|
|
|
|
|
|
+ mDriver.Device[mDriver.Polling.CurrentAddress].curtain = curtain;
|
|
mDriver.Device[mDriver.Polling.CurrentAddress].info = new DataClasses.CurtainCtrl.Info();
|
|
mDriver.Device[mDriver.Polling.CurrentAddress].info = new DataClasses.CurtainCtrl.Info();
|
|
mDriver.Device[mDriver.Polling.CurrentAddress].info.bInstall = true;
|
|
mDriver.Device[mDriver.Polling.CurrentAddress].info.bInstall = true;
|
|
mDriver.Polling.SearchDeviceCount = (byte) (mDriver.Polling.CurrentAddress + 1);
|
|
mDriver.Polling.SearchDeviceCount = (byte) (mDriver.Polling.CurrentAddress + 1);
|
|
@@ -284,7 +285,7 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
else {
|
|
else {
|
|
DataClasses.CurtainCtrl.Curtain curtain = sendGetUnitCurtainStatus(DEVICE_ADDRESS, CurrentAddress);
|
|
DataClasses.CurtainCtrl.Curtain curtain = sendGetUnitCurtainStatus(DEVICE_ADDRESS, CurrentAddress);
|
|
if (curtain != null) {
|
|
if (curtain != null) {
|
|
- mDriver.Device[CurrentAddress].crutain = curtain;
|
|
|
|
|
|
+ mDriver.Device[CurrentAddress].curtain = curtain;
|
|
mDriver.Device[CurrentAddress].info = new DataClasses.CurtainCtrl.Info();
|
|
mDriver.Device[CurrentAddress].info = new DataClasses.CurtainCtrl.Info();
|
|
mDriver.Device[CurrentAddress].info.bInstall = true;
|
|
mDriver.Device[CurrentAddress].info.bInstall = true;
|
|
AddDoCount(CurrentAddress, true);
|
|
AddDoCount(CurrentAddress, true);
|
|
@@ -380,11 +381,11 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
}
|
|
}
|
|
|
|
|
|
// 2. Doing
|
|
// 2. Doing
|
|
- DataClasses.CurtainCtrl.Curtain circuit;
|
|
|
|
- circuit = sendGetUnitCurtainStatus(DEVICE_ADDRESS, Index);
|
|
|
|
|
|
+ DataClasses.CurtainCtrl.Curtain curtain;
|
|
|
|
+ curtain = sendGetUnitCurtainStatus(DEVICE_ADDRESS, Index);
|
|
|
|
|
|
- if (circuit != null) {
|
|
|
|
- updateVariables(Index, circuit, false);
|
|
|
|
|
|
+ if (curtain != null) {
|
|
|
|
+ updateVariables(Index, curtain, false);
|
|
SHMem.retVal = RefreshResult(Index);
|
|
SHMem.retVal = RefreshResult(Index);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -411,23 +412,23 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
else if (ctrDevFormat.CmdStr.equals("setUnitCurtainStatus")) {
|
|
else if (ctrDevFormat.CmdStr.equals("setUnitCurtainStatus")) {
|
|
try {
|
|
try {
|
|
byte Index = ctrDevFormat.param[0];
|
|
byte Index = ctrDevFormat.param[0];
|
|
- byte hStatus = ctrDevFormat.param[1];
|
|
|
|
|
|
+ byte hStatus = ctrDevFormat.param[1];
|
|
|
|
|
|
// 1. 범위체크
|
|
// 1. 범위체크
|
|
// 1.1. Index
|
|
// 1.1. Index
|
|
if (!DeviceIndexRangeCheck(Index)) {
|
|
if (!DeviceIndexRangeCheck(Index)) {
|
|
- Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Param : Index - Out Of Range !!! (Index:" + Index + ")");
|
|
|
|
|
|
+ Log.w(TAG, "[do_ctrEmm -> setUnitCurtainStatus] Param : Index - Out Of Range !!! (Index:" + Index + ")");
|
|
return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.INVALIDPARAMETER;
|
|
return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.INVALIDPARAMETER;
|
|
}
|
|
}
|
|
|
|
|
|
if (!mDriver.Device[Index].info.bInstall) {
|
|
if (!mDriver.Device[Index].info.bInstall) {
|
|
- Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Device [" + Index + "] No Install !!!");
|
|
|
|
|
|
+ Log.w(TAG, "[do_ctrEmm -> setUnitCurtainStatus] Device [" + Index + "] No Install !!!");
|
|
return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
}
|
|
}
|
|
|
|
|
|
// 3. Doing
|
|
// 3. Doing
|
|
DataClasses.CurtainCtrl.Curtain circuit;
|
|
DataClasses.CurtainCtrl.Curtain circuit;
|
|
- circuit = sendSetUnitCircuitStatus(Index, hStatus);
|
|
|
|
|
|
+ circuit = sendSetUnitCurtainStatus(Index, hStatus);
|
|
|
|
|
|
if (circuit != null) {
|
|
if (circuit != null) {
|
|
updateVariables(Index, circuit, false);
|
|
updateVariables(Index, circuit, false);
|
|
@@ -506,7 +507,7 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
if (mDriver == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
if (mDriver == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
if (mDriver.Device == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
if (mDriver.Device == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
if (mDriver.Device[Index].info == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
if (mDriver.Device[Index].info == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
- if (mDriver.Device[Index].crutain == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
|
|
|
|
+ if (mDriver.Device[Index].curtain == null) return APIErrorCode.FAILSTR + ";" + APIErrorCode.DEVICEISNOTREADY;
|
|
|
|
|
|
/*
|
|
/*
|
|
* [Format]
|
|
* [Format]
|
|
@@ -530,9 +531,10 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
if (!Device.info.bInstall) return result;
|
|
if (!Device.info.bInstall) return result;
|
|
|
|
|
|
// 회로 정보
|
|
// 회로 정보
|
|
- result += Device.crutain.getCurtainID() + ";";
|
|
|
|
- result += Device.crutain.getCurtainStatus() + ";";
|
|
|
|
- result += Device.crutain.getErrorStatus() + ";";
|
|
|
|
|
|
+ result += Device.curtain.getCurtainGroupID() + ";"; //그룹정보
|
|
|
|
+ result += Device.curtain.getCurtainID() + ";"; //아이디
|
|
|
|
+ result += Device.curtain.getCurtainStatus() + ";"; //상태
|
|
|
|
+ result += Device.curtain.getErrorStatus() + ";"; //에러
|
|
|
|
|
|
} catch (RuntimeException re) {
|
|
} catch (RuntimeException re) {
|
|
LogUtil.errorLogInfo("", TAG, re);
|
|
LogUtil.errorLogInfo("", TAG, re);
|
|
@@ -607,7 +609,7 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
* @param status - (byte) 요청할 회로 상태
|
|
* @param status - (byte) 요청할 회로 상태
|
|
* @return (DataClasses.CurtainCtrl.Curtain) 기기상태 null - Error , Not null - OK
|
|
* @return (DataClasses.CurtainCtrl.Curtain) 기기상태 null - Error , Not null - OK
|
|
*/
|
|
*/
|
|
- private DataClasses.CurtainCtrl.Curtain sendSetUnitCircuitStatus(byte deviceIdx, byte status) {
|
|
|
|
|
|
+ private DataClasses.CurtainCtrl.Curtain sendSetUnitCurtainStatus(byte deviceIdx, byte status) {
|
|
try {
|
|
try {
|
|
if ((deviceIdx < 0) || (deviceIdx >= MAX_DEVICE_CNT)) {
|
|
if ((deviceIdx < 0) || (deviceIdx >= MAX_DEVICE_CNT)) {
|
|
Log.w(TAG, "[sendSetUnitCircuitStatus] param [circuitId] Out of Range!!! " + deviceIdx);
|
|
Log.w(TAG, "[sendSetUnitCircuitStatus] param [circuitId] Out of Range!!! " + deviceIdx);
|
|
@@ -703,9 +705,10 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
}
|
|
}
|
|
// Data check OK!
|
|
// Data check OK!
|
|
|
|
|
|
- index = 1; // index 초기화
|
|
|
|
|
|
+ index = 1; // index 초기화 (D1은 응답 성공만 체크
|
|
DataClasses.CurtainCtrl.Curtain curtain = new DataClasses.CurtainCtrl.Curtain();
|
|
DataClasses.CurtainCtrl.Curtain curtain = new DataClasses.CurtainCtrl.Curtain();
|
|
- curtain.setCurtainGroupID(data);
|
|
|
|
|
|
+ curtain.setCurtainGroupID(GroupID);
|
|
|
|
+ curtain.setCurtainID(deviceIdx);
|
|
|
|
|
|
// - D2 : 제어기 제어 상태
|
|
// - D2 : 제어기 제어 상태
|
|
data = Reply[index++];
|
|
data = Reply[index++];
|
|
@@ -716,6 +719,7 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
data = Reply[index++];
|
|
data = Reply[index++];
|
|
curtain.setGroupCount(data);
|
|
curtain.setGroupCount(data);
|
|
|
|
|
|
|
|
+ // - D4 : reserve 데이터
|
|
index++;
|
|
index++;
|
|
|
|
|
|
// - D5 : 제어기 이상 상태
|
|
// - D5 : 제어기 이상 상태
|
|
@@ -773,11 +777,11 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
// 1. Param Range Check
|
|
// 1. Param Range Check
|
|
if (deviceIdx < 0) return false;
|
|
if (deviceIdx < 0) return false;
|
|
if (deviceIdx >= mDriver.Polling.SearchDeviceCount) return false;
|
|
if (deviceIdx >= mDriver.Polling.SearchDeviceCount) return false;
|
|
- if (mDriver.Device[deviceIdx].crutain == null) return false;
|
|
|
|
|
|
+ if (mDriver.Device[deviceIdx].curtain == null) return false;
|
|
|
|
|
|
// 2. Check
|
|
// 2. Check
|
|
boolean bChanged = false;
|
|
boolean bChanged = false;
|
|
- DataClasses.CurtainCtrl.Curtain OldCurtain = mDriver.Device[deviceIdx].crutain;
|
|
|
|
|
|
+ DataClasses.CurtainCtrl.Curtain OldCurtain = mDriver.Device[deviceIdx].curtain;
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
|
|
|
|
@@ -792,11 +796,11 @@ public class CurtainV1_Controller extends DeviceManager {
|
|
}
|
|
}
|
|
|
|
|
|
if (bChanged || bNotify) {
|
|
if (bChanged || bNotify) {
|
|
- mDriver.Device[deviceIdx].crutain = curtain;
|
|
|
|
|
|
+ mDriver.Device[deviceIdx].curtain = curtain;
|
|
StatusChanged(deviceIdx);
|
|
StatusChanged(deviceIdx);
|
|
|
|
|
|
DeviceLog("updateVariables !!!! ***************************************");
|
|
DeviceLog("updateVariables !!!! ***************************************");
|
|
- DeviceLog(mDriver.Device[deviceIdx].crutain.ToDebugString(deviceIdx));
|
|
|
|
|
|
+ DeviceLog(mDriver.Device[deviceIdx].curtain.ToDebugString(deviceIdx));
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|