1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999 |
- package kr.co.icontrols.wallpadmain;
- import kr.co.icontrols.a20ioctl.A20IOInterface;
- import kr.co.icontrols.gledeviceinterface.jni;
- import kr.co.icontrols.v40ioctl.V40IOInterface;
- import kr.co.icontrols.v40ioctl.V40IOInterface2;
- import kr.co.icontrols.wallpadmain.declare.Common;
- import kr.co.icontrols.wallpadmain.declare.Common.IGW200CMD;
- import kr.co.icontrols.wallpadmain.declare.Common.IGW300CMD;
- import kr.co.icontrols.wallpadmain.declare.Common.BOARD_TYPE;
- import kr.co.icontrols.wallpadsupport.Version;
- import kr.co.icontrols.wallpadsupport.Version.MODEL_TYPE;
- import com.artncore.commons.define;
- import com.artncore.deviceinterface.WallPadInterface;
- import com.artncore.wallpadapi.IGW200dAPI;
- import com.artncore.wallpadapi.IGW300API;
- import com.artncore.wallpadapi.WallPadAPI;
- import android.content.Context;
- import android.content.Intent;
- import android.os.Build;
- import android.os.Handler;
- import android.os.Looper;
- import android.os.Message;
- import android.util.Log;
- import com.util.LogUtil;
- public class IOInterface {
- String TAG = "IOInterface";
- boolean bLOG = true;
- private void LOG(String log) {
- if (bLOG) Log.v(TAG, log);
- }
- boolean bLOG_DEBUG = false;
- private void LOG_DEBUG(String log) {
- if (bLOG_DEBUG) Log.d(TAG, log);
- }
- boolean bLOG_INFO = true;
- private void LOG_INFO(String log) {
- if (bLOG_INFO) Log.i(TAG, log);
- }
- // TCC8935
- private int IOCTL_CAMERA_SET_BRIGHTNESS = 0xF901; // Camera Brightness 설정(0 ~ 20 단계), Default 설정시 10 단계
- private int IOCTL_CAMERA_SET_CONTRAST = 0xF902; // Camera Contrast 설정 (0 ~ 20), Default 설정시 10 단계
- private int IOCTL_MIC_GAIN_SET = 0xFD01; // MAX 79
- private int IOCTL_MIC_GAIN_GET = 0xFD02;
- private int IOCTL_MIC_RECORD_GAIN_SET = 0xFD03; // mic record gain
- private int IOCTL_MIC_RECORD_GAIN_GET = 0xFD04; // mic record gain
- private int IOCTL_MIC_BOOST_GAIN_SET = 0xFD05; // mic boost gain (6dB steps)
- private int IOCTL_MIC_BOOST_GAIN_GET = 0xFD06; // mic boost gain
- private int IOCTL_SPK_EQ_GAIN_SET = 0xFD09; // (0 ~ 32767) Speaker EQ gain 설정 제어 (WallPad Speaker)
- private int IOCTL_SPK_EQ_GAIN_GET = 0xFD0A; // (0 ~ 32767) Speaker EQ gain 상태 읽기 (WallPad Speaker)
- private int IOCTL_MONOOUT_SUB_GAIN_SET = 0xFD0D; // MAX 79 (Lobby/Guard Speaker)
- private int IOCTL_MONOOUT_SUB_GAIN_GET = 0xFD0E; // (Lobby/Guard Speaker)
- private int IOCTL_CAMERA_SELECT = 0xFE01; // 월패드 영상입력 선택 (0: 현관카메라, 1: 월패드 카메라)
- private int IOCTL_FRONTCAM_BELL = 0xFF01; // 현관카메라 벨제어 (띵동~)
- private int IOCTL_BTNEMR_LEDONOFF = 0xFF02; // 비상버튼 LED
- private int IOCTL_BTNCALL_LEDONOFF = 0xFF03; // 통화버튼 LED
- private int IOCTL_BTNOPEN_LEDONOFF = 0xFF04; // 문열림 LED
- private int IOCTL_VIDEOSELECT_SUBPHONE = 0xFF06; // 서브폰 영상 소스 선택 (0: 현관영상, 1: MoIP 영상)
- private int IOCTL_WALLPADCAM_POWERONOFF = 0xFF07; // 월패드 카메라 전원 ON/OFF
- private int IOCTL_AUDIO_SWITCH_34118 = 0xFF08; // 현관통화시 음성패스 설정 (0: 월패드, 1: 서브폰), MoIP 통화시 음성패스 설정 (0: 서브폰, 1: 월패드) // A20, V40
- private int IOCTL_DOOR_LOCK_OPEN_REGIS = 0xFF09; // 무선도어락 제어 (0: 도어락 등록, 1: 도어락 열기)
- private int IOCTL_FRONTCAM_POWERONOFF = 0xFF0B; // 현관카메라 전원 ON/OFF
- private int IOCTL_FRONTCAM_AUDIO = 0xFF10; // 월패드 음성 Path 선택 (0: Disable, 1: Enable)
- // TCC8935
- // A20
- private int IOCTL_GET_BOARD_REVISION = 0xF509; // IHN-1020B-A2 보드 리비전 (0: Rev. 1.3 (LCD 회전 없음), 2: Rev. 1.0 ~ 1.2 (LCD 180도 회전)
- private int IOCLT_CX93021_RESET = 0xFF11; // PSTN 모뎀 IC 리셋 (High -> Low(15ms 이상) -> High), High로 유지해야 Enable
- // A20
- // V40 DTMF HT9170 관련
- private int IOCTL_DTMFIN_ONOFF = 0xFFF2;
- private int IOCTL_DTMFOUT_DELAYTIME = 0xFFF3;
- private int IOCTL_DTMFOUT_TONE = 0xFFF4;
- private int IOCTL_DTMFOUT_ONOFF = 0xFFF5;
- public static final int TYPE_GPIO2_CMD = (0xFE << 8);
- public static final int IOCTL_SET_PROXSEN_LEVEL = (TYPE_GPIO2_CMD | 0x04);
- // V40
- public static final int IOCTL_EMR_TYPE = (TYPE_GPIO2_CMD | 0x02);
- Context mContext;
- private WallPadInterface mTCC8935IOIF = null;
- private jni mGLEINTERFACE = null;
- private A20IOInterface mA20IOIFCMOS = null;
- private A20IOInterface mA20IOIFCCD = null;
- private V40IOInterface mV40IOIF = null;
- private V40IOInterface2 mV40IOIF_NOUGAT = null;
- private WallPadAPI mWallPadAPI = null;
- private IGW200dAPI mIGW200DAPI = null;
- private IGW300API mIGW300API = null;
- int BOARDTYPE = 0;
- public IOInterface(int nBoardType) {
- try {
- BOARDTYPE = nBoardType;
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
- mTCC8935IOIF = new WallPadInterface();
- mGLEINTERFACE = new jni();
- }
- else if (BOARDTYPE == BOARD_TYPE.TCC8935) {
- mTCC8935IOIF = new WallPadInterface();
- mGLEINTERFACE = new jni();
- }
- else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
- mA20IOIFCMOS = new A20IOInterface();
- }
- else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
- mA20IOIFCCD = new A20IOInterface();
- }
- else if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- mV40IOIF = new V40IOInterface();
- }
- else if (BOARDTYPE == BOARD_TYPE.V40) {
- mV40IOIF = new V40IOInterface();
- }
- else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- mV40IOIF_NOUGAT = new V40IOInterface2();
- }
- else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- mV40IOIF_NOUGAT = new V40IOInterface2();
- }
- else {
- Log.w(TAG, "[IOInterface] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] IOInterface(int nBoardType)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public IOInterface(Context context, WallPadAPI wallpadapi) {
- try {
- mContext = context;
- BOARDTYPE = getBoardType(Version.getModelType());
- Log.i(TAG, "[IOInterface] BOARDTYPE [" + BOARDTYPE + "]");
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
- mTCC8935IOIF = new WallPadInterface();
- mGLEINTERFACE = new jni();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- if(mWallPadAPI!=null)
- mIGW200DAPI = mWallPadAPI.Get_IGW200dController();
- if (mIGW200DAPI == null) {
- Log.w(TAG, "[IOInterface] mIGW200DAPI is null!!");
- startConnectIGW200API();
- }
- }
- else if (BOARDTYPE == BOARD_TYPE.TCC8935) {
- mTCC8935IOIF = new WallPadInterface();
- mGLEINTERFACE = new jni();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- }
- else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
- mA20IOIFCMOS = new A20IOInterface();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- }
- else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
- mA20IOIFCCD = new A20IOInterface();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- }
- else if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- mV40IOIF = new V40IOInterface();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- if(mWallPadAPI!=null)
- mIGW300API = mWallPadAPI.Get_IGW300Controller();
- if (mIGW300API == null) {
- Log.d(TAG, "[IOInterface] mIGW300API is null!!");
- startConnectIGW300API();
- }
- }
- else if (BOARDTYPE == BOARD_TYPE.V40) {
- mV40IOIF = new V40IOInterface();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- }
- else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- mV40IOIF_NOUGAT = new V40IOInterface2();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- if (wallpadapi != null) mIGW300API = mWallPadAPI.Get_IGW300Controller();
- if (mIGW300API == null) {
- Log.d(TAG, "[IOInterface] mIGW300API is null!!");
- startConnectIGW300API();
- }
- }
- else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- mV40IOIF_NOUGAT = new V40IOInterface2();
- if (wallpadapi != null) mWallPadAPI = wallpadapi;
- else Log.w(TAG, "[IOInterface] wallpadapi is null!!");
- }
- else {
- Log.w(TAG, "[IOInterface] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] IOInterface(int nBoardType, WallPadAPI wallpadapi)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public int getBoardType(int nModelType) {
- try {
- Log.i(TAG, "[getBoardType] nModelType [" + nModelType + "], Build.VERSION.SDK_INT [" + Build.VERSION.SDK_INT + "]");
- switch (nModelType) {
- case MODEL_TYPE.IHN_1020GL:
- return BOARD_TYPE.TCC8935_IGW200;
- case MODEL_TYPE.IHN_1020B_A:
- case MODEL_TYPE.IHN_1020SA_A:
- case MODEL_TYPE.IHN_750:
- return BOARD_TYPE.TCC8935;
- case MODEL_TYPE.IHN_1020B_A2:
- return BOARD_TYPE.A20_CMOS;
- case MODEL_TYPE.IHN_1030_A2:
- return BOARD_TYPE.A20_CCD;
- case MODEL_TYPE.IHN_D101:
- case MODEL_TYPE.IHN_D101_I:
- case MODEL_TYPE.IHN_D101K:
- case MODEL_TYPE.IHN_D101K_I:
- case MODEL_TYPE.IHN_1010GL:
- case MODEL_TYPE.IHN_1010GL_I:
- case MODEL_TYPE.IHN_D101_I_OCF:
- case MODEL_TYPE.IHN_1010GL_I_2443ALT:
- case MODEL_TYPE.IHN_1010GL_I_6410ALT:
- if (Build.VERSION.SDK_INT > 23) return BOARD_TYPE.V40_IGW300_NOUGAT;
- else return BOARD_TYPE.V40_IGW300;
- case MODEL_TYPE.IHN_1010:
- case MODEL_TYPE.IHN_1010_I:
- case MODEL_TYPE.IHN_T1010:
- case MODEL_TYPE.IHN_T1010_I:
- case MODEL_TYPE.IHN_HS101:
- case MODEL_TYPE.IHN_HS101_I:
- case MODEL_TYPE.IHN_1030_I:
- case MODEL_TYPE.IHN_1040:
- case MODEL_TYPE.IHN_1040_I:
- case MODEL_TYPE.IHN_1050:
- case MODEL_TYPE.IHN_1050_I:
- case MODEL_TYPE.IHN_1050DW_I:
- case MODEL_TYPE.IHN_1020B_I:
- case MODEL_TYPE.IHN_1303_I:
- if (Build.VERSION.SDK_INT > 23) return BOARD_TYPE.V40_NOUGAT;
- else return BOARD_TYPE.V40;
- default:
- return -99;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getBoardType(int nModelType)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- // PSTN 서비스에서 사용하기 위한 코드
- public void setBoardType(int nBoardType) {
- try {
- BOARDTYPE = nBoardType;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setBoardType(nBoardType)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // Wallpad_JNI
- public int WpdInterfaceOpen() {
- LOG_INFO("WpdInterfaceOpen()");
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
- return mTCC8935IOIF.WpdInterfaceOpen();
- } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
- return mA20IOIFCMOS.WpdInterfaceOpen();
- } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
- return mA20IOIFCCD.WpdInterfaceOpen();
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
- return mV40IOIF.WpdInterfaceOpen();
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- return mV40IOIF_NOUGAT.WpdInterfaceOpen();
- } else {
- Log.w(TAG, "[WpdInterfaceOpen] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- return -99;
- }
- }
- public int WpdInterfaceClose() {
- LOG_INFO("WpdInterfaceClose()");
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
- return mTCC8935IOIF.WpdInterfaceClose();
- } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
- return mA20IOIFCMOS.WpdInterfaceClose();
- } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
- return mA20IOIFCCD.WpdInterfaceClose();
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
- return mV40IOIF.WpdInterfaceClose();
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- return mV40IOIF_NOUGAT.WpdInterfaceClose();
- } else {
- Log.w(TAG, "[VideoJNI] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- return -99;
- }
- }
- public int WpdInterfaceControl(int cmd, int arg) {
- // LOG_INFO("WpdInterfaceControl(" + cmd + ", " + arg + ")");
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
- return mTCC8935IOIF.WpdInterfaceControl(cmd, arg);
- } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
- return mA20IOIFCMOS.WpdInterfaceControl(cmd, arg);
- } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
- return mA20IOIFCCD.WpdInterfaceControl(cmd, arg);
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
- return mV40IOIF.WpdInterfaceControl(cmd, arg);
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- return mV40IOIF_NOUGAT.WpdInterfaceControl(cmd, arg);
- } else {
- Log.w(TAG, "[WpdInterfaceControl] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- return -99;
- }
- }
- public int SetMacAddr(int cmd, String macAddr) {
- LOG_INFO("SetMacAddr(" + cmd + ", " + macAddr + ")");
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
- return mTCC8935IOIF.SetMacAddr(cmd, macAddr);
- } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
- return mA20IOIFCMOS.SetMacAddr(cmd, macAddr);
- } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
- return mA20IOIFCCD.SetMacAddr(cmd, macAddr);
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
- return mV40IOIF.SetMacAddr(macAddr);
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- return mV40IOIF_NOUGAT.SetMacAddr(macAddr);
- } else {
- Log.w(TAG, "[VideoJNI] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- return -99;
- }
- }
- private boolean bWallpadJNI = false;
- public void ctrlWallpadJNI(boolean bOpen) {
- try {
- LOG_INFO("[ctrlWallpadJNI] bOpen = " + bOpen);
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200 || BOARDTYPE == BOARD_TYPE.TCC8935) {
- if (bOpen) {
- if (!bWallpadJNI) {
- mTCC8935IOIF.WpdInterfaceOpen();
- bWallpadJNI = true;
- }
- } else {
- mTCC8935IOIF.WpdInterfaceClose();
- bWallpadJNI = false;
- }
- } else if (BOARDTYPE == BOARD_TYPE.A20_CMOS) {
- if (bOpen) {
- if (!bWallpadJNI) {
- mA20IOIFCMOS.WpdInterfaceOpen();
- bWallpadJNI = true;
- }
- } else {
- mA20IOIFCMOS.WpdInterfaceClose();
- bWallpadJNI = false;
- }
- } else if (BOARDTYPE == BOARD_TYPE.A20_CCD) {
- if (bOpen) {
- if (!bWallpadJNI) {
- mA20IOIFCCD.WpdInterfaceOpen();
- bWallpadJNI = true;
- }
- } else {
- mA20IOIFCCD.WpdInterfaceClose();
- bWallpadJNI = false;
- }
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
- if (bOpen) {
- if (!bWallpadJNI) {
- mV40IOIF.WpdInterfaceOpen();
- bWallpadJNI = true;
- }
- } else {
- mV40IOIF.WpdInterfaceClose();
- bWallpadJNI = false;
- }
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- if (bOpen) {
- if (!bWallpadJNI) {
- mV40IOIF_NOUGAT.WpdInterfaceOpen();
- bWallpadJNI = true;
- }
- } else {
- mV40IOIF_NOUGAT.WpdInterfaceClose();
- bWallpadJNI = false;
- }
- } else {
- bWallpadJNI = false;
- Log.w(TAG, "[VideoJNI] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- bWallpadJNI = false;
- }
- catch (Exception e) {
- bWallpadJNI = false;
- Log.e(TAG, "[Exception] ctrlWallpadJNI(bOpen)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public boolean setMacAddr(String MACAddr) {
- try {
- ctrlWallpadJNI(true);
- SetMacAddr(0xFB01, MACAddr);
- ctrlWallpadJNI(false);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setMacAddr(MACAddr)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- // IHN-1020B-A2 Board Revision Check
- public int getBoardRevision() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_GET_BOARD_REVISION, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[getBoardRevision] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getBoardRevision()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Set speaker gain (Lobby, Guard)
- // param - int nValue : Speaker gain
- // return - int : -1 (fail), otherwise(success)
- int MIN_VOLUME = 0;
- int MAX_VOLUME = 79;
- public int setSpeakerGain(int nValue) {
- try {
- LOG_INFO("[setSpeakerGain] nValue = " + nValue);
- if (nValue < MIN_VOLUME) nValue = MIN_VOLUME;
- else if (nValue > MAX_VOLUME) nValue = MAX_VOLUME;
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MONOOUT_SUB_GAIN_SET, nValue);
- ctrlWallpadJNI(false);
- LOG_INFO("[setSpeakerGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setSpeakerGain(nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Get speaker gain (Lobby, Guard)
- // return - int : -1 (fail), otherwise(success)
- public int getSpeakerGain() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MONOOUT_SUB_GAIN_GET, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[getSpeakerGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getSpeakerGain()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Set speaker gain (Wallpad)
- // param - int nValue : Speaker gain
- // return - int : -1 (fail), otherwise(success)
- int MIN_VOLUME_WALLPAD = 0;
- int MAX_VOLUME_WALLPAD = 32767;
- public int setWallPadSpeakerGain(int nValue) {
- try {
- LOG_INFO("[setWallPadSpeakerGain] nValue = " + nValue);
- if (nValue < MIN_VOLUME_WALLPAD) nValue = MIN_VOLUME_WALLPAD;
- else if (nValue > MAX_VOLUME_WALLPAD) nValue = MAX_VOLUME_WALLPAD;
- int nResult = -1;
- // TODO GPIO 확인 -> IOCTL_SPK_EQ_GAIN_SET 없으므로 if문 추가
- if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_SPK_EQ_GAIN_SET, nValue);
- ctrlWallpadJNI(false);
- LOG_INFO("[setWallPadSpeakerGain] nResult = " + nResult);
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setWallPadSpeakerGain(nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int setWallPadSpeakerDefaultGain() {
- try {
- LOG_INFO("[setWallPadSpeakerDefaultGain]");
- int nResult = -1;
- // TODO GPIO 확인 -> IOCTL_SPK_EQ_GAIN_SET 없으므로 if문 추가
- if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_SPK_EQ_GAIN_SET, 4096);
- ctrlWallpadJNI(false);
- LOG_INFO("[setWallPadSpeakerDefaultGain] nResult = " + nResult);
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setWallPadSpeakerDefaultGain()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Get speaker gain (Wallpad)
- // return - int : -1 (fail), otherwise(success)
- public int getWallPadSpeakerGain() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_SPK_EQ_GAIN_GET, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[getWallPadSpeakerGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getWallPadSpeakerGain()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Set MIC gain
- // param - int nValue : MIC gain
- // return - int : -1 (fail), otherwise(success)
- int MIN_MIC = 0;
- int MAX_MIC = 79;
- public int setMICGain(int nValue) {
- try {
- LOG_INFO("[setMICGain] nValue = " + nValue);
- if (nValue < MIN_MIC) nValue = MIN_MIC;
- else if (nValue > MAX_MIC) nValue = MAX_MIC;
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MIC_GAIN_SET, nValue);
- ctrlWallpadJNI(false);
- LOG_INFO("[setMICGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setMICGain(nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Get MIC gain
- // return - int : -1 (fail), otherwise(success)
- public int getMICGain() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MIC_GAIN_GET, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[getMICGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getMICGain()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Set Boost MIC gain
- // param - int nValue : MIC gain
- // return - int : -1 (fail), otherwise(success)
- int MIN_MIC_BOOST = 0;
- int MAX_MIC_BOOST = 7;
- public int setMICBoostGain(int nValue) {
- try {
- LOG_INFO("[setMICBoostGain] nValue = " + nValue);
- if (nValue < MIN_MIC_BOOST) nValue = MIN_MIC_BOOST;
- else if (nValue > MAX_MIC_BOOST) nValue = MAX_MIC_BOOST;
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MIC_BOOST_GAIN_SET, nValue);
- ctrlWallpadJNI(false);
- LOG_INFO("[setMICBoostGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setMICBoostGain(nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Get Boost MIC gain
- // return - int : -1 (fail), otherwise(success)
- public int getMICBoostGain() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MIC_BOOST_GAIN_GET, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[getMICBoostGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[getMICBoostGain] getMICGain()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Set Record MIC gain
- // param - int nValue : MIC gain
- // return - int : -1 (fail), otherwise(success)
- int MIN_MIC_RECORD = 0;
- int MAX_MIC_RECORD = 7;
- public int setMICRecordGain(int nValue) {
- try {
- LOG_INFO("[setMICRecordGain] nValue = " + nValue);
- if (nValue < MIN_MIC_RECORD) nValue = MIN_MIC_RECORD;
- else if (nValue > MAX_MIC_RECORD) nValue = MAX_MIC_RECORD;
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MIC_RECORD_GAIN_SET, nValue);
- ctrlWallpadJNI(false);
- LOG_INFO("[setMICRecordGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setMICRecordGain(nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // Get Record MIC gain
- // return - int : -1 (fail), otherwise(success)
- public int getMICRecordGain() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_MIC_RECORD_GAIN_GET, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[getMICRecordGain] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getMICRecordGain()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlWallPadCamPower(boolean bOn) {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- if (bOn) nResult = WpdInterfaceControl(IOCTL_WALLPADCAM_POWERONOFF, 1);
- else nResult = WpdInterfaceControl(IOCTL_WALLPADCAM_POWERONOFF, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[ctrlWallPadCamPower] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlWallPadCamPower(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlFrontCamPower(boolean bOn) {
- try {
- Log.d(TAG, "[ctrlFrontCamPower] bON: " + bOn);
- int nResult = -1;
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
- if (bOn) nResult = interfaceIGW200(IGW200CMD.FRONT_PWR_ON);
- else nResult = interfaceIGW200(IGW200CMD.FRONT_PWR_OFF);
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- if (bOn) nResult = interfaceIGW300(IGW300CMD.FRONT_PWR_ON);
- else nResult = interfaceIGW300(IGW300CMD.FRONT_PWR_OFF);
- } else {
- ctrlWallpadJNI(true);
- if (bOn) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_POWERONOFF, 1);
- else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_POWERONOFF, 0);
- ctrlWallpadJNI(false);
- ctrlRFFrontCamPolling(bOn);
- }
- LOG_INFO("[ctrlFrontCamPower] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlFrontCamPower(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlFrontCamBell(boolean bOn) {
- try {
- // (JEFF, 2016.10.31)
- // 가끔 띵동소리가 안나는 문제로 false인 경우를 막는다.
- // 파라미터가 뭔든간에 "IOCTL_FRONTCAM_BELL"만 호출하면 벨을 실행시키는 효과.
- // 결과적으로 "false"에도 벨을 울리도록 하는 거였음.
- // (JEFF, 2016.10.31)
- int nResult = -1;
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200) {
- if (bOn) nResult = interfaceIGW200(IGW200CMD.FRONT_BELL_ON);
- else nResult = interfaceIGW200(IGW200CMD.FRONT_BELL_OFF);
- } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- if (bOn) nResult = interfaceIGW300(IGW300CMD.FRONT_BELL_ON);
- else nResult = interfaceIGW300(IGW300CMD.FRONT_BELL_OFF);
- } else {
- if (!bOn) return 99;
- ctrlWallpadJNI(true);
- if (bOn) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_BELL, 1);
- else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_BELL, 0);
- ctrlWallpadJNI(false);
- }
- LOG_INFO("[ctrlFrontCamBell] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlFrontCamBell(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // V40, A20 전용 메소드
- public int ctrlFrontCamAudio(boolean bEnable) {
- try {
- int nResult = -1;
- if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) { // TODO V40만인지 V40_IGW300도인지 확인
- // TODO GPIO 확인 -> IOCTL_FRONTCAM_AUDIO : 메일에 없음
- // ctrlWallpadJNI(true);
- // if (bEnable) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 1);
- // else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 0);
- // ctrlWallpadJNI(false);
- } else if ((BOARDTYPE == BOARD_TYPE.A20_CMOS) || (BOARDTYPE == BOARD_TYPE.A20_CCD)) {
- ctrlWallpadJNI(true);
- if (bEnable) nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 1);
- else nResult = WpdInterfaceControl(IOCTL_FRONTCAM_AUDIO, 0);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[ctrlFrontCamAudio] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- LOG_INFO("[ctrlFrontCamAudio] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlFrontCamAudio(bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlAudioSwitch34118(boolean nWallpad) {
- try {
- Log.d(TAG, "[ctrlAudioSwitch34118] nWallpad: " + nWallpad);
- int nResult = -1;
- if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) { // TODO V40만인지 V40_IGW300도인지 확인
- ctrlWallpadJNI(true);
- if (nWallpad)
- nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 0); // 현관통화시 [W/P] MOIP통화시 [S/P]으로 패스
- else
- nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 1); // 현관통화시 [S/P] MOIP통화시 [W/P]로 패스
- ctrlWallpadJNI(false);
- } else if ((BOARDTYPE == BOARD_TYPE.A20_CMOS) || (BOARDTYPE == BOARD_TYPE.A20_CCD)) {
- ctrlWallpadJNI(true);
- if (nWallpad) nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 0);
- else nResult = WpdInterfaceControl(IOCTL_AUDIO_SWITCH_34118, 1);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[ctrlAudioSwitch34118] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- LOG_INFO("[ctrlAudioSwitch34118] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlAudioSwitch34118(bWallPad)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // V40 전용
- private Boolean setDTMFWrite(int nNo) {
- try {
- int nResult = -1;
- if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_DTMFOUT_TONE, nNo);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[setDTMFWrite] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- boolean bResult;
- if (nResult > 0) bResult = true;
- else bResult = false;
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setDTMFWrite(nNo)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public int ctrlLcdWakeUp() {
- try {
- sendLCDBacklightStatus(true);
- int nResult = -1;
- if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) {
- ctrlWallpadJNI(true);
- nResult = mV40IOIF.LcdWakeUp();
- ctrlWallpadJNI(false);
- } else if ((BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) || (BOARDTYPE == BOARD_TYPE.V40_NOUGAT)) {
- ctrlWallpadJNI(true);
- nResult = mV40IOIF_NOUGAT.LcdWakeUp();
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[ctrlLcdWakeUp] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlLcdWakeUp");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- /**
- * Edited by jeff (2020.06.22)
- * LCD 잔상 현장 복구/보호를 위해 실행되고 있는 LCD Keeper를 종료하기 위해, 통화 App이 실행되면서
- * backlight를 On하기 전에 이를 알리는 BR를 수신하여 LCD Keeper를 종료한다.
- * @param bOn
- */
- private void sendLCDBacklightStatus(boolean bOn) {
- try {
- Log.d(TAG,"[sendLCDBacklightStatus] bOn [" + bOn + "]");
- Intent mIntent = new Intent();
- if (bOn) mIntent.setAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_ON);
- else mIntent.setAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_OFF);
- mContext.sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendLCDBacklightStatus(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public int runRemoteUpdate() {
- try {
- int nResult = -1;
- Log.w(TAG, "[runRemoteUpdate] ========== UPDATE ==========");
- if ((BOARDTYPE == BOARD_TYPE.V40_IGW300) || (BOARDTYPE == BOARD_TYPE.V40)) {
- ctrlWallpadJNI(true);
- nResult = mV40IOIF.LiveUpdate();
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[runRemoteUpdate] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runRemoteUpdate");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int setDTMFOutDelayTime(byte nDelay) {
- try {
- int nResult = -1;
- if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- Log.d(TAG, "[setDTMFOutDelayTime] nDelay: " + String.format("0x%02X", nDelay));
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_DTMFOUT_DELAYTIME, nDelay);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[setDTMFOutDelayTime] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setDTMFOutDelayTime(int nDelay)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int setDTMFOutOnOff(boolean bON) {
- try {
- int nResult = -1;
- if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- ctrlWallpadJNI(true);
- if (bON) nResult = WpdInterfaceControl(IOCTL_DTMFOUT_ONOFF, 1);
- else nResult = WpdInterfaceControl(IOCTL_DTMFOUT_ONOFF, 0);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[setDTMFOutOnOff] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setDTMFOutOnOff(boolean bON)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int setDTMFInOnOff(boolean bON) {
- try {
- Log.d(TAG, "[setDTMFInOnOff] bON: " + bON);
- int nResult = -1;
- if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- ctrlWallpadJNI(true);
- if (bON) nResult = WpdInterfaceControl(IOCTL_DTMFIN_ONOFF, 1);
- else nResult = WpdInterfaceControl(IOCTL_DTMFIN_ONOFF, 0);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[Exception] setDTMFInOnOff(boolean bON)");
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setDTMFInOnOff");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int selectFrontCam(boolean bFrontCam) {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- // TODO 1,0 바꾸기 요청 후 수정
- if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- if (bFrontCam) nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 1);
- else nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 0);
- } else {
- if (bFrontCam) nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 0);
- else nResult = WpdInterfaceControl(IOCTL_CAMERA_SELECT, 1);
- }
- ctrlWallpadJNI(false);
- LOG_INFO("[selectFrontCam] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] selectFrontCam(boolean bFrontCam)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlCameraBrightness(int nValue) {
- try {
- int nResult = -1;
- // TODO GPIO 확인 -> IOCTL_CAMERA_SET_BRIGHTNESS 없으므로 if문 추가
- if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_CAMERA_SET_BRIGHTNESS, nValue);
- ctrlWallpadJNI(false);
- LOG_INFO("[ctrlCameraBrightness] nResult = " + nResult);
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlCameraBrightness(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlFrontCamContrast(int nValue) {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_CAMERA_SET_CONTRAST, nValue);
- ctrlWallpadJNI(false);
- LOG_INFO("[ctrlFrontCamContrast] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlFrontCamContrast(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlVideoSelectSubPhone(boolean bFront) {
- try {
- int nResult = -99;
- ctrlWallpadJNI(true);
- if (bFront) nResult = WpdInterfaceControl(IOCTL_VIDEOSELECT_SUBPHONE, 0);
- else nResult = WpdInterfaceControl(IOCTL_VIDEOSELECT_SUBPHONE, 1);
- ctrlWallpadJNI(false);
- LOG_INFO("[ctrlVideoSelectSubPhone] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlVideoSelectSubPhone(boolean bFront)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- public int openWirelessDoorlock() {
- try {
- int nResult = -99;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCTL_DOOR_LOCK_OPEN_REGIS, 1);
- ctrlWallpadJNI(false);
- LOG_INFO("[openWirelessDoorlock] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] openWirelessDoorlock()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- public int ctrlWallPadLED_Emergency(boolean bOn) {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- if (bOn) nResult = WpdInterfaceControl(IOCTL_BTNEMR_LEDONOFF, 0);
- else nResult = WpdInterfaceControl(IOCTL_BTNEMR_LEDONOFF, 1);
- ctrlWallpadJNI(false);
- LOG_INFO("[ctrlWallPadLED_Emergency] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlWallPadLED_Emergency(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlWallPadLED_Call(boolean bOn) {
- try {
- int nResult = -1;
- // TODO GPIO 확인 -> IOCTL_BTNCALL_LEDONOFF 없으므로 if문 추가
- if (BOARDTYPE != BOARD_TYPE.V40_IGW300) {
- ctrlWallpadJNI(true);
- if (bOn) nResult = WpdInterfaceControl(IOCTL_BTNCALL_LEDONOFF, 0);
- else nResult = WpdInterfaceControl(IOCTL_BTNCALL_LEDONOFF, 1);
- ctrlWallpadJNI(false);
- LOG_INFO("[ctrlWallPadLED_Call] nResult = " + nResult);
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlWallPadLED_Call(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public int ctrlWallPadLED_DoorOpen(boolean bOn) {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- if (bOn) nResult = WpdInterfaceControl(IOCTL_BTNOPEN_LEDONOFF, 0);
- else nResult = WpdInterfaceControl(IOCTL_BTNOPEN_LEDONOFF, 1);
- ctrlWallpadJNI(false);
- LOG_INFO("[ctrlWallPadLED_DoorOpen] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlWallPadLED_DoorOpen(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public boolean setEmergencyLEDOnOff(boolean bOn) {
- try {
- return mGLEINTERFACE.setEmerLedOnOff(bOn);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setEmergencyLEDOnOff(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean sendDTMF(int nNo) {
- try {
- if (BOARDTYPE == BOARD_TYPE.TCC8935_IGW200)
- return mGLEINTERFACE.setDTMFWrite(nNo);
- else if (BOARDTYPE == BOARD_TYPE.V40_IGW300)
- return setDTMFWrite(nNo);
- else {
- Log.w(TAG, "[sendDTMF] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendDTMF(int nNo)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public void resetPSTNModem() {
- try {
- sendHandlerMsgDelayed(HANDLERMSG.CX93021_RESET_HIGH, 0, 0, 0);
- sendHandlerMsgDelayed(HANDLERMSG.CX93021_RESET_LOW, 0, 0, 100);
- sendHandlerMsgDelayed(HANDLERMSG.CX93021_RESET_HIGH, 0, 0, 200);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] resetPSTNModem()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public int setProximitySensorLevel(int nLevel) {
- try {
- int nResult = -1;
- if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- ctrlWallpadJNI(true);
- nResult = mV40IOIF.WpdInterfaceControl(IOCTL_SET_PROXSEN_LEVEL, nLevel);
- ctrlWallpadJNI(false);
- Log.i(TAG, "[setProximitySensorLevel] nResult = " + nResult);
- return nResult;
- }
- else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- ctrlWallpadJNI(true);
- nResult = mV40IOIF_NOUGAT.WpdInterfaceControl(IOCTL_SET_PROXSEN_LEVEL, nLevel);
- ctrlWallpadJNI(false);
- Log.i(TAG, "[setProximitySensorLevel] nResult = " + nResult);
- return nResult;
- }
- else {
- Log.w(TAG, "[setProximitySensorLevel] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- return nResult;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setProximitySensorLevel(int nLevel)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- private int setPSTNResetLow() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCLT_CX93021_RESET, 0);
- ctrlWallpadJNI(false);
- LOG_INFO("[setPSTNResetLow] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setPSTNResetLow()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- private int setPSTNResetHigh() {
- try {
- int nResult = -1;
- ctrlWallpadJNI(true);
- nResult = WpdInterfaceControl(IOCLT_CX93021_RESET, 1);
- ctrlWallpadJNI(false);
- LOG_INFO("[setPSTNResetHigh] nResult = " + nResult);
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setPSTNResetHigh()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- private void ctrlRFFrontCamPolling(boolean bStop) {
- try {
- Log.i(TAG, "[ctrlRFFrontCamPolling] bStop [" + bStop + "]");
- if (mWallPadAPI != null) mWallPadAPI.SetDevService_DoorCamUseOnOff(bStop);
- else Log.w(TAG, "[ctrlRFFrontCamPolling] mWallPadAPI is null!!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlRFFrontCamPolling(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public final class HANDLERMSG {
- public final static int CX93021_RESET_LOW = 100;
- public final static int CX93021_RESET_HIGH = 110;
- }
- public Handler IOIFHandler = new Handler(Looper.getMainLooper()) {
- public void handleMessage(Message msg) {
- Log.d(TAG, "[handleMessage] IOIFHandler : what [" + msg.what + "], arg1 [" + msg.arg1 + "], arg2 [" + msg.arg2 + "]");
- switch (msg.what) {
- case HANDLERMSG.CX93021_RESET_LOW:
- setPSTNResetLow();
- break;
- case HANDLERMSG.CX93021_RESET_HIGH:
- setPSTNResetHigh();
- break;
- default:
- Log.d(TAG, "IOIFHandler : " + msg.what);
- break;
- }
- }
- };
- public void sendHandlerMsg(int what, int arg1, int arg2) {
- try {
- Log.d(TAG, "[sendHandlerMsg] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "]");
- Message HandleMsg = IOIFHandler.obtainMessage();
- HandleMsg.what = what;
- HandleMsg.arg1 = arg1;
- HandleMsg.arg2 = arg2;
- IOIFHandler.sendMessage(HandleMsg);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendHandlerMsg(msg)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void sendHandlerMsgDelayed(int what, int arg1, int arg2, long delay) {
- try {
- Log.d(TAG, "[sendHandlerMsgDelayed] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "], delay [" + delay + "]");
- Message HandleMsg = IOIFHandler.obtainMessage();
- HandleMsg.what = what;
- HandleMsg.arg1 = arg1;
- HandleMsg.arg2 = arg2;
- IOIFHandler.sendMessageDelayed(HandleMsg, delay);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendHandlerMsgDelayed(msg)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /*===============================================================================
- Added below codes by Jeff for IHN-1020GL Gateway (Jeff, 2018.01.25)
- ===============================================================================*/
- public int interfaceIGW200(int nCMD) {
- try {
- Log.i(TAG, "[interfaceIGW200] nCMD [" + nCMD + "]");
- switch (nCMD) {
- case IGW200CMD.FRONT_PWR_ON:
- // 현관카메라 전원 ON
- return IGW200_IOCtrl(IGW200dAPI.OUTPUT.DOOR_POWER, true);
- case IGW200CMD.FRONT_PWR_OFF:
- // 현관카메라 전원 OFF
- return IGW200_IOCtrl(IGW200dAPI.OUTPUT.DOOR_POWER, false);
- case IGW200CMD.FRONT_BELL_ON:
- // 현관카메라 호출음 출력
- return IGW200_IOCtrl(IGW200dAPI.OUTPUT.BELL_CONT, true);
- case IGW200CMD.FRONT_BELL_OFF:
- // 현관카메라 호출음 정지
- return IGW200_IOCtrl(IGW200dAPI.OUTPUT.BELL_CONT, false);
- case IGW200CMD.VIDEO_MOIP:
- // MoIP영상 선택
- return IGW200_IOCtrl(IGW200dAPI.OUTPUT.VIDEO_SEL, true);
- case IGW200CMD.VIDEO_FRONT:
- // 현관영상 선택
- return IGW200_IOCtrl(IGW200dAPI.OUTPUT.VIDEO_SEL, false);
- case IGW200CMD.AUDIO_OFF:
- // 모든 통화패스 OFF
- return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.OFF);
- case IGW200CMD.AUDIO_PSTN:
- // 국선통화 연결
- return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.WPAD_TEL);
- case IGW200CMD.AUDIO_FRONT_WALLPAD:
- // 현관통화 월패드 연결
- return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.WPAD_DOOR);
- case IGW200CMD.AUDIO_FRONT_SUBPHONE:
- // 현관통화 서브폰 연결
- return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.SUB_DOOR);
- case IGW200CMD.AUDIO_MOIP_SUBPHONE:
- // MoIP 통화 서브폰 연결
- return IGW200_CallPathCtrl(IGW200dAPI.TEL_PATH.MOIP_SUB);
- default:
- return -100;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -999;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] interfaceIGW200(int nCMD)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -999;
- }
- }
- public int IGW200_IOCtrl(byte hCMD, boolean bOnOff) {
- try {
- Log.d(TAG, "[IGW200_IOCtrl] hCMD [" + String.format("0x%02X", hCMD) + "], bOnOff [" + bOnOff + "]");
- if (mIGW200DAPI == null) {
- Log.w(TAG, "[IGW200_IOCtrl] mIGW200DAPI is null!!");
- return -1;
- }
- int nResult = mIGW200DAPI.ControlOutput(hCMD, bOnOff);
- if (nResult < 0) {
- Log.e(TAG, "[IGW200_IOCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW200DAPI.ErrorCode.ErrStr() + "]");
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -102;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] IGW200_IOCtrl(byte hCMD, boolean OnOff)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -102;
- }
- return 0;
- }
- /**
- * 통화채널 설정을 변경한다.
- *
- * @param hCallPath - (int) 변경할 체널패스 ( {@link IGW200dAPI.TEL_PATH} )
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- public int IGW200_CallPathCtrl(byte hCallPath) {
- try {
- Log.d(TAG, "[IGW200_CallPathCtrl] hCallPath [" + String.format("0x%02X", hCallPath) + "]");
- if (mIGW200DAPI == null) {
- Log.w(TAG, "[IGW200_CallPathCtrl] mIGW200DAPI is null!!");
- return -1;
- }
- int nResult = mIGW200DAPI.ControlTelPath(hCallPath);
- if (nResult < 0) {
- Log.e(TAG, "[IGW200_CallPathCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW200DAPI.ErrorCode.ErrStr() + "]");
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] IGW200_CallPathCtrl(byte hCallPath)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return 0;
- }
- private void startConnectIGW200API() {
- try {
- LOG("[startConnectIGW200API] ===== START =====");
- mConnectIGW200APIThread = new ConnectIGW200APIThread();
- mConnectIGW200APIThread.start();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] startConnectIGW200API()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void stopConnectIGW200API() {
- try {
- LOG("[stopConnectIGW200API] ===== START =====");
- if (mConnectIGW200APIThread != null) {
- mConnectIGW200APIThread = null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] stopConnectIGW200API()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- static long lConnectionPeriod = 0;
- // static int CONNECT_TIMEOUT = 1000 * 60; // 타임아웃 시간은 1분
- static int CONNECT_TIMEOUT = 1000; // 타임아웃 시간은 1초
- private ConnectIGW200APIThread mConnectIGW200APIThread;
- private class ConnectIGW200APIThread extends Thread {
- String strSendingDTMF = "";
- public ConnectIGW200APIThread() {
- LOG_INFO("[ConnectIGW200APIThread()] ===== START =====");
- }
- public void run() {
- try {
- LOG_INFO("[ConnectIGW200APIThread().run()] ===== START =====");
- lConnectionPeriod = System.currentTimeMillis() + CONNECT_TIMEOUT; // 타임아웃시간을 설정한다.
- while ((mIGW200DAPI == null) && (System.currentTimeMillis() < lConnectionPeriod)) {
- mIGW200DAPI = mWallPadAPI.Get_IGW200dController();
- if (mIGW200DAPI != null)
- Log.e(TAG, "[ConnectIGW200APIThread] mIGW200DAPI loading OK!!!!!!!");
- else Log.w(TAG, "[ConnectIGW200APIThread] mIGW200DAPI loading FAIL!!");
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- Log.e(TAG, "[InterruptedException] Thread.sleep(100)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ConnectIGW200APIThread.run()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
- /*===============================================================================
- IHN-D101 IGW300 Gateway
- ===============================================================================*/
- public int interfaceIGW300(int nCMD) {
- try {
- Log.i(TAG, "[interfaceIGW300] nCMD [" + nCMD + "]");
- switch (nCMD) {
- case IGW300CMD.FRONT_PWR_ON:
- // 현관카메라 전원 ON
- Log.d(TAG, "[interfaceIGW300] FRONT_PWR_ON");
- return IGW300_IOCtrl(IGW300API.OUTPUT.DOOR_POWER, true);
- case IGW300CMD.FRONT_PWR_OFF:
- // 현관카메라 전원 OFF
- Log.d(TAG, "[interfaceIGW300] FRONT_PWR_OFF");
- return IGW300_IOCtrl(IGW300API.OUTPUT.DOOR_POWER, false);
- case IGW300CMD.FRONT_BELL_ON:
- // 현관카메라 호출음 출력
- Log.d(TAG, "[interfaceIGW300] FRONT_BELL_ON");
- return IGW300_IOCtrl(IGW300API.OUTPUT.BELL_CONT, true);
- case IGW300CMD.FRONT_BELL_OFF:
- // 현관카메라 호출음 정지
- Log.d(TAG, "[interfaceIGW300] FRONT_BELL_OFF");
- return IGW300_IOCtrl(IGW300API.OUTPUT.BELL_CONT, false);
- case IGW300CMD.VIDEO_MOIP:
- // MoIP영상 선택
- Log.d(TAG, "[interfaceIGW300] VIDEO_MOIP");
- return IGW300_IOCtrl(IGW300API.OUTPUT.VIDEO_SEL, true);
- case IGW300CMD.VIDEO_FRONT:
- // 현관영상 선택
- Log.d(TAG, "[interfaceIGW300] VIDEO_FRONT");
- return IGW300_IOCtrl(IGW300API.OUTPUT.VIDEO_SEL, false);
- // CONTROL CALL PATH -> Handler로 수정
- default:
- return -100;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -999;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] interfaceIGW300(int nCMD)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -999;
- }
- }
- public int IGW300_IOCtrl(byte hCMD, boolean bOnOff) {
- try {
- Log.d(TAG, "[IGW300_IOCtrl] hCMD [" + String.format("0x%02X", hCMD) + "], bOnOff [" + bOnOff + "]");
- if (mIGW300API == null) {
- Log.w(TAG, "[IGW300_IOCtrl] mIGW300API is null!!");
- return -1;
- }
- int nResult = mIGW300API.ControlOutput(hCMD, bOnOff);
- Log.d(TAG, "[IGW300_IOCtrl] nResult: " + nResult);
- if (nResult < 0) {
- Log.e(TAG, "[IGW300_IOCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW300API.ErrorCode.ErrStr() + "]");
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -102;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] IGW300_IOCtrl(byte hCMD, boolean OnOff)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -102;
- }
- return 0;
- }
- public int IGW300_CallPathCtrl(byte hCallPath) {
- try {
- Log.d(TAG, "[IGW300_CallPathCtrl] hCallPath [" + String.format("0x%02X", hCallPath) + "]");
- if (mIGW300API == null) {
- Log.w(TAG, "[IGW300_CallPathCtrl] mIGW300API is null!!");
- return -1;
- }
- int nResult = mIGW300API.ControlTelPath(hCallPath);
- if (nResult < 0) {
- Log.e(TAG, "[IGW300_CallPathCtrl] nResult [" + nResult + "], ErrorCode [" + mIGW300API.ErrorCode.ErrStr() + "]");
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] IGW300_CallPathCtrl(byte hCallPath)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return 0;
- }
- private void startConnectIGW300API() {
- try {
- LOG("[startConnectIGW300API]");
- mConnectIGW300APIThread = new ConnectIGW300APIThread();
- mConnectIGW300APIThread.start();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] startConnectIGW300API()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void stopConnectIGW300API() {
- try {
- LOG("[stopConnectIGW300API]");
- if (mConnectIGW300APIThread != null) {
- mConnectIGW300APIThread = null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] stopConnectIGW300API()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private ConnectIGW300APIThread mConnectIGW300APIThread;
- private class ConnectIGW300APIThread extends Thread {
- public ConnectIGW300APIThread() {
- LOG_INFO("============ [ConnectIGW300APIThread()] ============");
- }
- public void run() {
- try {
- LOG_INFO("[ConnectIGW300APIThread().run()]");
- lConnectionPeriod = System.currentTimeMillis() + CONNECT_TIMEOUT;
- while ((mIGW300API == null) && (System.currentTimeMillis() < lConnectionPeriod)) {
- mIGW300API = mWallPadAPI.Get_IGW300Controller();
- if (mIGW300API != null)
- Log.e(TAG, "[ConnectIGW300APIThread] mIGW300API loading OK!!!!!!!");
- else Log.w(TAG, "[ConnectIGW300APIThread] mIGW300API loading FAIL!!");
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- Log.e(TAG, "[InterruptedException] Thread.sleep(100)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ConnectIGW300APIThread.run()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
- public static final int VIDEO_INPUT_TYPE_DOOR = 0;
- public static final int VIDEO_INPUT_TYPE_CAMERA = 1;
- public static final int IOCTL_VIDEOINPUT_DOORCAMERA = 0xFE01; // 월패드 영상 입력 선택 제어
- public static final int IOCTL_CAMERA_POWERONOFF = 0xFF07; // 카메라 power on/off 제어
- // controll videoInput
- // 0: door, 1: camera
- public int videoInputControll(int type) {
- Log.d(TAG, "videoInputControll() type :" + type);
- int ret = -1;
- if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
- ctrlWallpadJNI(true);
- switch (type) {
- case VIDEO_INPUT_TYPE_DOOR:
- ret = WpdInterfaceControl(IOCTL_VIDEOINPUT_DOORCAMERA, type);
- break;
- case VIDEO_INPUT_TYPE_CAMERA:
- ret = WpdInterfaceControl(IOCTL_CAMERA_POWERONOFF, type); //전원
- ret = WpdInterfaceControl(IOCTL_VIDEOINPUT_DOORCAMERA, type);
- break;
- default:
- break;
- }
- ctrlWallpadJNI(false);
- }
- else {
- Log.d(TAG, "videoInputControll open success: ");
- ctrlWallpadJNI(false);
- switch (type) {
- case VIDEO_INPUT_TYPE_DOOR:
- case VIDEO_INPUT_TYPE_CAMERA:
- ret = WpdInterfaceControl(IOCTL_VIDEOINPUT_DOORCAMERA, type);
- break;
- default:
- break;
- }
- ctrlWallpadJNI(true);
- }
- return ret;
- }
- public boolean setCameraConfigure(int nValue) {
- try {
- Log.i(TAG, "[setCameraConfigure] nValue [" + nValue+ "]");
- if (Build.VERSION.SDK_INT > 23) {
- if (mV40IOIF_NOUGAT == null) {
- Log.w(TAG, "[setCameraConfigure] Not supported!! mV40IOIF_NOUGAT is null!!");
- return false;
- }
- mV40IOIF_NOUGAT.CameraSet(nValue);
- return true;
- }
- else {
- Log.w(TAG, "[setCameraConfigure] Not supported AOS Version !!! AOS Ver. [" + Build.VERSION.SDK_INT+ "]");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setCameraConfigure(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private int IOCTL_AUDIO_PATH_DOOR_WALLPAD = 0xFE02; // 월패드-현관
- private int IOCTL_AUDIO_PATH_NORMAL = 0xFE09; // 기본 오디오패스
- public void ctrlSetTalkPathDoor() {
- try {
- Log.d(TAG, "[ctrlSetTalkPathDoor]");
- if (BOARDTYPE == BOARD_TYPE.V40 || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- ctrlWallpadJNI(true);
- WpdInterfaceControl(IOCTL_AUDIO_PATH_DOOR_WALLPAD, 1);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[ctrlSetTalkPathDoor] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlSetTalkPathDoor()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void ctrlSetTalkPathNormal() {
- try {
- Log.d(TAG, "[ctrlSetTalkPathNormal]");
- if (BOARDTYPE == BOARD_TYPE.V40 || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- ctrlWallpadJNI(true);
- WpdInterfaceControl(IOCTL_AUDIO_PATH_NORMAL, 1);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[ctrlSetTalkPathDoor] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlSetTalkPathNormal()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setEmergencyType() {
- try {
- Log.d(TAG, "[setEmergencyType]");
- if (Version.getModelType() == MODEL_TYPE.IHN_1010GL || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I
- || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_2443ALT || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_6410ALT) {
- ctrlWallpadJNI(true);
- WpdInterfaceControl(IOCTL_EMR_TYPE, 1);
- ctrlWallpadJNI(false);
- } else {
- Log.w(TAG, "[setEmergencyType] Not supported MODEL_TYPE!! [" + Version.getModelType() + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setEmergencyType()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
|