Browse Source

1. 코드 정리

Jeffrey Nam 3 years ago
parent
commit
9069674b72

+ 25 - 47
WallPadAPI/src/main/java/kr/co/icontrols/homeautomation/HomeAutomation_Call.java

@@ -11,8 +11,7 @@ import com.artncore.commons.define;
 
 import java.util.List;
 
-public class HomeAutomation_Call
-{    
+public class HomeAutomation_Call {
     private static final String TAG = "HomeAutomation_Call";
     Context context;
 
@@ -56,8 +55,7 @@ public class HomeAutomation_Call
     public static final int CALLTYPE_SEND_DOOR_OPEN         = 11; //문열림 요청
     public static final int CALLTYPE_RECEIVE_DOOR_OPEN_ACK  = 12; //문열림 응답 (응답 수신 후, 통화 종료 BR Send 해야 함, 그리고 통화 APP 종료)
     
-    public class Call_Info
-    {
+    public class Call_Info {
         /** 기기 종류 **/
         public int Type_Device;
         
@@ -72,8 +70,7 @@ public class HomeAutomation_Call
          *  로비, 경비인 경우는 ID로 사용됨**/
         public int ID_Ho;
         
-        public Call_Info()
-        {
+        public Call_Info() {
             Type_Device = DEVICE_NONE;
             Type_Call = CALLTYPE_NONE;
             ID_Dong = 0;
@@ -84,8 +81,7 @@ public class HomeAutomation_Call
     /**
      * 생성자
      * **/
-    public HomeAutomation_Call(Context ctx)
-    {
+    public HomeAutomation_Call(Context ctx) {
         context = ctx;
         Log.d(TAG,  "HomeAutomation_Call API Start");
     }
@@ -101,32 +97,27 @@ public class HomeAutomation_Call
      * @param AppName -> 본 함수 사용하는 APP의 Name ("WallPadDevService or WallPadCall")
      * **/
     int m_nCallType = 0;
-    public Call_Info BR_Parsing(Intent intent, String AppName)
-    {
+    public Call_Info BR_Parsing(Intent intent, String AppName) {
         Log.e(TAG,  "[BR_Parsing] AppName : " + AppName);
         Call_Info call_info = null;
         
         // 1. 디바이스 정보 범위 체크
         int Device = intent.getIntExtra(BR_DEVICE, DEVICE_NONE);
-        if((Device < DEVICE_NONE) || (Device > DEVICE_NEIBOR))
-        {
+        if ((Device < DEVICE_NONE) || (Device > DEVICE_NEIBOR)) {
             Log.e(TAG,  "BR_Parsing - Device is error : " + Device);
             return null;
         }
 
         // 2. 통화 정보 범위 체크
         int CallType = intent.getIntExtra(BR_TYPE_CALL, CALLTYPE_NONE);        
-        if((CallType < CALLTYPE_NONE) || (CALLTYPE_RECEIVE_DOOR_OPEN_ACK < CallType))
-        {
+        if ((CallType < CALLTYPE_NONE) || (CALLTYPE_RECEIVE_DOOR_OPEN_ACK < CallType)) {
             Log.e(TAG,  "BR_Parsing - CallType is error : " + CallType);
             return null;
         }
         
         // 2.1 WallPadDevService 일 경우 받은 BR 종류 범위 체크
-        if(AppName.equalsIgnoreCase(APP_NAME_WALLPADDEVSERVICE) == true)
-        {
-            switch(CallType)
-            {
+        if (AppName.equalsIgnoreCase(APP_NAME_WALLPADDEVSERVICE) == true) {
+            switch (CallType) {
             case CALLTYPE_SEND_CALL_ACK:
             case CALLTYPE_SEND_CALL_ACK_FAIL:
             case CALLTYPE_SEND_CALL_START:
@@ -142,10 +133,8 @@ public class HomeAutomation_Call
         }
         
         // 2.2 WallPadCall 일 경우 받은 BR 종류 범위 체크
-        if(AppName.equalsIgnoreCase(APP_NAME_WALLPADCALL) == true)
-        {
-            switch(CallType)
-            {
+        if (AppName.equalsIgnoreCase(APP_NAME_WALLPADCALL) == true) {
+            switch (CallType) {
             case CALLTYPE_RECEIVE_CALL_REQUEST:
             case CALLTYPE_RECEIVE_CALL_END:
             case CALLTYPE_RECEIVE_CALL_ACK:
@@ -162,15 +151,13 @@ public class HomeAutomation_Call
 
         // 3. 동 정보 범위 체크
         int Dong = intent.getIntExtra(BR_ID_DONG, -1);
-        if((Dong < 0) || (Dong > 9999))
-        {
+        if ((Dong < 0) || (Dong > 9999)) {
             Log.e(TAG,  "BR_Parsing - Dong is error : " + Dong);
             return null;
         }
-        if(Device == DEVICE_GUARD)
-        {
-            if(Dong != 0)
-            {
+
+        if (Device == DEVICE_GUARD) {
+            if (Dong != 0) {
                 Log.e(TAG,  "BR_Parsing - Dong is error : " + Dong + "(DEVICE_GUARD)");
                 return null;
             }
@@ -178,8 +165,7 @@ public class HomeAutomation_Call
 
         // 4. 호 정보 범위 체크        
         int Ho = intent.getIntExtra(BR_ID_HO, -1);
-        if((Ho < 0) || (Ho > 9999))
-        {
+        if ((Ho < 0) || (Ho > 9999)) {
             Log.e(TAG,  "BR_Parsing - Ho is error : " + Ho);
             return null;
         }
@@ -210,8 +196,7 @@ public class HomeAutomation_Call
      * @param ID_Dong -> 동 ID (경비실인 경우는 무시)
      * @param ID_Ho -> 호 ID (로비, 경비인 경우는 ID로 사용됨)
      * **/
-    public boolean BR_Send(int DeviceType, int CallType, int ID_Dong, int ID_Ho)
-    {
+    public boolean BR_Send(int DeviceType, int CallType, int ID_Dong, int ID_Ho) {
         /** param check **/
 /*
         if(CallType == CALLTYPE_SEND_CALL_END || CallType == CALLTYPE_SEND_CALL_ACK_FAIL ||
@@ -226,32 +211,28 @@ public class HomeAutomation_Call
         }
 */
         // 1. 디바이스 정보 범위 체크
-        if((DeviceType < DEVICE_NONE) || (DeviceType > DEVICE_NEIBOR))
-        {
+        if ((DeviceType < DEVICE_NONE) || (DeviceType > DEVICE_NEIBOR)) {
             Log.e(TAG,  "BR_Send - DeviceType is error : " + DeviceType);
             //m_nCallType = 0;
             return false;
         }
         
         // 2. 통화 정보 범위 체크
-        if((CallType < CALLTYPE_NONE) || (CallType > CALLTYPE_RECEIVE_DOOR_OPEN_ACK))
-        {
+        if ((CallType < CALLTYPE_NONE) || (CallType > CALLTYPE_RECEIVE_DOOR_OPEN_ACK)) {
             Log.e(TAG,  "BR_Send - CallType is error : " + CallType);
             //m_nCallType = 0;
             return false;
         }
         
         // 3. 동 정보 범위 체크
-        if((ID_Dong < 0) || (ID_Dong > 9999))
-        {
+        if ((ID_Dong < 0) || (ID_Dong > 9999)) {
             Log.e(TAG,  "BR_Send - ID_Dong is error : " + ID_Dong);
             //m_nCallType = 0;
             return false;
         }
-        if(DeviceType == DEVICE_GUARD)
-        {
-            if(ID_Dong != 0)
-            {
+
+        if (DeviceType == DEVICE_GUARD) {
+            if (ID_Dong != 0) {
                 Log.e(TAG,  "BR_Send - ID_Dong is error : " + ID_Dong + "(DEVICE_GUARD)");
                 //m_nCallType = 0;
                 return false;
@@ -259,8 +240,7 @@ public class HomeAutomation_Call
         }
         
         // 4. 호 정보 범위 체크   
-        if((ID_Ho < 0) || (ID_Ho > 9999))
-        {
+        if ((ID_Ho < 0) || (ID_Ho > 9999)) {
             Log.e(TAG,  "BR_Send - ID_Dong is error : " + ID_Ho);
             //m_nCallType = 0;
             return false;
@@ -300,8 +280,7 @@ public class HomeAutomation_Call
         return true;
     }
 
-    public void setCallStaus(int nStatus)
-    {
+    public void setCallStaus(int nStatus) {
         m_nCallType = nStatus;
         Log.d(TAG, "BR_Send - CallType1 : " + m_nCallType);
     }
@@ -324,7 +303,6 @@ public class HomeAutomation_Call
                 mIntent.putExtra(BR_ID_HO, nHo);  
                 context.sendBroadcast(mIntent);
             }
-            
         } catch (Exception e) {
             Log.e(TAG, "[Exception] sendCallBR(int nCallType, int nEventType, int nDong, int nHo)");
             e.printStackTrace();