IOInterface.java 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999
  1. package kr.co.icontrols.wallpadmain;
  2. import kr.co.icontrols.a20ioctl.A20IOInterface;
  3. import kr.co.icontrols.gledeviceinterface.jni;
  4. import kr.co.icontrols.v40ioctl.V40IOInterface;
  5. import kr.co.icontrols.v40ioctl.V40IOInterface2;
  6. import kr.co.icontrols.wallpadmain.declare.Common;
  7. import kr.co.icontrols.wallpadmain.declare.Common.IGW200CMD;
  8. import kr.co.icontrols.wallpadmain.declare.Common.IGW300CMD;
  9. import kr.co.icontrols.wallpadmain.declare.Common.BOARD_TYPE;
  10. import kr.co.icontrols.wallpadsupport.Version;
  11. import kr.co.icontrols.wallpadsupport.Version.MODEL_TYPE;
  12. import com.artncore.commons.define;
  13. import com.artncore.deviceinterface.WallPadInterface;
  14. import com.artncore.wallpadapi.IGW200dAPI;
  15. import com.artncore.wallpadapi.IGW300API;
  16. import com.artncore.wallpadapi.WallPadAPI;
  17. import android.content.Context;
  18. import android.content.Intent;
  19. import android.os.Build;
  20. import android.os.Handler;
  21. import android.os.Looper;
  22. import android.os.Message;
  23. import android.util.Log;
  24. import com.util.LogUtil;
  25. public class IOInterface {
  26. String TAG = "IOInterface";
  27. boolean bLOG = true;
  28. private void LOG(String log) {
  29. if (bLOG) Log.v(TAG, log);
  30. }
  31. boolean bLOG_DEBUG = false;
  32. private void LOG_DEBUG(String log) {
  33. if (bLOG_DEBUG) Log.d(TAG, log);
  34. }
  35. boolean bLOG_INFO = true;
  36. private void LOG_INFO(String log) {
  37. if (bLOG_INFO) Log.i(TAG, log);
  38. }
  39. // TCC8935
  40. private int IOCTL_CAMERA_SET_BRIGHTNESS = 0xF901; // Camera Brightness 설정(0 ~ 20 단계), Default 설정시 10 단계
  41. private int IOCTL_CAMERA_SET_CONTRAST = 0xF902; // Camera Contrast 설정 (0 ~ 20), Default 설정시 10 단계
  42. private int IOCTL_MIC_GAIN_SET = 0xFD01; // MAX 79
  43. private int IOCTL_MIC_GAIN_GET = 0xFD02;
  44. private int IOCTL_MIC_RECORD_GAIN_SET = 0xFD03; // mic record gain
  45. private int IOCTL_MIC_RECORD_GAIN_GET = 0xFD04; // mic record gain
  46. private int IOCTL_MIC_BOOST_GAIN_SET = 0xFD05; // mic boost gain (6dB steps)
  47. private int IOCTL_MIC_BOOST_GAIN_GET = 0xFD06; // mic boost gain
  48. private int IOCTL_SPK_EQ_GAIN_SET = 0xFD09; // (0 ~ 32767) Speaker EQ gain 설정 제어 (WallPad Speaker)
  49. private int IOCTL_SPK_EQ_GAIN_GET = 0xFD0A; // (0 ~ 32767) Speaker EQ gain 상태 읽기 (WallPad Speaker)
  50. private int IOCTL_MONOOUT_SUB_GAIN_SET = 0xFD0D; // MAX 79 (Lobby/Guard Speaker)
  51. private int IOCTL_MONOOUT_SUB_GAIN_GET = 0xFD0E; // (Lobby/Guard Speaker)
  52. private int IOCTL_CAMERA_SELECT = 0xFE01; // 월패드 영상입력 선택 (0: 현관카메라, 1: 월패드 카메라)
  53. private int IOCTL_FRONTCAM_BELL = 0xFF01; // 현관카메라 벨제어 (띵동~)
  54. private int IOCTL_BTNEMR_LEDONOFF = 0xFF02; // 비상버튼 LED
  55. private int IOCTL_BTNCALL_LEDONOFF = 0xFF03; // 통화버튼 LED
  56. private int IOCTL_BTNOPEN_LEDONOFF = 0xFF04; // 문열림 LED
  57. private int IOCTL_VIDEOSELECT_SUBPHONE = 0xFF06; // 서브폰 영상 소스 선택 (0: 현관영상, 1: MoIP 영상)
  58. private int IOCTL_WALLPADCAM_POWERONOFF = 0xFF07; // 월패드 카메라 전원 ON/OFF
  59. private int IOCTL_AUDIO_SWITCH_34118 = 0xFF08; // 현관통화시 음성패스 설정 (0: 월패드, 1: 서브폰), MoIP 통화시 음성패스 설정 (0: 서브폰, 1: 월패드) // A20, V40
  60. private int IOCTL_DOOR_LOCK_OPEN_REGIS = 0xFF09; // 무선도어락 제어 (0: 도어락 등록, 1: 도어락 열기)
  61. private int IOCTL_FRONTCAM_POWERONOFF = 0xFF0B; // 현관카메라 전원 ON/OFF
  62. private int IOCTL_FRONTCAM_AUDIO = 0xFF10; // 월패드 음성 Path 선택 (0: Disable, 1: Enable)
  63. // TCC8935
  64. // A20
  65. private int IOCTL_GET_BOARD_REVISION = 0xF509; // IHN-1020B-A2 보드 리비전 (0: Rev. 1.3 (LCD 회전 없음), 2: Rev. 1.0 ~ 1.2 (LCD 180도 회전)
  66. private int IOCLT_CX93021_RESET = 0xFF11; // PSTN 모뎀 IC 리셋 (High -> Low(15ms 이상) -> High), High로 유지해야 Enable
  67. // A20
  68. // V40 DTMF HT9170 관련
  69. private int IOCTL_DTMFIN_ONOFF = 0xFFF2;
  70. private int IOCTL_DTMFOUT_DELAYTIME = 0xFFF3;
  71. private int IOCTL_DTMFOUT_TONE = 0xFFF4;
  72. private int IOCTL_DTMFOUT_ONOFF = 0xFFF5;
  73. public static final int TYPE_GPIO2_CMD = (0xFE << 8);
  74. public static final int IOCTL_SET_PROXSEN_LEVEL = (TYPE_GPIO2_CMD | 0x04);
  75. // V40
  76. public static final int IOCTL_EMR_TYPE = (TYPE_GPIO2_CMD | 0x02);
  77. Context mContext;
  78. private WallPadInterface mTCC8935IOIF = null;
  79. private jni mGLEINTERFACE = null;
  80. private A20IOInterface mA20IOIFCMOS = null;
  81. private A20IOInterface mA20IOIFCCD = null;
  82. private V40IOInterface mV40IOIF = null;
  83. private V40IOInterface2 mV40IOIF_NOUGAT = null;
  84. private WallPadAPI mWallPadAPI = null;
  85. private IGW200dAPI mIGW200DAPI = null;
  86. private IGW300API mIGW300API = null;
  87. int BOARDTYPE = 0;
  88. public IOInterface(int nBoardType) {
  89. try {
  90. BOARDTYPE = nBoardType;
  91. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
  92. mTCC8935IOIF = new WallPadInterface();
  93. mGLEINTERFACE = new jni();
  94. }
  95. else if (BOARDTYPE == BOARD_TYPE.TCC8935) {
  96. mTCC8935IOIF = new WallPadInterface();
  97. mGLEINTERFACE = new jni();
  98. }
  99. else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
  100. mA20IOIFCMOS = new A20IOInterface();
  101. }
  102. else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
  103. mA20IOIFCCD = new A20IOInterface();
  104. }
  105. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  106. mV40IOIF = new V40IOInterface();
  107. }
  108. else if (BOARDTYPE == BOARD_TYPE.V40) {
  109. mV40IOIF = new V40IOInterface();
  110. }
  111. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  112. mV40IOIF_NOUGAT = new V40IOInterface2();
  113. }
  114. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  115. mV40IOIF_NOUGAT = new V40IOInterface2();
  116. }
  117. else {
  118. Log.w(TAG, "[IOInterface] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  119. }
  120. } catch (RuntimeException re) {
  121. LogUtil.errorLogInfo("", TAG, re);
  122. }
  123. catch (Exception e) {
  124. Log.e(TAG, "[Exception] IOInterface(int nBoardType)");
  125. //e.printStackTrace();
  126. LogUtil.errorLogInfo("", TAG, e);
  127. }
  128. }
  129. public IOInterface(Context context, WallPadAPI wallpadapi) {
  130. try {
  131. mContext = context;
  132. BOARDTYPE = getBoardType(Version.getModelType());
  133. Log.i(TAG, "[IOInterface] BOARDTYPE [" + BOARDTYPE + "]");
  134. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
  135. mTCC8935IOIF = new WallPadInterface();
  136. mGLEINTERFACE = new jni();
  137. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  138. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  139. if(mWallPadAPI!=null)
  140. mIGW200DAPI = mWallPadAPI.Get_IGW200dController();
  141. if (mIGW200DAPI == null) {
  142. Log.w(TAG, "[IOInterface] mIGW200DAPI is null!!");
  143. startConnectIGW200API();
  144. }
  145. }
  146. else if (BOARDTYPE == BOARD_TYPE.TCC8935) {
  147. mTCC8935IOIF = new WallPadInterface();
  148. mGLEINTERFACE = new jni();
  149. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  150. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  151. }
  152. else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
  153. mA20IOIFCMOS = new A20IOInterface();
  154. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  155. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  156. }
  157. else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
  158. mA20IOIFCCD = new A20IOInterface();
  159. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  160. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  161. }
  162. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  163. mV40IOIF = new V40IOInterface();
  164. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  165. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  166. if(mWallPadAPI!=null)
  167. mIGW300API = mWallPadAPI.Get_IGW300Controller();
  168. if (mIGW300API == null) {
  169. Log.d(TAG, "[IOInterface] mIGW300API is null!!");
  170. startConnectIGW300API();
  171. }
  172. }
  173. else if (BOARDTYPE == BOARD_TYPE.V40) {
  174. mV40IOIF = new V40IOInterface();
  175. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  176. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  177. }
  178. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  179. mV40IOIF_NOUGAT = new V40IOInterface2();
  180. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  181. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  182. if (wallpadapi != null) mIGW300API = mWallPadAPI.Get_IGW300Controller();
  183. if (mIGW300API == null) {
  184. Log.d(TAG, "[IOInterface] mIGW300API is null!!");
  185. startConnectIGW300API();
  186. }
  187. }
  188. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  189. mV40IOIF_NOUGAT = new V40IOInterface2();
  190. if (wallpadapi != null) mWallPadAPI = wallpadapi;
  191. else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
  192. }
  193. else {
  194. Log.w(TAG, "[IOInterface] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  195. }
  196. } catch (RuntimeException re) {
  197. LogUtil.errorLogInfo("", TAG, re);
  198. }
  199. catch (Exception e) {
  200. Log.e(TAG, "[Exception] IOInterface(int nBoardType, WallPadAPI wallpadapi)");
  201. //e.printStackTrace();
  202. LogUtil.errorLogInfo("", TAG, e);
  203. }
  204. }
  205. public int getBoardType(int nModelType) {
  206. try {
  207. Log.i(TAG, "[getBoardType] nModelType [" + nModelType + "], Build.VERSION.SDK_INT [" + Build.VERSION.SDK_INT + "]");
  208. switch (nModelType) {
  209. case MODEL_TYPE.IHN_1020GL:
  210. return BOARD_TYPE.TCC8935_IGW200;
  211. case MODEL_TYPE.IHN_1020B_A:
  212. case MODEL_TYPE.IHN_1020SA_A:
  213. case MODEL_TYPE.IHN_750:
  214. return BOARD_TYPE.TCC8935;
  215. case MODEL_TYPE.IHN_1020B_A2:
  216. return BOARD_TYPE.A20_CMOS;
  217. case MODEL_TYPE.IHN_1030_A2:
  218. return BOARD_TYPE.A20_CCD;
  219. case MODEL_TYPE.IHN_D101:
  220. case MODEL_TYPE.IHN_D101_I:
  221. case MODEL_TYPE.IHN_D101K:
  222. case MODEL_TYPE.IHN_D101K_I:
  223. case MODEL_TYPE.IHN_1010GL:
  224. case MODEL_TYPE.IHN_1010GL_I:
  225. case MODEL_TYPE.IHN_D101_I_OCF:
  226. case MODEL_TYPE.IHN_1010GL_I_2443ALT:
  227. case MODEL_TYPE.IHN_1010GL_I_6410ALT:
  228. if (Build.VERSION.SDK_INT > 23) return BOARD_TYPE.V40_IGW300_NOUGAT;
  229. else return BOARD_TYPE.V40_IGW300;
  230. case MODEL_TYPE.IHN_1010:
  231. case MODEL_TYPE.IHN_1010_I:
  232. case MODEL_TYPE.IHN_T1010:
  233. case MODEL_TYPE.IHN_T1010_I:
  234. case MODEL_TYPE.IHN_HS101:
  235. case MODEL_TYPE.IHN_HS101_I:
  236. case MODEL_TYPE.IHN_1030_I:
  237. case MODEL_TYPE.IHN_1040:
  238. case MODEL_TYPE.IHN_1040_I:
  239. case MODEL_TYPE.IHN_1050:
  240. case MODEL_TYPE.IHN_1050_I:
  241. case MODEL_TYPE.IHN_1050DW_I:
  242. case MODEL_TYPE.IHN_1020B_I:
  243. case MODEL_TYPE.IHN_1303_I:
  244. if (Build.VERSION.SDK_INT > 23) return BOARD_TYPE.V40_NOUGAT;
  245. else return BOARD_TYPE.V40;
  246. default:
  247. return -99;
  248. }
  249. } catch (RuntimeException re) {
  250. LogUtil.errorLogInfo("", TAG, re);
  251. return -99;
  252. }
  253. catch (Exception e) {
  254. Log.e(TAG, "[Exception] getBoardType(int nModelType)");
  255. //e.printStackTrace();
  256. LogUtil.errorLogInfo("", TAG, e);
  257. return -99;
  258. }
  259. }
  260. // PSTN 서비스에서 사용하기 위한 코드
  261. public void setBoardType(int nBoardType) {
  262. try {
  263. BOARDTYPE = nBoardType;
  264. } catch (RuntimeException re) {
  265. LogUtil.errorLogInfo("", TAG, re);
  266. }
  267. catch (Exception e) {
  268. Log.e(TAG, "[Exception] setBoardType(nBoardType)");
  269. //e.printStackTrace();
  270. LogUtil.errorLogInfo("", TAG, e);
  271. }
  272. }
  273. // Wallpad_JNI
  274. public int WpdInterfaceOpen() {
  275. LOG_INFO("WpdInterfaceOpen()");
  276. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
  277. return mTCC8935IOIF.WpdInterfaceOpen();
  278. } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
  279. return mA20IOIFCMOS.WpdInterfaceOpen();
  280. } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
  281. return mA20IOIFCCD.WpdInterfaceOpen();
  282. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  283. return mV40IOIF.WpdInterfaceOpen();
  284. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  285. return mV40IOIF_NOUGAT.WpdInterfaceOpen();
  286. } else {
  287. Log.w(TAG, "[WpdInterfaceOpen] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  288. return -99;
  289. }
  290. }
  291. public int WpdInterfaceClose() {
  292. LOG_INFO("WpdInterfaceClose()");
  293. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
  294. return mTCC8935IOIF.WpdInterfaceClose();
  295. } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
  296. return mA20IOIFCMOS.WpdInterfaceClose();
  297. } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
  298. return mA20IOIFCCD.WpdInterfaceClose();
  299. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  300. return mV40IOIF.WpdInterfaceClose();
  301. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  302. return mV40IOIF_NOUGAT.WpdInterfaceClose();
  303. } else {
  304. Log.w(TAG, "[VideoJNI] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  305. return -99;
  306. }
  307. }
  308. public int WpdInterfaceControl(int cmd, int arg) {
  309. // LOG_INFO("WpdInterfaceControl(" + cmd + ", " + arg + ")");
  310. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
  311. return mTCC8935IOIF.WpdInterfaceControl(cmd, arg);
  312. } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
  313. return mA20IOIFCMOS.WpdInterfaceControl(cmd, arg);
  314. } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
  315. return mA20IOIFCCD.WpdInterfaceControl(cmd, arg);
  316. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  317. return mV40IOIF.WpdInterfaceControl(cmd, arg);
  318. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  319. return mV40IOIF_NOUGAT.WpdInterfaceControl(cmd, arg);
  320. } else {
  321. Log.w(TAG, "[WpdInterfaceControl] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  322. return -99;
  323. }
  324. }
  325. public int SetMacAddr(int cmd, String macAddr) {
  326. LOG_INFO("SetMacAddr(" + cmd + ", " + macAddr + ")");
  327. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
  328. return mTCC8935IOIF.SetMacAddr(cmd, macAddr);
  329. } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
  330. return mA20IOIFCMOS.SetMacAddr(cmd, macAddr);
  331. } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
  332. return mA20IOIFCCD.SetMacAddr(cmd, macAddr);
  333. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  334. return mV40IOIF.SetMacAddr(macAddr);
  335. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  336. return mV40IOIF_NOUGAT.SetMacAddr(macAddr);
  337. } else {
  338. Log.w(TAG, "[VideoJNI] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  339. return -99;
  340. }
  341. }
  342. private boolean bWallpadJNI = false;
  343. public void ctrlWallpadJNI(boolean bOpen) {
  344. try {
  345. LOG_INFO("[ctrlWallpadJNI] bOpen = " + bOpen);
  346. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
  347. if (bOpen) {
  348. if (!bWallpadJNI) {
  349. mTCC8935IOIF.WpdInterfaceOpen();
  350. bWallpadJNI = true;
  351. }
  352. } else {
  353. mTCC8935IOIF.WpdInterfaceClose();
  354. bWallpadJNI = false;
  355. }
  356. } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
  357. if (bOpen) {
  358. if (!bWallpadJNI) {
  359. mA20IOIFCMOS.WpdInterfaceOpen();
  360. bWallpadJNI = true;
  361. }
  362. } else {
  363. mA20IOIFCMOS.WpdInterfaceClose();
  364. bWallpadJNI = false;
  365. }
  366. } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
  367. if (bOpen) {
  368. if (!bWallpadJNI) {
  369. mA20IOIFCCD.WpdInterfaceOpen();
  370. bWallpadJNI = true;
  371. }
  372. } else {
  373. mA20IOIFCCD.WpdInterfaceClose();
  374. bWallpadJNI = false;
  375. }
  376. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  377. if (bOpen) {
  378. if (!bWallpadJNI) {
  379. mV40IOIF.WpdInterfaceOpen();
  380. bWallpadJNI = true;
  381. }
  382. } else {
  383. mV40IOIF.WpdInterfaceClose();
  384. bWallpadJNI = false;
  385. }
  386. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  387. if (bOpen) {
  388. if (!bWallpadJNI) {
  389. mV40IOIF_NOUGAT.WpdInterfaceOpen();
  390. bWallpadJNI = true;
  391. }
  392. } else {
  393. mV40IOIF_NOUGAT.WpdInterfaceClose();
  394. bWallpadJNI = false;
  395. }
  396. } else {
  397. bWallpadJNI = false;
  398. Log.w(TAG, "[VideoJNI] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  399. }
  400. } catch (RuntimeException re) {
  401. LogUtil.errorLogInfo("", TAG, re);
  402. bWallpadJNI = false;
  403. }
  404. catch (Exception e) {
  405. bWallpadJNI = false;
  406. Log.e(TAG, "[Exception] ctrlWallpadJNI(bOpen)");
  407. //e.printStackTrace();
  408. LogUtil.errorLogInfo("", TAG, e);
  409. }
  410. }
  411. public boolean setMacAddr(String MACAddr) {
  412. try {
  413. ctrlWallpadJNI(true);
  414. SetMacAddr(0xFB01, MACAddr);
  415. ctrlWallpadJNI(false);
  416. return true;
  417. } catch (RuntimeException re) {
  418. LogUtil.errorLogInfo("", TAG, re);
  419. return false;
  420. }
  421. catch (Exception e) {
  422. Log.e(TAG, "[Exception] setMacAddr(MACAddr)");
  423. //e.printStackTrace();
  424. LogUtil.errorLogInfo("", TAG, e);
  425. return false;
  426. }
  427. }
  428. // IHN-1020B-A2 Board Revision Check
  429. public int getBoardRevision() {
  430. try {
  431. int nResult = -1;
  432. ctrlWallpadJNI(true);
  433. nResult = WpdInterfaceControl(IOCTL_GET_BOARD_REVISION, 0);
  434. ctrlWallpadJNI(false);
  435. LOG_INFO("[getBoardRevision] nResult = " + nResult);
  436. return nResult;
  437. } catch (RuntimeException re) {
  438. LogUtil.errorLogInfo("", TAG, re);
  439. return -1;
  440. }
  441. catch (Exception e) {
  442. Log.e(TAG, "[Exception] getBoardRevision()");
  443. //e.printStackTrace();
  444. LogUtil.errorLogInfo("", TAG, e);
  445. return -1;
  446. }
  447. }
  448. // Set speaker gain (Lobby, Guard)
  449. // param - int nValue : Speaker gain
  450. // return - int : -1 (fail), otherwise(success)
  451. int MIN_VOLUME = 0;
  452. int MAX_VOLUME = 79;
  453. public int setSpeakerGain(int nValue) {
  454. try {
  455. LOG_INFO("[setSpeakerGain] nValue = " + nValue);
  456. if (nValue < MIN_VOLUME) nValue = MIN_VOLUME;
  457. else if (nValue > MAX_VOLUME) nValue = MAX_VOLUME;
  458. int nResult = -1;
  459. ctrlWallpadJNI(true);
  460. nResult = WpdInterfaceControl(IOCTL_MONOOUT_SUB_GAIN_SET, nValue);
  461. ctrlWallpadJNI(false);
  462. LOG_INFO("[setSpeakerGain] nResult = " + nResult);
  463. return nResult;
  464. } catch (RuntimeException re) {
  465. LogUtil.errorLogInfo("", TAG, re);
  466. return -1;
  467. }
  468. catch (Exception e) {
  469. Log.e(TAG, "[Exception] setSpeakerGain(nValue)");
  470. //e.printStackTrace();
  471. LogUtil.errorLogInfo("", TAG, e);
  472. return -1;
  473. }
  474. }
  475. // Get speaker gain (Lobby, Guard)
  476. // return - int : -1 (fail), otherwise(success)
  477. public int getSpeakerGain() {
  478. try {
  479. int nResult = -1;
  480. ctrlWallpadJNI(true);
  481. nResult = WpdInterfaceControl(IOCTL_MONOOUT_SUB_GAIN_GET, 0);
  482. ctrlWallpadJNI(false);
  483. LOG_INFO("[getSpeakerGain] nResult = " + nResult);
  484. return nResult;
  485. } catch (RuntimeException re) {
  486. LogUtil.errorLogInfo("", TAG, re);
  487. return -1;
  488. }
  489. catch (Exception e) {
  490. Log.e(TAG, "[Exception] getSpeakerGain()");
  491. //e.printStackTrace();
  492. LogUtil.errorLogInfo("", TAG, e);
  493. return -1;
  494. }
  495. }
  496. // Set speaker gain (Wallpad)
  497. // param - int nValue : Speaker gain
  498. // return - int : -1 (fail), otherwise(success)
  499. int MIN_VOLUME_WALLPAD = 0;
  500. int MAX_VOLUME_WALLPAD = 32767;
  501. public int setWallPadSpeakerGain(int nValue) {
  502. try {
  503. LOG_INFO("[setWallPadSpeakerGain] nValue = " + nValue);
  504. if (nValue < MIN_VOLUME_WALLPAD) nValue = MIN_VOLUME_WALLPAD;
  505. else if (nValue > MAX_VOLUME_WALLPAD) nValue = MAX_VOLUME_WALLPAD;
  506. int nResult = -1;
  507. // TODO GPIO 확인 -> IOCTL_SPK_EQ_GAIN_SET 없으므로 if문 추가
  508. if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
  509. ctrlWallpadJNI(true);
  510. nResult = WpdInterfaceControl(IOCTL_SPK_EQ_GAIN_SET, nValue);
  511. ctrlWallpadJNI(false);
  512. LOG_INFO("[setWallPadSpeakerGain] nResult = " + nResult);
  513. }
  514. return nResult;
  515. } catch (RuntimeException re) {
  516. LogUtil.errorLogInfo("", TAG, re);
  517. return -1;
  518. }
  519. catch (Exception e) {
  520. Log.e(TAG, "[Exception] setWallPadSpeakerGain(nValue)");
  521. //e.printStackTrace();
  522. LogUtil.errorLogInfo("", TAG, e);
  523. return -1;
  524. }
  525. }
  526. public int setWallPadSpeakerDefaultGain() {
  527. try {
  528. LOG_INFO("[setWallPadSpeakerDefaultGain]");
  529. int nResult = -1;
  530. // TODO GPIO 확인 -> IOCTL_SPK_EQ_GAIN_SET 없으므로 if문 추가
  531. if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
  532. ctrlWallpadJNI(true);
  533. nResult = WpdInterfaceControl(IOCTL_SPK_EQ_GAIN_SET, 4096);
  534. ctrlWallpadJNI(false);
  535. LOG_INFO("[setWallPadSpeakerDefaultGain] nResult = " + nResult);
  536. }
  537. return nResult;
  538. } catch (RuntimeException re) {
  539. LogUtil.errorLogInfo("", TAG, re);
  540. return -1;
  541. }
  542. catch (Exception e) {
  543. Log.e(TAG, "[Exception] setWallPadSpeakerDefaultGain()");
  544. //e.printStackTrace();
  545. LogUtil.errorLogInfo("", TAG, e);
  546. return -1;
  547. }
  548. }
  549. // Get speaker gain (Wallpad)
  550. // return - int : -1 (fail), otherwise(success)
  551. public int getWallPadSpeakerGain() {
  552. try {
  553. int nResult = -1;
  554. ctrlWallpadJNI(true);
  555. nResult = WpdInterfaceControl(IOCTL_SPK_EQ_GAIN_GET, 0);
  556. ctrlWallpadJNI(false);
  557. LOG_INFO("[getWallPadSpeakerGain] nResult = " + nResult);
  558. return nResult;
  559. } catch (RuntimeException re) {
  560. LogUtil.errorLogInfo("", TAG, re);
  561. return -1;
  562. }
  563. catch (Exception e) {
  564. Log.e(TAG, "[Exception] getWallPadSpeakerGain()");
  565. //e.printStackTrace();
  566. LogUtil.errorLogInfo("", TAG, e);
  567. return -1;
  568. }
  569. }
  570. // Set MIC gain
  571. // param - int nValue : MIC gain
  572. // return - int : -1 (fail), otherwise(success)
  573. int MIN_MIC = 0;
  574. int MAX_MIC = 79;
  575. public int setMICGain(int nValue) {
  576. try {
  577. LOG_INFO("[setMICGain] nValue = " + nValue);
  578. if (nValue < MIN_MIC) nValue = MIN_MIC;
  579. else if (nValue > MAX_MIC) nValue = MAX_MIC;
  580. int nResult = -1;
  581. ctrlWallpadJNI(true);
  582. nResult = WpdInterfaceControl(IOCTL_MIC_GAIN_SET, nValue);
  583. ctrlWallpadJNI(false);
  584. LOG_INFO("[setMICGain] nResult = " + nResult);
  585. return nResult;
  586. } catch (RuntimeException re) {
  587. LogUtil.errorLogInfo("", TAG, re);
  588. return -1;
  589. }
  590. catch (Exception e) {
  591. Log.e(TAG, "[Exception] setMICGain(nValue)");
  592. //e.printStackTrace();
  593. LogUtil.errorLogInfo("", TAG, e);
  594. return -1;
  595. }
  596. }
  597. // Get MIC gain
  598. // return - int : -1 (fail), otherwise(success)
  599. public int getMICGain() {
  600. try {
  601. int nResult = -1;
  602. ctrlWallpadJNI(true);
  603. nResult = WpdInterfaceControl(IOCTL_MIC_GAIN_GET, 0);
  604. ctrlWallpadJNI(false);
  605. LOG_INFO("[getMICGain] nResult = " + nResult);
  606. return nResult;
  607. } catch (RuntimeException re) {
  608. LogUtil.errorLogInfo("", TAG, re);
  609. return -1;
  610. }
  611. catch (Exception e) {
  612. Log.e(TAG, "[Exception] getMICGain()");
  613. //e.printStackTrace();
  614. LogUtil.errorLogInfo("", TAG, e);
  615. return -1;
  616. }
  617. }
  618. // Set Boost MIC gain
  619. // param - int nValue : MIC gain
  620. // return - int : -1 (fail), otherwise(success)
  621. int MIN_MIC_BOOST = 0;
  622. int MAX_MIC_BOOST = 7;
  623. public int setMICBoostGain(int nValue) {
  624. try {
  625. LOG_INFO("[setMICBoostGain] nValue = " + nValue);
  626. if (nValue < MIN_MIC_BOOST) nValue = MIN_MIC_BOOST;
  627. else if (nValue > MAX_MIC_BOOST) nValue = MAX_MIC_BOOST;
  628. int nResult = -1;
  629. ctrlWallpadJNI(true);
  630. nResult = WpdInterfaceControl(IOCTL_MIC_BOOST_GAIN_SET, nValue);
  631. ctrlWallpadJNI(false);
  632. LOG_INFO("[setMICBoostGain] nResult = " + nResult);
  633. return nResult;
  634. } catch (RuntimeException re) {
  635. LogUtil.errorLogInfo("", TAG, re);
  636. return -1;
  637. }
  638. catch (Exception e) {
  639. Log.e(TAG, "[Exception] setMICBoostGain(nValue)");
  640. //e.printStackTrace();
  641. LogUtil.errorLogInfo("", TAG, e);
  642. return -1;
  643. }
  644. }
  645. // Get Boost MIC gain
  646. // return - int : -1 (fail), otherwise(success)
  647. public int getMICBoostGain() {
  648. try {
  649. int nResult = -1;
  650. ctrlWallpadJNI(true);
  651. nResult = WpdInterfaceControl(IOCTL_MIC_BOOST_GAIN_GET, 0);
  652. ctrlWallpadJNI(false);
  653. LOG_INFO("[getMICBoostGain] nResult = " + nResult);
  654. return nResult;
  655. } catch (RuntimeException re) {
  656. LogUtil.errorLogInfo("", TAG, re);
  657. return -1;
  658. }
  659. catch (Exception e) {
  660. Log.e(TAG, "[getMICBoostGain] getMICGain()");
  661. //e.printStackTrace();
  662. LogUtil.errorLogInfo("", TAG, e);
  663. return -1;
  664. }
  665. }
  666. // Set Record MIC gain
  667. // param - int nValue : MIC gain
  668. // return - int : -1 (fail), otherwise(success)
  669. int MIN_MIC_RECORD = 0;
  670. int MAX_MIC_RECORD = 7;
  671. public int setMICRecordGain(int nValue) {
  672. try {
  673. LOG_INFO("[setMICRecordGain] nValue = " + nValue);
  674. if (nValue < MIN_MIC_RECORD) nValue = MIN_MIC_RECORD;
  675. else if (nValue > MAX_MIC_RECORD) nValue = MAX_MIC_RECORD;
  676. int nResult = -1;
  677. ctrlWallpadJNI(true);
  678. nResult = WpdInterfaceControl(IOCTL_MIC_RECORD_GAIN_SET, nValue);
  679. ctrlWallpadJNI(false);
  680. LOG_INFO("[setMICRecordGain] nResult = " + nResult);
  681. return nResult;
  682. } catch (RuntimeException re) {
  683. LogUtil.errorLogInfo("", TAG, re);
  684. return -1;
  685. }
  686. catch (Exception e) {
  687. Log.e(TAG, "[Exception] setMICRecordGain(nValue)");
  688. //e.printStackTrace();
  689. LogUtil.errorLogInfo("", TAG, e);
  690. return -1;
  691. }
  692. }
  693. // Get Record MIC gain
  694. // return - int : -1 (fail), otherwise(success)
  695. public int getMICRecordGain() {
  696. try {
  697. int nResult = -1;
  698. ctrlWallpadJNI(true);
  699. nResult = WpdInterfaceControl(IOCTL_MIC_RECORD_GAIN_GET, 0);
  700. ctrlWallpadJNI(false);
  701. LOG_INFO("[getMICRecordGain] nResult = " + nResult);
  702. return nResult;
  703. } catch (RuntimeException re) {
  704. LogUtil.errorLogInfo("", TAG, re);
  705. return -1;
  706. }
  707. catch (Exception e) {
  708. Log.e(TAG, "[Exception] getMICRecordGain()");
  709. //e.printStackTrace();
  710. LogUtil.errorLogInfo("", TAG, e);
  711. return -1;
  712. }
  713. }
  714. public int ctrlWallPadCamPower(boolean bOn) {
  715. try {
  716. int nResult = -1;
  717. ctrlWallpadJNI(true);
  718. if (bOn) nResult = WpdInterfaceControl(IOCTL_WALLPADCAM_POWERONOFF, 1);
  719. else nResult = WpdInterfaceControl(IOCTL_WALLPADCAM_POWERONOFF, 0);
  720. ctrlWallpadJNI(false);
  721. LOG_INFO("[ctrlWallPadCamPower] nResult = " + nResult);
  722. return nResult;
  723. } catch (RuntimeException re) {
  724. LogUtil.errorLogInfo("", TAG, re);
  725. return -1;
  726. }
  727. catch (Exception e) {
  728. Log.e(TAG, "[Exception] ctrlWallPadCamPower(boolean bOn)");
  729. //e.printStackTrace();
  730. LogUtil.errorLogInfo("", TAG, e);
  731. return -1;
  732. }
  733. }
  734. public int ctrlFrontCamPower(boolean bOn) {
  735. try {
  736. Log.d(TAG, "[ctrlFrontCamPower] bON: " + bOn);
  737. int nResult = -1;
  738. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
  739. if (bOn) nResult = interfaceIGW200(IGW200CMD.FRONT_PWR_ON);
  740. else nResult = interfaceIGW200(IGW200CMD.FRONT_PWR_OFF);
  741. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  742. if (bOn) nResult = interfaceIGW300(IGW300CMD.FRONT_PWR_ON);
  743. else nResult = interfaceIGW300(IGW300CMD.FRONT_PWR_OFF);
  744. } else {
  745. ctrlWallpadJNI(true);
  746. if (bOn) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_POWERONOFF, 1);
  747. else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_POWERONOFF, 0);
  748. ctrlWallpadJNI(false);
  749. ctrlRFFrontCamPolling(bOn);
  750. }
  751. LOG_INFO("[ctrlFrontCamPower] nResult = " + nResult);
  752. return nResult;
  753. } catch (RuntimeException re) {
  754. LogUtil.errorLogInfo("", TAG, re);
  755. return -1;
  756. }
  757. catch (Exception e) {
  758. Log.e(TAG, "[Exception] ctrlFrontCamPower(boolean bOn)");
  759. //e.printStackTrace();
  760. LogUtil.errorLogInfo("", TAG, e);
  761. return -1;
  762. }
  763. }
  764. public int ctrlFrontCamBell(boolean bOn) {
  765. try {
  766. // (JEFF, 2016.10.31)
  767. // 가끔 띵동소리가 안나는 문제로 false인 경우를 막는다.
  768. // 파라미터가 뭔든간에 "IOCTL_FRONTCAM_BELL"만 호출하면 벨을 실행시키는 효과.
  769. // 결과적으로 "false"에도 벨을 울리도록 하는 거였음.
  770. // (JEFF, 2016.10.31)
  771. int nResult = -1;
  772. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
  773. if (bOn) nResult = interfaceIGW200(IGW200CMD.FRONT_BELL_ON);
  774. else nResult = interfaceIGW200(IGW200CMD.FRONT_BELL_OFF);
  775. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  776. if (bOn) nResult = interfaceIGW300(IGW300CMD.FRONT_BELL_ON);
  777. else nResult = interfaceIGW300(IGW300CMD.FRONT_BELL_OFF);
  778. } else {
  779. if (!bOn) return 99;
  780. ctrlWallpadJNI(true);
  781. if (bOn) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_BELL, 1);
  782. else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_BELL, 0);
  783. ctrlWallpadJNI(false);
  784. }
  785. LOG_INFO("[ctrlFrontCamBell] nResult = " + nResult);
  786. return nResult;
  787. } catch (RuntimeException re) {
  788. LogUtil.errorLogInfo("", TAG, re);
  789. return -1;
  790. }
  791. catch (Exception e) {
  792. Log.e(TAG, "[Exception] ctrlFrontCamBell(boolean bOn)");
  793. //e.printStackTrace();
  794. LogUtil.errorLogInfo("", TAG, e);
  795. return -1;
  796. }
  797. }
  798. // V40, A20 전용 메소드
  799. public int ctrlFrontCamAudio(boolean bEnable) {
  800. try {
  801. int nResult = -1;
  802. if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) { // TODO V40만인지 V40_IGW300도인지 확인
  803. // TODO GPIO 확인 -> IOCTL_FRONTCAM_AUDIO : 메일에 없음
  804. // ctrlWallpadJNI(true);
  805. // if (bEnable) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 1);
  806. // else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 0);
  807. // ctrlWallpadJNI(false);
  808. } else if ((BOARDTYPE == BOARD_TYPE.A20_CMOS) || (BOARDTYPE == BOARD_TYPE.A20_CCD)) {
  809. ctrlWallpadJNI(true);
  810. if (bEnable) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 1);
  811. else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 0);
  812. ctrlWallpadJNI(false);
  813. } else {
  814. Log.w(TAG, "[ctrlFrontCamAudio] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  815. }
  816. LOG_INFO("[ctrlFrontCamAudio] nResult = " + nResult);
  817. return nResult;
  818. } catch (RuntimeException re) {
  819. LogUtil.errorLogInfo("", TAG, re);
  820. return -1;
  821. }
  822. catch (Exception e) {
  823. Log.e(TAG, "[Exception] ctrlFrontCamAudio(bEnable)");
  824. //e.printStackTrace();
  825. LogUtil.errorLogInfo("", TAG, e);
  826. return -1;
  827. }
  828. }
  829. public int ctrlAudioSwitch34118(boolean nWallpad) {
  830. try {
  831. Log.d(TAG, "[ctrlAudioSwitch34118] nWallpad: " + nWallpad);
  832. int nResult = -1;
  833. if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) { // TODO V40만인지 V40_IGW300도인지 확인
  834. ctrlWallpadJNI(true);
  835. if (nWallpad)
  836. nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 0); // 현관통화시 [W/P] MOIP통화시 [S/P]으로 패스
  837. else
  838. nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 1); // 현관통화시 [S/P] MOIP통화시 [W/P]로 패스
  839. ctrlWallpadJNI(false);
  840. } else if ((BOARDTYPE == BOARD_TYPE.A20_CMOS) || (BOARDTYPE == BOARD_TYPE.A20_CCD)) {
  841. ctrlWallpadJNI(true);
  842. if (nWallpad) nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 0);
  843. else nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 1);
  844. ctrlWallpadJNI(false);
  845. } else {
  846. Log.w(TAG, "[ctrlAudioSwitch34118] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  847. }
  848. LOG_INFO("[ctrlAudioSwitch34118] nResult = " + nResult);
  849. return nResult;
  850. } catch (RuntimeException re) {
  851. LogUtil.errorLogInfo("", TAG, re);
  852. return -1;
  853. }
  854. catch (Exception e) {
  855. Log.e(TAG, "[Exception] ctrlAudioSwitch34118(bWallPad)");
  856. //e.printStackTrace();
  857. LogUtil.errorLogInfo("", TAG, e);
  858. return -1;
  859. }
  860. }
  861. // V40 전용
  862. private Boolean setDTMFWrite(int nNo) {
  863. try {
  864. int nResult = -1;
  865. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  866. ctrlWallpadJNI(true);
  867. nResult = WpdInterfaceControl(IOCTL_DTMFOUT_TONE, nNo);
  868. ctrlWallpadJNI(false);
  869. } else {
  870. Log.w(TAG, "[setDTMFWrite] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  871. }
  872. boolean bResult;
  873. if (nResult > 0) bResult = true;
  874. else bResult = false;
  875. return bResult;
  876. } catch (RuntimeException re) {
  877. LogUtil.errorLogInfo("", TAG, re);
  878. return false;
  879. }
  880. catch (Exception e) {
  881. Log.e(TAG, "[Exception] setDTMFWrite(nNo)");
  882. //e.printStackTrace();
  883. LogUtil.errorLogInfo("", TAG, e);
  884. return false;
  885. }
  886. }
  887. public int ctrlLcdWakeUp() {
  888. try {
  889. sendLCDBacklightStatus(true);
  890. int nResult = -1;
  891. if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) {
  892. ctrlWallpadJNI(true);
  893. nResult = mV40IOIF.LcdWakeUp();
  894. ctrlWallpadJNI(false);
  895. } else if ((BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) || (BOARDTYPE == BOARD_TYPE.V40_NOUGAT)) {
  896. ctrlWallpadJNI(true);
  897. nResult = mV40IOIF_NOUGAT.LcdWakeUp();
  898. ctrlWallpadJNI(false);
  899. } else {
  900. Log.w(TAG, "[ctrlLcdWakeUp] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  901. }
  902. return nResult;
  903. } catch (RuntimeException re) {
  904. LogUtil.errorLogInfo("", TAG, re);
  905. return -1;
  906. }
  907. catch (Exception e) {
  908. Log.e(TAG, "[Exception] ctrlLcdWakeUp");
  909. //e.printStackTrace();
  910. LogUtil.errorLogInfo("", TAG, e);
  911. return -1;
  912. }
  913. }
  914. /**
  915. * Edited by jeff (2020.06.22)
  916. * LCD 잔상 현장 복구/보호를 위해 실행되고 있는 LCD Keeper를 종료하기 위해, 통화 App이 실행되면서
  917. * backlight를 On하기 전에 이를 알리는 BR를 수신하여 LCD Keeper를 종료한다.
  918. * @param bOn
  919. */
  920. private void sendLCDBacklightStatus(boolean bOn) {
  921. try {
  922. Log.d(TAG,"[sendLCDBacklightStatus] bOn [" + bOn + "]");
  923. Intent mIntent = new Intent();
  924. if (bOn) mIntent.setAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_ON);
  925. else mIntent.setAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_OFF);
  926. mContext.sendBroadcast(mIntent);
  927. } catch (RuntimeException re) {
  928. LogUtil.errorLogInfo("", TAG, re);
  929. }
  930. catch (Exception e) {
  931. Log.e(TAG, "[Exception] sendLCDBacklightStatus(boolean bOn)");
  932. //e.printStackTrace();
  933. LogUtil.errorLogInfo("", TAG, e);
  934. }
  935. }
  936. public int runRemoteUpdate() {
  937. try {
  938. int nResult = -1;
  939. Log.w(TAG, "[runRemoteUpdate] ========== UPDATE ==========");
  940. if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) {
  941. ctrlWallpadJNI(true);
  942. nResult = mV40IOIF.LiveUpdate();
  943. ctrlWallpadJNI(false);
  944. } else {
  945. Log.w(TAG, "[runRemoteUpdate] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  946. }
  947. return nResult;
  948. } catch (RuntimeException re) {
  949. LogUtil.errorLogInfo("", TAG, re);
  950. return -1;
  951. }
  952. catch (Exception e) {
  953. Log.e(TAG, "[Exception] runRemoteUpdate");
  954. //e.printStackTrace();
  955. LogUtil.errorLogInfo("", TAG, e);
  956. return -1;
  957. }
  958. }
  959. public int setDTMFOutDelayTime(byte nDelay) {
  960. try {
  961. int nResult = -1;
  962. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  963. Log.d(TAG, "[setDTMFOutDelayTime] nDelay: " + String.format("0x%02X", nDelay));
  964. ctrlWallpadJNI(true);
  965. nResult = WpdInterfaceControl(IOCTL_DTMFOUT_DELAYTIME, nDelay);
  966. ctrlWallpadJNI(false);
  967. } else {
  968. Log.w(TAG, "[setDTMFOutDelayTime] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  969. }
  970. return nResult;
  971. } catch (RuntimeException re) {
  972. LogUtil.errorLogInfo("", TAG, re);
  973. return -1;
  974. }
  975. catch (Exception e) {
  976. Log.e(TAG, "[Exception] setDTMFOutDelayTime(int nDelay)");
  977. //e.printStackTrace();
  978. LogUtil.errorLogInfo("", TAG, e);
  979. return -1;
  980. }
  981. }
  982. public int setDTMFOutOnOff(boolean bON) {
  983. try {
  984. int nResult = -1;
  985. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  986. ctrlWallpadJNI(true);
  987. if (bON) nResult = WpdInterfaceControl(IOCTL_DTMFOUT_ONOFF, 1);
  988. else nResult = WpdInterfaceControl(IOCTL_DTMFOUT_ONOFF, 0);
  989. ctrlWallpadJNI(false);
  990. } else {
  991. Log.w(TAG, "[setDTMFOutOnOff] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  992. }
  993. return nResult;
  994. } catch (RuntimeException re) {
  995. LogUtil.errorLogInfo("", TAG, re);
  996. return -1;
  997. }
  998. catch (Exception e) {
  999. Log.e(TAG, "[Exception] setDTMFOutOnOff(boolean bON)");
  1000. //e.printStackTrace();
  1001. LogUtil.errorLogInfo("", TAG, e);
  1002. return -1;
  1003. }
  1004. }
  1005. public int setDTMFInOnOff(boolean bON) {
  1006. try {
  1007. Log.d(TAG, "[setDTMFInOnOff] bON: " + bON);
  1008. int nResult = -1;
  1009. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  1010. ctrlWallpadJNI(true);
  1011. if (bON) nResult = WpdInterfaceControl(IOCTL_DTMFIN_ONOFF, 1);
  1012. else nResult = WpdInterfaceControl(IOCTL_DTMFIN_ONOFF, 0);
  1013. ctrlWallpadJNI(false);
  1014. } else {
  1015. Log.w(TAG, "[Exception] setDTMFInOnOff(boolean bON)");
  1016. }
  1017. return nResult;
  1018. } catch (RuntimeException re) {
  1019. LogUtil.errorLogInfo("", TAG, re);
  1020. return -1;
  1021. }
  1022. catch (Exception e) {
  1023. Log.e(TAG, "[Exception] setDTMFInOnOff");
  1024. //e.printStackTrace();
  1025. LogUtil.errorLogInfo("", TAG, e);
  1026. return -1;
  1027. }
  1028. }
  1029. public int selectFrontCam(boolean bFrontCam) {
  1030. try {
  1031. int nResult = -1;
  1032. ctrlWallpadJNI(true);
  1033. // TODO 1,0 바꾸기 요청 후 수정
  1034. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  1035. if (bFrontCam) nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 1);
  1036. else nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 0);
  1037. } else {
  1038. if (bFrontCam) nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 0);
  1039. else nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 1);
  1040. }
  1041. ctrlWallpadJNI(false);
  1042. LOG_INFO("[selectFrontCam] nResult = " + nResult);
  1043. return nResult;
  1044. } catch (RuntimeException re) {
  1045. LogUtil.errorLogInfo("", TAG, re);
  1046. return -1;
  1047. }
  1048. catch (Exception e) {
  1049. Log.e(TAG, "[Exception] selectFrontCam(boolean bFrontCam)");
  1050. //e.printStackTrace();
  1051. LogUtil.errorLogInfo("", TAG, e);
  1052. return -1;
  1053. }
  1054. }
  1055. public int ctrlCameraBrightness(int nValue) {
  1056. try {
  1057. int nResult = -1;
  1058. // TODO GPIO 확인 -> IOCTL_CAMERA_SET_BRIGHTNESS 없으므로 if문 추가
  1059. if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
  1060. ctrlWallpadJNI(true);
  1061. nResult = WpdInterfaceControl(IOCTL_CAMERA_SET_BRIGHTNESS, nValue);
  1062. ctrlWallpadJNI(false);
  1063. LOG_INFO("[ctrlCameraBrightness] nResult = " + nResult);
  1064. }
  1065. return nResult;
  1066. } catch (RuntimeException re) {
  1067. LogUtil.errorLogInfo("", TAG, re);
  1068. return -1;
  1069. }
  1070. catch (Exception e) {
  1071. Log.e(TAG, "[Exception] ctrlCameraBrightness(int nValue)");
  1072. //e.printStackTrace();
  1073. LogUtil.errorLogInfo("", TAG, e);
  1074. return -1;
  1075. }
  1076. }
  1077. public int ctrlFrontCamContrast(int nValue) {
  1078. try {
  1079. int nResult = -1;
  1080. ctrlWallpadJNI(true);
  1081. nResult = WpdInterfaceControl(IOCTL_CAMERA_SET_CONTRAST, nValue);
  1082. ctrlWallpadJNI(false);
  1083. LOG_INFO("[ctrlFrontCamContrast] nResult = " + nResult);
  1084. return nResult;
  1085. } catch (RuntimeException re) {
  1086. LogUtil.errorLogInfo("", TAG, re);
  1087. return -1;
  1088. }
  1089. catch (Exception e) {
  1090. Log.e(TAG, "[Exception] ctrlFrontCamContrast(int nValue)");
  1091. //e.printStackTrace();
  1092. LogUtil.errorLogInfo("", TAG, e);
  1093. return -1;
  1094. }
  1095. }
  1096. public int ctrlVideoSelectSubPhone(boolean bFront) {
  1097. try {
  1098. int nResult = -99;
  1099. ctrlWallpadJNI(true);
  1100. if (bFront) nResult = WpdInterfaceControl(IOCTL_VIDEOSELECT_SUBPHONE, 0);
  1101. else nResult = WpdInterfaceControl(IOCTL_VIDEOSELECT_SUBPHONE, 1);
  1102. ctrlWallpadJNI(false);
  1103. LOG_INFO("[ctrlVideoSelectSubPhone] nResult = " + nResult);
  1104. return nResult;
  1105. } catch (RuntimeException re) {
  1106. LogUtil.errorLogInfo("", TAG, re);
  1107. return -99;
  1108. }
  1109. catch (Exception e) {
  1110. Log.e(TAG, "[Exception] ctrlVideoSelectSubPhone(boolean bFront)");
  1111. //e.printStackTrace();
  1112. LogUtil.errorLogInfo("", TAG, e);
  1113. return -99;
  1114. }
  1115. }
  1116. public int openWirelessDoorlock() {
  1117. try {
  1118. int nResult = -99;
  1119. ctrlWallpadJNI(true);
  1120. nResult = WpdInterfaceControl(IOCTL_DOOR_LOCK_OPEN_REGIS, 1);
  1121. ctrlWallpadJNI(false);
  1122. LOG_INFO("[openWirelessDoorlock] nResult = " + nResult);
  1123. return nResult;
  1124. } catch (RuntimeException re) {
  1125. LogUtil.errorLogInfo("", TAG, re);
  1126. return -99;
  1127. }
  1128. catch (Exception e) {
  1129. Log.e(TAG, "[Exception] openWirelessDoorlock()");
  1130. //e.printStackTrace();
  1131. LogUtil.errorLogInfo("", TAG, e);
  1132. return -99;
  1133. }
  1134. }
  1135. public int ctrlWallPadLED_Emergency(boolean bOn) {
  1136. try {
  1137. int nResult = -1;
  1138. ctrlWallpadJNI(true);
  1139. if (bOn) nResult = WpdInterfaceControl(IOCTL_BTNEMR_LEDONOFF, 0);
  1140. else nResult = WpdInterfaceControl(IOCTL_BTNEMR_LEDONOFF, 1);
  1141. ctrlWallpadJNI(false);
  1142. LOG_INFO("[ctrlWallPadLED_Emergency] nResult = " + nResult);
  1143. return nResult;
  1144. } catch (RuntimeException re) {
  1145. LogUtil.errorLogInfo("", TAG, re);
  1146. return -1;
  1147. }
  1148. catch (Exception e) {
  1149. Log.e(TAG, "[Exception] ctrlWallPadLED_Emergency(boolean bOn)");
  1150. //e.printStackTrace();
  1151. LogUtil.errorLogInfo("", TAG, e);
  1152. return -1;
  1153. }
  1154. }
  1155. public int ctrlWallPadLED_Call(boolean bOn) {
  1156. try {
  1157. int nResult = -1;
  1158. // TODO GPIO 확인 -> IOCTL_BTNCALL_LEDONOFF 없으므로 if문 추가
  1159. if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
  1160. ctrlWallpadJNI(true);
  1161. if (bOn) nResult = WpdInterfaceControl(IOCTL_BTNCALL_LEDONOFF, 0);
  1162. else nResult = WpdInterfaceControl(IOCTL_BTNCALL_LEDONOFF, 1);
  1163. ctrlWallpadJNI(false);
  1164. LOG_INFO("[ctrlWallPadLED_Call] nResult = " + nResult);
  1165. }
  1166. return nResult;
  1167. } catch (RuntimeException re) {
  1168. LogUtil.errorLogInfo("", TAG, re);
  1169. return -1;
  1170. }
  1171. catch (Exception e) {
  1172. Log.e(TAG, "[Exception] ctrlWallPadLED_Call(boolean bOn)");
  1173. //e.printStackTrace();
  1174. LogUtil.errorLogInfo("", TAG, e);
  1175. return -1;
  1176. }
  1177. }
  1178. public int ctrlWallPadLED_DoorOpen(boolean bOn) {
  1179. try {
  1180. int nResult = -1;
  1181. ctrlWallpadJNI(true);
  1182. if (bOn) nResult = WpdInterfaceControl(IOCTL_BTNOPEN_LEDONOFF, 0);
  1183. else nResult = WpdInterfaceControl(IOCTL_BTNOPEN_LEDONOFF, 1);
  1184. ctrlWallpadJNI(false);
  1185. LOG_INFO("[ctrlWallPadLED_DoorOpen] nResult = " + nResult);
  1186. return nResult;
  1187. } catch (RuntimeException re) {
  1188. LogUtil.errorLogInfo("", TAG, re);
  1189. return -1;
  1190. }
  1191. catch (Exception e) {
  1192. Log.e(TAG, "[Exception] ctrlWallPadLED_DoorOpen(boolean bOn)");
  1193. //e.printStackTrace();
  1194. LogUtil.errorLogInfo("", TAG, e);
  1195. return -1;
  1196. }
  1197. }
  1198. public boolean setEmergencyLEDOnOff(boolean bOn) {
  1199. try {
  1200. return mGLEINTERFACE.setEmerLedOnOff(bOn);
  1201. } catch (RuntimeException re) {
  1202. LogUtil.errorLogInfo("", TAG, re);
  1203. return false;
  1204. }
  1205. catch (Exception e) {
  1206. Log.e(TAG, "[Exception] setEmergencyLEDOnOff(boolean bOn)");
  1207. //e.printStackTrace();
  1208. LogUtil.errorLogInfo("", TAG, e);
  1209. return false;
  1210. }
  1211. }
  1212. public boolean sendDTMF(int nNo) {
  1213. try {
  1214. if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200)
  1215. return mGLEINTERFACE.setDTMFWrite(nNo);
  1216. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300)
  1217. return setDTMFWrite(nNo);
  1218. else {
  1219. Log.w(TAG, "[sendDTMF] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  1220. return false;
  1221. }
  1222. } catch (RuntimeException re) {
  1223. LogUtil.errorLogInfo("", TAG, re);
  1224. return false;
  1225. }
  1226. catch (Exception e) {
  1227. Log.e(TAG, "[Exception] sendDTMF(int nNo)");
  1228. //e.printStackTrace();
  1229. LogUtil.errorLogInfo("", TAG, e);
  1230. return false;
  1231. }
  1232. }
  1233. public void resetPSTNModem() {
  1234. try {
  1235. sendHandlerMsgDelayed(HANDLERMSG.CX93021_RESET_HIGH, 0, 0, 0);
  1236. sendHandlerMsgDelayed(HANDLERMSG.CX93021_RESET_LOW, 0, 0, 100);
  1237. sendHandlerMsgDelayed(HANDLERMSG.CX93021_RESET_HIGH, 0, 0, 200);
  1238. } catch (RuntimeException re) {
  1239. LogUtil.errorLogInfo("", TAG, re);
  1240. }
  1241. catch (Exception e) {
  1242. Log.e(TAG, "[Exception] resetPSTNModem()");
  1243. //e.printStackTrace();
  1244. LogUtil.errorLogInfo("", TAG, e);
  1245. }
  1246. }
  1247. public int setProximitySensorLevel(int nLevel) {
  1248. try {
  1249. int nResult = -1;
  1250. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  1251. ctrlWallpadJNI(true);
  1252. nResult = mV40IOIF.WpdInterfaceControl(IOCTL_SET_PROXSEN_LEVEL, nLevel);
  1253. ctrlWallpadJNI(false);
  1254. Log.i(TAG, "[setProximitySensorLevel] nResult = " + nResult);
  1255. return nResult;
  1256. }
  1257. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  1258. ctrlWallpadJNI(true);
  1259. nResult = mV40IOIF_NOUGAT.WpdInterfaceControl(IOCTL_SET_PROXSEN_LEVEL, nLevel);
  1260. ctrlWallpadJNI(false);
  1261. Log.i(TAG, "[setProximitySensorLevel] nResult = " + nResult);
  1262. return nResult;
  1263. }
  1264. else {
  1265. Log.w(TAG, "[setProximitySensorLevel] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  1266. return nResult;
  1267. }
  1268. } catch (RuntimeException re) {
  1269. LogUtil.errorLogInfo("", TAG, re);
  1270. return -99;
  1271. }
  1272. catch (Exception e) {
  1273. Log.e(TAG, "[Exception] setProximitySensorLevel(int nLevel)");
  1274. //e.printStackTrace();
  1275. LogUtil.errorLogInfo("", TAG, e);
  1276. return -99;
  1277. }
  1278. }
  1279. private int setPSTNResetLow() {
  1280. try {
  1281. int nResult = -1;
  1282. ctrlWallpadJNI(true);
  1283. nResult = WpdInterfaceControl(IOCLT_CX93021_RESET, 0);
  1284. ctrlWallpadJNI(false);
  1285. LOG_INFO("[setPSTNResetLow] nResult = " + nResult);
  1286. return nResult;
  1287. } catch (RuntimeException re) {
  1288. LogUtil.errorLogInfo("", TAG, re);
  1289. return -99;
  1290. }
  1291. catch (Exception e) {
  1292. Log.e(TAG, "[Exception] setPSTNResetLow()");
  1293. //e.printStackTrace();
  1294. LogUtil.errorLogInfo("", TAG, e);
  1295. return -99;
  1296. }
  1297. }
  1298. private int setPSTNResetHigh() {
  1299. try {
  1300. int nResult = -1;
  1301. ctrlWallpadJNI(true);
  1302. nResult = WpdInterfaceControl(IOCLT_CX93021_RESET, 1);
  1303. ctrlWallpadJNI(false);
  1304. LOG_INFO("[setPSTNResetHigh] nResult = " + nResult);
  1305. return nResult;
  1306. } catch (RuntimeException re) {
  1307. LogUtil.errorLogInfo("", TAG, re);
  1308. return -99;
  1309. }
  1310. catch (Exception e) {
  1311. Log.e(TAG, "[Exception] setPSTNResetHigh()");
  1312. //e.printStackTrace();
  1313. LogUtil.errorLogInfo("", TAG, e);
  1314. return -99;
  1315. }
  1316. }
  1317. private void ctrlRFFrontCamPolling(boolean bStop) {
  1318. try {
  1319. Log.i(TAG, "[ctrlRFFrontCamPolling] bStop [" + bStop + "]");
  1320. if (mWallPadAPI != null) mWallPadAPI.SetDevService_DoorCamUseOnOff(bStop);
  1321. else Log.w(TAG, "[ctrlRFFrontCamPolling] mWallPadAPI is null!!");
  1322. } catch (RuntimeException re) {
  1323. LogUtil.errorLogInfo("", TAG, re);
  1324. }
  1325. catch (Exception e) {
  1326. Log.e(TAG, "[Exception] ctrlRFFrontCamPolling(boolean bOn)");
  1327. //e.printStackTrace();
  1328. LogUtil.errorLogInfo("", TAG, e);
  1329. }
  1330. }
  1331. public final class HANDLERMSG {
  1332. public final static int CX93021_RESET_LOW = 100;
  1333. public final static int CX93021_RESET_HIGH = 110;
  1334. }
  1335. public Handler IOIFHandler = new Handler(Looper.getMainLooper()) {
  1336. public void handleMessage(Message msg) {
  1337. Log.d(TAG, "[handleMessage] IOIFHandler : what [" + msg.what + "], arg1 [" + msg.arg1 + "], arg2 [" + msg.arg2 + "]");
  1338. switch (msg.what) {
  1339. case HANDLERMSG.CX93021_RESET_LOW:
  1340. setPSTNResetLow();
  1341. break;
  1342. case HANDLERMSG.CX93021_RESET_HIGH:
  1343. setPSTNResetHigh();
  1344. break;
  1345. default:
  1346. Log.d(TAG, "IOIFHandler : " + msg.what);
  1347. break;
  1348. }
  1349. }
  1350. };
  1351. public void sendHandlerMsg(int what, int arg1, int arg2) {
  1352. try {
  1353. Log.d(TAG, "[sendHandlerMsg] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "]");
  1354. Message HandleMsg = IOIFHandler.obtainMessage();
  1355. HandleMsg.what = what;
  1356. HandleMsg.arg1 = arg1;
  1357. HandleMsg.arg2 = arg2;
  1358. IOIFHandler.sendMessage(HandleMsg);
  1359. } catch (RuntimeException re) {
  1360. LogUtil.errorLogInfo("", TAG, re);
  1361. }
  1362. catch (Exception e) {
  1363. Log.e(TAG, "[Exception] sendHandlerMsg(msg)");
  1364. //e.printStackTrace();
  1365. LogUtil.errorLogInfo("", TAG, e);
  1366. }
  1367. }
  1368. public void sendHandlerMsgDelayed(int what, int arg1, int arg2, long delay) {
  1369. try {
  1370. Log.d(TAG, "[sendHandlerMsgDelayed] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "], delay [" + delay + "]");
  1371. Message HandleMsg = IOIFHandler.obtainMessage();
  1372. HandleMsg.what = what;
  1373. HandleMsg.arg1 = arg1;
  1374. HandleMsg.arg2 = arg2;
  1375. IOIFHandler.sendMessageDelayed(HandleMsg, delay);
  1376. } catch (RuntimeException re) {
  1377. LogUtil.errorLogInfo("", TAG, re);
  1378. }
  1379. catch (Exception e) {
  1380. Log.e(TAG, "[Exception] sendHandlerMsgDelayed(msg)");
  1381. //e.printStackTrace();
  1382. LogUtil.errorLogInfo("", TAG, e);
  1383. }
  1384. }
  1385. /*===============================================================================
  1386. Added below codes by Jeff for IHN-1020GL Gateway (Jeff, 2018.01.25)
  1387. ===============================================================================*/
  1388. public int interfaceIGW200(int nCMD) {
  1389. try {
  1390. Log.i(TAG, "[interfaceIGW200] nCMD [" + nCMD + "]");
  1391. switch (nCMD) {
  1392. case IGW200CMD.FRONT_PWR_ON:
  1393. // 현관카메라 전원 ON
  1394. return IGW200_IOCtrl(IGW200dAPI.OUTPUT.DOOR_POWER, true);
  1395. case IGW200CMD.FRONT_PWR_OFF:
  1396. // 현관카메라 전원 OFF
  1397. return IGW200_IOCtrl(IGW200dAPI.OUTPUT.DOOR_POWER, false);
  1398. case IGW200CMD.FRONT_BELL_ON:
  1399. // 현관카메라 호출음 출력
  1400. return IGW200_IOCtrl(IGW200dAPI.OUTPUT.BELL_CONT, true);
  1401. case IGW200CMD.FRONT_BELL_OFF:
  1402. // 현관카메라 호출음 정지
  1403. return IGW200_IOCtrl(IGW200dAPI.OUTPUT.BELL_CONT, false);
  1404. case IGW200CMD.VIDEO_MOIP:
  1405. // MoIP영상 선택
  1406. return IGW200_IOCtrl(IGW200dAPI.OUTPUT.VIDEO_SEL, true);
  1407. case IGW200CMD.VIDEO_FRONT:
  1408. // 현관영상 선택
  1409. return IGW200_IOCtrl(IGW200dAPI.OUTPUT.VIDEO_SEL, false);
  1410. case IGW200CMD.AUDIO_OFF:
  1411. // 모든 통화패스 OFF
  1412. return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.OFF);
  1413. case IGW200CMD.AUDIO_PSTN:
  1414. // 국선통화 연결
  1415. return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.WPAD_TEL);
  1416. case IGW200CMD.AUDIO_FRONT_WALLPAD:
  1417. // 현관통화 월패드 연결
  1418. return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.WPAD_DOOR);
  1419. case IGW200CMD.AUDIO_FRONT_SUBPHONE:
  1420. // 현관통화 서브폰 연결
  1421. return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.SUB_DOOR);
  1422. case IGW200CMD.AUDIO_MOIP_SUBPHONE:
  1423. // MoIP 통화 서브폰 연결
  1424. return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.MOIP_SUB);
  1425. default:
  1426. return -100;
  1427. }
  1428. } catch (RuntimeException re) {
  1429. LogUtil.errorLogInfo("", TAG, re);
  1430. return -999;
  1431. }
  1432. catch (Exception e) {
  1433. Log.e(TAG, "[Exception] interfaceIGW200(int nCMD)");
  1434. //e.printStackTrace();
  1435. LogUtil.errorLogInfo("", TAG, e);
  1436. return -999;
  1437. }
  1438. }
  1439. public int IGW200_IOCtrl(byte hCMD, boolean bOnOff) {
  1440. try {
  1441. Log.d(TAG, "[IGW200_IOCtrl] hCMD [" + String.format("0x%02X", hCMD) + "], bOnOff [" + bOnOff + "]");
  1442. if (mIGW200DAPI == null) {
  1443. Log.w(TAG, "[IGW200_IOCtrl] mIGW200DAPI is null!!");
  1444. return -1;
  1445. }
  1446. int nResult = mIGW200DAPI.ControlOutput(hCMD, bOnOff);
  1447. if (nResult < 0) {
  1448. Log.e(TAG, "[IGW200_IOCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW200DAPI.ErrorCode.ErrStr() + "]");
  1449. return -2;
  1450. }
  1451. } catch (RuntimeException re) {
  1452. LogUtil.errorLogInfo("", TAG, re);
  1453. return -102;
  1454. }
  1455. catch (Exception e) {
  1456. Log.e(TAG, "[Exception] IGW200_IOCtrl(byte hCMD, boolean OnOff)");
  1457. //e.printStackTrace();
  1458. LogUtil.errorLogInfo("", TAG, e);
  1459. return -102;
  1460. }
  1461. return 0;
  1462. }
  1463. /**
  1464. * 통화채널 설정을 변경한다.
  1465. *
  1466. * @param hCallPath - (int) 변경할 체널패스 ( {@link IGW200dAPI.TEL_PATH} )
  1467. * @return (int) - >=0 : 성공, <0 : 실패
  1468. */
  1469. public int IGW200_CallPathCtrl(byte hCallPath) {
  1470. try {
  1471. Log.d(TAG, "[IGW200_CallPathCtrl] hCallPath [" + String.format("0x%02X", hCallPath) + "]");
  1472. if (mIGW200DAPI == null) {
  1473. Log.w(TAG, "[IGW200_CallPathCtrl] mIGW200DAPI is null!!");
  1474. return -1;
  1475. }
  1476. int nResult = mIGW200DAPI.ControlTelPath(hCallPath);
  1477. if (nResult < 0) {
  1478. Log.e(TAG, "[IGW200_CallPathCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW200DAPI.ErrorCode.ErrStr() + "]");
  1479. return -2;
  1480. }
  1481. } catch (RuntimeException re) {
  1482. LogUtil.errorLogInfo("", TAG, re);
  1483. }
  1484. catch (Exception e) {
  1485. Log.e(TAG, "[Exception] IGW200_CallPathCtrl(byte hCallPath)");
  1486. //e.printStackTrace();
  1487. LogUtil.errorLogInfo("", TAG, e);
  1488. }
  1489. return 0;
  1490. }
  1491. private void startConnectIGW200API() {
  1492. try {
  1493. LOG("[startConnectIGW200API] ===== START =====");
  1494. mConnectIGW200APIThread = new ConnectIGW200APIThread();
  1495. mConnectIGW200APIThread.start();
  1496. } catch (RuntimeException re) {
  1497. LogUtil.errorLogInfo("", TAG, re);
  1498. }
  1499. catch (Exception e) {
  1500. Log.e(TAG, "[Exception] startConnectIGW200API()");
  1501. //e.printStackTrace();
  1502. LogUtil.errorLogInfo("", TAG, e);
  1503. }
  1504. }
  1505. private void stopConnectIGW200API() {
  1506. try {
  1507. LOG("[stopConnectIGW200API] ===== START =====");
  1508. if (mConnectIGW200APIThread != null) {
  1509. mConnectIGW200APIThread = null;
  1510. }
  1511. } catch (RuntimeException re) {
  1512. LogUtil.errorLogInfo("", TAG, re);
  1513. }
  1514. catch (Exception e) {
  1515. Log.e(TAG, "[Exception] stopConnectIGW200API()");
  1516. //e.printStackTrace();
  1517. LogUtil.errorLogInfo("", TAG, e);
  1518. }
  1519. }
  1520. static long lConnectionPeriod = 0;
  1521. // static int CONNECT_TIMEOUT = 1000 * 60; // 타임아웃 시간은 1분
  1522. static int CONNECT_TIMEOUT = 1000; // 타임아웃 시간은 1초
  1523. private ConnectIGW200APIThread mConnectIGW200APIThread;
  1524. private class ConnectIGW200APIThread extends Thread {
  1525. String strSendingDTMF = "";
  1526. public ConnectIGW200APIThread() {
  1527. LOG_INFO("[ConnectIGW200APIThread()] ===== START =====");
  1528. }
  1529. public void run() {
  1530. try {
  1531. LOG_INFO("[ConnectIGW200APIThread().run()] ===== START =====");
  1532. lConnectionPeriod = System.currentTimeMillis() + CONNECT_TIMEOUT; // 타임아웃시간을 설정한다.
  1533. while ((mIGW200DAPI == null) && (System.currentTimeMillis() < lConnectionPeriod)) {
  1534. mIGW200DAPI = mWallPadAPI.Get_IGW200dController();
  1535. if (mIGW200DAPI != null)
  1536. Log.e(TAG, "[ConnectIGW200APIThread] mIGW200DAPI loading OK!!!!!!!");
  1537. else Log.w(TAG, "[ConnectIGW200APIThread] mIGW200DAPI loading FAIL!!");
  1538. try {
  1539. Thread.sleep(100);
  1540. } catch (InterruptedException e) {
  1541. Log.e(TAG, "[InterruptedException] Thread.sleep(100)");
  1542. //e.printStackTrace();
  1543. LogUtil.errorLogInfo("", TAG, e);
  1544. }
  1545. }
  1546. } catch (RuntimeException re) {
  1547. LogUtil.errorLogInfo("", TAG, re);
  1548. }
  1549. catch (Exception e) {
  1550. Log.e(TAG, "[Exception] ConnectIGW200APIThread.run()");
  1551. //e.printStackTrace();
  1552. LogUtil.errorLogInfo("", TAG, e);
  1553. }
  1554. }
  1555. }
  1556. /*===============================================================================
  1557. IHN-D101 IGW300 Gateway
  1558. ===============================================================================*/
  1559. public int interfaceIGW300(int nCMD) {
  1560. try {
  1561. Log.i(TAG, "[interfaceIGW300] nCMD [" + nCMD + "]");
  1562. switch (nCMD) {
  1563. case IGW300CMD.FRONT_PWR_ON:
  1564. // 현관카메라 전원 ON
  1565. Log.d(TAG, "[interfaceIGW300] FRONT_PWR_ON");
  1566. return IGW300_IOCtrl(IGW300API.OUTPUT.DOOR_POWER, true);
  1567. case IGW300CMD.FRONT_PWR_OFF:
  1568. // 현관카메라 전원 OFF
  1569. Log.d(TAG, "[interfaceIGW300] FRONT_PWR_OFF");
  1570. return IGW300_IOCtrl(IGW300API.OUTPUT.DOOR_POWER, false);
  1571. case IGW300CMD.FRONT_BELL_ON:
  1572. // 현관카메라 호출음 출력
  1573. Log.d(TAG, "[interfaceIGW300] FRONT_BELL_ON");
  1574. return IGW300_IOCtrl(IGW300API.OUTPUT.BELL_CONT, true);
  1575. case IGW300CMD.FRONT_BELL_OFF:
  1576. // 현관카메라 호출음 정지
  1577. Log.d(TAG, "[interfaceIGW300] FRONT_BELL_OFF");
  1578. return IGW300_IOCtrl(IGW300API.OUTPUT.BELL_CONT, false);
  1579. case IGW300CMD.VIDEO_MOIP:
  1580. // MoIP영상 선택
  1581. Log.d(TAG, "[interfaceIGW300] VIDEO_MOIP");
  1582. return IGW300_IOCtrl(IGW300API.OUTPUT.VIDEO_SEL, true);
  1583. case IGW300CMD.VIDEO_FRONT:
  1584. // 현관영상 선택
  1585. Log.d(TAG, "[interfaceIGW300] VIDEO_FRONT");
  1586. return IGW300_IOCtrl(IGW300API.OUTPUT.VIDEO_SEL, false);
  1587. // CONTROL CALL PATH -> Handler로 수정
  1588. default:
  1589. return -100;
  1590. }
  1591. } catch (RuntimeException re) {
  1592. LogUtil.errorLogInfo("", TAG, re);
  1593. return -999;
  1594. }
  1595. catch (Exception e) {
  1596. Log.e(TAG, "[Exception] interfaceIGW300(int nCMD)");
  1597. //e.printStackTrace();
  1598. LogUtil.errorLogInfo("", TAG, e);
  1599. return -999;
  1600. }
  1601. }
  1602. public int IGW300_IOCtrl(byte hCMD, boolean bOnOff) {
  1603. try {
  1604. Log.d(TAG, "[IGW300_IOCtrl] hCMD [" + String.format("0x%02X", hCMD) + "], bOnOff [" + bOnOff + "]");
  1605. if (mIGW300API == null) {
  1606. Log.w(TAG, "[IGW300_IOCtrl] mIGW300API is null!!");
  1607. return -1;
  1608. }
  1609. int nResult = mIGW300API.ControlOutput(hCMD, bOnOff);
  1610. Log.d(TAG, "[IGW300_IOCtrl] nResult: " + nResult);
  1611. if (nResult < 0) {
  1612. Log.e(TAG, "[IGW300_IOCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW300API.ErrorCode.ErrStr() + "]");
  1613. return -2;
  1614. }
  1615. } catch (RuntimeException re) {
  1616. LogUtil.errorLogInfo("", TAG, re);
  1617. return -102;
  1618. }
  1619. catch (Exception e) {
  1620. Log.e(TAG, "[Exception] IGW300_IOCtrl(byte hCMD, boolean OnOff)");
  1621. //e.printStackTrace();
  1622. LogUtil.errorLogInfo("", TAG, e);
  1623. return -102;
  1624. }
  1625. return 0;
  1626. }
  1627. public int IGW300_CallPathCtrl(byte hCallPath) {
  1628. try {
  1629. Log.d(TAG, "[IGW300_CallPathCtrl] hCallPath [" + String.format("0x%02X", hCallPath) + "]");
  1630. if (mIGW300API == null) {
  1631. Log.w(TAG, "[IGW300_CallPathCtrl] mIGW300API is null!!");
  1632. return -1;
  1633. }
  1634. int nResult = mIGW300API.ControlTelPath(hCallPath);
  1635. if (nResult < 0) {
  1636. Log.e(TAG, "[IGW300_CallPathCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW300API.ErrorCode.ErrStr() + "]");
  1637. return -2;
  1638. }
  1639. } catch (RuntimeException re) {
  1640. LogUtil.errorLogInfo("", TAG, re);
  1641. }
  1642. catch (Exception e) {
  1643. Log.e(TAG, "[Exception] IGW300_CallPathCtrl(byte hCallPath)");
  1644. //e.printStackTrace();
  1645. LogUtil.errorLogInfo("", TAG, e);
  1646. }
  1647. return 0;
  1648. }
  1649. private void startConnectIGW300API() {
  1650. try {
  1651. LOG("[startConnectIGW300API]");
  1652. mConnectIGW300APIThread = new ConnectIGW300APIThread();
  1653. mConnectIGW300APIThread.start();
  1654. } catch (RuntimeException re) {
  1655. LogUtil.errorLogInfo("", TAG, re);
  1656. }
  1657. catch (Exception e) {
  1658. Log.e(TAG, "[Exception] startConnectIGW300API()");
  1659. //e.printStackTrace();
  1660. LogUtil.errorLogInfo("", TAG, e);
  1661. }
  1662. }
  1663. private void stopConnectIGW300API() {
  1664. try {
  1665. LOG("[stopConnectIGW300API]");
  1666. if (mConnectIGW300APIThread != null) {
  1667. mConnectIGW300APIThread = null;
  1668. }
  1669. } catch (RuntimeException re) {
  1670. LogUtil.errorLogInfo("", TAG, re);
  1671. }
  1672. catch (Exception e) {
  1673. Log.e(TAG, "[Exception] stopConnectIGW300API()");
  1674. //e.printStackTrace();
  1675. LogUtil.errorLogInfo("", TAG, e);
  1676. }
  1677. }
  1678. private ConnectIGW300APIThread mConnectIGW300APIThread;
  1679. private class ConnectIGW300APIThread extends Thread {
  1680. public ConnectIGW300APIThread() {
  1681. LOG_INFO("============ [ConnectIGW300APIThread()] ============");
  1682. }
  1683. public void run() {
  1684. try {
  1685. LOG_INFO("[ConnectIGW300APIThread().run()]");
  1686. lConnectionPeriod = System.currentTimeMillis() + CONNECT_TIMEOUT;
  1687. while ((mIGW300API == null) && (System.currentTimeMillis() < lConnectionPeriod)) {
  1688. mIGW300API = mWallPadAPI.Get_IGW300Controller();
  1689. if (mIGW300API != null)
  1690. Log.e(TAG, "[ConnectIGW300APIThread] mIGW300API loading OK!!!!!!!");
  1691. else Log.w(TAG, "[ConnectIGW300APIThread] mIGW300API loading FAIL!!");
  1692. try {
  1693. Thread.sleep(100);
  1694. } catch (InterruptedException e) {
  1695. Log.e(TAG, "[InterruptedException] Thread.sleep(100)");
  1696. //e.printStackTrace();
  1697. LogUtil.errorLogInfo("", TAG, e);
  1698. }
  1699. }
  1700. } catch (RuntimeException re) {
  1701. LogUtil.errorLogInfo("", TAG, re);
  1702. }
  1703. catch (Exception e) {
  1704. Log.e(TAG, "[Exception] ConnectIGW300APIThread.run()");
  1705. //e.printStackTrace();
  1706. LogUtil.errorLogInfo("", TAG, e);
  1707. }
  1708. }
  1709. }
  1710. public static final int VIDEO_INPUT_TYPE_DOOR = 0;
  1711. public static final int VIDEO_INPUT_TYPE_CAMERA = 1;
  1712. public static final int IOCTL_VIDEOINPUT_DOORCAMERA = 0xFE01; // 월패드 영상 입력 선택 제어
  1713. public static final int IOCTL_CAMERA_POWERONOFF = 0xFF07; // 카메라 power on/off 제어
  1714. // controll videoInput
  1715. // 0: door, 1: camera
  1716. public int videoInputControll(int type) {
  1717. Log.d(TAG, "videoInputControll() type :" + type);
  1718. int ret = -1;
  1719. if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
  1720. ctrlWallpadJNI(true);
  1721. switch (type) {
  1722. case VIDEO_INPUT_TYPE_DOOR:
  1723. ret = WpdInterfaceControl(IOCTL_VIDEOINPUT_DOORCAMERA, type);
  1724. break;
  1725. case VIDEO_INPUT_TYPE_CAMERA:
  1726. ret = WpdInterfaceControl(IOCTL_CAMERA_POWERONOFF, type); //전원
  1727. ret = WpdInterfaceControl(IOCTL_VIDEOINPUT_DOORCAMERA, type);
  1728. break;
  1729. default:
  1730. break;
  1731. }
  1732. ctrlWallpadJNI(false);
  1733. }
  1734. else {
  1735. Log.d(TAG, "videoInputControll open success: ");
  1736. ctrlWallpadJNI(false);
  1737. switch (type) {
  1738. case VIDEO_INPUT_TYPE_DOOR:
  1739. case VIDEO_INPUT_TYPE_CAMERA:
  1740. ret = WpdInterfaceControl(IOCTL_VIDEOINPUT_DOORCAMERA, type);
  1741. break;
  1742. default:
  1743. break;
  1744. }
  1745. ctrlWallpadJNI(true);
  1746. }
  1747. return ret;
  1748. }
  1749. public boolean setCameraConfigure(int nValue) {
  1750. try {
  1751. Log.i(TAG, "[setCameraConfigure] nValue [" + nValue+ "]");
  1752. if (Build.VERSION.SDK_INT > 23) {
  1753. if (mV40IOIF_NOUGAT == null) {
  1754. Log.w(TAG, "[setCameraConfigure] Not supported!! mV40IOIF_NOUGAT is null!!");
  1755. return false;
  1756. }
  1757. mV40IOIF_NOUGAT.CameraSet(nValue);
  1758. return true;
  1759. }
  1760. else {
  1761. Log.w(TAG, "[setCameraConfigure] Not supported AOS Version !!! AOS Ver. [" + Build.VERSION.SDK_INT+ "]");
  1762. return false;
  1763. }
  1764. } catch (RuntimeException re) {
  1765. LogUtil.errorLogInfo("", TAG, re);
  1766. return false;
  1767. }
  1768. catch (Exception e) {
  1769. Log.e(TAG, "[Exception] setCameraConfigure(int nValue)");
  1770. //e.printStackTrace();
  1771. LogUtil.errorLogInfo("", TAG, e);
  1772. return false;
  1773. }
  1774. }
  1775. private int IOCTL_AUDIO_PATH_DOOR_WALLPAD = 0xFE02; // 월패드-현관
  1776. private int IOCTL_AUDIO_PATH_NORMAL = 0xFE09; // 기본 오디오패스
  1777. public void ctrlSetTalkPathDoor() {
  1778. try {
  1779. Log.d(TAG, "[ctrlSetTalkPathDoor]");
  1780. if (BOARDTYPE == BOARD_TYPE.V40 || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  1781. ctrlWallpadJNI(true);
  1782. WpdInterfaceControl(IOCTL_AUDIO_PATH_DOOR_WALLPAD, 1);
  1783. ctrlWallpadJNI(false);
  1784. } else {
  1785. Log.w(TAG, "[ctrlSetTalkPathDoor] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  1786. }
  1787. } catch (RuntimeException re) {
  1788. LogUtil.errorLogInfo("", TAG, re);
  1789. }
  1790. catch (Exception e) {
  1791. Log.e(TAG, "[Exception] ctrlSetTalkPathDoor()");
  1792. //e.printStackTrace();
  1793. LogUtil.errorLogInfo("", TAG, e);
  1794. }
  1795. }
  1796. public void ctrlSetTalkPathNormal() {
  1797. try {
  1798. Log.d(TAG, "[ctrlSetTalkPathNormal]");
  1799. if (BOARDTYPE == BOARD_TYPE.V40 || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  1800. ctrlWallpadJNI(true);
  1801. WpdInterfaceControl(IOCTL_AUDIO_PATH_NORMAL, 1);
  1802. ctrlWallpadJNI(false);
  1803. } else {
  1804. Log.w(TAG, "[ctrlSetTalkPathDoor] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  1805. }
  1806. } catch (RuntimeException re) {
  1807. LogUtil.errorLogInfo("", TAG, re);
  1808. }
  1809. catch (Exception e) {
  1810. Log.e(TAG, "[Exception] ctrlSetTalkPathNormal()");
  1811. //e.printStackTrace();
  1812. LogUtil.errorLogInfo("", TAG, e);
  1813. }
  1814. }
  1815. public void setEmergencyType() {
  1816. try {
  1817. Log.d(TAG, "[setEmergencyType]");
  1818. if (Version.getModelType() == MODEL_TYPE.IHN_1010GL || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I
  1819. || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_2443ALT || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_6410ALT) {
  1820. ctrlWallpadJNI(true);
  1821. WpdInterfaceControl(IOCTL_EMR_TYPE, 1);
  1822. ctrlWallpadJNI(false);
  1823. } else {
  1824. Log.w(TAG, "[setEmergencyType] Not supported MODEL_TYPE!! [" + Version.getModelType() + "]");
  1825. }
  1826. } catch (RuntimeException re) {
  1827. LogUtil.errorLogInfo("", TAG, re);
  1828. }
  1829. catch (Exception e) {
  1830. Log.e(TAG, "[Exception] setEmergencyType()");
  1831. //e.printStackTrace();
  1832. LogUtil.errorLogInfo("", TAG, e);
  1833. }
  1834. }
  1835. }