TalkResidence.java 144 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870
  1. package kr.co.icontrols.wallpadcall.screen;
  2. import android.content.Context;
  3. import android.content.Intent;
  4. import android.graphics.Color;
  5. import android.os.Handler;
  6. import android.os.Looper;
  7. import android.os.Message;
  8. import android.util.Log;
  9. import android.view.Gravity;
  10. import android.view.KeyEvent;
  11. import android.view.LayoutInflater;
  12. import android.view.MotionEvent;
  13. import android.view.View;
  14. import android.widget.LinearLayout;
  15. import android.widget.RelativeLayout;
  16. import android.widget.RelativeLayout.LayoutParams;
  17. import android.widget.SeekBar;
  18. import android.widget.Toast;
  19. import com.artncore.wallpadimap.RetProci;
  20. import com.util.LogUtil;
  21. import java.io.BufferedReader;
  22. import java.io.IOException;
  23. import java.io.InputStreamReader;
  24. import java.text.SimpleDateFormat;
  25. import java.util.Date;
  26. import kr.co.icontrols.callengine.engine.CallController.CallEventListener;
  27. import kr.co.icontrols.callengine.engine.CallManager.CALLEVENTTYPE;
  28. import kr.co.icontrols.callengine.engine.CallManager.CALLOWNER;
  29. import kr.co.icontrols.callengine.engine.CallManager.CALLPATH;
  30. import kr.co.icontrols.callengine.engine.CallManager.CALLSTATUS;
  31. import kr.co.icontrols.callengine.engine.CallManager.CALLTYPE;
  32. import kr.co.icontrols.wallpadcall.MainActivity;
  33. import kr.co.icontrols.wallpadcall.MainActivity.MAINEVENT;
  34. import kr.co.icontrols.wallpadcall.MainActivity.MainEventListener;
  35. import kr.co.icontrols.wallpadcall.R;
  36. import kr.co.icontrols.wallpadcall.declare.Common;
  37. import kr.co.icontrols.wallpadcall.declare.DataClasses.MultiCallInfo;
  38. import kr.co.icontrols.wallpadcall.declare.DataClasses.RemoteIDInfo;
  39. import kr.co.icontrols.wallpadcall.declare.DataClasses.SmartRFCamLEDMode;
  40. import kr.co.icontrols.wallpadcall.declare.DataClasses.SmartRFCamStatusMode;
  41. import kr.co.icontrols.wallpadcall.declare.Declare;
  42. import kr.co.icontrols.wallpadcall.declare.Declare.DEVICENAME;
  43. import kr.co.icontrols.wallpadcall.declare.Declare.DeviceType;
  44. import kr.co.icontrols.wallpadcall.declare.Enumeration.TARGETINFOINPUTSTEP;
  45. import kr.co.icontrols.wallpadcall.declare.Global;
  46. import kr.co.icontrols.wallpadcall.declare.Global.BOARD_TYPE;
  47. import kr.co.icontrols.wallpadcall.declare.Global.CALLACTION;
  48. import kr.co.icontrols.wallpadcall.declare.Global.CALLDIRECTION;
  49. import kr.co.icontrols.wallpadcall.declare.Global.CALLRESULT;
  50. import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
  51. import kr.co.icontrols.wallpadcall.declare.ID;
  52. import kr.co.icontrols.wallpadcall.imap.Request_call_history_save;
  53. import kr.co.icontrols.wallpadcall.imap.Request_check_sip_activation;
  54. import kr.co.icontrols.wallpadcall.imap.Request_visitor_picture_delete;
  55. import kr.co.icontrols.wallpadsupport.Version;
  56. import kr.co.icontrols.wallpadsupport.WpadImageView;
  57. import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
  58. import kr.co.icontrols.wallpadsupport.WpadScale;
  59. import kr.co.icontrols.wallpadsupport.WpadScreen;
  60. import kr.co.icontrols.wallpadsupport.WpadSound.SND;
  61. import kr.co.icontrols.wallpadsupport.WpadTextView;
  62. import static kr.co.icontrols.wallpadcall.MainActivity.bFFMPEGEnable;
  63. public class TalkResidence extends WpadScreen implements CallEventListener, MainEventListener {
  64. private final String TAG = "TalkResidence";
  65. boolean bLOG = true;
  66. private void LOG(String log) {
  67. if (bLOG) Log.v(TAG, log);
  68. }
  69. boolean bLOG_DEBUG = false;
  70. private void LOG_DEBUG(String log) {
  71. if (bLOG_DEBUG) Log.d(TAG, log);
  72. }
  73. boolean bLOG_INFO = true;
  74. private void LOG_INFO(String log) {
  75. if (bLOG_INFO) Log.i(TAG, log);
  76. }
  77. boolean bLOG_WARN = true;
  78. private void LOG_WARN(String log) {
  79. if (bLOG_WARN) Log.i(TAG, log);
  80. }
  81. boolean m_bCallStartBtnEnable = false;
  82. WpadImageView SCREEN_BG;
  83. WpadImageView IMG_RESIDENCE_BACKGROUND;
  84. WpadImageView IMG_VIDEO_MODULE;
  85. WpadImageView IMG_VOLUME;
  86. WpadImageView BTN_TALK;
  87. WpadImageView BTN_END;
  88. WpadImageView BTN_PORTRAIT;
  89. WpadImageView BTN_DELETE;
  90. WpadImageView BTN_DIVISION;
  91. WpadImageView[] BTN_TENKEY = new WpadImageView[6];
  92. int[][] TENKEYS = {
  93. {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_pressed, R.drawable.btn_floor_1_selected}, //10.1.1.1
  94. {R.drawable.btn_floor_2_normal, R.drawable.btn_floor_2_pressed, R.drawable.btn_floor_2_selected}, //10.1.2.1
  95. {R.drawable.btn_floor_3_normal, R.drawable.btn_floor_3_pressed, R.drawable.btn_floor_3_selected}, //10.1.3.1
  96. {R.drawable.btn_main_room_normal, R.drawable.btn_main_room_pressed, R.drawable.btn_main_room_selected}, //10.1.3.2
  97. {R.drawable.btn_driver_normal, R.drawable.btn_driver_pressed, R.drawable.btn_driver_selected}, //10.1.1.3
  98. {R.drawable.btn_maid_normal, R.drawable.btn_maid_pressed, R.drawable.btn_maid_selected}, //10.1.1.2
  99. {R.drawable.btn_kitchen_normal, R.drawable.btn_kitchen_pressed, R.drawable.btn_kitchen_selected}, //10.1.2.2
  100. {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
  101. {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
  102. {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
  103. {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal},
  104. {R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal, R.drawable.btn_floor_1_normal}
  105. };
  106. String[] strEndIP = {"10.1.1.1", "10.1.2.1", "10.1.3.1", "10.1.3.2", "10.1.1.3", "10.1.1.2", "10.1.2.2"};
  107. WpadTextView TXT_RESIDENCEINFO; // 세대정보
  108. WpadTextView TXT_INSTRUCTION; // 안내문구
  109. String strTXT_RESIDENCEINFO = "";
  110. String strTXT_INSTRUCTION = "";
  111. SeekBar SEEKBAR_VOLUME;
  112. WpadTextView TXT_VOLUME_LEVEL;
  113. int m_nIDCnt_type = 0;
  114. boolean m_bCallStateThreadStop = true;
  115. class TextResources {
  116. static final String strDong = "동";
  117. static final String strHo = "호";
  118. static final String strInputResidenceInfo = "세대정보를\n 입력하세요.";
  119. static final String strTryingResidence = "호출합니다.";
  120. static final String strCallingResidence = "호출중입니다.";
  121. static final String strCalledResidence = "호출이\n 왔습니다.";
  122. static final String strTalkingResidence = "통화중입니다.";
  123. static final String strBusyTryCallLater = "통화중입니다. 잠시후에 호출 하세요.";
  124. static final String strTryAgain = "다시 시도하세요.";
  125. static final String strPSTNCalled_01 = "전화가 왔습니다.";
  126. static final String strPSTNCalled_02 = "통화를 수락하시겠습니까?";
  127. }
  128. int MAXLENGTH_DONG = 4;
  129. int MAXLENGTH_HO = 4;
  130. int MINLENGTH_DONG = 3;
  131. int MINLENGTH_HO = 3;
  132. int KEYBALANCE = ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01 - 1;
  133. int nCurrentVolume = 0;
  134. boolean bshowMyVideo = false;
  135. boolean mbCameraONOFF = true;
  136. Context mContext;
  137. public TalkResidence(Context context, RelativeLayout layout) {
  138. super(context, layout);
  139. try {
  140. mContext = context;
  141. Initialize();
  142. SCREEN_BG = new WpadImageView(context, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.SCREEN.TALKRESIDENCE.ELEMENT.IMAGE.BG);
  143. ViewRegistration(layout, SCREEN_BG, 0, 0);
  144. IMG_RESIDENCE_BACKGROUND = new WpadImageView(context, TOUCH_KIND.NONE, 724, 544, R.drawable.bg_residence, 0, ID.SCREEN.TALKRESIDENCE.ELEMENT.IMAGE.BACKGROUND);
  145. ViewRegistration(layout, IMG_RESIDENCE_BACKGROUND, Common.ImgPosition.GetX(142), Common.ImgPosition.GetY(110));
  146. IMG_RESIDENCE_BACKGROUND.setVisibility(View.INVISIBLE);
  147. IMG_VIDEO_MODULE = new WpadImageView(context, TOUCH_KIND.NONE, 720, 540, R.drawable.image_neig, 0, ID.SCREEN.TALKRESIDENCE.ELEMENT.IMAGE.VIDEO_MODULE);
  148. ViewRegistration(layout, IMG_VIDEO_MODULE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(112));
  149. IMG_VIDEO_MODULE.setVisibility(View.INVISIBLE);
  150. IMG_VOLUME = new WpadImageView(context, TOUCH_KIND.NONE, 40, 40, R.drawable.bar_icon_sound, 0, ID.SCREEN.TALKRESIDENCE.ELEMENT.IMAGE.VOLUME);
  151. ViewRegistration(layout, IMG_VOLUME, Common.ImgPosition.GetX(318), Common.ImgPosition.GetY(707));
  152. TXT_VOLUME_LEVEL = new WpadTextView(context, false, 40, 40, Gravity.CENTER, Color.WHITE, Common.fontsize._30, false, ID.SCREEN.TALKFRONT.ELEMENT.TEXT.VOLUME_LEVEL);
  153. ViewRegistration(layout, TXT_VOLUME_LEVEL, Common.ImgPosition.GetX(644), Common.ImgPosition.GetY(705));
  154. if (WpadScale.getWidthPixels() == WpadScale.DEFAULT_WIDTH_PIXELS) {
  155. LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  156. LinearLayout volumeLayout = (LinearLayout) inflater.inflate(R.layout.volume_seekbar_1280, null);
  157. LayoutParams volumeParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  158. int volMarginLeft = WpadScale.getWidth(Common.ImgPosition.GetX(359));
  159. int volMarginTop = WpadScale.getHeight(Common.ImgPosition.GetY(707));
  160. volumeParams.setMargins(volMarginLeft, volMarginTop, 0, 0);
  161. volumeLayout.setLayoutParams(volumeParams);
  162. SEEKBAR_VOLUME = (SeekBar) volumeLayout.findViewById(R.id.volumeSeekBar);
  163. SEEKBAR_VOLUME.setMax(100);
  164. SEEKBAR_VOLUME.setOnSeekBarChangeListener(mOnVolumeChangeListener);
  165. layout.addView(volumeLayout);
  166. }
  167. else {
  168. LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  169. LinearLayout volumeLayout = (LinearLayout) inflater.inflate(R.layout.volume_seekbar, null);
  170. LayoutParams volumeParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  171. int volMarginLeft = WpadScale.getWidth(Common.ImgPosition.GetX(366));
  172. int volMarginTop = WpadScale.getHeight(Common.ImgPosition.GetY(703));
  173. volumeParams.setMargins(volMarginLeft, volMarginTop, 0, 0);
  174. volumeLayout.setLayoutParams(volumeParams);
  175. SEEKBAR_VOLUME = (SeekBar) volumeLayout.findViewById(R.id.volumeSeekBar);
  176. SEEKBAR_VOLUME.setMax(100);
  177. SEEKBAR_VOLUME.setOnSeekBarChangeListener(mOnVolumeChangeListener);
  178. layout.addView(volumeLayout);
  179. }
  180. int nTenKeyGuide_X = Common.ImgPosition.GetX(142);
  181. int nTenKeyGuide_Y = Common.ImgPosition.GetY(148);
  182. int nIDCnt = 0;
  183. //String[] strEndIP = {"10.1.1.1", "10.1.1.2", "10.1.1.3", "10.1.1.4", "10.1.1.5", "10.1.1.6", "10.1.1.7"};
  184. int nIDCnt_img = -1;
  185. for(int i = 0; i < strEndIP.length; i++)
  186. {
  187. if (ConfigValues.strDeviceIPaddress.equals(strEndIP[i])) {
  188. m_nIDCnt_type = i;
  189. break;
  190. }
  191. }
  192. for (int i = 0; i < 2; i++) {
  193. for (int j = 0; j < 3; j++) {
  194. if(m_nIDCnt_type == nIDCnt)
  195. nIDCnt_img +=2;
  196. else
  197. nIDCnt_img++;
  198. BTN_TENKEY[nIDCnt] = new WpadImageView(context, TOUCH_KIND.BUTTON, 236, 230, TENKEYS[nIDCnt_img][0], TENKEYS[nIDCnt_img][1], ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01 + nIDCnt_img);
  199. ViewRegistration(layout, BTN_TENKEY[nIDCnt], nTenKeyGuide_X, nTenKeyGuide_Y);
  200. nTenKeyGuide_X += 244;
  201. nIDCnt++;
  202. }
  203. nTenKeyGuide_X = Common.ImgPosition.GetX(142);
  204. nTenKeyGuide_Y += 238;
  205. }
  206. LOG("[TalkResidence] bWallPadCameraEnable [" + ConfigValues.bWallPadCameraEnable + "]");
  207. if (ConfigValues.bWallPadCameraEnable) {
  208. BTN_TALK = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 181, R.drawable.btn_residence_call_normal3, R.drawable.btn_residence_call_pressed3, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TALK_3);
  209. ViewRegistration(layout, BTN_TALK, Common.ImgPosition.GetX(908), Common.ImgPosition.GetY(110));
  210. BTN_END = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 182, R.drawable.btn_residence_end_normal3, R.drawable.btn_residence_end_pressed3, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.END_3);
  211. ViewRegistration(layout, BTN_END, Common.ImgPosition.GetX(908), Common.ImgPosition.GetY(291));
  212. BTN_PORTRAIT = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 181, R.drawable.btn_residence_me_normal3, R.drawable.btn_residence_me_pressed3, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.PORTRAIT_3);
  213. ViewRegistration(layout, BTN_PORTRAIT, Common.ImgPosition.GetX(908), Common.ImgPosition.GetY(473));
  214. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  215. }
  216. else {
  217. BTN_TALK = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.btn_residence_call_normal2, R.drawable.btn_residence_call_pressed2, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TALK_2);
  218. ViewRegistration(layout, BTN_TALK, Common.ImgPosition.GetX(908), Common.ImgPosition.GetY(110));
  219. BTN_END = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.btn_residence_end_normal2, R.drawable.btn_residence_end_pressed2, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.END_2);
  220. ViewRegistration(layout, BTN_END, Common.ImgPosition.GetX(908), Common.ImgPosition.GetY(382));
  221. BTN_PORTRAIT = null;
  222. }
  223. // 부분 임대세대 적용여부 판단
  224. // if (ConfigValues.bEnableHouseDivision) {
  225. // Log.d(TAG, "[TalkResidenceScreen] bEnableHouseDivision TRUE 분리세대");
  226. // BTN_DELETE = new WpadImageView(context, TOUCH_KIND.BUTTON_LC, 154, 132, R.drawable.btn_num_del_normal2, R.drawable.btn_num_del_pressed2, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE);
  227. // ViewRegistration(layout, BTN_DELETE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(520));
  228. //
  229. // BTN_DIVISION = new WpadImageView(context, TOUCH_KIND.BUTTON, 154, 132, R.drawable.btn_num_separation_normal, R.drawable.btn_num_separation_pressed, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DIVISION);
  230. // ViewRegistration(layout, BTN_DIVISION, Common.ImgPosition.GetX(302), Common.ImgPosition.GetY(520));
  231. // } else {
  232. // BTN_DELETE = new WpadImageView(context, TOUCH_KIND.BUTTON_LC, 312, 132, R.drawable.btn_num_del_normal, R.drawable.btn_num_del_pressed, ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE);
  233. // ViewRegistration(layout, BTN_DELETE, Common.ImgPosition.GetX(144), Common.ImgPosition.GetY(520));
  234. // }
  235. //
  236. TXT_RESIDENCEINFO = new WpadTextView(context, false, 292, 284, Gravity.LEFT, context.getResources().getColor(R.color.orange), Common.fontsize._46, false, ID.SCREEN.TALKRESIDENCE.ELEMENT.TEXT.RESIDENCEINFO);
  237. ViewRegistration(layout, TXT_RESIDENCEINFO, Common.ImgPosition.GetX(155), Common.ImgPosition.GetY(111));
  238. TXT_RESIDENCEINFO.setText(strTXT_RESIDENCEINFO);
  239. //TXT_RESIDENCEINFO.setVisibility(View.GONE);
  240. TXT_INSTRUCTION = new WpadTextView(context, false, 317, 364, Gravity.CENTER, context.getResources().getColor(R.color.orange), Common.fontsize._52, true, ID.SCREEN.TALKRESIDENCE.ELEMENT.TEXT.INSTRUCTION);
  241. ViewRegistration(layout, TXT_INSTRUCTION, Common.ImgPosition.GetX(142), Common.ImgPosition.GetY(255));
  242. TXT_INSTRUCTION.setText(strTXT_INSTRUCTION);
  243. //TXT_INSTRUCTION.setVisibility(View.GONE);
  244. displayScreenValues();
  245. sendHandlerMsg(HANDLERMSG.PROC_ADDCALL, 0, 0);
  246. StateCamera();
  247. } catch (RuntimeException re) {
  248. LogUtil.errorLogInfo("", TAG, re);
  249. } catch (Exception e) {
  250. Log.e(TAG, "[Exception] ScreenTalkResidence(Context context, RelativeLayout layout)");
  251. //e.printStackTrace();
  252. LogUtil.errorLogInfo("", TAG, e);
  253. }
  254. }
  255. protected void Initialize() {
  256. try {
  257. LOG_INFO("[Initialize]");
  258. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.IDLE) ((MainActivity) mContext).setMenuBTNEnable(false);
  259. else ((MainActivity) mContext).setMenuBTNEnable(true);
  260. MainActivity.mCallController.setCallEventListener(this);
  261. ((MainActivity) mContext).setMainEventListener(this);
  262. int mMarginLeft = ((MainActivity) mContext).TopBackBtn.getVisibility() == View.VISIBLE ? 893 : 1019;
  263. ((MainActivity) mContext).setManualBtnVisible(((MainActivity) mContext).getManualUse(), mMarginLeft);
  264. ((MainActivity) mContext).setTopHideBtnVisible(true);
  265. super.setFinishTimerCreate(Common.FINISH_TIME_START_SCREEN);
  266. getVolume();
  267. if (MainActivity.bFFMPEGEnable) ((MainActivity)mContext).showRemoteVideo(false, false);
  268. MainActivity.mCallController.mVideoJNI.setDecoderInfo_V40(116, 85, 576, 405); // 세대통화시 영상 좌표 재설정
  269. //MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 세대통화 시작시 초기화
  270. } catch (RuntimeException re) {
  271. LogUtil.errorLogInfo("", TAG, re);
  272. } catch (Exception e) {
  273. Log.e(TAG, "[Exception] Initialize()");
  274. //e.printStackTrace();
  275. LogUtil.errorLogInfo("", TAG, e);
  276. }
  277. }
  278. private void initCallVariables() {
  279. try {
  280. if (!RemoteIDInfo.bAutoCall) RemoteIDInfo.InitVariables();
  281. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  282. Global.TargetInputStep = TARGETINFOINPUTSTEP.DONG;
  283. strTXT_RESIDENCEINFO = "";
  284. } catch (RuntimeException re) {
  285. LogUtil.errorLogInfo("", TAG, re);
  286. } catch (Exception e) {
  287. Log.e(TAG, "[Exception] initCallVariables()");
  288. //e.printStackTrace();
  289. LogUtil.errorLogInfo("", TAG, e);
  290. }
  291. }
  292. @Override
  293. protected void onClose() {
  294. super.onClose();
  295. try {
  296. LOG_INFO("[onClose]");
  297. if (MainActivity.mIOInterface != null) MainActivity.mIOInterface.ctrlWallPadLED_Call(false);
  298. if (mPathCheckHandler != null) {
  299. mPathCheckHandler.removeMessages(0);
  300. mPathCheckHandler.removeMessages(1);
  301. }
  302. mbCallState = false;
  303. MainActivity.mCallController.mSIPInterface.videoSet(false, false, false);
  304. MainActivity.mCallController.selectVideoSourceToSubPhone(CALLTYPE.NONE, true);
  305. MainActivity.mCallController.releaseCallEventListener();
  306. ((MainActivity) mContext).releaseMainEventListener();
  307. MainActivity.mCallController.stop1stCallTimer();
  308. MainActivity.mCallController.stop2ndCallTimer();
  309. initCallVariables();
  310. //Global.add1stCallHistoryInfoFinal();
  311. } catch (RuntimeException re) {
  312. LogUtil.errorLogInfo("", TAG, re);
  313. } catch (Exception e) {
  314. Log.e(TAG, "[Exception] onClose()");
  315. //e.printStackTrace();
  316. LogUtil.errorLogInfo("", TAG, e);
  317. }
  318. }
  319. @Override
  320. protected void onBrReceive(Intent intent) {
  321. super.onBrReceive(intent);
  322. try {
  323. LOG_INFO("[onBrReceive] intent : " + intent);
  324. } catch (RuntimeException re) {
  325. LogUtil.errorLogInfo("", TAG, re);
  326. } catch (Exception e) {
  327. Log.e(TAG, "[Exception] onBrReceive()");
  328. //e.printStackTrace();
  329. LogUtil.errorLogInfo("", TAG, e);
  330. }
  331. }
  332. @Override
  333. protected void onTouchEvent(View v, MotionEvent event) {
  334. super.onTouchEvent(v, event);
  335. try {
  336. int nEvent = event.getAction();
  337. int nID = v.getId();
  338. if (nEvent == MotionEvent.ACTION_UP) {
  339. LOG("[onTouchEvent] nID [" + nID + "], nEvent [" + nEvent + "]");
  340. if (ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TALK_2 <= nID && nID <= ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_HO) {
  341. if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TALK_2 || nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TALK_3) {
  342. // 통화중에 버튼 터치음을 발생시키면, 통화 상대방에게 터치음이 전달되므로 통화중에는 터치음을 출력하지 않는다.(JEFF, 2019.12.24)
  343. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING) MainActivity.mSound.Play(SND.effect.TOUCH_LATCHED);
  344. BTN_END.setButtonEventOffEnable(R.drawable.btn_residence_end_disabled2);
  345. m_bCallStartBtnEnable = true;
  346. new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  347. @Override
  348. public void run() {
  349. BTN_END.setImageResource(R.drawable.btn_residence_end_normal3);
  350. BTN_END.setButtonEventOffDisable();
  351. m_bCallStartBtnEnable = false;
  352. }
  353. }, 2000);
  354. if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONE) {
  355. doTalk(CALLOWNER.WALLPAD);
  356. }
  357. else {
  358. MainActivity.mSound.Play(SND.setting.RETRY_INPUT);
  359. initCallVariables();
  360. updateScreen();
  361. }
  362. }
  363. else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.END_2 || nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.END_3) {
  364. // 통화중에 버튼 터치음을 발생시키면, 통화 상대방에게 터치음이 전달되므로 통화중에는 터치음을 출력하지 않는다.(JEFF, 2019.12.24)
  365. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING) MainActivity.mSound.Play(SND.effect.TOUCH_LATCHED);
  366. doEnd();
  367. }
  368. else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.PORTRAIT_3) {
  369. if (mbCameraONOFF) {
  370. // 통화중에 버튼 터치음을 발생시키면, 통화 상대방에게 터치음이 전달되므로 통화중에는 터치음을 출력하지 않는다.(JEFF, 2019.12.24)
  371. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING)
  372. MainActivity.mSound.Play(SND.effect.TOUCH_LATCHED);
  373. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  374. showMyVideo(!bshowMyVideo);
  375. } else {
  376. LOG_WARN("[onTouchEvent] Call Status is not TALKING!!!");
  377. }
  378. } else {
  379. ((MainActivity) (getContext())).StartPopup(ID.POPUP.POPUP_NOTICE_CAMERAONOFF);
  380. }
  381. }
  382. else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE) {
  383. // 통화중에 버튼 터치음을 발생시키면, 통화 상대방에게 터치음이 전달되므로 통화중에는 터치음을 출력하지 않는다.(JEFF, 2019.12.24)
  384. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING) MainActivity.mSound.Play(SND.effect.TOUCH_LATCHED);
  385. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.IDLE) {
  386. deleteResiInfo();
  387. }
  388. else {
  389. LOG_WARN("[onTouchEvent] Call Status is not IDLE!!!");
  390. }
  391. }
  392. else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DIVISION) {
  393. // 통화중에 버튼 터치음을 발생시키면, 통화 상대방에게 터치음이 전달되므로 통화중에는 터치음을 출력하지 않는다.(JEFF, 2019.12.24)
  394. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING) MainActivity.mSound.Play(SND.effect.TOUCH_LATCHED);
  395. if (ConfigValues.bEnableHouseDivision) {
  396. if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
  397. RemoteIDInfo.strHo = RemoteIDInfo.strDong;
  398. RemoteIDInfo.strDong = ConfigValues.strDong;
  399. if (MINLENGTH_HO > RemoteIDInfo.strHo.length()) {
  400. initCallVariables();
  401. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  402. return;
  403. }
  404. RemoteIDInfo.bRentRoomSelected = true;
  405. RemoteIDInfo.nHo_Extension = 1;
  406. Global.TargetInputStep = TARGETINFOINPUTSTEP.HO;
  407. updateResidenceInfo();
  408. }
  409. else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO || Global.TargetInputStep == TARGETINFOINPUTSTEP.DONE) {
  410. RemoteIDInfo.bRentRoomSelected = true;
  411. RemoteIDInfo.nHo_Extension = 1;
  412. updateResidenceInfo();
  413. }
  414. }
  415. }
  416. else if (ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01 <= nID && nID <= ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_09) {
  417. int nPressedNum = nID - KEYBALANCE;
  418. Global.TargetInputStep = TARGETINFOINPUTSTEP.DONG;
  419. playTenkeyNo(nID);
  420. Global.TargetInputStep = TARGETINFOINPUTSTEP.DONE;
  421. // if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
  422. // RemoteIDInfo.strDong += nPressedNum;
  423. // if (RemoteIDInfo.strDong.length() > MAXLENGTH_DONG) {
  424. // RemoteIDInfo.strDong = RemoteIDInfo.strDong.substring(1, 5);
  425. // }
  426. // playTenkeyNo(nID);
  427. // } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO) {
  428. // RemoteIDInfo.strHo += nPressedNum;
  429. // if (RemoteIDInfo.strHo.length() > MAXLENGTH_HO) {
  430. // RemoteIDInfo.strHo = RemoteIDInfo.strHo.substring(1, 5);
  431. // }
  432. // playTenkeyNo(nID);
  433. // }
  434. updateResidenceInfo();
  435. } else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_00) {
  436. int nPressedNum = 0;
  437. if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
  438. RemoteIDInfo.strDong += nPressedNum;
  439. if (RemoteIDInfo.strDong.length() > MAXLENGTH_DONG) {
  440. RemoteIDInfo.strDong = RemoteIDInfo.strDong.substring(1, 5);
  441. }
  442. playTenkeyNo(nID);
  443. } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO) {
  444. RemoteIDInfo.strHo += nPressedNum;
  445. if (RemoteIDInfo.strHo.length() > MAXLENGTH_HO) {
  446. RemoteIDInfo.strHo = RemoteIDInfo.strHo.substring(1, 5);
  447. }
  448. playTenkeyNo(nID);
  449. }
  450. updateResidenceInfo();
  451. } else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_DONG) {
  452. if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
  453. if (MINLENGTH_DONG > RemoteIDInfo.strDong.length()) {
  454. initCallVariables();
  455. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  456. return;
  457. }
  458. playTenkeyNo(nID);
  459. }
  460. Global.TargetInputStep = TARGETINFOINPUTSTEP.HO;
  461. updateResidenceInfo();
  462. } else if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_HO) {
  463. if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
  464. RemoteIDInfo.strHo = RemoteIDInfo.strDong;
  465. RemoteIDInfo.strDong = ConfigValues.strDong;
  466. if (MINLENGTH_HO > RemoteIDInfo.strHo.length()) {
  467. initCallVariables();
  468. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  469. return;
  470. }
  471. playTenkeyNo(nID);
  472. } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO) {
  473. if (MINLENGTH_HO > RemoteIDInfo.strHo.length()) {
  474. initCallVariables();
  475. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  476. return;
  477. }
  478. playTenkeyNo(nID);
  479. }
  480. Global.TargetInputStep = TARGETINFOINPUTSTEP.DONE;
  481. updateResidenceInfo();
  482. }
  483. }
  484. } else if (nEvent == MotionEvent.ACTION_POINTER_DOWN) {
  485. LOG("[onTouchEvent] nID [" + nID + "], nEvent [" + nEvent + "]");
  486. if (nID == ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.DELETE) {
  487. // 통화중에 버튼 터치음을 발생시키면, 통화 상대방에게 터치음이 전달되므로 통화중에는 터치음을 출력하지 않는다.(JEFF, 2019.12.24)
  488. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING) MainActivity.mSound.Play(SND.effect.TOUCH_LATCHED);
  489. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.IDLE) {
  490. initCallVariables();
  491. updateScreen();
  492. }
  493. else {
  494. LOG_WARN("[onTouchEvent] Call Status is not IDLE!!!");
  495. }
  496. }
  497. }
  498. } catch (RuntimeException re) {
  499. LogUtil.errorLogInfo("", TAG, re);
  500. } catch (Exception e) {
  501. Log.e(TAG, "[Exception] onTouchEvent(View v, MotionEvent event)");
  502. //e.printStackTrace();
  503. LogUtil.errorLogInfo("", TAG, e);
  504. }
  505. }
  506. @Override
  507. public void onMainTouchEvent(MAINEVENT eEvent) {
  508. try {
  509. LOG_INFO("[onMainTouchEvent] eEvent [" + eEvent + "]");
  510. if (eEvent == MAINEVENT.BTN_HOME && m_bCallStartBtnEnable == false) {
  511. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING) Sound().Play(SND.effect.TOUCH_LATCHED);
  512. finishWallpadCallApp();
  513. } else if (eEvent == MAINEVENT.BTN_HOME_MOBILE) {
  514. finishWallpadCallApp();
  515. }
  516. } catch (RuntimeException re) {
  517. LogUtil.errorLogInfo("", TAG, re);
  518. } catch (Exception e) {
  519. Log.e(TAG, "[Exception] onMainTouchEvent(MAINEVENT eEvent)");
  520. //e.printStackTrace();
  521. LogUtil.errorLogInfo("", TAG, e);
  522. }
  523. }
  524. @Override
  525. protected void onKeyDown(int keyCode, KeyEvent event) {
  526. LOG_INFO("[onKeyDown] keyCode [" + keyCode + "], event.getAction() [" + event.getAction() + "]");
  527. if ((keyCode == Declare.BTN.TALK || keyCode == Declare.BTN.TALK_V40) && m_bCallStartBtnEnable == false) {
  528. doTalkByBTN(CALLOWNER.WALLPAD);
  529. } else if (keyCode == Declare.BTN.PLAY_DECODED_VIDEO || (keyCode == Declare.BTN.PLAY_DECODED_VIDEO_V40 && ConfigValues.bWallPadCameraEnable)) {
  530. if (!MainActivity.bFFMPEGEnable) ctrlAlphaBlending(true);
  531. }
  532. super.onKeyDown(keyCode, event);
  533. }
  534. String mRemoteDong = "101";
  535. String mRemoteHo = "101";
  536. private boolean send_call_history_save(String strType, String strTime) {
  537. try {
  538. LOG_INFO("[send_call_history_save] strType() "+ strType + " strTime " + strTime);
  539. final Request_call_history_save call_history_save = new Request_call_history_save(mContext);
  540. if (call_history_save.send_call_history_save(mRemoteDong, mRemoteHo, strType, strTime)) {
  541. call_history_save.setResultCtrl(new RetProci() {
  542. @Override
  543. public void ProcSuccess() {
  544. LOG_INFO("[send_call_history_save] ProcSuccess() ");
  545. }
  546. @Override
  547. public void ProcError() {
  548. LOG_INFO("[send_call_history_save] ProcError()");
  549. //MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
  550. }
  551. @Override
  552. public void ProcDoing() {
  553. LOG_INFO("[send_call_history_save] ProcDoing()");
  554. }
  555. });
  556. return true;
  557. }
  558. } catch (Exception e) {
  559. Log.e(TAG, "[Exception] send_call_history_save(String strTargetIP, String strMessage)");
  560. e.printStackTrace();
  561. }
  562. return false;
  563. }
  564. boolean mbCallState = false;
  565. @Override
  566. public void onCallEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strRemoteIP, String strRemoteSIPID, String strMessage) {
  567. try {
  568. LOG_INFO("[onCallEvent] eCallOwner [" + eCallOwner + "], eCallStatus [" + eCallStatus + "], eCallType [" + eCallType + "], strRemoteIP [" + strRemoteIP + "], strRemoteSIPID [" + strRemoteSIPID + "], strMessage [" + strMessage + "]");
  569. if (eCallType == CALLTYPE.NONE) return;
  570. if (eCallType == CALLTYPE.RESIDENCE) {
  571. MainActivity.mCallController.setRemoteInfo(strRemoteSIPID, strRemoteIP);
  572. setBTNStatus();
  573. if (eCallStatus == CALLSTATUS.CALLING) {
  574. mbCallState = true;
  575. bRcvEnd = false;
  576. mRemoteDong = RemoteIDInfo.strDong;
  577. mRemoteHo = RemoteIDInfo.strHo;
  578. Global.playMelodyRepeat(eCallType);
  579. super.setFinishTimerDestroy();
  580. if (Global.getKitchenTVIdx(eCallOwner) >= 0 || Global.getBathPhoneIdx(eCallOwner) >= 0 || eCallOwner == CALLOWNER.SUB_WALLPAD || Global.getBathTVIdx(eCallOwner) >= 0) {
  581. send_check_sip_activation_request(strRemoteIP);
  582. }
  583. MainActivity.mCallController.set1stCallTimer(eCallType, MainActivity.mCallController.mCTT.CALLING);
  584. updateInstruction();
  585. //Global.make1stCallHistoryInfo(strRemoteIP, strRemoteSIPID, CALLDIRECTION.OUT, CALLACTION.MISS, CALLRESULT.OUT_MISS);
  586. //strRemoteIP
  587. //setTunkeyImage(0);
  588. // String[] strEndIP = {"10.1.1.1", "10.1.1.2", "10.1.1.3", "10.1.1.4", "10.1.1.5", "10.1.1.6", "10.1.1.7"};
  589. //
  590. for(int i = 0; i < strEndIP.length; i++)
  591. {
  592. if (strRemoteIP.equals(strEndIP[i])) {
  593. setTunkeyImage(i);
  594. break;
  595. }
  596. }
  597. } else if (eCallStatus == CALLSTATUS.CALLED) {
  598. bRcvEnd = false;
  599. mRemoteDong = RemoteIDInfo.strDong;
  600. mRemoteHo = RemoteIDInfo.strHo;
  601. MainActivity.mIOInterface.ctrlLcdWakeUp();
  602. Global.playMelodyRepeat(eCallType);
  603. super.setFinishTimerDestroy();
  604. if (Global.getKitchenTVIdx(eCallOwner) >= 0 || Global.getBathPhoneIdx(eCallOwner) >= 0 || Global.getBathTVIdx(eCallOwner) >= 0 || eCallOwner == CALLOWNER.SUB_WALLPAD) {
  605. MainActivity.mSubPhoneController.sendACKNewCall(eCallOwner, eCallType, strRemoteIP, null);
  606. ((MainActivity)(getContext())).StartPopup(ID.POPUP.POPUP_NOTICE_SUBPHONETALK);
  607. }
  608. MainActivity.mCallController.set1stCallTimer(eCallType, MainActivity.mCallController.mCTT.CALLED);
  609. updateScreen();
  610. //Global.make1stCallHistoryInfo(strRemoteIP, strRemoteSIPID, CALLDIRECTION.IN, CALLACTION.MISS, CALLRESULT.IN_MISS);
  611. for(int i = 0; i < strEndIP.length; i++)
  612. {
  613. if (strRemoteIP.equals(strEndIP[i])) {
  614. CallStateThread nr = new CallStateThread(i) ;
  615. Thread t = new Thread(nr) ;
  616. t.start() ;
  617. break;
  618. }
  619. }
  620. }
  621. else if (eCallStatus == CALLSTATUS.TALKING) {
  622. Global.stopMelodyRepeat();
  623. m_bCallStateThreadStop = false;
  624. if (ConfigValues.bWallPadCameraEnable) {
  625. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  626. || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  627. prepareMyVideo(true);
  628. }
  629. }
  630. if (eCallOwner != CALLOWNER.WALLPAD) {
  631. ((MainActivity) mContext).StartPopup(ID.POPUP.POPUP_NOTICE_SUBPHONETALK);
  632. MainActivity.mCallController.setTalkPath(CALLPATH.SUBPHONE_MOIP);
  633. if (eCallOwner == CALLOWNER.SUB_WALLPAD) MainActivity.mCallController.setSubWallPadAudioPath();
  634. }
  635. else {
  636. ((MainActivity) mContext).sendHandlerMsg(MainActivity.HANDLERMSG.SET_TEMPSYSTEM_VOLUME, 0, 0);// 통화 중 임의 볼륨값 설정 seulki
  637. MainActivity.mCallController.setTalkPath(CALLPATH.MOIP_V40_RESIDENCE);
  638. }
  639. mPathCheckHandler.sendEmptyMessage(0);
  640. MainActivity.mCallController.set1stCallTimer(eCallType, MainActivity.mCallController.mCTT.RESIDENCEnRESIDENCE);
  641. updateInstruction();
  642. Global.change1stCallLogAction(CALLACTION.TALK);
  643. //Global.add1stCallHistoryInfoFinal();
  644. if(mbCallState)
  645. {
  646. String strTimeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
  647. send_call_history_save("call", strTimeStamp);
  648. mbCallState = false;
  649. }
  650. //String[] strEndIP = {"10.1.1.1", "10.1.1.2", "10.1.1.3", "10.1.1.4", "10.1.1.5", "10.1.1.6", "10.1.1.7"};
  651. for(int i = 0; i < strEndIP.length; i++)
  652. {
  653. if (strRemoteIP.equals(strEndIP[i])) {
  654. Thread.sleep(1000);
  655. setTunkeyImage(i);
  656. // new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  657. // @Override
  658. // public void run() {
  659. //
  660. // }
  661. // }, 1500);
  662. break;
  663. }
  664. }
  665. }
  666. else if (eCallStatus == CALLSTATUS.HOMEVIEW) {
  667. LOG_WARN("[onCallEvent] MOBILE HOMEVIEW!!!!");
  668. // [방문객원격통화] 모바일에서 홈뷰어 요청 -> 모바일 기기로 월패드카메라 인코딩 영상 전송
  669. ((MainActivity) mContext).showRemoteCallNoticeText(true); // 방문객원격통화 팝업 삭제 -> 상단 문구로 대체
  670. // ((MainActivity) mContext).StartPopup(ID.POPUP.POPUP_NOTICE_REMOTECALL);
  671. prepareMyVideo(true);
  672. ((MainActivity) mContext).showMyVideo(true, true);
  673. MainActivity.mCallController.mSIPInterface.videoSet(true, true, true);
  674. MainActivity.mCallController.set1stCallTimer(eCallType, MainActivity.mCallController.mCTT.RESIDENCEnRESIDENCE); // 홈뷰어 타이머 3분
  675. //Global.make1stCallHistoryInfo("HOMEVIEW", "HOMEVIEW", CALLDIRECTION.OUT, CALLACTION.HOMEVIEW, CALLRESULT.OUT_HONEVIEW); // 통화기록 - 발신:세대:홈뷰어
  676. }
  677. else if (eCallStatus == CALLSTATUS.END) {
  678. Global.stopMelodyRepeat();
  679. bRemoteVideoShow = false;
  680. if (ConfigValues.bWallPadCameraEnable) {
  681. prepareMyVideo(false);
  682. }
  683. MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
  684. if (bRcvEnd) {
  685. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  686. return;
  687. }
  688. bRcvEnd = true;
  689. if (eCallOwner != CALLOWNER.WALLPAD) {
  690. //((MainActivity) mContext).showRemoteCallNoticeText(false);
  691. ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_NOTICE_SUBPHONETALK);
  692. }
  693. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  694. MainActivity.mCallController.stop1stCallTimer();
  695. initCallVariables();
  696. updateScreen();
  697. showMyVideo(false);
  698. MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
  699. MainActivity.mCallController.MultiCallScenarioManager();
  700. } else if (eCallStatus == CALLSTATUS.REJECT) {
  701. Global.stopMelodyRepeat();
  702. if(mbCallState)
  703. {
  704. String strTimeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
  705. send_call_history_save("reject_call", strTimeStamp);
  706. mbCallState = false;
  707. }
  708. bRemoteVideoShow = false;
  709. if (ConfigValues.bWallPadCameraEnable) {
  710. prepareMyVideo(false);
  711. }
  712. MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
  713. if (bRcvEnd) {
  714. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  715. return;
  716. }
  717. bRcvEnd = true;
  718. int nTime = MainActivity.mSound.PlayMent(SND.call.BUSY_TRY_LATER);
  719. //int nTime = MainActivity.mSound.PlayMent(SND.call.TR.TRYLATER);
  720. Log.i(TAG, "[onCallEvent] nTime [" + nTime + "]");
  721. Thread.sleep(nTime + 500);
  722. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  723. MainActivity.mCallController.stop1stCallTimer();
  724. initCallVariables();
  725. updateScreen();
  726. Global.change1stCallLogAction(CALLACTION.REJECT);
  727. showMyVideo(false);
  728. MainActivity.mCallController.MultiCallScenarioManager();
  729. }
  730. else if (eCallStatus == CALLSTATUS.BUSY) {
  731. Global.stopMelodyRepeat();
  732. bRemoteVideoShow = false;
  733. if (ConfigValues.bWallPadCameraEnable) {
  734. prepareMyVideo(false);
  735. }
  736. MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
  737. if (bRcvEnd) {
  738. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  739. return;
  740. }
  741. bRcvEnd = true;
  742. int nTime = MainActivity.mSound.PlayMent(SND.call.BUSY_TRY_LATER);
  743. Log.i(TAG, "[onCallEvent] nTime [" + nTime + "]");
  744. Thread.sleep(nTime + 500);
  745. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  746. MainActivity.mCallController.stop1stCallTimer();
  747. initCallVariables();
  748. updateScreen();
  749. Global.change1stCallLogAction(CALLACTION.BUSY);
  750. showMyVideo(false);
  751. MainActivity.mCallController.MultiCallScenarioManager();
  752. } else if (eCallStatus == CALLSTATUS.CANCEL) {
  753. Global.stopMelodyRepeat();
  754. bRemoteVideoShow = false;
  755. if (ConfigValues.bWallPadCameraEnable) {
  756. prepareMyVideo(false);
  757. }
  758. MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
  759. if (bRcvEnd) {
  760. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  761. return;
  762. }
  763. bRcvEnd = true;
  764. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  765. MainActivity.mCallController.stop1stCallTimer();
  766. initCallVariables();
  767. updateScreen();
  768. Global.change1stCallLogAction(CALLACTION.CANCEL);
  769. showMyVideo(false);
  770. MainActivity.mCallController.MultiCallScenarioManager();
  771. } else if (eCallStatus == CALLSTATUS.FORWARD) {
  772. Global.stopMelodyRepeat();
  773. bRemoteVideoShow = false;
  774. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  775. MainActivity.mCallController.stop1stCallTimer();
  776. tryAutoCall(strMessage);
  777. } else if (eCallStatus == CALLSTATUS.TIMEOUT_1STCALL) {
  778. if(mbCallState)
  779. {
  780. String strTimeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
  781. send_call_history_save("missed_call", strTimeStamp);
  782. mbCallState = false;
  783. }
  784. Global.stopMelodyRepeat();
  785. bRemoteVideoShow = false;
  786. if (ConfigValues.bWallPadCameraEnable) {
  787. prepareMyVideo(false);
  788. }
  789. MainActivity.mCallController.setTalkPath(CALLPATH.NORMAL);
  790. if (eCallOwner != CALLOWNER.WALLPAD) {
  791. ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_NOTICE_SUBPHONETALK);
  792. }
  793. MainActivity.mCallController.quitMoIPCall();
  794. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  795. MainActivity.mCallController.stop1stCallTimer();
  796. ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_NOTICE_SUBPHONETALK);
  797. initCallVariables();
  798. updateScreen();
  799. showMyVideo(false);
  800. MainActivity.mCallController.MultiCallScenarioManager();
  801. } else {
  802. Log.w(TAG, "[onCallEvent] Incorrect eCallStatus!!! eCallStatus = " + eCallStatus);
  803. }
  804. } else {
  805. onMultiCallEvent(eCallOwner, eCallStatus, eCallType, strRemoteIP, strRemoteSIPID, strMessage);
  806. }
  807. } catch (RuntimeException re) {
  808. LogUtil.errorLogInfo("", TAG, re);
  809. } catch (Exception e) {
  810. Log.e(TAG, "[Exception] onCallEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strRemoteIP, String strRemoteSIPID, String strMessage)");
  811. //e.printStackTrace();
  812. LogUtil.errorLogInfo("", TAG, e);
  813. }
  814. }
  815. public void onMultiCallEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strRemoteIP, String strRemoteSIPID, String strMessage) {
  816. try {
  817. LOG_INFO("[onMultiCallEvent] eCallOwner [" + eCallOwner + "], eCallStatus [" + eCallStatus + "], eCallType [" + eCallType + "], strRemoteIP [" + strRemoteIP + "], strRemoteSIPID [" + strRemoteSIPID + "], strMessage [" + strMessage + "]");
  818. MainActivity.mCallController.mCallInfo.printCallStatus();
  819. MainActivity.mCallController.mCallInfo.printMultiCallStatus();
  820. if (eCallStatus == CALLSTATUS.CALLED) {
  821. if (eCallType == CALLTYPE.FRONT) {
  822. playFrontCamBell(true);
  823. if (MainActivity.mCallController.mCallInfo.getMultiCallStatus() == CALLSTATUS.IDLE) {
  824. // 멀티콜 없음
  825. MultiCallInfo MCInfo = new MultiCallInfo();
  826. MCInfo.setMulticallInfo(CALLTYPE.RESIDENCE, eCallType, eCallStatus, CALLOWNER.NONE, strRemoteSIPID, "", "", "세대현관", strRemoteIP);
  827. MainActivity.mCallController.mCallInfo.setMultiCallInfo(MCInfo);
  828. //Global.make2ndCallHistoryInfo(eCallType.toString(), "NONE", CALLDIRECTION.IN, CALLACTION.MISS, CALLRESULT.IN_MISS);
  829. CALLSTATUS eResidenceCallStatus = MainActivity.mCallController.mCallInfo.getRESI();
  830. LOG("[onMultiCallEvent] eResidenceCallStatus [" + eResidenceCallStatus + "]");
  831. /**
  832. * JEFF, 2020.01.02
  833. * 모든통화에서 멀티콜 발생시 알림 팝업만 띄우고 busy처리 하도록 시나리오 수정
  834. */
  835. if (eResidenceCallStatus == CALLSTATUS.CALLING || eResidenceCallStatus == CALLSTATUS.CALLED || eResidenceCallStatus == CALLSTATUS.TALKING || eResidenceCallStatus == CALLSTATUS.HOMEVIEW) {
  836. if (eCallOwner == CALLOWNER.WALLPAD || eCallOwner == CALLOWNER.MOBILE || eCallOwner == CALLOWNER.NONE) {
  837. ((MainActivity) (getContext())).startMultiCallPopup(ID.POPUP.POPUP_MULTICALL_NOTICE);
  838. }
  839. else {
  840. if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
  841. MainActivity.mCallController.stop2ndCallTimer();
  842. doMultiCallReject();
  843. // if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  844. // || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  845. // MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
  846. // }
  847. sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
  848. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  849. || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  850. LOG("[onMultiCallEvent] bRemoteVideoShow [" + bRemoteVideoShow + "]");
  851. if (bRemoteVideoShow) ctrlAlphaBlending(true); // 세대 월패드에서 내모습 보이기 출력중인 경우 멀티콜 거절시(팝업 종료시) 세대영상 출력
  852. else ctrlAlphaBlending(false);
  853. }
  854. }
  855. }
  856. else {
  857. LOG_WARN("[onMultiCallEvent] Invalid eResidenceCallStatus [" + eResidenceCallStatus + "]");
  858. }
  859. // LOG("[onMultiCallEvent] eResidenceCallStatus [" + eResidenceCallStatus + "]");
  860. // if (eResidenceCallStatus == CALLSTATUS.CALLING || eResidenceCallStatus == CALLSTATUS.CALLED) {
  861. // ((MainActivity) (getContext())).startMultiCallPopup(ID.POPUP.POPUP_MULTICALL_NOTICE);
  862. // } else if (eResidenceCallStatus == CALLSTATUS.TALKING) {
  863. // MainActivity.mCallController.set2ndCallTimer(eCallType, MainActivity.mCallController.mCTT.CALLED);
  864. // ((MainActivity) (getContext())).startMultiCallPopup(ID.POPUP.POPUP_MULTICALL);
  865. // } else {
  866. // LOG_WARN("[onMultiCallEvent] Invalid eResidenceCallStatus [" + eResidenceCallStatus + "]");
  867. // }
  868. }
  869. else {
  870. // 멀티콜 있음
  871. sendHandlerMsgDelayed(HANDLERMSG.OFF_FRONT, 0, 0, 2000);
  872. MainActivity.mCallController.mCallInfo.setCallStatus(eCallType, CALLSTATUS.IDLE);
  873. return;
  874. }
  875. }
  876. else if (eCallType == CALLTYPE.LOBBY || eCallType == CALLTYPE.GUARD || eCallType == CALLTYPE.RESIDENCE) {
  877. if (MainActivity.mCallController.mCallInfo.getMultiCallStatus() == CALLSTATUS.IDLE) {
  878. // 멀티콜 없음
  879. MultiCallInfo MCInfo = new MultiCallInfo();
  880. MCInfo.setMulticallInfo(CALLTYPE.RESIDENCE, eCallType, eCallStatus, CALLOWNER.NONE, strRemoteSIPID, Integer.toString(MainActivity.mCallController.getRemoteDong(strRemoteSIPID)),
  881. Integer.toString(MainActivity.mCallController.getRemoteID(strRemoteSIPID)), MainActivity.mCallController.getRemoteName(strRemoteSIPID, strRemoteIP), strRemoteIP);
  882. MainActivity.mCallController.mCallInfo.setMultiCallInfo(MCInfo);
  883. //Global.make2ndCallHistoryInfo(strRemoteIP, strRemoteSIPID, CALLDIRECTION.IN, CALLACTION.MISS, CALLRESULT.IN_MISS);
  884. CALLSTATUS eResidenceCallStatus = MainActivity.mCallController.mCallInfo.getRESI();
  885. /**
  886. * JEFF, 2020.01.02
  887. * 모든통화에서 멀티콜 발생시 알림 팝업만 띄우고 busy처리 하도록 시나리오 수정
  888. */
  889. if (eResidenceCallStatus == CALLSTATUS.CALLING || eResidenceCallStatus == CALLSTATUS.CALLED || eResidenceCallStatus == CALLSTATUS.TALKING || eResidenceCallStatus == CALLSTATUS.HOMEVIEW) {
  890. if (eCallOwner == CALLOWNER.WALLPAD || eCallOwner == CALLOWNER.NONE) {
  891. ((MainActivity) (getContext())).startMultiCallPopup(ID.POPUP.POPUP_MULTICALL_NOTICE);
  892. }
  893. else if (eCallOwner == CALLOWNER.MOBILE) {
  894. // 모바일로 홈뷰어 실행 중 멀티콜 오는 경우 통화중 처리
  895. MainActivity.mCallController.mCallInfo.setCallStatus(eCallType, CALLSTATUS.IDLE);
  896. MainActivity.mCallController.rejectMoIPCall();
  897. }
  898. else {
  899. if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
  900. MainActivity.mCallController.stop2ndCallTimer();
  901. doMultiCallReject();
  902. // if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  903. // || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  904. // MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
  905. // }
  906. sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
  907. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  908. || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  909. LOG("[onMultiCallEvent] bRemoteVideoShow [" + bRemoteVideoShow + "]");
  910. if (bRemoteVideoShow) ctrlAlphaBlending(true); // 세대 월패드에서 내모습 보이기 출력중인 경우 멀티콜 거절시(팝업 종료시) 세대영상 출력
  911. else ctrlAlphaBlending(false);
  912. }
  913. }
  914. }
  915. else {
  916. LOG_WARN("[onMultiCallEvent] Invalid eResidenceCallStatus [" + eResidenceCallStatus + "]");
  917. }
  918. // if (eResidenceCallStatus == CALLSTATUS.CALLING || eResidenceCallStatus == CALLSTATUS.CALLED) {
  919. // ((MainActivity) (getContext())).startMultiCallPopup(ID.POPUP.POPUP_MULTICALL_NOTICE);
  920. // }
  921. // else if (eResidenceCallStatus == CALLSTATUS.TALKING) {
  922. // MainActivity.mCallController.set2ndCallTimer(eCallType, MainActivity.mCallController.mCTT.CALLED);
  923. // ((MainActivity) (getContext())).startMultiCallPopup(ID.POPUP.POPUP_MULTICALL);
  924. // }
  925. // else {
  926. // LOG_WARN("[onMultiCallEvent] Invalid eResidenceCallStatus [" + eResidenceCallStatus + "]");
  927. // }
  928. } else {
  929. // 멀티콜 있음
  930. MainActivity.mCallController.rejectMoIPMultiCall();
  931. MainActivity.mCallController.mCallInfo.setCallStatus(eCallType, CALLSTATUS.IDLE);
  932. }
  933. } else if (eCallType == CALLTYPE.PSTN) {
  934. TalkPSTN.bPSTNCalled = true;
  935. if (MainActivity.mCallController.mCallInfo.getMultiCallStatus() == CALLSTATUS.IDLE) {
  936. // 멀티콜 없음
  937. MultiCallInfo MCInfo = new MultiCallInfo();
  938. MCInfo.setMulticallInfo(CALLTYPE.RESIDENCE, eCallType, eCallStatus, CALLOWNER.NONE, strRemoteSIPID, "", "", "NONE", strRemoteIP);
  939. MainActivity.mCallController.mCallInfo.setMultiCallInfo(MCInfo);
  940. //Global.make2ndCallHistoryInfo(eCallType.toString(), "NONE", CALLDIRECTION.IN, CALLACTION.MISS, CALLRESULT.IN_MISS);
  941. ((MainActivity) (getContext())).startMultiCallPopup(ID.POPUP.POPUP_MULTICALL);
  942. } else {
  943. // 멀티콜 있음
  944. // 기존 멀티콜을 거절하고, 국선을 멀티콜로 설정한다.
  945. CALLTYPE eMulticallType = MainActivity.mCallController.mCallInfo.getMultiCallType();
  946. if (eMulticallType == CALLTYPE.FRONT) playFrontCamBell(false);
  947. else if (eMulticallType == CALLTYPE.LOBBY || eMulticallType == CALLTYPE.GUARD || eMulticallType == CALLTYPE.RESIDENCE)
  948. MainActivity.mCallController.rejectMoIPMultiCall();
  949. else
  950. LOG_WARN("[onMultiCallEvent] Invalid eMulticallType [" + eMulticallType + "]");
  951. MainActivity.mCallController.mCallInfo.setCallStatus(eMulticallType, CALLSTATUS.IDLE);
  952. MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  953. MainActivity.mCallController.stop2ndCallTimer();
  954. //Global.add2ndCallHistoryInfo(CALLRESULT.IN_MISS);
  955. LOG_WARN("[onMultiCallEvent] Another multicall is processing. Change multicall to PSTN multicall!!");
  956. MultiCallInfo MCInfo = new MultiCallInfo();
  957. MCInfo.setMulticallInfo(CALLTYPE.RESIDENCE, eCallType, eCallStatus, CALLOWNER.NONE, strRemoteSIPID, "", "", "NONE", strRemoteIP);
  958. MainActivity.mCallController.mCallInfo.setMultiCallInfo(MCInfo);
  959. //Global.make2ndCallHistoryInfo(eCallType.toString(), "NONE", CALLDIRECTION.IN, CALLACTION.MISS, CALLRESULT.IN_MISS);
  960. MainActivity.mCallController.mPopupEventListener.onMulticallChange(eCallType, eCallStatus, "");
  961. }
  962. } else {
  963. LOG_WARN("[onMultiCallEvent] Invalid CallType [" + eCallType + "]");
  964. }
  965. } else if (eCallStatus == CALLSTATUS.CALLERID) {
  966. MainActivity.mCallController.mCallInfo.updateMultiCallName(strRemoteSIPID);
  967. Global.change2ndCallLogSIPID(CALLTYPE.PSTN.toString() + ":" + strRemoteSIPID);
  968. } else if (eCallStatus == CALLSTATUS.END) {
  969. MainActivity.mCallController.mCallInfo.setCallStatus(eCallType, CALLSTATUS.IDLE);
  970. if (MainActivity.mCallController.mCallInfo.getMultiCallType() == eCallType) {
  971. MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  972. MainActivity.mCallController.stop2ndCallTimer();
  973. //Global.add2ndCallHistoryInfo(CALLRESULT.IN_MISS);
  974. ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_MULTICALL);
  975. } else LOG_WARN("[onMultiCallEvent] Invalid CallType [" + eCallType + "]");
  976. } else if (eCallStatus == CALLSTATUS.CANCEL) {
  977. MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  978. MainActivity.mCallController.mCallInfo.setCallStatus(eCallType, CALLSTATUS.IDLE);
  979. MainActivity.mCallController.stop2ndCallTimer();
  980. //Global.add2ndCallHistoryInfo(CALLRESULT.IN_REJECT);
  981. ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_MULTICALL);
  982. } else if (eCallStatus == CALLSTATUS.FORWARD) {
  983. Global.stopMelodyRepeat();
  984. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  985. MainActivity.mCallController.stop1stCallTimer();
  986. tryAutoCall(strMessage);
  987. } else if (eCallStatus == CALLSTATUS.TIMEOUT_2NDCALL) {
  988. // 거동수상자 녹화기능 수정중 (추후 동작상태보고 수정)
  989. // if (eCallType == CALLTYPE.FRONT_RECORD) {
  990. // // [스마트현관카메라] 거동수상자 녹화 팝업 미선택시 녹화 시작
  991. // ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_MULTICALL_RECORD);
  992. // MainActivity.mCallController.stop2ndCallTimer();
  993. // MainActivity.mCallController.mSIPInterface.videoSet(false, false, false);
  994. // doMultiCallAccept();
  995. // } else {
  996. // doMultiCallReject();
  997. // Global.add2ndCallHistoryInfo(CALLRESULT.IN_MISS);
  998. // MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  999. // MainActivity.mCallController.mCallInfo.setCallStatus(eCallType, CALLSTATUS.IDLE);
  1000. // ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_MULTICALL);
  1001. // }
  1002. doMultiCallReject();
  1003. //Global.add2ndCallHistoryInfo(CALLRESULT.IN_MISS);
  1004. if(MainActivity.mCallController.mCallInfo!=null)
  1005. MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  1006. if(MainActivity.mCallController.mCallInfo!=null)
  1007. MainActivity.mCallController.mCallInfo.setCallStatus(eCallType, CALLSTATUS.IDLE);
  1008. ((MainActivity) mContext).finishPopUp(ID.POPUP.POPUP_MULTICALL);
  1009. } else {
  1010. LOG_WARN("[onMultiCallEvent] Invalid CallStatus [" + eCallStatus + "]");
  1011. }
  1012. } catch (RuntimeException re) {
  1013. LogUtil.errorLogInfo("", TAG, re);
  1014. } catch (Exception e) {
  1015. Log.e(TAG, "[Exception] onMultiCallEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strRemoteIP, String strRemoteSIPID, String strMessage)");
  1016. //e.printStackTrace();
  1017. LogUtil.errorLogInfo("", TAG, e);
  1018. }
  1019. }
  1020. @Override
  1021. public void onSubPhoneEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strTargetID, String strMessage) {
  1022. try {
  1023. LOG_INFO("[onSubPhoneEvent] eCallOwner [" + eCallOwner + "], eCallStatus [" + eCallStatus + "], eCallType [" + eCallType + "], strTargetID [" + strTargetID + "], strMessage [" + strMessage + "]");
  1024. if (eCallType == CALLTYPE.NONE) return;
  1025. if (eCallType == CALLTYPE.RESIDENCE) {
  1026. if (eCallStatus == CALLSTATUS.TALKING) {
  1027. if (eCallOwner != CALLOWNER.WALLPAD) {
  1028. doTalk(eCallOwner);
  1029. } else {
  1030. MainActivity.mCallController.setTalkPath(CALLPATH.SUBPHONE_MOIP);
  1031. }
  1032. } else if (eCallStatus == CALLSTATUS.END) {
  1033. if (eCallOwner != CALLOWNER.WALLPAD) {
  1034. doEnd();
  1035. }
  1036. }
  1037. else if (eCallStatus == CALLSTATUS.TRYING_CALL) {
  1038. String[] strSplit = strTargetID.split(",");
  1039. RemoteIDInfo.strDong = strSplit[0];
  1040. RemoteIDInfo.strHo = strSplit[1];
  1041. RemoteIDInfo.strIP = Global.makeIPAddress(DeviceType.RESIDENCE, strSplit[0], strSplit[1]);
  1042. RemoteIDInfo.strName = strSplit[0] + "동 " + strSplit[1] + "호";
  1043. if (!RemoteIDInfo.bAutoCall) RemoteIDInfo.bAutoCall = true;
  1044. doAutoCall_sub();
  1045. }
  1046. else {
  1047. Log.w(TAG, "[onSubPhoneEvent] Incorrect eCallStatus!!! eCallStatus = " + eCallStatus);
  1048. }
  1049. } else {
  1050. Log.w(TAG, "[onSubPhoneEvent] Incorrect eCallType!!! eCallType = " + eCallType);
  1051. }
  1052. } catch (RuntimeException re) {
  1053. LogUtil.errorLogInfo("", TAG, re);
  1054. } catch (Exception e) {
  1055. Log.e(TAG, "[Exception] onSubPhoneEvent(CALLOWNER eCallOwner, CALLSTATUS eCallStatus, CALLTYPE eCallType, String strTargetID, String strMessage)");
  1056. //e.printStackTrace();
  1057. LogUtil.errorLogInfo("", TAG, e);
  1058. }
  1059. }
  1060. @Override
  1061. public void onVideoSet(boolean bSet, String strRemoteSIPID) {
  1062. try {
  1063. LOG_INFO("[onVideoSet] bSet [" + bSet + "], strRemoteSIPID [" + strRemoteSIPID + "]");
  1064. if (bSet) {
  1065. if (!strRemoteSIPID.contains(DEVICENAME.strType_Resi)) {
  1066. Log.e(TAG, "[onVideoSet] Device name is not matched!!!");
  1067. return;
  1068. }
  1069. }
  1070. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  1071. || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1072. Log.i(TAG, "[onVideoSet] ConfigValues.bWallPadCameraEnable [" + ConfigValues.bWallPadCameraEnable + "]");
  1073. if (ConfigValues.bWallPadCameraEnable) {
  1074. if (!bSet) showMyVideo(bSet);
  1075. MainActivity.mCallController.mSIPInterface.videoSet(bSet, bSet, bSet);
  1076. // if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  1077. // MainActivity.mCallController.mSIPInterface.videoSet(bSet, bSet, bSet);
  1078. // }
  1079. // else {
  1080. // Log.i(TAG, "[onVideoSet] CallStatus is NOT TALKING!!");
  1081. // }
  1082. }
  1083. else {
  1084. Log.w(TAG, "[onVideoSet] Wallpad camera is not enabled!!");
  1085. }
  1086. }
  1087. else {
  1088. LOG_WARN("[onVideoSet] Not Supported BOARD_TYPE!! [" + ConfigValues.DEVICE_BOARDTYPE + "]");
  1089. }
  1090. } catch (RuntimeException re) {
  1091. LogUtil.errorLogInfo("", TAG, re);
  1092. } catch (Exception e) {
  1093. Log.e(TAG, "[Exception] onVideoSet(boolean bSet, String strRemoteSIPID)");
  1094. //e.printStackTrace();
  1095. LogUtil.errorLogInfo("", TAG, e);
  1096. }
  1097. }
  1098. boolean bRemoteVideoShow = false;
  1099. @Override
  1100. public void onShowRemoteVideo(boolean bShow) {
  1101. try {
  1102. LOG_INFO("[onShowRemoteVideo] bShow [" + bShow + "]");
  1103. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40
  1104. || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  1105. bRemoteVideoShow = bShow;
  1106. LOG("[onShowRemoteVideo] bRemoteVideoShow [" + bRemoteVideoShow + "]");
  1107. if (MainActivity.bFFMPEGEnable) {
  1108. ((MainActivity)mContext).showRemoteVideo(bShow, true);
  1109. }
  1110. else {
  1111. CALLOWNER eCallOwner = MainActivity.mCallController.mCallInfo.getCallOwner();
  1112. CALLSTATUS eMultiCallStatus = MainActivity.mCallController.mCallInfo.getMultiCallStatus();
  1113. LOG("[onShowRemoteVideo] eCallOwner [" + eCallOwner + "], eMultiCallStatus [" + eMultiCallStatus + "]");
  1114. if (eCallOwner == CALLOWNER.WALLPAD) {
  1115. if (eMultiCallStatus == CALLSTATUS.IDLE) {
  1116. LOG("[onShowRemoteVideo] =========== POPUP X =========== (display remote video)");
  1117. ctrlAlphaBlending(bShow); // 팝업(서브폰통화, 멀티콜)이 떠있지 않는 경우만 원격지 영상 출력-> 팝업 짤림 (02.12.01 seulki)
  1118. }
  1119. else {
  1120. LOG("[onShowRemoteVideo] =========== POPUP O =========== (do not display remote video)");
  1121. }
  1122. }
  1123. else {
  1124. LOG("[onShowRemoteVideo] =========== POPUP O =========== (do not display remote video)");
  1125. }
  1126. }
  1127. }
  1128. else {
  1129. LOG_WARN("[onShowRemoteVideo] Not Supported BOARD_TYPE!! [" + ConfigValues.DEVICE_BOARDTYPE + "]");
  1130. }
  1131. } catch (RuntimeException re) {
  1132. LogUtil.errorLogInfo("", TAG, re);
  1133. } catch (Exception e) {
  1134. Log.e(TAG, "[Exception] onShowRemoteVideo(boolean bShow)");
  1135. //e.printStackTrace();
  1136. LogUtil.errorLogInfo("", TAG, e);
  1137. }
  1138. }
  1139. @Override
  1140. protected void onPopupResult(Intent data) {
  1141. try {
  1142. int nScreen = data.getIntExtra("SCREEN", -1);
  1143. int nID = data.getIntExtra("POPUP_BTN", -1);
  1144. boolean bFinish = data.getBooleanExtra("FINISH_FLAG", false);
  1145. Log.d(TAG, "[onPopupResult] nScreen: " + nScreen + ", nID: " + nID + ", bFinish: " + bFinish);
  1146. if (nScreen == ID.POPUP.POPUP_MULTICALL) {
  1147. if (nID == ID.POPUP.MUTICALL.ELEMENT.BUTTON.ACCEPT) {
  1148. LOG_INFO("[onPopupResult] ID.POPUP.MUTICALL.ELEMENT.BUTTON.ACCEPT");
  1149. MainActivity.mCallController.mSIPInterface.videoSet(false, false, false);
  1150. MainActivity.mCallController.stop2ndCallTimer();
  1151. doMultiCallAccept();
  1152. } else if (nID == ID.POPUP.MUTICALL.ELEMENT.BUTTON.REJECT) {
  1153. LOG_INFO("[onPopupResult] ID.POPUP.MUTICALL.ELEMENT.BUTTON.REJECT");
  1154. if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
  1155. MainActivity.mCallController.stop2ndCallTimer();
  1156. doMultiCallReject();
  1157. // if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  1158. // || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1159. // MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
  1160. // }
  1161. sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
  1162. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  1163. || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1164. LOG("[onPopupResult] bRemoteVideoShow [" + bRemoteVideoShow + "]");
  1165. if (bRemoteVideoShow) ctrlAlphaBlending(true); // 세대 월패드에서 내모습 보이기 출력중인 경우 멀티콜 거절시(팝업 종료시) 세대영상 출력
  1166. else ctrlAlphaBlending(false);
  1167. }
  1168. }
  1169. // if (bFinish
  1170. // && (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40
  1171. // || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  1172. // || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT))
  1173. //MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
  1174. } else if (nScreen == ID.POPUP.POPUP_NOTICE_SUBPHONETALK) {
  1175. if (nID == ID.POPUP.NOTICE_SUBPHONETALK.ELEMENT.BUTTON.END) {
  1176. LOG_INFO("[onPopupResult] ID.POPUP.NOTICE_SUBPHONETALK.ELEMENT.BUTTON.END");
  1177. MainActivity.mCallController.stop2ndCallTimer();
  1178. doEnd();
  1179. }
  1180. } else if (nScreen == ID.POPUP.POPUP_MULTICALL_NOTICE) {
  1181. if (nID == ID.POPUP.MUTICALL_NOTICE.ELEMENT.BUTTON.CONFIRM) {
  1182. LOG_INFO("[onPopupResult] ID.POPUP.POPUP_MULTICALL_NOTICE.ELEMENT.BUTTON.CONFIRM");
  1183. // if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  1184. // || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1185. // MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
  1186. // }
  1187. /**
  1188. * JEFF, 2020.01.01
  1189. * 모든 통화에서 멀티콜을 막음
  1190. */
  1191. if (MainActivity.mPSTNController != null) MainActivity.mPSTNController.stopPSTNRingCntThread(); // PSTN 멀티콜 거절시 ring cnt 초기화
  1192. MainActivity.mCallController.stop2ndCallTimer();
  1193. doMultiCallReject();
  1194. // if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  1195. // || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1196. // MainActivity.mIOInterface.ctrlPopupGUI_Resi(false, bshowMyVideo); // 현재 통화패스가 IHN-1010 이웃통화일 경우 멀티콜 거절시 GUI 화면이 아래로(영상이 위로)
  1197. // }
  1198. sendHandlerMsgDelayed(HANDLERMSG.REFRESH_BTNLED_STATUS, 0, 0, 1000);
  1199. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
  1200. || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1201. LOG("[onPopupResult] bRemoteVideoShow [" + bRemoteVideoShow + "]");
  1202. if (bRemoteVideoShow) ctrlAlphaBlending(true); // 세대 월패드에서 내모습 보이기 출력중인 경우 멀티콜 거절시(팝업 종료시) 세대영상 출력
  1203. else ctrlAlphaBlending(false);
  1204. }
  1205. }
  1206. } else if (nScreen == ID.POPUP.POPUP_NOTICE_REMOTECALL) {
  1207. if (nID == ID.POPUP.NOTICE_REMOTECALL.ELEMENT.BUTTON.END) {
  1208. LOG_INFO("[onPopupResult] ID.POPUP.NOTICE_REMOTECALL.ELEMENT.BUTTON.END");
  1209. doEnd();
  1210. MainActivity.mRemoteCallController.sendCloseRemoteCall();
  1211. MainActivity.mCallController.MultiCallScenarioManager();
  1212. }
  1213. } else if (nScreen == ID.POPUP.POPUP_NOTICE_CAMERAONOFF) {
  1214. if (nID == ID.POPUP.NOTICE_CAMERAONOFF.ELEMENT.BUTTON.END) {
  1215. LOG_INFO("[onPopupResult] ID.POPUP.NOTICE_CAMERAONOFF.ELEMENT.BUTTON.END");
  1216. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  1217. }
  1218. }
  1219. } catch (RuntimeException re) {
  1220. LogUtil.errorLogInfo("", TAG, re);
  1221. } catch (Exception e) {
  1222. Log.e(TAG, "[Exception] onPopupResult(Intent data)");
  1223. //e.printStackTrace();
  1224. LogUtil.errorLogInfo("", TAG, e);
  1225. }
  1226. }
  1227. boolean bRcvEnd = false;
  1228. private void doTalk(CALLOWNER eCallOwner) {
  1229. try {
  1230. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.IDLE) {
  1231. ((MainActivity) mContext).setMenuBTNEnable(false);
  1232. if (MINLENGTH_DONG > RemoteIDInfo.strDong.length() || MINLENGTH_HO > RemoteIDInfo.strHo.length()) {
  1233. initCallVariables();
  1234. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  1235. updateScreen();
  1236. ((MainActivity) mContext).setMenuBTNEnable(true);
  1237. return;
  1238. }
  1239. try {
  1240. if (RemoteIDInfo.bRentRoomSelected)
  1241. RemoteIDInfo.strIP = Global.makeIPAddress(DeviceType.RENTRESIDENCE, RemoteIDInfo.strDong, RemoteIDInfo.strHo);
  1242. else
  1243. RemoteIDInfo.strIP = Global.makeIPAddress(DeviceType.RESIDENCE, RemoteIDInfo.strDong, RemoteIDInfo.strHo);
  1244. Log.d(TAG, "[doTalk] ConfigValues.strDeviceIPaddress: " + ConfigValues.strDeviceIPaddress + ", RemoteIDInfo.strIP: " + RemoteIDInfo.strIP);
  1245. if (ConfigValues.strDeviceIPaddress.equals(RemoteIDInfo.strIP)) {
  1246. Log.e(TAG, "[doTalk] IPAddress is same!!");
  1247. initCallVariables();
  1248. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  1249. updateScreen();
  1250. ((MainActivity) mContext).setMenuBTNEnable(true);
  1251. return;
  1252. }
  1253. } catch (RuntimeException re) {
  1254. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  1255. ((MainActivity) mContext).setMenuBTNEnable(true);
  1256. LogUtil.errorLogInfo("", TAG, re);
  1257. } catch (Exception e) {
  1258. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  1259. Log.e(TAG, "[Exception] doTalk -> EthernetCtrl.makeIPAddress(...)");
  1260. ((MainActivity) mContext).setMenuBTNEnable(true);
  1261. //e.printStackTrace();
  1262. LogUtil.errorLogInfo("", TAG, e);
  1263. }
  1264. if (!send_check_sip_activation_request(RemoteIDInfo.strIP)) {
  1265. initCallVariables();
  1266. MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  1267. updateScreen();
  1268. ((MainActivity) mContext).setMenuBTNEnable(true);
  1269. return;
  1270. }
  1271. MainActivity.mCallController.mCallInfo.setCallOwner(eCallOwner);
  1272. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.TRYING_CALL);
  1273. }
  1274. else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLED) {
  1275. MainActivity.mCallController.mCallInfo.setCallOwner(eCallOwner);
  1276. MainActivity.mCallController.acceptMoIPCall(false);
  1277. }
  1278. else {
  1279. LOG_INFO("[doTalk] Invalid CALLSTATUS [" + MainActivity.mCallController.mCallInfo.getRESI() + "]");
  1280. }
  1281. } catch (RuntimeException re) {
  1282. LogUtil.errorLogInfo("", TAG, re);
  1283. MainActivity.mCallController.mCallInfo.setCallOwner(CALLOWNER.NONE);
  1284. } catch (Exception e) {
  1285. Log.e(TAG, "[Exception] doTalk()");
  1286. //e.printStackTrace();
  1287. LogUtil.errorLogInfo("", TAG, e);
  1288. MainActivity.mCallController.mCallInfo.setCallOwner(CALLOWNER.NONE);
  1289. }
  1290. }
  1291. private void doEnd() {
  1292. try {
  1293. if (MainActivity.mCallController.mCallInfo.getIDLECnt() != MainActivity.mCallController.mCallInfo.IDLECNT_MAX) {
  1294. LOG("[doEnd] MainActivity.mCallController.mCallInfo.getRESI() = " + MainActivity.mCallController.mCallInfo.getRESI());
  1295. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLED) {
  1296. Global.change1stCallLogAction(CALLACTION.REJECT);
  1297. bshowMyVideo = false;
  1298. Global.stopMelodyRepeat();
  1299. MainActivity.mCallController.rejectMoIPCall();
  1300. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLING) {
  1301. bshowMyVideo = false;
  1302. Global.stopMelodyRepeat();
  1303. MainActivity.mCallController.quitMoIPCall();
  1304. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  1305. if (ConfigValues.bWallPadCameraEnable) {
  1306. // ctrlAlphaBlending(false);
  1307. showMyVideo(false);
  1308. if(BTN_PORTRAIT!=null)
  1309. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  1310. }
  1311. bshowMyVideo = false;
  1312. MainActivity.mCallController.quitMoIPCall();
  1313. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.HOMEVIEW) {
  1314. MainActivity.mRemoteCallController.sendCloseRemoteCall();
  1315. MainActivity.mCallController.MultiCallScenarioManager();
  1316. bshowMyVideo = false;
  1317. prepareMyVideo(false);
  1318. showMyVideo(false);
  1319. MainActivity.mCallController.mSIPInterface.videoSet(false, false, false);
  1320. MainActivity.mCallController.mVideoJNI.encoderStopOperation();
  1321. } else {
  1322. LOG_INFO("[doEnd] Invalid CALLSTATUS [" + MainActivity.mCallController.mCallInfo.getRESI() + "]");
  1323. MainActivity.mCallController.quitMoIPCall();
  1324. }
  1325. } else {
  1326. LOG_INFO("[doEnd] IDLE Cnt is not MAX [" + MainActivity.mCallController.mCallInfo.IDLECNT_MAX + "]");
  1327. MainActivity.mCallController.mCallInfo.printCallStatus();
  1328. MainActivity.mCallController.MultiCallScenarioManager();
  1329. }
  1330. } catch (RuntimeException re) {
  1331. LogUtil.errorLogInfo("", TAG, re);
  1332. } catch (Exception e) {
  1333. Log.e(TAG, "[Exception] doEnd()");
  1334. //e.printStackTrace();
  1335. LogUtil.errorLogInfo("", TAG, e);
  1336. }
  1337. }
  1338. private void doTalkByBTN(CALLOWNER eCallOwner) {
  1339. try {
  1340. LOG_INFO("[doTalkByBTN] CALLSTATUS [" + MainActivity.mCallController.mCallInfo.getRESI() + "]");
  1341. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLING) {
  1342. MainActivity.mCallController.quitMoIPCall();
  1343. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLED) {
  1344. MainActivity.mCallController.acceptMoIPCall(false);
  1345. MainActivity.mCallController.mCallInfo.setCallOwner(eCallOwner);
  1346. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  1347. MainActivity.mCallController.quitMoIPCall();
  1348. } else {
  1349. LOG_INFO("[doTalkByBTN] Invalid CALLSTATUS [" + MainActivity.mCallController.mCallInfo.getRESI() + "]");
  1350. }
  1351. } catch (RuntimeException re) {
  1352. LogUtil.errorLogInfo("", TAG, re);
  1353. } catch (Exception e) {
  1354. Log.e(TAG, "[Exception] doTalkByBTN(CALLOWNER eCallOwner)");
  1355. //e.printStackTrace();
  1356. LogUtil.errorLogInfo("", TAG, e);
  1357. }
  1358. }
  1359. private void doMultiCallAccept() {
  1360. try {
  1361. MainActivity.mCallController.mCallInfo.setMultiCallAcceptFlag(true);
  1362. doEnd();
  1363. } catch (RuntimeException re) {
  1364. LogUtil.errorLogInfo("", TAG, re);
  1365. } catch (Exception e) {
  1366. Log.e(TAG, "[Exception] doMultiCallAccept()");
  1367. //e.printStackTrace();
  1368. LogUtil.errorLogInfo("", TAG, e);
  1369. }
  1370. }
  1371. private void doMultiCallReject() {
  1372. try {
  1373. CALLTYPE eMultiCallType = MainActivity.mCallController.mCallInfo.getMultiCallType();
  1374. if (eMultiCallType == CALLTYPE.FRONT) {
  1375. playFrontCamBell(false);
  1376. MainActivity.mCallController.mCallInfo.setCallStatus(eMultiCallType, CALLSTATUS.IDLE);
  1377. } else if (eMultiCallType == CALLTYPE.LOBBY || eMultiCallType == CALLTYPE.GUARD || eMultiCallType == CALLTYPE.RESIDENCE) {
  1378. MainActivity.mCallController.rejectMoIPMultiCall();
  1379. MainActivity.mCallController.mCallInfo.setCallStatus(eMultiCallType, CALLSTATUS.IDLE);
  1380. } else if (eMultiCallType == CALLTYPE.PSTN) {
  1381. if(MainActivity.mPSTNController!=null)
  1382. MainActivity.mPSTNController.sendReject();
  1383. MainActivity.mCallController.onPSTNEvent(CALLEVENTTYPE.CANCEL_CALL, null, null);
  1384. if(MainActivity.mCallController.mCallInfo!=null)
  1385. MainActivity.mCallController.mCallInfo.setCallStatus(eMultiCallType, CALLSTATUS.IDLE);
  1386. } else {
  1387. LOG_WARN("[doMultiCallReject] Invalid eMultiCallType [" + eMultiCallType + "]");
  1388. }
  1389. if(MainActivity.mCallController.mCallInfo!=null)
  1390. MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  1391. } catch (RuntimeException re) {
  1392. LogUtil.errorLogInfo("", TAG, re);
  1393. } catch (Exception e) {
  1394. Log.e(TAG, "[Exception] doMultiCallReject()");
  1395. //e.printStackTrace();
  1396. LogUtil.errorLogInfo("", TAG, e);
  1397. }
  1398. }
  1399. private void doAutoCall() {
  1400. try {
  1401. Log.e(TAG, "[doAutoCall] RemoteIDInfo.bAutoCall [" + RemoteIDInfo.bAutoCall + "]");
  1402. if (RemoteIDInfo.bAutoCall) {
  1403. RemoteIDInfo.bAutoCall = false;
  1404. LOG("[doAutoCall] strDong [" + RemoteIDInfo.strDong + "], strHo [" + RemoteIDInfo.strHo + "], strIP [" + RemoteIDInfo.strIP + "]");
  1405. if (!send_check_sip_activation_request(RemoteIDInfo.strIP)) {
  1406. initCallVariables();
  1407. MainActivity.mSound.PlayMent(SND.guard.TRYLATER);
  1408. return;
  1409. }
  1410. MainActivity.mCallController.mCallInfo.setCallOwner(CALLOWNER.WALLPAD);
  1411. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.TRYING_CALL);
  1412. updateResidenceInfo();
  1413. } else {
  1414. LOG("[doAutoCall] AutoCall is not activated!!");
  1415. }
  1416. } catch (RuntimeException re) {
  1417. LogUtil.errorLogInfo("", TAG, re);
  1418. } catch (Exception e) {
  1419. Log.e(TAG, "[Exception] doAutoCall()");
  1420. //e.printStackTrace();
  1421. LogUtil.errorLogInfo("", TAG, e);
  1422. }
  1423. }
  1424. private void doAutoCall_sub() {
  1425. try {
  1426. Log.e(TAG, "[doAutoCall_sub] RemoteIDInfo.bAutoCall [" + RemoteIDInfo.bAutoCall + "]");
  1427. if (RemoteIDInfo.bAutoCall) {
  1428. RemoteIDInfo.bAutoCall = false;
  1429. LOG("[doAutoCall_sub] strDong [" + RemoteIDInfo.strDong + "], strHo [" + RemoteIDInfo.strHo + "], strIP [" + RemoteIDInfo.strIP + "]");
  1430. if (!send_check_sip_activation_request(RemoteIDInfo.strIP)) {
  1431. Log.e(TAG, "[doAutoCall_sub] send_check_sip_activation_request [error]");
  1432. initCallVariables();
  1433. MainActivity.mSound.PlayMent(SND.guard.TRYLATER);
  1434. return;
  1435. }
  1436. MainActivity.mCallController.mCallInfo.setCallOwner(CALLOWNER.SUB_WALLPAD);
  1437. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.TRYING_CALL);
  1438. updateResidenceInfo();
  1439. } else {
  1440. LOG("[doAutoCall] AutoCall is not activated!!");
  1441. }
  1442. } catch (RuntimeException re) {
  1443. LogUtil.errorLogInfo("", TAG, re);
  1444. } catch (Exception e) {
  1445. Log.e(TAG, "[Exception] doAutoCall()");
  1446. //e.printStackTrace();
  1447. LogUtil.errorLogInfo("", TAG, e);
  1448. }
  1449. }
  1450. private void procAddCall() {
  1451. try {
  1452. LOG("[procAddCall]");
  1453. CALLTYPE eMType = MainActivity.mCallController.mCallInfo.getMultiCallType();
  1454. CALLSTATUS eMStatus = MainActivity.mCallController.mCallInfo.getMultiCallStatus();
  1455. LOG("[procAddCall] eMType [" + eMType + "], eMStatus [" + eMStatus + "]");
  1456. if (eMType == CALLTYPE.RESIDENCE && eMStatus == CALLSTATUS.CALLED) {
  1457. MainActivity.mCallController.setRemoteInfo(MainActivity.mCallController.mCallInfo.getMultiCall_ID(), MainActivity.mCallController.mCallInfo.getMultiCall_IP());
  1458. //Global.replace1stBy2ndCallHistory();
  1459. if (MainActivity.mCallController.mCallInfo.getMultiCallAccept()) {
  1460. // 멀티콜 수락 (통화시작)
  1461. ((MainActivity) mContext).setMenuBTNEnable(false);
  1462. if (ConfigValues.bWallPadCameraEnable) BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled3);
  1463. else BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled2);
  1464. if (ConfigValues.bWallPadCameraEnable) {
  1465. prepareMyVideo(true);
  1466. BTN_PORTRAIT.setButtonEventOffDisable();
  1467. BTN_PORTRAIT.setImageResource(R.drawable.btn_residence_me_normal3);
  1468. }
  1469. showTalkMode(true);
  1470. super.setFinishTimerDestroy();
  1471. MainActivity.mCallController.set1stCallTimer(eMType, MainActivity.mCallController.mCTT.RESIDENCEnRESIDENCE);
  1472. doTalk(CALLOWNER.WALLPAD);
  1473. } else {
  1474. // 멀티콜 수신중 (호출수신중)
  1475. Global.playMelodyRepeat(eMType);
  1476. super.setFinishTimerDestroy();
  1477. Global.TargetInputStep = TARGETINFOINPUTSTEP.DONE;
  1478. updateResidenceInfo();
  1479. MainActivity.mCallController.set1stCallTimer(eMType, MainActivity.mCallController.mCTT.CALLED);
  1480. }
  1481. setBTNStatus();
  1482. MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  1483. } else {
  1484. LOG("[procAddCall] No MultiCall!!");
  1485. // 멀티콜 없음
  1486. if (RemoteIDInfo.bAutoCall) {
  1487. doAutoCall(); // 멀티콜 상황이 아닌경우 자동호출을 수행함
  1488. }
  1489. MainActivity.mCallController.mCallInfo.resetMultiCallInfo();
  1490. }
  1491. } catch (RuntimeException re) {
  1492. LogUtil.errorLogInfo("", TAG, re);
  1493. } catch (Exception e) {
  1494. Log.e(TAG, "[Exception] procAddCall()");
  1495. //e.printStackTrace();
  1496. LogUtil.errorLogInfo("", TAG, e);
  1497. }
  1498. }
  1499. private void playFrontCamBell(boolean bBell) {
  1500. try {
  1501. MainActivity.mIOInterface.ctrlFrontCamPower(bBell);
  1502. MainActivity.mIOInterface.ctrlFrontCamBell(bBell);
  1503. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1504. if (bBell) {
  1505. ((MainActivity) mContext).ctrlSmartIOTCamStatusMode(SmartRFCamStatusMode.STATUS_ON);
  1506. ((MainActivity) mContext).ctrlSmartIOTCamLEDMode(SmartRFCamLEDMode.LED_ON);
  1507. } else {
  1508. ((MainActivity) mContext).ctrlSmartIOTCamStatusMode(SmartRFCamStatusMode.STATUS_OFF);
  1509. ((MainActivity) mContext).ctrlSmartIOTCamLEDMode(SmartRFCamLEDMode.LED_OFF);
  1510. }
  1511. }
  1512. } catch (RuntimeException re) {
  1513. LogUtil.errorLogInfo("", TAG, re);
  1514. } catch (Exception e) {
  1515. Log.e(TAG, "[Exception] playFrontCamBell(boolean bBell)");
  1516. //e.printStackTrace();
  1517. LogUtil.errorLogInfo("", TAG, e);
  1518. }
  1519. }
  1520. boolean bAutoCallRun = false;
  1521. private boolean tryAutoCall(String strAutoCallInfo) {
  1522. try {
  1523. if (bAutoCallRun) return false;
  1524. bAutoCallRun = true;
  1525. LOG("[tryAutoCall] strAutoCallInfo [" + strAutoCallInfo + "]");
  1526. String[] strParse_01 = strAutoCallInfo.split(":");
  1527. String[] strParse_02 = strParse_01[1].split("@");
  1528. String[] strParse_03 = strParse_02[1].split(":");
  1529. String strForwardTarget_SIPID = strParse_02[0];
  1530. String strForwardTarget_IP = strParse_03[0];
  1531. CALLTYPE eCallType = MainActivity.mCallController.tryAutoMoIPCall(strForwardTarget_IP, strForwardTarget_SIPID);
  1532. if (eCallType == CALLTYPE.FRONT || eCallType == CALLTYPE.LOBBY || eCallType == CALLTYPE.PSTN || eCallType == CALLTYPE.NONE)
  1533. return false;
  1534. else if (eCallType == CALLTYPE.GUARD) {
  1535. ((MainActivity) mContext).changeMenuNScreen(ID.MENU.MENU_TALKGUARD);
  1536. return true;
  1537. } else if (eCallType == CALLTYPE.RESIDENCE) {
  1538. doAutoCall();
  1539. return true;
  1540. } else {
  1541. return false;
  1542. }
  1543. } catch (RuntimeException re) {
  1544. LogUtil.errorLogInfo("", TAG, re);
  1545. return false;
  1546. } catch (Exception e) {
  1547. Log.e(TAG, "[Exception] tryAutoCall(String strAutoCallInfo)");
  1548. //e.printStackTrace();
  1549. LogUtil.errorLogInfo("", TAG, e);
  1550. return false;
  1551. }
  1552. }
  1553. private boolean send_check_sip_activation_request(String strTargetIP) {
  1554. try {
  1555. Request_check_sip_activation check_sip_activation = new Request_check_sip_activation(mContext);
  1556. if (check_sip_activation.send_check_sip_activation(strTargetIP, null)) {
  1557. check_sip_activation.setResultCtrl(new RetProci() {
  1558. @Override
  1559. public void ProcSuccess() {
  1560. LOG_INFO("[send_check_sip_activation_request] ProcSuccess()");
  1561. bRcvEnd = false;
  1562. if (RemoteIDInfo.bRentRoomSelected) {
  1563. MainActivity.mCallController.tryMoIPCall(CALLTYPE.RENTRESIDENCE, RemoteIDInfo.strDong, RemoteIDInfo.strHo);
  1564. } else {
  1565. MainActivity.mCallController.tryMoIPCall(CALLTYPE.RESIDENCE, RemoteIDInfo.strDong, RemoteIDInfo.strHo);
  1566. }
  1567. MainActivity.mSubPhoneController.sendACKNewCall(CALLOWNER.SUB_WALLPAD, CALLTYPE.RESIDENCE);
  1568. }
  1569. @Override
  1570. public void ProcError() {
  1571. LOG_INFO("[send_check_sip_activation_request] ProcError()");
  1572. // initCallVariables();
  1573. // MainActivity.mSound.PlayMent(SND.setting.RETRY_INPUT);
  1574. // updateScreen();
  1575. // ((MainActivity) mContext).setMenuBTNEnable(true);
  1576. // MainActivity.mSubPhoneController.sendBusyCall(CALLOWNER.SUB_WALLPAD, CALLTYPE.RESIDENCE);
  1577. int nTime = MainActivity.mSound.PlayMent(SND.call.BUSY_TRY_LATER);
  1578. try {
  1579. Thread.sleep(nTime + 500);
  1580. } catch (InterruptedException e) {
  1581. e.printStackTrace();
  1582. }
  1583. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  1584. MainActivity.mCallController.stop1stCallTimer();
  1585. initCallVariables();
  1586. updateScreen();
  1587. Global.change1stCallLogAction(CALLACTION.BUSY);
  1588. MainActivity.mCallController.MultiCallScenarioManager();
  1589. ((MainActivity) mContext).setMenuBTNEnable(true);
  1590. MainActivity.mSubPhoneController.sendBusyCall(CALLOWNER.SUB_WALLPAD, CALLTYPE.RESIDENCE);
  1591. /*
  1592. new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  1593. @Override
  1594. public void run() {
  1595. MainActivity.mCallController.mCallInfo.setCallStatus(CALLTYPE.RESIDENCE, CALLSTATUS.IDLE);
  1596. MainActivity.mCallController.stop1stCallTimer();
  1597. initCallVariables();
  1598. updateScreen();
  1599. Global.change1stCallLogAction(CALLACTION.BUSY);
  1600. MainActivity.mCallController.MultiCallScenarioManager();
  1601. ((MainActivity) mContext).setMenuBTNEnable(true);
  1602. MainActivity.mSubPhoneController.sendBusyCall(CALLOWNER.SUB_WALLPAD, CALLTYPE.RESIDENCE);
  1603. }
  1604. }, nTime + 500);
  1605. }
  1606. @Override
  1607. public void ProcDoing() {
  1608. LOG_INFO("[send_check_sip_activation_request] ProcDoing()");
  1609. }
  1610. });
  1611. return true;
  1612. }
  1613. } catch (RuntimeException re) {
  1614. LogUtil.errorLogInfo("", TAG, re);
  1615. } catch (Exception e) {
  1616. Log.e(TAG, "[Exception] send_check_sip_activation_request(String strTargetIP, String strMessage)");
  1617. //e.printStackTrace();
  1618. LogUtil.errorLogInfo("", TAG, e);
  1619. }
  1620. return false;
  1621. }
  1622. private void ctrlAlphaBlending(boolean bON) {
  1623. try {
  1624. LOG("[ctrlAlphaBlending] bON [" + bON + "]");
  1625. int BOARDTYPE = ConfigValues.DEVICE_BOARDTYPE;
  1626. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  1627. if (bON) {
  1628. //IMG_VIDEO_MODULE.setImageResource(R.drawable.video_black_back);
  1629. MainActivity.mCallController.mVideoJNI.setPreviewInfo_V40(116, 85, 240, 160);
  1630. }
  1631. else {
  1632. //IMG_VIDEO_MODULE.setImageResource(R.drawable.image_neig);
  1633. MainActivity.mCallController.mVideoJNI.setPreviewInfo_V40(0, 0, 0, 0);
  1634. }
  1635. //MainActivity.mIOInterface.ctrlPopupGUI_Resi(!bON, bshowMyVideo);
  1636. }
  1637. else {
  1638. Log.w(TAG, "[ctrlAlphaBlending] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  1639. }
  1640. } catch (RuntimeException re) {
  1641. LogUtil.errorLogInfo("", TAG, re);
  1642. } catch (Exception e) {
  1643. Log.e(TAG, "[Exception] ctrlAlphaBlending(boolean bON)");
  1644. //e.printStackTrace();
  1645. LogUtil.errorLogInfo("", TAG, e);
  1646. }
  1647. }
  1648. private void displayScreenValues() {
  1649. try {
  1650. getVolume();
  1651. drawVolume();
  1652. showTalkMode(false);
  1653. updateInstruction();
  1654. } catch (RuntimeException re) {
  1655. LogUtil.errorLogInfo("", TAG, re);
  1656. } catch (Exception e) {
  1657. Log.e(TAG, "[Exception] displayScreenValues()");
  1658. //e.printStackTrace();
  1659. LogUtil.errorLogInfo("", TAG, e);
  1660. }
  1661. }
  1662. private void setBTNStatus() {
  1663. try {
  1664. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLING) {
  1665. ((MainActivity) mContext).setMenuBTNEnable(false);
  1666. if (ConfigValues.bWallPadCameraEnable) {
  1667. BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled3);
  1668. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  1669. } else {
  1670. BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled2);
  1671. }
  1672. showTalkMode(false);
  1673. runFlickerCallLED();
  1674. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLED) {
  1675. ((MainActivity) mContext).setMenuBTNEnable(false);
  1676. if (ConfigValues.bWallPadCameraEnable) {
  1677. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  1678. }
  1679. showTalkMode(false);
  1680. runFlickerCallLED();
  1681. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  1682. ((MainActivity) mContext).setMenuBTNEnable(false);
  1683. if (ConfigValues.bWallPadCameraEnable) {
  1684. BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled3);
  1685. sendHandlerMsgDelayed(HANDLERMSG.ENABLE_PORTRAIT, 0, 0, 3000);
  1686. } else {
  1687. BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled2);
  1688. }
  1689. showTalkMode(true);
  1690. setOnCallLED();
  1691. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.HOMEVIEW) {
  1692. ((MainActivity) mContext).setMenuBTNEnable(false);
  1693. if (ConfigValues.bWallPadCameraEnable) {
  1694. BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled3);
  1695. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  1696. } else {
  1697. BTN_TALK.setButtonEventOffEnable(R.drawable.btn_residence_call_disabled2);
  1698. }
  1699. showTalkMode(true);
  1700. } else {
  1701. ((MainActivity) mContext).setMenuBTNEnable(true);
  1702. // 버튼 이미지 조작
  1703. BTN_TALK.setButtonEventOffDisable();
  1704. BTN_TALK.setImageResource(R.drawable.btn_residence_call_normal3);
  1705. if (ConfigValues.bWallPadCameraEnable) {
  1706. BTN_TALK.setImageResource(R.drawable.btn_residence_call_normal3);
  1707. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  1708. } else {
  1709. BTN_TALK.setImageResource(R.drawable.btn_residence_call_normal2);
  1710. }
  1711. showTalkMode(false);
  1712. setOffCallLED();
  1713. }
  1714. } catch (RuntimeException re) {
  1715. LogUtil.errorLogInfo("", TAG, re);
  1716. } catch (Exception e) {
  1717. Log.e(TAG, "[Exception] setBTNStatus()");
  1718. //e.printStackTrace();
  1719. LogUtil.errorLogInfo("", TAG, e);
  1720. }
  1721. }
  1722. private void setBTNLEDStatus() {
  1723. try {
  1724. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLING) {
  1725. runFlickerCallLED();
  1726. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLED) {
  1727. runFlickerCallLED();
  1728. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  1729. setOnCallLED();
  1730. } else {
  1731. setOffCallLED();
  1732. }
  1733. } catch (RuntimeException re) {
  1734. LogUtil.errorLogInfo("", TAG, re);
  1735. } catch (Exception e) {
  1736. Log.e(TAG, "[Exception] setBTNLEDStatus()");
  1737. //e.printStackTrace();
  1738. LogUtil.errorLogInfo("", TAG, e);
  1739. }
  1740. }
  1741. private void updateResidenceInfo() {
  1742. try {
  1743. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.IDLE) {
  1744. if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
  1745. if (RemoteIDInfo.strDong.length() > 0) {
  1746. // 첫자리에 "0"이 출력되지 않도록 숫자로 변경하면서 "0"을 제거하고, 다시 String으로 변환한다.
  1747. RemoteIDInfo.nDong = Integer.parseInt(RemoteIDInfo.strDong);
  1748. RemoteIDInfo.strDong = Integer.toString(RemoteIDInfo.nDong);
  1749. }
  1750. strTXT_RESIDENCEINFO = RemoteIDInfo.strDong;
  1751. } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO) {
  1752. if (RemoteIDInfo.strDong.length() > 0) {
  1753. // 첫자리에 "0"이 출력되지 않도록 숫자로 변경하면서 "0"을 제거하고, 다시 String으로 변환한다.
  1754. RemoteIDInfo.nDong = Integer.parseInt(RemoteIDInfo.strDong);
  1755. RemoteIDInfo.strDong = Integer.toString(RemoteIDInfo.nDong);
  1756. }
  1757. strTXT_RESIDENCEINFO = RemoteIDInfo.strDong + TextResources.strDong;
  1758. if (RemoteIDInfo.strHo.length() > 0) {
  1759. // 첫자리에 "0"이 출력되지 않도록 숫자로 변경하면서 "0"을 제거하고, 다시 String으로 변환한다.
  1760. RemoteIDInfo.nHo = Integer.parseInt(RemoteIDInfo.strHo);
  1761. RemoteIDInfo.strHo = Integer.toString(RemoteIDInfo.nHo);
  1762. }
  1763. if (ConfigValues.bEnableHouseDivision && RemoteIDInfo.bRentRoomSelected)
  1764. strTXT_RESIDENCEINFO += "\n" + RemoteIDInfo.strHo + "-" + RemoteIDInfo.nHo_Extension;
  1765. else strTXT_RESIDENCEINFO += "\n" + RemoteIDInfo.strHo;
  1766. } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONE) {
  1767. if (RemoteIDInfo.strDong.length() > 0) {
  1768. // 첫자리에 "0"이 출력되지 않도록 숫자로 변경하면서 "0"을 제거하고, 다시 String으로 변환한다.
  1769. RemoteIDInfo.nDong = Integer.parseInt(RemoteIDInfo.strDong);
  1770. RemoteIDInfo.strDong = Integer.toString(RemoteIDInfo.nDong);
  1771. }
  1772. strTXT_RESIDENCEINFO = RemoteIDInfo.strDong + TextResources.strDong;
  1773. if (RemoteIDInfo.strHo.length() > 0) {
  1774. // 첫자리에 "0"이 출력되지 않도록 숫자로 변경하면서 "0"을 제거하고, 다시 String으로 변환한다.
  1775. RemoteIDInfo.nHo = Integer.parseInt(RemoteIDInfo.strHo);
  1776. RemoteIDInfo.strHo = Integer.toString(RemoteIDInfo.nHo);
  1777. }
  1778. if (ConfigValues.bEnableHouseDivision && RemoteIDInfo.bRentRoomSelected)
  1779. strTXT_RESIDENCEINFO += "\n" + RemoteIDInfo.strHo + "-" + RemoteIDInfo.nHo_Extension + TextResources.strHo;
  1780. else strTXT_RESIDENCEINFO += "\n" + RemoteIDInfo.strHo + TextResources.strHo;
  1781. }
  1782. } else {
  1783. LOG_WARN("[updateResidenceInfo] Call Status is not IDLE!!!");
  1784. strTXT_RESIDENCEINFO = RemoteIDInfo.strName;
  1785. }
  1786. // 2017.11.16 SEULKI
  1787. // '세대정보를 입력하세요.' 화면에서 동/호 입력한 경우, 동/호 텍스트만 나오게
  1788. if (!strTXT_RESIDENCEINFO.equals("") && (strTXT_INSTRUCTION.equals(TextResources.strInputResidenceInfo)))
  1789. strTXT_INSTRUCTION = "";
  1790. // 동/호 텍스트 지웠을 경우, 다시 '세대정보를 입력하세요.' 텍스트 나오게
  1791. if (strTXT_RESIDENCEINFO.equals("") && (strTXT_INSTRUCTION.equals("")))
  1792. strTXT_INSTRUCTION = TextResources.strInputResidenceInfo;
  1793. TXT_INSTRUCTION.setText(strTXT_INSTRUCTION);
  1794. TXT_RESIDENCEINFO.setText(strTXT_RESIDENCEINFO);
  1795. } catch (RuntimeException re) {
  1796. LogUtil.errorLogInfo("", TAG, re);
  1797. } catch (Exception e) {
  1798. Log.e(TAG, "[Exception] updateResidenceInfo()");
  1799. //e.printStackTrace();
  1800. LogUtil.errorLogInfo("", TAG, e);
  1801. }
  1802. }
  1803. private void deleteResiInfo() {
  1804. try {
  1805. if (RemoteIDInfo.bRentRoomSelected) {
  1806. RemoteIDInfo.bRentRoomSelected = false;
  1807. RemoteIDInfo.nHo_Extension = 0;
  1808. } else {
  1809. if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONG) {
  1810. int nDongLength = RemoteIDInfo.strDong.length();
  1811. if (nDongLength > 0) {
  1812. RemoteIDInfo.strDong = RemoteIDInfo.strDong.substring(0, nDongLength - 1);
  1813. }
  1814. } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.HO) {
  1815. int nHoLength = RemoteIDInfo.strHo.length();
  1816. if (nHoLength > 0) {
  1817. RemoteIDInfo.strHo = RemoteIDInfo.strHo.substring(0, nHoLength - 1);
  1818. } else {
  1819. Global.TargetInputStep = TARGETINFOINPUTSTEP.DONG;
  1820. }
  1821. } else if (Global.TargetInputStep == TARGETINFOINPUTSTEP.DONE) {
  1822. Global.TargetInputStep = TARGETINFOINPUTSTEP.HO;
  1823. }
  1824. }
  1825. updateResidenceInfo();
  1826. } catch (RuntimeException re) {
  1827. LogUtil.errorLogInfo("", TAG, re);
  1828. } catch (Exception e) {
  1829. Log.e(TAG, "[Exception] deleteResiInfo()");
  1830. //e.printStackTrace();
  1831. LogUtil.errorLogInfo("", TAG, e);
  1832. }
  1833. }
  1834. private void updateInstruction() {
  1835. try {
  1836. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.IDLE) {
  1837. strTXT_INSTRUCTION = TextResources.strInputResidenceInfo;
  1838. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TRYING_CALL) {
  1839. strTXT_INSTRUCTION = TextResources.strTryingResidence;
  1840. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.WAITNG_INVITE_ACK) {
  1841. strTXT_INSTRUCTION = TextResources.strCallingResidence;
  1842. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLING) {
  1843. strTXT_INSTRUCTION = TextResources.strCallingResidence;
  1844. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLED) {
  1845. strTXT_INSTRUCTION = TextResources.strCalledResidence;
  1846. Global.TargetInputStep = TARGETINFOINPUTSTEP.DONE;
  1847. } else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  1848. strTXT_INSTRUCTION = TextResources.strTalkingResidence;
  1849. if (MainActivity.mCallController.bTalkTestModeEnable) {
  1850. strTXT_INSTRUCTION = strTXT_INSTRUCTION + " [음량 " + Global.getWallPadMoIPVolume() + "]";
  1851. }
  1852. } else {
  1853. strTXT_INSTRUCTION = "";
  1854. }
  1855. TXT_INSTRUCTION.setText(strTXT_INSTRUCTION);
  1856. } catch (RuntimeException re) {
  1857. LogUtil.errorLogInfo("", TAG, re);
  1858. } catch (Exception e) {
  1859. Log.e(TAG, "[Exception] updateInstruction()");
  1860. //e.printStackTrace();
  1861. LogUtil.errorLogInfo("", TAG, e);
  1862. }
  1863. }
  1864. private void updateScreen() {
  1865. try {
  1866. updateResidenceInfo();
  1867. updateInstruction();
  1868. } catch (RuntimeException re) {
  1869. LogUtil.errorLogInfo("", TAG, re);
  1870. } catch (Exception e) {
  1871. Log.e(TAG, "[Exception] updateScreen()");
  1872. //e.printStackTrace();
  1873. LogUtil.errorLogInfo("", TAG, e);
  1874. }
  1875. }
  1876. private void showTalkMode(boolean bTalk) {
  1877. try {
  1878. LOG("[showTalkMode] bTalk [" + bTalk + "]");
  1879. if (bTalk) {
  1880. // 세대정보/안내문구
  1881. // TXT_RESIDENCEINFO.setVisibility(View.VISIBLE);
  1882. // TXT_INSTRUCTION.setVisibility(View.VISIBLE);
  1883. // 텐키 이미지 조작
  1884. //IMG_VIDEO_MODULE.setVisibility(View.VISIBLE);
  1885. // TXT_RESIDENCEINFO.setVisibility(View.VISIBLE);
  1886. // TXT_INSTRUCTION.setVisibility(View.VISIBLE);
  1887. //BTN_DELETE.setVisibility(View.INVISIBLE);
  1888. // if (ConfigValues.bEnableHouseDivision) {
  1889. // if(BTN_DIVISION!=null)
  1890. // BTN_DIVISION.setVisibility(View.INVISIBLE);
  1891. // }
  1892. // for (int i = 0; i < BTN_TENKEY.length; i++) {
  1893. // BTN_TENKEY[i].setVisibility(View.INVISIBLE);
  1894. // }
  1895. // 통화상대 정보
  1896. ((MainActivity) mContext).displayRemoteID(null);
  1897. } else {
  1898. // 세대정보/안내문구
  1899. if(MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.IDLE)
  1900. {
  1901. TXT_RESIDENCEINFO.setVisibility(View.INVISIBLE);
  1902. TXT_INSTRUCTION.setVisibility(View.INVISIBLE);
  1903. for (int i = 0; i < BTN_TENKEY.length; i++) {
  1904. BTN_TENKEY[i].setVisibility(View.VISIBLE);
  1905. }
  1906. }
  1907. else
  1908. {
  1909. // TXT_RESIDENCEINFO.setVisibility(View.VISIBLE);
  1910. // TXT_INSTRUCTION.setVisibility(View.VISIBLE);
  1911. for (int i = 0; i < BTN_TENKEY.length; i++) {
  1912. BTN_TENKEY[i].setButtonEventOffEnable();
  1913. }
  1914. }
  1915. // 텐키 이미지 조작
  1916. //BTN_DELETE.setVisibility(View.VISIBLE);
  1917. // if (ConfigValues.bEnableHouseDivision) {
  1918. // if(BTN_DIVISION!=null)
  1919. // BTN_DIVISION.setVisibility(View.VISIBLE);
  1920. // }
  1921. // for (int i = 0; i < BTN_TENKEY.length; i++) {
  1922. // if(BTN_TENKEY[i]!=null)
  1923. // BTN_TENKEY[i].setVisibility(View.VISIBLE);
  1924. // }
  1925. IMG_VIDEO_MODULE.setVisibility(View.INVISIBLE);
  1926. // 통화상대 정보
  1927. ((MainActivity) mContext).displayRemoteID(null);
  1928. }
  1929. } catch (RuntimeException re) {
  1930. LogUtil.errorLogInfo("", TAG, re);
  1931. } catch (Exception e) {
  1932. Log.e(TAG, "[Exception] showTalkMode(boolean bTalk)");
  1933. //e.printStackTrace();
  1934. LogUtil.errorLogInfo("", TAG, e);
  1935. }
  1936. }
  1937. private void showMyVideo(boolean bShow) {
  1938. try {
  1939. LOG_INFO("[showMyVideo] bShow [" + bShow + "]");
  1940. if (MainActivity.mCallController.mCallInfo.getRESI() != CALLSTATUS.TALKING) {
  1941. LOG_INFO("[showMyVideo] CallStatus is NOT TALKING!!");
  1942. return;
  1943. }
  1944. if (BTN_PORTRAIT != null) {
  1945. bshowMyVideo = bShow;
  1946. LOG_INFO("[showMyVideo] bshowMyVideo [" + bshowMyVideo + "]");
  1947. ((MainActivity) mContext).showMyVideo(bshowMyVideo, false);
  1948. if (bShow) {
  1949. BTN_PORTRAIT.setImageResource(R.drawable.btn_residence_me_selected);
  1950. } else {
  1951. BTN_PORTRAIT.setImageResource(R.drawable.btn_residence_me_normal3);
  1952. }
  1953. //MainActivity.mIOInterface.ctrlPopupGUI_Resi(!bRemoteVideoShow, bshowMyVideo); // 세대통화 시작시 초기화
  1954. }
  1955. else {
  1956. LOG_WARN("[showMyVideo] BTN_PORTRAIT is null!!");
  1957. }
  1958. } catch (RuntimeException re) {
  1959. LogUtil.errorLogInfo("", TAG, re);
  1960. } catch (Exception e) {
  1961. Log.e(TAG, "[Exception] showMyVideo(boolean bShow)");
  1962. //e.printStackTrace();
  1963. LogUtil.errorLogInfo("", TAG, e);
  1964. }
  1965. }
  1966. boolean bMyVideoPrepared = false;
  1967. private void prepareMyVideo(boolean bOn) {
  1968. try {
  1969. LOG_INFO("[prepareMyVideo] bOn [" + bOn + "]");
  1970. if (!MainActivity.bFFMPEGEnable) ctrlAlphaBlending(false);
  1971. if (bOn) {
  1972. if (bMyVideoPrepared) return;
  1973. bMyVideoPrepared = true;
  1974. ((MainActivity) mContext).initMyVideoSurfaceLayout();
  1975. } else {
  1976. ((MainActivity) mContext).finishMyVideo();
  1977. bMyVideoPrepared = false;
  1978. }
  1979. } catch (RuntimeException re) {
  1980. LogUtil.errorLogInfo("", TAG, re);
  1981. } catch (Exception e) {
  1982. Log.e(TAG, "[Exception] prepareMyVideo(boolean bOn)");
  1983. //e.printStackTrace();
  1984. LogUtil.errorLogInfo("", TAG, e);
  1985. }
  1986. }
  1987. // Handler mHandler = new Handler() ;
  1988. //
  1989. // class CallStateThread extends Thread {
  1990. // Handler handler = mHandler ;
  1991. // int m_iVal = 0;
  1992. // int m_iVal1 = 0;
  1993. // boolean m_bImageSet = false;
  1994. // boolean m_bStop = true;
  1995. //
  1996. // public void CallStateThread(int val)
  1997. // {
  1998. // m_iVal = val;
  1999. // if(m_nIDCnt_type < val)
  2000. // m_iVal1 = val - 1;
  2001. // }
  2002. //
  2003. // public void ThreadStop()
  2004. // {
  2005. // m_bStop = false;
  2006. // }
  2007. //
  2008. // @Override
  2009. // public void run() {
  2010. // while (m_bStop) {
  2011. // // create Runnable instance.
  2012. // Runnable runnable = new Runnable() {
  2013. // @Override
  2014. // public void run() {
  2015. // // TODO : 실행 코드 작성.
  2016. // if(m_bImageSet)
  2017. // {
  2018. // BTN_TENKEY[m_iVal1].setButtonDefaultImageID();
  2019. // m_bImageSet = false;
  2020. // }
  2021. // else
  2022. // {
  2023. // BTN_TENKEY[m_iVal1].setButtonPressedImageID();
  2024. // m_bImageSet = true;
  2025. // }
  2026. //
  2027. // //BTN_TENKEY[m_iVal1].setImageResource(TENKEYS[m_iVal][2]);
  2028. // }
  2029. // };
  2030. //
  2031. // // send runnable object.
  2032. // handler.post(runnable) ;
  2033. //
  2034. // try {
  2035. // Thread.sleep(500);
  2036. // } catch (InterruptedException e) {
  2037. // e.printStackTrace();
  2038. // }
  2039. // }
  2040. // }
  2041. //
  2042. // }
  2043. class CallStateThread implements Runnable {
  2044. int m_iVal = 0;
  2045. int m_iImageSet = 0;
  2046. CallStateThread(int val) {
  2047. if(m_nIDCnt_type < val)
  2048. m_iVal = val - 1;
  2049. else
  2050. m_iVal = val;
  2051. }
  2052. public void run() {
  2053. // TODO : thread running codes.
  2054. while (m_bCallStateThreadStop) {
  2055. Message msg = handler.obtainMessage();
  2056. msg.arg1 = m_iVal;
  2057. msg.arg2 = m_iImageSet;
  2058. handler.sendMessage(msg);
  2059. if(m_iImageSet == 0) m_iImageSet = 1;
  2060. else if(m_iImageSet == 1) m_iImageSet = 0;
  2061. try {
  2062. Thread.sleep(500);
  2063. } catch (InterruptedException e) {
  2064. e.printStackTrace();
  2065. }
  2066. }
  2067. //
  2068. // Message msg = handler.obtainMessage();
  2069. //
  2070. // msg.arg1 = m_iVal;
  2071. // msg.arg2 = 2;
  2072. // handler.sendMessage(msg);
  2073. }
  2074. }
  2075. final Handler handler = new Handler()
  2076. {
  2077. public void handleMessage(Message msg)
  2078. {
  2079. if(m_bCallStateThreadStop)
  2080. {
  2081. if(msg.arg2 == 0)
  2082. {
  2083. BTN_TENKEY[msg.arg1].setButtonPressedImageID();
  2084. }
  2085. else if(msg.arg2 == 1)
  2086. {
  2087. BTN_TENKEY[msg.arg1].setButtonDefaultImageID();
  2088. }
  2089. else if(msg.arg2 == 2)
  2090. {
  2091. //BTN_TENKEY[msg.arg1].setButtonDefaultImageID();
  2092. BTN_TENKEY[msg.arg1].setImageResource(TENKEYS[msg.arg1][2]);
  2093. //setTunkeyImage(msg.arg1);
  2094. }
  2095. }
  2096. }
  2097. };
  2098. private void setTunkeyImage(int val)
  2099. {
  2100. int ival = 0;
  2101. if(m_nIDCnt_type < val)
  2102. ival = val - 1;
  2103. else
  2104. ival = val;
  2105. for(int i = 0; i < BTN_TENKEY.length; i++)
  2106. {
  2107. if(ival == i)
  2108. {
  2109. BTN_TENKEY[i].setImageResource(TENKEYS[val][2]);
  2110. }
  2111. else
  2112. {
  2113. BTN_TENKEY[i].setButtonDefaultImageID();
  2114. }
  2115. }
  2116. }
  2117. private void playTenkeyNo(int nBTN) {
  2118. try {
  2119. int nSoundIndex = SND.effect.TOUCH_LATCHED;
  2120. switch (nBTN) {
  2121. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_00:
  2122. //nSoundIndex = SND.number.NUM0;
  2123. break;
  2124. //String[] strEndIP = {"10.1.1.1", "10.1.2.1", "10.1.3.1", "10.1.3.2", "10.1.1.3", "10.1.1.2", "10.1.2.2"};
  2125. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_01:
  2126. //nSoundIndex = SND.number.NUM1;
  2127. RemoteIDInfo.strDong = "101";
  2128. RemoteIDInfo.strHo = "101";
  2129. setTunkeyImage(0);
  2130. break;
  2131. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_02:
  2132. //nSoundIndex = SND.number.NUM2;
  2133. RemoteIDInfo.strDong = "101";
  2134. RemoteIDInfo.strHo = "201";
  2135. setTunkeyImage(1);
  2136. break;
  2137. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_03:
  2138. //nSoundIndex = SND.number.NUM3;
  2139. RemoteIDInfo.strDong = "101";
  2140. RemoteIDInfo.strHo = "301";
  2141. setTunkeyImage(2);
  2142. break;
  2143. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_04:
  2144. //nSoundIndex = SND.number.NUM4;
  2145. RemoteIDInfo.strDong = "101";
  2146. RemoteIDInfo.strHo = "302";
  2147. setTunkeyImage(3);
  2148. break;
  2149. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_05:
  2150. //nSoundIndex = SND.number.NUM5;
  2151. RemoteIDInfo.strDong = "101";
  2152. RemoteIDInfo.strHo = "103";
  2153. setTunkeyImage(4);
  2154. break;
  2155. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_06:
  2156. //nSoundIndex = SND.number.NUM6;
  2157. RemoteIDInfo.strDong = "101";
  2158. RemoteIDInfo.strHo = "102";
  2159. setTunkeyImage(5);
  2160. break;
  2161. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_07:
  2162. //nSoundIndex = SND.number.NUM7;
  2163. RemoteIDInfo.strDong = "101";
  2164. RemoteIDInfo.strHo = "202";
  2165. setTunkeyImage(6);
  2166. break;
  2167. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_08:
  2168. //nSoundIndex = SND.number.NUM8;
  2169. break;
  2170. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_09:
  2171. //nSoundIndex = SND.number.NUM9;
  2172. break;
  2173. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_DONG:
  2174. //nSoundIndex = SND.setting.DONG;
  2175. break;
  2176. case ID.SCREEN.TALKRESIDENCE.ELEMENT.BUTTON.TENKEY_HO:
  2177. //nSoundIndex = SND.setting.HO;
  2178. break;
  2179. }
  2180. MainActivity.mSound.Play(nSoundIndex);
  2181. } catch (RuntimeException re) {
  2182. LogUtil.errorLogInfo("", TAG, re);
  2183. } catch (Exception e) {
  2184. Log.e(TAG, "[Exception] playTenkeyNo(int nBTN)");
  2185. //e.printStackTrace();
  2186. LogUtil.errorLogInfo("", TAG, e);
  2187. }
  2188. }
  2189. private void StateCamera() {
  2190. if (ConfigValues.DEVICE_MODELTYPE != Version.MODEL_TYPE.IHN_DW101_I) {
  2191. mbCameraONOFF = true;
  2192. return;
  2193. }
  2194. Log.d(TAG, "[StateCamera]");
  2195. String cmd = "getprop get.camera.onoff";
  2196. try {
  2197. Thread.sleep(500);
  2198. } catch (InterruptedException e) {
  2199. e.printStackTrace();
  2200. }
  2201. Runtime mRuntime = Runtime.getRuntime();
  2202. Process mProcess;
  2203. try {
  2204. mProcess = mRuntime.exec(cmd);
  2205. BufferedReader br = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));
  2206. String line;
  2207. String strResult = null;
  2208. while ((line = br.readLine()) != null) {
  2209. strResult = line;
  2210. }
  2211. if (strResult.equals("1")) {
  2212. } else {
  2213. mbCameraONOFF = false;
  2214. if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  2215. showMyVideo(false);
  2216. BTN_PORTRAIT.setButtonEventOffEnable(R.drawable.btn_residence_me_disabled3);
  2217. BTN_PORTRAIT.setEnabled(false);
  2218. Toast.makeText(getContext(), "카메라가 전원이 꺼져 내모습 영상을 종료합니다.", Toast.LENGTH_SHORT).show();
  2219. }
  2220. }
  2221. } catch (IOException e) {
  2222. e.printStackTrace();
  2223. }
  2224. }
  2225. @Override
  2226. protected void onKeyUp(int keyCode, KeyEvent event) {
  2227. super.onKeyUp(keyCode, event);
  2228. if (ConfigValues.DEVICE_MODELTYPE == Version.MODEL_TYPE.IHN_DW101_I)
  2229. if (keyCode == 267) {
  2230. StateCamera();
  2231. }
  2232. }
  2233. // LED
  2234. boolean bFlickeringCallLED = false;
  2235. boolean bStatusFlickeringCallLED = false;
  2236. private void runFlickerCallLED() {
  2237. try {
  2238. LOG("[runFlickerCallLED] bFlickeringCallLED [" + bFlickeringCallLED + "]");
  2239. if (!bFlickeringCallLED) {
  2240. bFlickeringCallLED = true;
  2241. sendHandlerMsg(HANDLERMSG.FLICKER_LED_CALL, 0, 0);
  2242. }
  2243. } catch (RuntimeException re) {
  2244. LogUtil.errorLogInfo("", TAG, re);
  2245. } catch (Exception e) {
  2246. Log.e(TAG, "[Exception] runFlickerCallLED()");
  2247. //e.printStackTrace();
  2248. LogUtil.errorLogInfo("", TAG, e);
  2249. }
  2250. }
  2251. private void setOnCallLED() {
  2252. try {
  2253. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  2254. bFlickeringCallLED = false;
  2255. bStatusFlickeringCallLED = true;
  2256. MainActivity.mIOInterface.ctrlWallPadLED_Call(bStatusFlickeringCallLED);
  2257. }
  2258. } catch (RuntimeException re) {
  2259. LogUtil.errorLogInfo("", TAG, re);
  2260. } catch (Exception e) {
  2261. Log.e(TAG, "[Exception] setOnCallLED()");
  2262. //e.printStackTrace();
  2263. LogUtil.errorLogInfo("", TAG, e);
  2264. }
  2265. }
  2266. private void setOffCallLED() {
  2267. try {
  2268. LOG("[setOffCallLED] bStatusFlickeringCallLED [" + bStatusFlickeringCallLED + "]");
  2269. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  2270. bFlickeringCallLED = false;
  2271. if (bStatusFlickeringCallLED) {
  2272. bStatusFlickeringCallLED = false;
  2273. MainActivity.mIOInterface.ctrlWallPadLED_Call(bStatusFlickeringCallLED);
  2274. }
  2275. }
  2276. } catch (RuntimeException re) {
  2277. LogUtil.errorLogInfo("", TAG, re);
  2278. } catch (Exception e) {
  2279. Log.e(TAG, "[Exception] setOffCallLED()");
  2280. //e.printStackTrace();
  2281. LogUtil.errorLogInfo("", TAG, e);
  2282. }
  2283. }
  2284. private void ctrlCallLED() {
  2285. try {
  2286. LOG_INFO("[ctrlCallLED] bFlickeringCallLED [" + bFlickeringCallLED + "], bStatusFlickeringCallLED [" + bStatusFlickeringCallLED + "]");
  2287. LOG_INFO("[ctrlCallLED] MainActivity.mCallController.mCallInfo.getRESI() [" + MainActivity.mCallController.mCallInfo.getRESI() + "]");
  2288. if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  2289. if ((MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLING) || (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.CALLED)) {
  2290. if (bFlickeringCallLED) {
  2291. MainActivity.mIOInterface.ctrlWallPadLED_Call(bStatusFlickeringCallLED);
  2292. bStatusFlickeringCallLED = !bStatusFlickeringCallLED;
  2293. sendHandlerMsgDelayed(HANDLERMSG.FLICKER_LED_CALL, 0, 0, 1000);
  2294. }
  2295. }
  2296. else if (MainActivity.mCallController.mCallInfo.getRESI() == CALLSTATUS.TALKING) {
  2297. bStatusFlickeringCallLED = true;
  2298. MainActivity.mIOInterface.ctrlWallPadLED_Call(bStatusFlickeringCallLED);
  2299. }
  2300. else {
  2301. bStatusFlickeringCallLED = false;
  2302. MainActivity.mIOInterface.ctrlWallPadLED_Call(bStatusFlickeringCallLED);
  2303. LOG_INFO("[ctrlCallLED] bFlickeringCallLED [" + bFlickeringCallLED + "], bStatusFlickeringCallLED [" + bStatusFlickeringCallLED + "]");
  2304. }
  2305. }
  2306. } catch (RuntimeException re) {
  2307. LogUtil.errorLogInfo("", TAG, re);
  2308. } catch (Exception e) {
  2309. Log.e(TAG, "[Exception] ctrlCallLED()");
  2310. //e.printStackTrace();
  2311. LogUtil.errorLogInfo("", TAG, e);
  2312. }
  2313. }
  2314. // 음량
  2315. SeekBar.OnSeekBarChangeListener mOnVolumeChangeListener = new SeekBar.OnSeekBarChangeListener() {
  2316. @Override
  2317. public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  2318. int nCtrlLevel = getCtrlLevel(progress);
  2319. if (nCurrentVolume != nCtrlLevel) {
  2320. nCurrentVolume = nCtrlLevel;
  2321. showVolume(nCurrentVolume);
  2322. // ctrlVolume(false);
  2323. }
  2324. }
  2325. @Override
  2326. public void onStartTrackingTouch(SeekBar seekBar) {
  2327. }
  2328. @Override
  2329. public void onStopTrackingTouch(SeekBar seekBar) {
  2330. // Log.d(TAG, "[onStopTrackingTouch] nCurrentVolume:" + nCurrentVolume);
  2331. nCurrentVolume = getCtrlLevel(seekBar.getProgress());
  2332. ctrlVolume(true);
  2333. }
  2334. };
  2335. private void getVolume() {
  2336. try {
  2337. nCurrentVolume = Global.getResidenceVolume();
  2338. } catch (RuntimeException re) {
  2339. LogUtil.errorLogInfo("", TAG, re);
  2340. } catch (Exception e) {
  2341. Log.e(TAG, "[Exception] getVolume()");
  2342. //e.printStackTrace();
  2343. LogUtil.errorLogInfo("", TAG, e);
  2344. }
  2345. }
  2346. private void setVolume(int nValue) {
  2347. try {
  2348. if (!Global.setResidenceVolume(nValue)) {
  2349. LOG_WARN("[setVolume] Fail to set volume!! nValue [" + nValue + "]");
  2350. }
  2351. } catch (RuntimeException re) {
  2352. LogUtil.errorLogInfo("", TAG, re);
  2353. } catch (Exception e) {
  2354. Log.e(TAG, "[Exception] setVolume()");
  2355. //e.printStackTrace();
  2356. LogUtil.errorLogInfo("", TAG, e);
  2357. }
  2358. }
  2359. private void ctrlVolume(boolean bSave) {
  2360. try {
  2361. if (bSave) setVolume(nCurrentVolume);
  2362. CALLSTATUS eCallStatus = MainActivity.mCallController.mCallInfo.getRESI();
  2363. LOG("[ctrlVolume] eCallStatus [" + eCallStatus + "]");
  2364. if (eCallStatus == CALLSTATUS.TALKING) {
  2365. Global.setV40WallPadVolume_RESIDENCE(nCurrentVolume);
  2366. }
  2367. } catch (RuntimeException re) {
  2368. LogUtil.errorLogInfo("", TAG, re);
  2369. } catch (Exception e) {
  2370. Log.e(TAG, "[Exception] ctrlVolume()");
  2371. //e.printStackTrace();
  2372. LogUtil.errorLogInfo("", TAG, e);
  2373. }
  2374. }
  2375. private void showVolume(int nValue) {
  2376. try {
  2377. // Log.d(TAG, "[showVolume] nValue [" + nValue + "]");
  2378. if (TXT_VOLUME_LEVEL != null) TXT_VOLUME_LEVEL.setText(Integer.toString(nValue));
  2379. else Log.w(TAG, "[showVolume] TXT_VOLUME_LEVEL is null!!");
  2380. } catch (RuntimeException re) {
  2381. LogUtil.errorLogInfo("", TAG, re);
  2382. } catch (Exception e) {
  2383. Log.e(TAG, "[Exception] showVolume(nValue)");
  2384. }
  2385. }
  2386. private void drawVolume() {
  2387. try {
  2388. if (SEEKBAR_VOLUME != null) {
  2389. SEEKBAR_VOLUME.setProgress(ctrlSeekBarThumb(nCurrentVolume));
  2390. showVolume(nCurrentVolume);
  2391. }
  2392. else Log.w(TAG, "[drawVolume] SEEKBAR_VOLUME is null!!");
  2393. } catch (RuntimeException re) {
  2394. LogUtil.errorLogInfo("", TAG, re);
  2395. } catch (Exception e) {
  2396. Log.e(TAG, "[Exception] drawVolume()");
  2397. //e.printStackTrace();
  2398. LogUtil.errorLogInfo("", TAG, e);
  2399. }
  2400. }
  2401. private int getCtrlLevel(int nValue) {
  2402. try {
  2403. // Log.d(TAG, "[getCtrlLevel] nValue: " + nValue);
  2404. if (nValue == 0) return 1;
  2405. int result = nValue / 10;
  2406. if ((nValue % 10) != 0) result++;
  2407. Log.d(TAG, "[getCtrlLevel] result: " + result);
  2408. return result;
  2409. } catch (RuntimeException re) {
  2410. LogUtil.errorLogInfo("", TAG, re);
  2411. return 1;
  2412. } catch (Exception e) {
  2413. Log.e(TAG, "[Exception] getCtrlLevel(nValue)");
  2414. //e.printStackTrace();
  2415. LogUtil.errorLogInfo("", TAG, e);
  2416. return 1;
  2417. }
  2418. }
  2419. private int ctrlSeekBarThumb(int nValue) {
  2420. try {
  2421. int progress;
  2422. if (nValue == 1) progress = 1;
  2423. else if (nValue == 10) progress = 100;
  2424. else progress = (nValue - 1) * 11;
  2425. return progress;
  2426. } catch (RuntimeException re) {
  2427. LogUtil.errorLogInfo("", TAG, re);
  2428. return 1;
  2429. } catch (Exception e) {
  2430. Log.e(TAG, "[Exception] ctrlSeekBarThumb()");
  2431. //e.printStackTrace();
  2432. LogUtil.errorLogInfo("", TAG, e);
  2433. return 1;
  2434. }
  2435. }
  2436. private void ctrlWallPadMoIPVolume(int nValue) {
  2437. try {
  2438. LOG("[ctrlWallPadMoIPVolume] nValue [" + nValue + "]");
  2439. Global.setV40WallPadVolume_RESIDENCE(nCurrentVolume);
  2440. int nRemoteNum = -1;
  2441. int nDeviceNm = -1;
  2442. String sVol = "0x0000";
  2443. for(int i = 0; i < strEndIP.length; i++)
  2444. {
  2445. if (ConfigValues.strDeviceIPaddress.equals(strEndIP[i])) {
  2446. nDeviceNm = i; //0 1 2
  2447. //break;
  2448. }
  2449. else if (RemoteIDInfo.strIP.equals(strEndIP[i])) {
  2450. nRemoteNum = i; //3 4 5 6
  2451. //break;
  2452. }
  2453. }
  2454. if (nDeviceNm > -1 && nDeviceNm < 3)
  2455. {
  2456. if (nRemoteNum > -1 && nRemoteNum < 3)
  2457. {
  2458. sVol = "0x0170";
  2459. }
  2460. else if (nRemoteNum > 2 && nRemoteNum < 7)
  2461. {
  2462. sVol = "0x0300";
  2463. }
  2464. else
  2465. sVol = "0x0300";
  2466. }
  2467. else if (nDeviceNm > 2 && nDeviceNm < 7)
  2468. {
  2469. if (nRemoteNum > -1 && nRemoteNum < 3)
  2470. {
  2471. sVol = "0x0300";
  2472. }
  2473. else if (nRemoteNum > 2 && nRemoteNum < 7)
  2474. {
  2475. sVol = "0x0300";
  2476. }
  2477. else
  2478. sVol = "0x0300";
  2479. }
  2480. else
  2481. sVol = "0x0300";
  2482. Global.setV40WallPadMicGain(sVol);
  2483. } catch (RuntimeException re) {
  2484. LogUtil.errorLogInfo("", TAG, re);
  2485. } catch (Exception e) {
  2486. Log.e(TAG, "[Exception] ctrlWallPadMoIPVolume(int nValue)");
  2487. //e.printStackTrace();
  2488. LogUtil.errorLogInfo("", TAG, e);
  2489. }
  2490. }
  2491. public final class HANDLERMSG {
  2492. public final static int PROC_ADDCALL = 100;
  2493. public final static int PLAYMENT_BUSY_TRY_LATER = 110;
  2494. public final static int FLICKER_LED_CALL = 160;
  2495. public final static int REFRESH_BTNLED_STATUS = 170;
  2496. public final static int ENABLE_PORTRAIT = 200;
  2497. public final static int OFF_FRONT = 300;
  2498. public final static int SET_VOLUME_TABLE = 400;
  2499. }
  2500. public Handler MainHandler = new Handler(Looper.getMainLooper()) {
  2501. public void handleMessage(Message msg) {
  2502. LOG("[MainHandler] MainHandler : what [" + msg.what + "], arg1 [" + msg.arg1 + "], arg2 [" + msg.arg2 + "]");
  2503. switch (msg.what) {
  2504. case HANDLERMSG.PROC_ADDCALL:
  2505. procAddCall();
  2506. break;
  2507. case HANDLERMSG.PLAYMENT_BUSY_TRY_LATER:
  2508. MainActivity.mSound.PlayMent(SND.call.BUSY_TRY_LATER);
  2509. break;
  2510. case HANDLERMSG.FLICKER_LED_CALL:
  2511. ctrlCallLED();
  2512. break;
  2513. case HANDLERMSG.ENABLE_PORTRAIT:
  2514. BTN_PORTRAIT.setButtonEventOffDisable();
  2515. break;
  2516. case HANDLERMSG.OFF_FRONT:
  2517. playFrontCamBell(false);
  2518. break;
  2519. case HANDLERMSG.REFRESH_BTNLED_STATUS:
  2520. setBTNLEDStatus();
  2521. break;
  2522. case HANDLERMSG.SET_VOLUME_TABLE:
  2523. ctrlWallPadMoIPVolume(nCurrentVolume);
  2524. break;
  2525. default:
  2526. break;
  2527. }
  2528. }
  2529. };
  2530. public void sendHandlerMsg(int what, int arg1, int arg2) {
  2531. try {
  2532. LOG("[sendHandlerMsg] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "]");
  2533. Message HandleMsg = MainHandler.obtainMessage();
  2534. HandleMsg.what = what;
  2535. HandleMsg.arg1 = arg1;
  2536. HandleMsg.arg2 = arg2;
  2537. MainHandler.sendMessage(HandleMsg);
  2538. } catch (RuntimeException re) {
  2539. LogUtil.errorLogInfo("", TAG, re);
  2540. } catch (Exception e) {
  2541. Log.e(TAG, "[Exception] sendHandlerMsg(msg)");
  2542. //e.printStackTrace();
  2543. LogUtil.errorLogInfo("", TAG, e);
  2544. }
  2545. }
  2546. public void sendHandlerMsgDelayed(int what, int arg1, int arg2, long delay) {
  2547. try {
  2548. LOG("[sendHandlerMsgDelayed] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "], delay [" + delay + "]");
  2549. Message HandleMsg = MainHandler.obtainMessage();
  2550. HandleMsg.what = what;
  2551. HandleMsg.arg1 = arg1;
  2552. HandleMsg.arg2 = arg2;
  2553. MainHandler.sendMessageDelayed(HandleMsg, delay);
  2554. } catch (RuntimeException re) {
  2555. LogUtil.errorLogInfo("", TAG, re);
  2556. } catch (Exception e) {
  2557. Log.e(TAG, "[Exception] sendHandlerMsgDelayed(msg)");
  2558. //e.printStackTrace();
  2559. LogUtil.errorLogInfo("", TAG, e);
  2560. }
  2561. }
  2562. int nCheckCnt = 0;
  2563. protected Handler mPathCheckHandler = new Handler() {
  2564. @Override
  2565. public void handleMessage(Message msg) {
  2566. // Log.d(TAG, "[mPathCheckHandler.handleMessage]");
  2567. if (msg.what == 0) {
  2568. nCheckCnt++;
  2569. if (nCheckCnt > 200) {
  2570. mPathCheckHandler.removeMessages(0);
  2571. mPathCheckHandler.removeMessages(1);
  2572. } else {
  2573. if (MainActivity.mCallController.getTalkPath() == CALLPATH.MOIP_V40_RESIDENCE)
  2574. mPathCheckHandler.sendEmptyMessageDelayed(1, 50);
  2575. else mPathCheckHandler.sendEmptyMessageDelayed(0, 50);
  2576. }
  2577. } else if (msg.what == 1) {
  2578. Log.d(TAG, "[mPathCheckHandler.handleMessage] Handler finish!! PATH [MOIP_V40_RESIDENCE]");
  2579. sendHandlerMsg(HANDLERMSG.SET_VOLUME_TABLE, 0, 0);
  2580. }
  2581. }
  2582. };
  2583. private void finishWallpadCallApp() {
  2584. try {
  2585. doEnd();
  2586. ((MainActivity) mContext).finishWallPadCall();
  2587. } catch (RuntimeException re) {
  2588. LogUtil.errorLogInfo("", TAG, re);
  2589. } catch (Exception e) {
  2590. Log.e(TAG, "[Exception] finishWallpadCallApp()");
  2591. //e.printStackTrace();
  2592. LogUtil.errorLogInfo("", TAG, e);
  2593. }
  2594. }
  2595. }