Ver Fonte

2023.07.04 메이드인랩 김수진

1. 주방티비에서 경비실 호출 기능 추가.
2. 경비실 호출시 착신 통화 기능 추가.
DESKTOP-UNEGUH3\MadeinLab_SW_02 há 1 ano atrás
pai
commit
749b70250a

+ 40 - 11
WallPadCall/src/main/java/ceres/service/MyTCPServer.java

@@ -83,21 +83,50 @@ public class MyTCPServer {
                     mOutputBuffer = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
                     mInputBuffer = new BufferedReader(new InputStreamReader(client.getInputStream()), 10);
 
-                    String data;
-                    while (! client.isClosed()) {
-                        //Log.d(TAG, "TCPServerThread(): 2");
-                        if ((data = mInputBuffer.readLine()) != null) {
-                            Log.d(TAG, "read: " + data);
-                            if (data.equals("HEY")) {
-                                mOutputBuffer.write("ACK", 0, "ACK".length());
-                                mOutputBuffer.flush();
-                                Message msg = mHandler.obtainMessage(100, clientIP);
-                                mHandler.sendMessage(msg);
-                            }
+                    String data = "";
+                    char[] str = new char[100];
+                    int len = 0;
+                    if ((len = mInputBuffer.read(str)) > 0) {
+                        for (int i = 0; i < len; i++) {
+                            data += Character.toString(str[i]);
+                        }
+
+                        Log.d(TAG, "read: " + data);
+                        if (data.equals("HEY")) {
+                            mOutputBuffer.write("ACK", 0, "ACK".length());
+                            mOutputBuffer.flush();
+                            Message msg = mHandler.obtainMessage(100, clientIP);
+                            mHandler.sendMessage(msg);
+                        }
+
+                        if (data.contains("CALL_REDIRECT_")) {
+                            Log.d(TAG,"[mySocket] CALL_REDIRECT_TO_() data " + data);
+                            mOutputBuffer.write("ACK", 0, "ACK".length());
+                            mOutputBuffer.flush();
+                            String[] strReIPSplit = data.split("_");
+
+                            Message msg = mHandler.obtainMessage(104, strReIPSplit[3].trim());
+                            mHandler.sendMessage(msg);
+
 
                         }
 
                     }
+
+//                    while (! client.isClosed()) {
+//                        //Log.d(TAG, "TCPServerThread(): 2");
+//                        if ((data = mInputBuffer.readLine()) != null) {
+//                            Log.d(TAG, "read: " + data);
+//                            if (data.equals("HEY")) {
+//                                mOutputBuffer.write("ACK", 0, "ACK".length());
+//                                mOutputBuffer.flush();
+//                                Message msg = mHandler.obtainMessage(100, clientIP);
+//                                mHandler.sendMessage(msg);
+//                            }
+//
+//                        }
+//
+//                    }
                 }
             } catch (IOException e) {
                 Log.v(TAG, "Fail TCPServer!!");

+ 5 - 0
WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/CallController.java

@@ -789,6 +789,11 @@ public class CallController extends CallManager implements SIPEventListener {
                 }
             }
             else if (eEventType == CALLEVENTTYPE.RECEIVE_CALL_ACK) {
+
+
+                if (Global.getKitchenTVIdx(eCallOwner) >= 0 || Global.getBathPhoneIdx(eCallOwner) >= 0 || eCallOwner == CALLOWNER.SUB_WALLPAD || Global.getBathTVIdx(eCallOwner) >= 0) {
+                    mCallInfo.setCallStatus(eCallType, CALLSTATUS.CALLING);
+                }
                 // 호출응답 수신
                 if (mCallInfo.getIDLECnt() < mCallInfo.IDLECNT_MAX) {
                     mCallInfo.setCallStatus(eCallType, CALLSTATUS.CALLING);

+ 12 - 1
WallPadCall/src/main/java/kr/co/icontrols/callengine/engine/MyTCPServer.java

@@ -147,7 +147,7 @@ public class MyTCPServer {
                     while (! client.isClosed()) {
                         Log.d(TAG, "TCPServerThread(): 2 " + clientIP);
                         String data = "";
-                        char[] str = new char[10];
+                        char[] str = new char[100];
                         int len = 0;
                         if ((len = mInputBuffer.read(str)) > 0) {
                             for(int i = 0; i < len; i++)
@@ -278,6 +278,17 @@ public class MyTCPServer {
 
 
                             }
+                            else if (data.contains("CALL_REDIRECT_")) {
+                                Log.d(TAG,"[mySocket] CALL_REDIRECT_TO_() data " + data);
+                                mOutputBuffer.write("ACK", 0, "ACK".length());
+                                mOutputBuffer.flush();
+                                String[] strReIPSplit = data.split("_");
+
+                                Message msg = mHandler.obtainMessage(106, strReIPSplit[3].trim());
+                                mHandler.sendMessage(msg);
+
+
+                            }
 
 
                         }

+ 12 - 0
WallPadCall/src/main/java/kr/co/icontrols/callengine/sip/SIPStun.java

@@ -5572,6 +5572,18 @@ public class SIPStun extends Service {
                     mContext.sendBroadcast(Intent);
                     //mCallController.onCeresCallEvent(Intent);
                     break;
+                case 106: // from I_AM_TALKING
+                    //int i = mCMIF.CERES_MakeCall(clientIP, 1);        // 1 : audio, 2: video, 3: audio+video
+                    //Log.v("yjyoon", "mCMIF.CERES_MakeCall " + i);
+                    clientIP = (String)msg.obj;
+                    message = "null";
+                    Intent.setAction("REDIRECT_CALL");
+                    Intent.putExtra(Declare.CALLTRIGGER.REMOTEINFO, clientIP);
+                    mContext.sendBroadcast(Intent);
+
+                    //mCallController.onCeresCallEvent(Intent);
+                    break;
+
             }
 
             if (message != null) {

+ 35 - 1
WallPadCall/src/main/java/kr/co/icontrols/wallpadcall/screen/TalkGuard.java

@@ -133,6 +133,9 @@ public class TalkGuard extends WpadScreen implements CallEventListener, MainEven
             mContext = context;
             Initialize();
 
+            addBrActionFilter("REDIRECT_CALL");
+            m_rediectCAll_eCallOwner = null;
+
             SCREEN_BG = new WpadImageView(context, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.SCREEN.TALKGUARD.ELEMENT.IMAGE.BG);
             ViewRegistration(layout, SCREEN_BG, 0, 0);
 
@@ -284,6 +287,7 @@ public class TalkGuard extends WpadScreen implements CallEventListener, MainEven
         super.onClose();
         try {
             LOG_INFO("[onClose]");
+            m_rediectCAll_eCallOwner = null;
             if (MainActivity.mIOInterface != null) MainActivity.mIOInterface.ctrlWallPadLED_Call(false);
             if (mPathCheckHandler != null) {
                 mPathCheckHandler.removeMessages(0);
@@ -329,6 +333,31 @@ public class TalkGuard extends WpadScreen implements CallEventListener, MainEven
     protected void onBrReceive(Intent intent) {
         super.onBrReceive(intent);
         try {
+
+            if(intent.getAction().equals("REDIRECT_CALL"))
+            {
+                String strRedirectIP = intent.getStringExtra(Declare.CALLTRIGGER.REMOTEINFO);
+
+                String[] aDeviceName = Global.makeDeviceName(strRedirectIP);
+                LOG("[onKeyDown] strRedirectIP [" + strRedirectIP + "] strGuard_Dong [" + aDeviceName[1] + "], strGuard_ID [" + aDeviceName[2] + "]");
+                RemoteIDInfo.strDong = aDeviceName[1];
+                RemoteIDInfo.strHo = aDeviceName[2];
+                RemoteIDInfo.strIP = strRedirectIP;
+
+                if (!send_check_sip_activation_request(RemoteIDInfo.strIP)) {
+                    initCallVariables();
+                    MainActivity.mSound.PlayMent(SND.guard.TRYLATER);
+                    return;
+                }
+
+                if(m_rediectCAll_eCallOwner != null )
+                    MainActivity.mCallController.mCallInfo.setCallOwner(m_rediectCAll_eCallOwner);
+                else
+                    MainActivity.mCallController.mCallInfo.setCallOwner(CALLOWNER.WALLPAD);
+
+                MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.GUARD, CALLSTATUS.TRYING_CALL);
+            }
+
 //            LOG_INFO("[onBrReceive] intent : " + intent);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -931,12 +960,15 @@ public class TalkGuard extends WpadScreen implements CallEventListener, MainEven
         }
     }
 
+    CALLOWNER m_rediectCAll_eCallOwner;
     @Override
     public void onSubPhoneEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strTargetID, String strMessage) {
         try {
             LOG_INFO("[onSubPhoneEvent] eCallOwner [" + eCallOwner + "], eCallStatus [" + eCallStatus + "], eCallType [" + eCallType + "], strTargetID [" + strTargetID + "], strMessage [" + strMessage + "]");
             if (eCallType == CALLTYPE.NONE) return;
 
+            m_rediectCAll_eCallOwner = eCallOwner;
+
             if (eCallType == CALLTYPE.GUARD) {
                 if (eCallStatus == CALLSTATUS.TRYING_CALL) {
                     if (eCallOwner != CALLOWNER.WALLPAD) {
@@ -952,7 +984,7 @@ public class TalkGuard extends WpadScreen implements CallEventListener, MainEven
                         tryGuardCall(eCallOwner, nGuardID);
                     }
                 }
-                if (eCallStatus == CALLSTATUS.TALKING) {
+                else if (eCallStatus == CALLSTATUS.TALKING) {
                     if (eCallOwner != CALLOWNER.WALLPAD) {
                         doTalk(eCallOwner);
                     }
@@ -1359,6 +1391,8 @@ public class TalkGuard extends WpadScreen implements CallEventListener, MainEven
             else if (nGuardType == GUARDLIST.SUBGATE) strGuardIP = strSUBGATEGUARD_IP;
             else if (nGuardType == GUARDLIST.OFFICE) strGuardIP = strOFFICEGUARD_IP;
 
+            //strGuardIP = "10.1.128.10";
+
             String[] IP_Parse = strGuardIP.split("\\.");
             int nDong = 101;
             if (ConfigValues.bIPExpansion) {