123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842 |
- package kr.co.icontrols.wallpadaddservice;
- import android.Manifest;
- import android.annotation.SuppressLint;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.content.pm.PackageManager;
- import android.graphics.Bitmap;
- import android.graphics.BitmapFactory;
- import android.graphics.Color;
- import android.hardware.Camera;
- import android.media.MediaRecorder;
- import android.os.Build;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.Message;
- import androidx.core.app.ActivityCompat;
- import androidx.core.content.ContextCompat;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.KeyEvent;
- import android.view.MotionEvent;
- import android.view.SurfaceHolder;
- import android.view.SurfaceView;
- import android.view.View;
- import android.view.animation.AccelerateInterpolator;
- import android.view.animation.Animation;
- import android.view.animation.TranslateAnimation;
- import android.widget.Button;
- import android.widget.ExpandableListView;
- import android.widget.ImageView;
- import android.widget.RelativeLayout;
- import com.artncore.WallPadDataMgr.WallpadDeviceSet;
- import com.artncore.WallPadDataMgr.WallpadStatusData;
- import com.artncore.WallPadDataMgr.wallpaddbmgr;
- import com.artncore.commons.API_Menu;
- import com.artncore.commons.API_Menu.MenuListDataClass;
- import com.artncore.commons.define;
- import com.artncore.wallpadapi.Sdb_LivingRoomLightAPI;
- import com.artncore.wallpadapi.WallPadAPI;
- import com.techwin.neighbor.ipolis.PlayerSurfaceView;
- import com.util.LogUtil;
- import java.io.IOException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import kr.co.icontrols.v40ioctl.V40IF;
- import kr.co.icontrols.wallpadaddservice.declare.Common;
- import kr.co.icontrols.wallpadaddservice.declare.ID;
- import kr.co.icontrols.wallpadaddservice.screen.AutoPictureMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.AutoPictureSubShowScreen;
- import kr.co.icontrols.wallpadaddservice.screen.BandLocationListScreen;
- import kr.co.icontrols.wallpadaddservice.screen.BandLocationMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.CarGuestInfoScreen;
- import kr.co.icontrols.wallpadaddservice.screen.CarInfoMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.CarParkingAccessList;
- import kr.co.icontrols.wallpadaddservice.screen.CctvMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.ConfigNoiseLogMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.CostScreen;
- import kr.co.icontrols.wallpadaddservice.screen.ElecCarMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.LocalInfoScreen;
- import kr.co.icontrols.wallpadaddservice.screen.MemoMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.MemoMakeAudio;
- import kr.co.icontrols.wallpadaddservice.screen.MemoMakeDrawing;
- import kr.co.icontrols.wallpadaddservice.screen.MemoMakeVideo;
- import kr.co.icontrols.wallpadaddservice.screen.NoticeContentsScreen;
- import kr.co.icontrols.wallpadaddservice.screen.NoticeMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.RepairScreen;
- import kr.co.icontrols.wallpadaddservice.screen.SafeStreetLightMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.ScheduleMainScreen;
- import kr.co.icontrols.wallpadaddservice.screen.UCityScreen;
- import kr.co.icontrols.wallpadaddservice.screen.VoteScreen;
- import kr.co.icontrols.wallpadaddservice.screen.WeatherMainScreen;
- import kr.co.icontrols.wallpadaddservice.subwallpadscreen.WeatherScreen_SubWallPad;
- import kr.co.icontrols.wallpadsupport.Version;
- import kr.co.icontrols.wallpadsupport.WpadActivity;
- import kr.co.icontrols.wallpadsupport.WpadImageView;
- import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
- import kr.co.icontrols.wallpadsupport.WpadRelativeLayoutParams;
- import kr.co.icontrols.wallpadsupport.WpadScale;
- import kr.co.icontrols.wallpadsupport.WpadSound;
- import kr.co.icontrols.wallpadsupport.WpadSound.SND;
- import kr.co.icontrols.wallpadsupport.WpadTextView;
- import kr.co.icontrols.wallpadsupport.WpadUtil;
- public class MainActivity extends WpadActivity {
- private final static String TAG = "MainActivity";
- private final boolean DEBUG_LOG_ON = true;
- private void DebugLogOutput(String s) {
- if (DEBUG_LOG_ON) Log.d(TAG, s);
- }
- // =================================================================================================
- // [ Declaration ] region
- // =================================================================================================
- protected Context mContext = null;
- public Context getContext() {
- return mContext;
- }
- public static V40IF mV40IF = null;
- public static WpadSound mSound;
- private WallPadAPI wpapi = null;
- Sdb_LivingRoomLightAPI sdbLivingRoomLightAPI;
- private int OPERATION_MODE = Common.MODE;
- private WallpadStatusData wdb = null;
- // Layout
- private RelativeLayout AllLayout;
- private RelativeLayout TopLayout;
- private RelativeLayout MenuLayout;
- private RelativeLayout ScreenLayout;
- WpadImageView ScreenBackground;
- // Top
- private WpadImageView TopBackground;
- WpadTextView TopTitle;
- WpadImageView TopHomeBtn, TopBackBtn, TopMenuBtn, TopManualBtn;
- // Menu
- private WpadImageView MenuBackground;
- private WpadImageView MenuClose;
- private WpadTextView MenuTitle;
- private static ExpandableListView mListView;
- private Menu_AdptMain adptMain;
- private MenuListDataClass menuListDataClass;
- private Menu mMenu = null;
- private boolean MenuOpen = false;
- // PopupActivityRun
- private static boolean PopupActivityRun = false;
- public static boolean getPopupActivityRun() {
- return PopupActivityRun;
- }
- public static void setPopupActivityRun(boolean run) {
- PopupActivityRun = run;
- }
- // CurrentScreenId
- private int mCurrentScreenId = -1;
- private int mTempCurrentScreenId = -1;
- private static int mCurrentManualScreenId = -1;
- private static final int REQUEST_EXTERNAL_STORAGE = 100;
- private static final int REQUEST_ACCESS_COARSE_LOCATION = 101;
- public int nCardNum = 0; // 밴드위치인식 카드번호
- // Screen
- private NoticeMainScreen noticeMainScreen = null; // 공지사항
- private NoticeContentsScreen noticeContentsScreen = null;
- private WeatherMainScreen weatherMainScreen = null; // 날씨
- private WeatherScreen_SubWallPad weatherSubScreen = null; // 서브월패드 날씨
- private MemoMainScreen memoMainScreen = null; // 메모
- private MemoMakeDrawing memoMainDrawingScreen = null;
- private MemoMakeAudio memoMainAudioScreen = null;
- private MemoMakeVideo memoMainVideoScreen = null;
- private AutoPictureMainScreen autoPictureMainScreen = null; // 전자액자
- private AutoPictureSubShowScreen autoPictureSubShowScreen = null;
- private ScheduleMainScreen scheduleMainScreen = null; // 일정표
- private CctvMainScreen cctvMainScreen = null; // CCTV
- private CarInfoMainScreen carInfoMainScreen = null; // 주차확인
- private CarParkingAccessList carParkingAccessListScreen = null;
- private ElecCarMainScreen elecCarMainScreen = null; // 전기차충전
- private ConfigNoiseLogMainScreen configNoiseLogMainScreen = null;
- private CarGuestInfoScreen carGuestInfoScreen = null; // 방문객 차량등록
- private BandLocationMainScreen bandLocationMainScreen = null; // 위치확인 (단지지도)
- private BandLocationListScreen bandLocationListScreen = null; // 위치확인 (내역)
- private SafeStreetLightMainScreen safeStreetLightMainScreen = null; // 안전가로등
- private RepairScreen repairScreen = null; // 보수신청
- private VoteScreen voteScreen = null; // 주민투표
- private LocalInfoScreen localInfoScreen = null; // 지역정보
- private CostScreen costScreen = null; // 관리비조회
- private UCityScreen uCityScreen = null; // u-city
- /* ================================================================================================
- * [ Activity Life Cycle ] region
- ================================================================================================ */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- Log.i(TAG, "[START - MainActivity]");
- super.onCreate(savedInstanceState);
- // @ AutoScale 설정
- WpadScale.setAutoScale(true);
- super.AppVersionLogOut();
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : Data Create");
- PopupActivityRun = false;
- ManualActivityRun = false;
- mContext = this;
- mSound = new WpadSound(this);
- mV40IF = new V40IF();
- // 2. 자동 종료 셋팅
- DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
- if (Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
- // 3. API 호출
- DebugLogOutput("[Create] - Step3 : API Call");
- if (OPERATION_MODE == Common.MODE_NORMAL) {
- Log.d(TAG, "OperationMode = MODE_NORMAL");
- try {
- wpapi = new WallPadAPI(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] - new WallPadAPI : " + e);
- }
- } else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- Log.d(TAG, "OperationMode = MODE_BUSINESS_SAMPLE");
- }
- try {
- wdb = new WallpadStatusData(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e);
- }
- // 4. Layout registration
- DebugLogOutput("[Create] - Step4 : Layout registration");
- // 4-1. mainLayout
- AllLayout = new RelativeLayout(this);
- RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
- AllLayout.setLayoutParams(params);
- AllLayout.setId(ID.main.layout.ALL);
- super.setAllLayoutRegistration(AllLayout);
- // 4-2. TopLayout
- TopLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, TopLayout, 1280, 110, 0, 0, ID.main.layout.TOP);
- // 4-4. ScreenLayout
- ScreenLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, ScreenLayout, 1280, 690, 0, 110, ID.main.layout.SCREEN);
- ScreenBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.main.image.BACKGROUND);
- ViewRegistration(ScreenLayout, ScreenBackground, 0, 0);
- // 5. Top Menu - ImageView registration
- DebugLogOutput("[Create] - Step5 : Top Menu - ImageView registration");
- TopBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 110, R.drawable.bg_topbar, 0, ID.top.image.BACKGROUND);
- ViewRegistration(TopLayout, TopBackground, 0, 0);
- TopTitle = new WpadTextView(this, false, 247 + 50, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.top.text.TITLE);
- ViewRegistration(TopLayout, TopTitle, 133, 15);
- TopHomeBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_home_normal, R.drawable.topbar_icon_home_pressed, ID.top.button.HOME);
- ViewRegistration(TopLayout, TopHomeBtn, 1145, 0);
- TopBackBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.top.button.BACK);
- ViewRegistration(TopLayout, TopBackBtn, 1019, 0);
- setTopBackBtnVisible(false);
- TopMenuBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_menu_normal, R.drawable.topbar_icon_menu_pressed, ID.top.button.MENU);
- ViewRegistration(TopLayout, TopMenuBtn, 0, 0);
- TopManualBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_manual_normal, R.drawable.topbar_icon_manual_pressed, ID.top.button.MANUAL);
- setManualBtnVisible(getManualUse(), 1019);
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(mContext);
- int noiseUse = wallpadDeviceSet.Get_NoiseSensor_Use();
- int cctvUse = wallpadDeviceSet.GetDeviceSetted("CCTV");
- int parkingUse = wallpadDeviceSet.GetDeviceSetted("주차확인");
- int carGuestUse = wallpadDeviceSet.GetDeviceSetted("방문객차량등록");
- int bandLocUse = wallpadDeviceSet.GetDeviceSetted("밴드위치확인");
- int elecCarUse = wallpadDeviceSet.GetDeviceSetted("전기차충전");
- int safeStreetLightUse = wallpadDeviceSet.GetDeviceSetted("안전가로등");
- boolean bNonInternetUse = wallpadDeviceSet.Get_NonInternetSupportUse();
- wallpadDeviceSet.closeDB();
- Log.d(TAG, "[onCreate] noiseUse [" + noiseUse + "], cctvUse [" + cctvUse + "], parkingUse [" + parkingUse + "], carGuestUse [" + carGuestUse + "], " +
- "bandLocUse [" + bandLocUse + "], elecCarUse [" + elecCarUse + "], bNonInternetUse [" + bNonInternetUse + "], safeStreetLightUse [" + safeStreetLightUse + "]");
- // 6. Menu Loading
- DebugLogOutput("[Create] - Step6 : Menu Loading");
- wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
- WallpadDBMGR.DeleteMenuList();
- ArrayList<ArrayList<Integer>> mGroupList = new ArrayList<ArrayList<Integer>>();
- ArrayList<Integer> mChildList = new ArrayList<Integer>();
- if (bNonInternetUse) {
- // 인터넷 미지원
- mChildList.add(API_Menu.SubMenuAddService.Notice);
- mChildList.add(API_Menu.SubMenuAddService.Memo);
- } else {
- // 인터넷 지원
- mChildList.add(API_Menu.SubMenuAddService.Notice);
- mChildList.add(API_Menu.SubMenuAddService.Weather);
- mChildList.add(API_Menu.SubMenuAddService.Memo);
- mChildList.add(API_Menu.SubMenuAddService.AutoPicture);
- mChildList.add(API_Menu.SubMenuAddService.Schedule);
- if (cctvUse == WallpadDeviceSet.DEV_DATA_ENABLE || cctvUse == WallpadDeviceSet.DEV_DATA_NONE) {
- mChildList.add(API_Menu.SubMenuAddService.Cctv);
- }
- if (parkingUse == WallpadDeviceSet.DEV_DATA_ENABLE || parkingUse == WallpadDeviceSet.DEV_DATA_NONE) {
- mChildList.add(API_Menu.SubMenuAddService.Parking);
- }
- mChildList.add(API_Menu.SubMenuAddService.ParkingList);
- if (noiseUse == 1) {
- mChildList.add(API_Menu.SubMenuAddService.InterlayerNoiseHistory);
- }
- if (carGuestUse == WallpadDeviceSet.DEV_DATA_ENABLE) {
- Log.d(TAG, "[onCreate] ====== 방문객차량등록 ======");
- mChildList.add(API_Menu.SubMenuAddService.CarGuest);
- }
- if (bandLocUse == WallpadDeviceSet.DEV_DATA_ENABLE) {
- Log.d(TAG, "[onCreate] ====== 밴드위치확인 ======");
- mChildList.add(API_Menu.SubMenuAddService.BandLocation);
- }
- if (elecCarUse == WallpadDeviceSet.DEV_DATA_ENABLE) {
- mChildList.add(API_Menu.SubMenuAddService.ElecCar);
- }
- if (safeStreetLightUse == WallpadDeviceSet.DEV_DATA_ENABLE) {
- Log.d(TAG, "[onCreate] ====== 안전가로등 ======");
- mChildList.add(API_Menu.SubMenuAddService.SafeStreetLight);
- }
- }
- // mChildList.add(API_Menu.SubMenuAddService.Repair);
- // mChildList.add(API_Menu.SubMenuAddService.Vote);
- // mChildList.add(API_Menu.SubMenuAddService.LocalInfo);
- // mChildList.add(API_Menu.SubMenuAddService.Cost);
- // mChildList.add(API_Menu.SubMenuAddService.UCity);
- mGroupList.add(mChildList);
- WallpadDBMGR.SetMenuList(mGroupList);
- menuListDataClass = WallpadDBMGR.GetMenuList();
- WallpadDBMGR.closeDB();
- if (menuListDataClass == null) {
- Log.w(TAG, "[onCreate] menuListDataClass == null");
- menuListDataClass = LoadDefaultMenuList();
- }
- // 6-1. 메뉴 정보 가져옴 (메인화면에서 전달한 Intent 에서 가져온다.)
- mMenu = new Menu();
- mMenu = super.getIntentParsingMenu(getIntent());
- if (mMenu == null) {
- Log.w(TAG, "[onCreate] mMenu == null");
- DefaultMenuListSetting();
- }
- // 6-2. 메뉴 표시
- mTempCurrentScreenId = mMenu.getStartId();
- if (mTempCurrentScreenId == API_Menu.SubMenuAddService.Memo) {
- int nModelType = Version.getModelType();
- if (nModelType == Version.MODEL_TYPE.IHN_D101 || nModelType == Version.MODEL_TYPE.IHN_D101_I
- || nModelType == Version.MODEL_TYPE.IHN_D101K || nModelType == Version.MODEL_TYPE.IHN_D101K_I
- || nModelType == Version.MODEL_TYPE.IHN_D101_I_OCF) {
- // IHN-D101 메모화면일 경우 스마트폰 조명제어 사용여부 설정 제어하기 위함 (거실에너지미터 BT-Wifi 모듈이 마이크에 무선 노이즈를 발생시키므로 - 영상/음성 메모)
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- }
- else {
- setChangeScreen(mTempCurrentScreenId, false);
- }
- } else {
- if (mTempCurrentScreenId == API_Menu.SubMenuAddService.BandLocation) {
- Intent intent = getIntent();
- nCardNum = intent.getIntExtra("CARD_NUM", 0);
- Log.d(TAG, "[onCreate] nCardNum [" + nCardNum + "]");
- }
- setChangeScreen(mTempCurrentScreenId, false);
- }
- // 7. Draw
- DebugLogOutput("[Create] - Step7 : setContentView");
- setContentView(AllLayout);
- // 8. Window ReSize
- DebugLogOutput("[Create] - Step8 : Window ReSize");
- // 9. Check Permission
- DebugLogOutput("[Create] - Step9 : Permission Check");
- boolean hasPermission = (ContextCompat.checkSelfPermission(this,
- Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
- Log.d(TAG, "[onCreate] hasPermission: " + hasPermission);
- if (!hasPermission) {
- ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
- REQUEST_EXTERNAL_STORAGE);
- }
- //퍼미션 추가
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- hasPermission = (ContextCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED);
- Log.d(TAG, "[onCreate] hasPermission: " + hasPermission);
- if (!hasPermission) {
- ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},
- REQUEST_ACCESS_COARSE_LOCATION);
- }
- }
- reg_Receiver();
- // 폰트 TEST
- // Typeface fontType = Typeface.createFromAsset(this.getAssets(), "fonts/NotoSansCJKkr-Thin.otf");
- // Typeface fontType = Typeface.createFromAsset(this.getAssets(), "fonts/NanumGothicCoding.ttf");
- // TopTitle.setTypeface(fontType);
- }
- @Override
- protected void onResume() {
- DebugLogOutput("[onResume]");
- setAudioMemoPlayVol(false);
- super.onResume();
- if (wpapi != null) wpapi.Resume();
- }
- @Override
- protected void onPause() {
- DebugLogOutput("[onPause]");
- super.onPause();
- if (wpapi != null) wpapi.Pause();
- mediaStopRec();
- ReleaseSurface();
- }
- @Override
- protected void onDestroy() {
- DebugLogOutput("[onDestroy]");
- setChangeScreen(mCurrentScreenId, true);
- unregisterReceiver(mWallPadAlertBR);
- unregisterReceiver(mWallPadJogBR);
- mSound.Release();
- if (sdbLivingRoomLightAPI != null) {
- Log.d(TAG, "[onDestroy] sdbLivingRoomLightAPI.SetWifiModuleOnOff [TRUE]");
- sdbLivingRoomLightAPI.SetWifiModuleOnOff(true);
- }
- if (wdb != null) wdb.closeDB();
- if (mCameraOpenCheckHandler != null) {
- mCameraOpenCheckHandler.removeMessages(0);
- mCameraOpenCheckHandler.removeMessages(1);
- }
- if (mWallPadApiCheckHandler != null) {
- mWallPadApiCheckHandler.removeMessages(0);
- mWallPadApiCheckHandler.removeMessages(1);
- }
- super.setFinishTimerDestroy();
- super.onDestroy();
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- Log.d(TAG, "[onActivityResult]");
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode == RESULT_OK) {
- int screenId = data.getIntExtra("ChangeScreen", 0);
- Log.d(TAG, "ChangeScreen : " + screenId);
- setChangeScreen(screenId, false);
- }
- }
- @Override
- public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
- Log.d(TAG, "[onRequestPermissionsResult] requestCode: " + requestCode);
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- switch (requestCode) {
- case REQUEST_EXTERNAL_STORAGE: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- Log.d(TAG, "[onRequestPermissionsResult] PERMISSION_GRANTED");
- } else {
- Log.d(TAG, "[onRequestPermissionsResult] PERMISSION_NOT_GRANTED");
- }
- return;
- }
- case REQUEST_ACCESS_COARSE_LOCATION: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- Log.d(TAG, "[onRequestPermissionsResult] PERMISSION_GRANTED");
- } else {
- Log.d(TAG, "[onRequestPermissionsResult] PERMISSION_NOT_GRANTED");
- }
- return;
- }
- }
- }
- @SuppressLint("HandlerLeak")
- protected Handler mWallPadApiCheckHandler = new Handler() {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- if (wpapi != null) {
- if (wpapi.Check_Connect())
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- else mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- } else if (msg.what == 1) {
- Log.d(TAG, "[mWallPadApiCheckHandler] Finish!! sdbLivingRoomLightAPI is connected!!");
- setChangeScreen(mTempCurrentScreenId, false);
- sdbLivingRoomLightAPI = wpapi.Get_Sdb_LivingRoomLightAPI();
- }
- }
- };
- /* ================================================================================================
- * [BroadcastReceiver] Section
- ================================================================================================ */
- @Override
- protected void onBrReceive(Intent intent) {
- super.onBrReceive(intent);
- DebugLogOutput("[onBrReceive] Receive alert BR " + intent.getAction());
- }
- /* ================================================================================================
- * [Touch & Key Event] Section
- ================================================================================================ */
- @Override
- protected void onTouchEvent(View v, MotionEvent event) {
- super.onTouchEvent(v, event);
- int TargetId = v.getId();
- int MoveEvent = event.getAction();
- if (MoveEvent == MotionEvent.ACTION_UP) {
- if (TargetId == ID.top.button.HOME) {
- DebugLogOutput("onTouchEvent [HOME] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- Intent intent = new Intent();
- intent.putExtra("Finish_Kind", "HomeButton");
- setResult(RESULT_OK, intent);
- finish();
- } else if (TargetId == ID.top.button.BACK) {
- DebugLogOutput("onTouchEvent [BACK] BUTTON !!!");
- mSound.Play(SND.effect.TOUCH_LATCHED);
- if (mCurrentScreenId == ID.screen.MemoMakeDrawing || mCurrentScreenId == ID.screen.MemoMakeAudio || mCurrentScreenId == ID.screen.MemoMakeVideo) {
- setChangeScreen(API_Menu.SubMenuAddService.Memo, false);
- } else if (mCurrentScreenId == ID.screen.AutoPictureShowScreen) {
- setChangeScreen(API_Menu.SubMenuAddService.AutoPicture, false);
- } else if (mCurrentScreenId == ID.screen.NoticeContentsScreen) {
- setChangeScreen(API_Menu.SubMenuAddService.Notice, false);
- } else if (mCurrentScreenId == ID.screen.BandLocationListScreen) {
- setChangeScreen(API_Menu.SubMenuAddService.BandLocation, false);
- }
- } else if (TargetId == ID.top.button.MENU) {
- DebugLogOutput("onTouchEvent [MENU] BUTTON !!!");
- if (MenuOpen) {
- return;
- }
- mSound.Play(SND.effect.TOUCH_LATCHED);
- OpenMenuLayout();
- } else if (TargetId == ID.menu.button.CLOSE) {
- DebugLogOutput("onTouchEvent [CLOSE] BUTTON");
- if (MenuOpen) {
- mSound.Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- }
- } else if (TargetId == ID.top.button.MANUAL) {
- DebugLogOutput("onTouchEvent [MANUAL] BUTTON mCurrentScreenId [" + mCurrentScreenId + "]");
- mSound.Play(SND.effect.TOUCH_LATCHED);
- if (mCurrentScreenId == API_Menu.SubMenuAddService.Notice) {
- StartManual(ID.screen.ManualNoticeMainScreen);
- } else if (mCurrentScreenId == ID.screen.NoticeContentsScreen) {
- StartManual(ID.screen.ManualNoticeSubScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.Weather) {
- StartManual(ID.screen.ManualWeatherMainScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.Memo) {
- StartManual(ID.screen.ManualMemoMainScreen);
- } else if (mCurrentScreenId == ID.screen.MemoMakeDrawing) {
- StartManual(ID.screen.ManualDrawingMemoScreen);
- } else if (mCurrentScreenId == ID.screen.MemoMakeAudio) {
- StartManual(ID.screen.ManualAudioMemoScreen);
- } else if (mCurrentScreenId == ID.screen.MemoMakeVideo) {
- StartManual(ID.screen.ManualVideoMemoScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.AutoPicture) {
- StartManual(ID.screen.ManualAutoPictureMainScreen);
- } else if (mCurrentScreenId == ID.screen.AutoPictureShowScreen) {
- StartManual(ID.screen.ManualAutoPictureShowScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.Schedule) {
- StartManual(ID.screen.ManualScheduleMainScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.Cctv) {
- StartManual(ID.screen.ManualCCTVMainScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.ElecCar) {
- StartManual(ID.screen.ManualElecCarMainScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.Parking) {
- StartManual(ID.screen.ManualCarInfoMainScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.ParkingList) {
- StartManual(ID.screen.ManualCarInfoListScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.CarGuest) {
- StartManual(ID.screen.ManualCarGuestInfoScreen);
- } else if (mCurrentScreenId == API_Menu.SubMenuAddService.BandLocation) {
- StartManual(ID.screen.ManualBandLocationMainScreen);
- } else if (mCurrentScreenId == ID.screen.BandLocationListScreen) {
- StartManual(ID.screen.ManualBandLocationListScreen);
- } else if (mCurrentScreenId == ID.screen.SafeStreetLightMainScreen) {
- StartManual(ID.screen.ManualSafeStreetLightScreen);
- }
- }
- }
- }
- private static final int BTN_CALL_IHN1010 = 264;
- // H/W Key Event
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
- return super.onKeyDown(keyCode, event);
- }
- /* ================================================================================================
- * [TOP - Back] Section
- ================================================================================================ */
- public boolean setTopBackBtnVisible(boolean Enabled) {
- if (Enabled) {
- if (TopBackBtn.getVisibility() != View.VISIBLE) TopBackBtn.setVisibility(View.VISIBLE);
- TopBackBtn.bringToFront();
- } else {
- if (TopBackBtn.getVisibility() != View.INVISIBLE)
- TopBackBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- }
- public boolean setTopMenuBtnVisible(boolean Enabled) {
- if (Enabled) {
- if (TopMenuBtn.getVisibility() != View.VISIBLE) TopMenuBtn.setVisibility(View.VISIBLE);
- TopMenuBtn.bringToFront();
- } else {
- if (TopMenuBtn.getVisibility() != View.INVISIBLE)
- TopMenuBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- }
- public void setTopTitleText(String strText) {
- try {
- if (TopTitle != null)
- TopTitle.setText(strText);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setTopTitleText(String strText)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setTopHomeBtnStatus(boolean bEnable) {
- try {
- if (TopHomeBtn != null) {
- // Log.d(TAG, "[setTopHomeBtnStatus] bEnable [" + bEnable + "]");
- if (!bEnable)
- TopHomeBtn.setButtonEventOffEnable(R.drawable.topbar_icon_home_disabled);
- else TopHomeBtn.setButtonEventOffDisable();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setTopHomeBtnStatus(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setTopBackBtnStatus(boolean bEnable) {
- try {
- if (TopBackBtn != null) {
- // Log.d(TAG, "[setTopBackBtnStatus] bEnable [" + bEnable + "]");
- if (!bEnable)
- TopBackBtn.setButtonEventOffEnable(R.drawable.topbar_icon_back_disabled);
- else TopBackBtn.setButtonEventOffDisable();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setTopBackBtnStatus(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setTopMenuBtnStatus(boolean bEnable) {
- try {
- if (TopMenuBtn != null) {
- if (!bEnable)
- TopMenuBtn.setButtonEventOffEnable(R.drawable.topbar_icon_menu_disabled);
- else TopMenuBtn.setButtonEventOffDisable();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setTopMenuBtnStatus(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setTopManualBtnStatus(boolean bEnable) {
- try {
- if (TopManualBtn != null) {
- if (!bEnable)
- TopManualBtn.setButtonEventOffEnable(R.drawable.topbar_icon_manual_disabled);
- else TopManualBtn.setButtonEventOffDisable();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setTopManualBtnStatus(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /* ================================================================================================
- * [Popup Activity] Section
- ================================================================================================ */
- public boolean StartPopup(int ScreenId) {
- if (getPopupActivityRun()) {
- return ((WpadActivity) (PopupActivity.getContext())).ChangeScreen(ScreenId);
- } else {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- public boolean StartPopup(int ScreenId, Intent data) {
- if (getPopupActivityRun()) {
- return false;
- } else {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- intent.putExtra("PopupScreenDataIntent", data);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- /* ================================================================================================
- * [Manual Activity] Section
- ================================================================================================ */
- public static ManualActivity mManualActivity;
- private static boolean ManualActivityRun = false;
- public static boolean getManualActivityRun() {
- Log.d(TAG, "[getManualActivityRun] ManualActivityRun: " + ManualActivityRun);
- return ManualActivityRun;
- }
- public static void setManualActivityRun(boolean run) {
- ManualActivityRun = run;
- if (!ManualActivityRun) resetCurrentManualScreenID();
- }
- public boolean StartManual(int screenId) {
- Log.d(TAG, "[StartManual] screenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
- if (getManualActivityRun()) {
- mCurrentManualScreenId = screenId;
- return ((WpadActivity) (ManualActivity.getContext())).ChangeScreen(screenId);
- } else {
- if (mCurrentManualScreenId == screenId) return false;
- mCurrentManualScreenId = screenId;
- setManualActivityRun(true);
- Intent intent = new Intent(mContext, ManualActivity.class);
- intent.putExtra("ScreenId", screenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- public boolean getManualUse() {
- WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
- String[] DBinfo = devSet.GetSettingData("매뉴얼");
- devSet.closeDB();
- if (DBinfo != null) {
- if (DBinfo[1].indexOf("사용함") > 0) {
- Log.d(TAG, "[getManualUse] Use Manual");
- return true;
- } else {
- // 미사용
- Log.d(TAG, "[getManualUse] Not Use Manual [1]");
- return false;
- }
- } else {
- // 미사용
- Log.d(TAG, "[getManualUse] Not Use Manual [2]");
- return false;
- }
- }
- public void setManualBtnVisible(boolean bEnable, int marginLeft) {
- try {
- Log.d(TAG, "[setManualBtnVisible] bEnable [" + bEnable + "], marginLeft [" + marginLeft + "]");
- if (bEnable) TopManualBtn.setVisibility(View.VISIBLE);
- else TopManualBtn.setVisibility(View.INVISIBLE);
- TopLayout.removeView(TopManualBtn);
- ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void resetCurrentManualScreenID() {
- try {
- mCurrentManualScreenId = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] resetCurrentManualScreenID()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void finishManual(int screenId) {
- try {
- Log.d(TAG, "[finishManual] mCurrentManualScreenId [" + mCurrentManualScreenId +"], screenId [" + screenId +"]");
- if (screenId == ID.screen.Manual_All) FinishManualActivity();
- else {
- if (mCurrentManualScreenId != screenId) return;
- FinishManualActivity();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] finishManual(int screenId)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void FinishManualActivity() {
- Log.i(TAG, "[FinishManualActivity]");
- try {
- if (mManualActivity != null) {
- mCurrentManualScreenId = -1;
- mManualActivity.finish();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FinishManualActivity()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /* ================================================================================================
- * [Screen] Section
- ================================================================================================ */
- @Override
- protected boolean onChangeScreen(int nScreenId) {
- super.onChangeScreen(nScreenId);
- return setChangeScreen(nScreenId, false);
- }
- private boolean setChangeScreen(int nScreenId, boolean OnlyRemove) {
- DebugLogOutput("setChangeScreen - " + "CurrentSelectDeviceId : " + mCurrentScreenId
- + " / NextLayoutId : " + nScreenId + " / OnlyRemove : " + OnlyRemove);
- if (mCurrentScreenId > 0) {
- ScreenLayout.removeAllViews();
- super.setCurrentScreen(null);
- }
- if (OnlyRemove) return true;
- mCurrentScreenId = nScreenId;
- try {
- switch (nScreenId) {
- // Default Menu
- case API_Menu.SubMenuAddService.Notice: // 공지사항
- setTitleText(API_Menu.SubMenuAddService.Name_Notice);
- noticeMainScreen = new NoticeMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(noticeMainScreen);
- break;
- case ID.screen.NoticeContentsScreen: // sub - 공지사항 내용
- noticeContentsScreen = new NoticeContentsScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(noticeContentsScreen);
- break;
- case API_Menu.SubMenuAddService.Weather: // 날씨
- setTitleText(API_Menu.SubMenuAddService.Name_Weather);
- if (!getAsSubWallPad()) {
- // 메인월패드
- weatherMainScreen = new WeatherMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(weatherMainScreen);
- } else {
- // 서브월패드
- weatherSubScreen = new WeatherScreen_SubWallPad(this, ScreenLayout);
- super.setCurrentScreen(weatherSubScreen);
- }
- break;
- case API_Menu.SubMenuAddService.Memo: // 메모
- setTitleText(API_Menu.SubMenuAddService.Name_Memo);
- memoMainScreen = new MemoMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(memoMainScreen);
- break;
- case ID.screen.MemoMakeDrawing: // sub - 그림메모
- memoMainDrawingScreen = new MemoMakeDrawing(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(memoMainDrawingScreen);
- break;
- case ID.screen.MemoMakeAudio: // sub - 음성메모
- memoMainAudioScreen = new MemoMakeAudio(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(memoMainAudioScreen);
- break;
- case ID.screen.MemoMakeVideo: // sub - 영상메모
- memoMainVideoScreen = new MemoMakeVideo(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(memoMainVideoScreen);
- break;
- case API_Menu.SubMenuAddService.AutoPicture: // 전자액자
- setTitleText(API_Menu.SubMenuAddService.Name_AutoPicture);
- autoPictureMainScreen = new AutoPictureMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(autoPictureMainScreen);
- break;
- case ID.screen.AutoPictureShowScreen: // sub - 전자액자시작
- autoPictureSubShowScreen = new AutoPictureSubShowScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(autoPictureSubShowScreen);
- break;
- case API_Menu.SubMenuAddService.Schedule: // 일정표
- setTitleText(API_Menu.SubMenuAddService.Name_Schedule);
- scheduleMainScreen = new ScheduleMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(scheduleMainScreen);
- break;
- case API_Menu.SubMenuAddService.Cctv: // cctv
- setTitleText(API_Menu.SubMenuAddService.Name_Cctv);
- cctvMainScreen = new CctvMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(cctvMainScreen);
- break;
- case API_Menu.SubMenuAddService.Parking: // 주차확인
- setTitleText(API_Menu.SubMenuAddService.Name_Parking);
- carInfoMainScreen = new CarInfoMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(carInfoMainScreen);
- break;
- case API_Menu.SubMenuAddService.ParkingList: // 차량출입내역
- setTitleText(API_Menu.SubMenuAddService.Name_ParkingList);
- carParkingAccessListScreen = new CarParkingAccessList(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(carParkingAccessListScreen);
- break;
- case API_Menu.SubMenuAddService.ElecCar: // 전기차충전
- setTitleText(API_Menu.SubMenuAddService.Name_ElecCar);
- elecCarMainScreen = new ElecCarMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(elecCarMainScreen);
- break;
- // Additional Menu
- case ID.screen.RepairScreen: // 보수신청
- repairScreen = new RepairScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(repairScreen);
- break;
- case ID.screen.VoteScreen: // 주민투표
- voteScreen = new VoteScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(voteScreen);
- break;
- case ID.screen.LocalInfoScreen: // 지역정보
- localInfoScreen = new LocalInfoScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(localInfoScreen);
- break;
- case ID.screen.CostInfoScreen: // 관리비조회
- costScreen = new CostScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(costScreen);
- break;
- case ID.screen.UCityScreen: // U-City
- uCityScreen = new UCityScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(uCityScreen);
- break;
- case API_Menu.SubMenuAddService.InterlayerNoiseHistory: // 층간소음 내역
- setTitleText(API_Menu.SubMenuAddService.Name_NoiseLog);
- configNoiseLogMainScreen = new ConfigNoiseLogMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(configNoiseLogMainScreen);
- break;
- case API_Menu.SubMenuAddService.CarGuest: // 방문객 차량등록
- setTitleText(API_Menu.SubMenuAddService.Name_CarGuest);
- carGuestInfoScreen = new CarGuestInfoScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(carGuestInfoScreen);
- break;
- case API_Menu.SubMenuAddService.BandLocation: // 밴드위치확인
- setTitleText(API_Menu.SubMenuAddService.Name_BandLocation);
- bandLocationMainScreen = new BandLocationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(bandLocationMainScreen);
- break;
- case ID.screen.BandLocationListScreen:
- bandLocationListScreen = new BandLocationListScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(bandLocationListScreen);
- break;
- case API_Menu.SubMenuAddService.SafeStreetLight: // 안전가로등
- setTitleText(API_Menu.SubMenuAddService.Name_SafeStreetLight);
- safeStreetLightMainScreen = new SafeStreetLightMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(safeStreetLightMainScreen);
- break;
- default:
- Log.e(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
- mCurrentScreenId = -1;
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - setChangeScreen->Screen Create : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- return true;
- }
- private void setTitleText(String setText) {
- if (setText != null) TopTitle.setText(setText);
- }
- /* ================================================================================================
- * [Menu] Section
- ================================================================================================ */
- // Default 메뉴 리스트 설정
- private void DefaultMenuListSetting() {
- try {
- Log.d(TAG, "[DefaultMenuListSetting()]");
- mMenu = new Menu(7);
- wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
- WallpadDBMGR.DeleteMenuList();
- ArrayList<ArrayList<Integer>> mGroupList = new ArrayList<ArrayList<Integer>>();
- ArrayList<Integer> mChildList = new ArrayList<Integer>();
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(mContext);
- boolean bNonInternetUse = wallpadDeviceSet.Get_NonInternetSupportUse();
- wallpadDeviceSet.closeDB();
- if (bNonInternetUse) {
- // 인터넷 미지원
- mChildList.add(API_Menu.SubMenuAddService.Notice);
- mChildList.add(API_Menu.SubMenuAddService.Memo);
- } else {
- // 인터넷 지원
- mChildList.add(API_Menu.SubMenuAddService.Notice);
- mChildList.add(API_Menu.SubMenuAddService.Weather);
- mChildList.add(API_Menu.SubMenuAddService.Memo);
- mChildList.add(API_Menu.SubMenuAddService.AutoPicture);
- mChildList.add(API_Menu.SubMenuAddService.Schedule);
- }
- mGroupList.add(mChildList);
- WallpadDBMGR.SetMenuList(mGroupList);
- menuListDataClass = WallpadDBMGR.GetMenuList();
- WallpadDBMGR.closeDB();
- mMenu.StartId = API_Menu.SubMenuAddService.Notice;
- mMenu.Opiton = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] DefaultMenuSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 메뉴 레이아웃 생성
- private void OpenMenuLayout() {
- if (MenuOpen) {
- return;
- }
- if (menuListDataClass == null) {
- return;
- }
- //0. 현재 ID 및 리스트 불러오기
- String Title = API_Menu.GetGroupNameByID(API_Menu.SubMenuAddService.BASE);
- String TempChildName = null;
- int ChooseGroup = 0;
- int ChooseChild = 0;
- for (int i = 0; i < menuListDataClass.arrayGroup.size(); i++) {
- if (menuListDataClass.arrayGroup.get(i).equals(Title)) {
- ChooseGroup = i;
- break;
- }
- }
- for (int i = 0; i < menuListDataClass.idMappingTable.length; i++) {
- if (menuListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
- TempChildName = menuListDataClass.idMappingTable[i].Name;
- break;
- } else if ((ID.screen.MemoMakeDrawing == mCurrentScreenId) || (ID.screen.MemoMakeAudio == mCurrentScreenId) || (ID.screen.MemoMakeVideo == mCurrentScreenId)) {
- Title = API_Menu.SubMenuAddService.Name;
- TempChildName = API_Menu.SubMenuAddService.Name_Memo;
- break;
- } else if (ID.screen.NoticeContentsScreen == mCurrentScreenId) {
- Title = API_Menu.SubMenuAddService.Name;
- TempChildName = API_Menu.SubMenuAddService.Name_Notice;
- break;
- } else if (ID.screen.AutoPictureShowScreen == mCurrentScreenId) {
- Title = API_Menu.SubMenuAddService.Name;
- TempChildName = API_Menu.SubMenuAddService.Name_AutoPicture;
- break;
- } else if (ID.screen.BandLocationListScreen == mCurrentScreenId) {
- Title = API_Menu.SubMenuAddService.Name;
- TempChildName = API_Menu.SubMenuAddService.Name_BandLocation;
- } else if (ID.screen.SafeStreetLightMainScreen == mCurrentScreenId) {
- Title = API_Menu.SubMenuAddService.Name;
- TempChildName = API_Menu.SubMenuAddService.Name_SafeStreetLight;
- }
- }
- if (TempChildName == null) {
- Log.e(TAG, "[OpenMenuLayout] TempChildName == null");
- return;
- }
- for (int i = 0; i < menuListDataClass.arrayChild.get(Title).size(); i++) {
- if (menuListDataClass.arrayChild.get(Title).get(i).equals(TempChildName)) {
- ChooseChild = i;
- break;
- }
- }
- //1. 기존 화면 투명도 변경
- TopLayout.setAlpha(0.5f);
- ScreenLayout.setAlpha(0.5f);
- //2. Layout 생성 및 처리 이벤트 등록
- MenuLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, MenuLayout, 1280, 800, 0, 0, ID.main.layout.MENU);
- MenuLayout.setOnTouchListener(new Button.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_UP) {
- setFinishTimerReset();
- CloseMenuLayout();
- }
- return true;
- }
- });
- //3. 배경 이미지 생성 및 에니메이션 등록
- MenuBackground = new WpadImageView(this, TOUCH_KIND.BUTTON, 460, 800, R.drawable.bg_menu, R.drawable.bg_menu, ID.menu.image.BACKGROUND);
- TranslateAnimation anim = new TranslateAnimation(WpadScale.getWidth(-460), 0, 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- MenuLayout.setAnimation(anim);
- ViewRegistration(MenuLayout, MenuBackground, 0, 0);
- //4. 타이틀 등록
- MenuTitle = new WpadTextView(this, false, 247, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.top.text.TITLE);
- ViewRegistration(MenuLayout, MenuTitle, 133, 15);
- MenuTitle.setText(Title);
- //5. 종료 버튼 등록
- MenuClose = new WpadImageView(this, TOUCH_KIND.BUTTON, 80, 80, R.drawable.topbar_icon_close_normal, R.drawable.topbar_icon_close_pressed, ID.menu.button.CLOSE);
- MenuClose.setTouchDelayMs(1000);
- ViewRegistration(MenuLayout, MenuClose, 380, 15);
- //6. 리스트뷰 초기화 및 등록
- mListView = new ExpandableListView(this);
- ExpandableListView.LayoutParams params = new ExpandableListView.LayoutParams(WpadScale.getWidth(460), WpadScale.getHeight(690));
- mListView.setLayoutParams(params);
- mListView.setX(WpadScale.getWidth(0));
- mListView.setY(WpadScale.getHeight(112));
- mListView.setBackgroundColor(Color.BLACK);
- mListView.setId(ID.menu.view.LISTVIEW);
- mListView.setGroupIndicator(null);
- mListView.setDividerHeight(0);
- mListView.setDivider(null);
- mListView.setFocusable(true);
- mListView.setSmoothScrollbarEnabled(true);
- mListView.setTranscriptMode(android.widget.AbsListView.TRANSCRIPT_MODE_DISABLED);
- mListView.setScrollbarFadingEnabled(true);
- MenuLayout.addView(mListView);
- adptMain = new Menu_AdptMain(this, menuListDataClass.arrayGroup, menuListDataClass.arrayChild, ChooseGroup, ChooseChild);
- mListView.setAdapter(adptMain);
- //7. 선택된 그룹 열기
- mListView.setSelectedGroup(ChooseGroup);
- mListView.expandGroup(ChooseGroup);
- // 8. 리스트뷰 터치 이벤트 등록
- mListView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if ((event.getAction() == MotionEvent.ACTION_DOWN) ||
- (event.getAction() == MotionEvent.ACTION_UP)) {
- WpadActivity.setFinishTimerReset();
- }
- return false;
- }
- });
- // 9. 그룹 터치 이벤트 등록
- mListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
- @Override
- public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- // 10. 차일드 터치 이벤트 등록
- mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
- @Override
- public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- // 11. 그룹 열리는 경우 이벤트
- mListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
- @Override
- public void onGroupExpand(int groupPosition) {
- mSound.Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 12. 그룹 닫히는 경우 이벤트
- mListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
- @Override
- public void onGroupCollapse(int groupPosition) {
- mSound.Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 13. MenuOpen True 설정
- MenuOpen = true;
- }
- // 메뉴 layout 닫힘 처리
- private void CloseMenuLayout() {
- if (!MenuOpen) {
- return;
- }
- TranslateAnimation anim = new TranslateAnimation(0, WpadScale.getWidth(-460), 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- anim.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
- MenuOpen = false;
- }
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
- @Override
- public void onAnimationEnd(Animation animation) {
- AllLayout.removeView(MenuLayout);
- TopLayout.setAlpha(1.0f);
- ScreenLayout.setAlpha(1.0f);
- }
- });
- MenuLayout.startAnimation(anim);
- }
- // 메뉴 그룹 터치시 처리 (Menu_AdptMain에서 호출)
- public static void SetListViewGroupExpand_Collapse(int GroupId, boolean ExpandEnable) {
- if (ExpandEnable) {
- mListView.expandGroup(GroupId);
- } else {
- mListView.collapseGroup(GroupId);
- }
- }
- // Menu정보가 DB에 없을 경우 불러올 스크린 로딩
- private MenuListDataClass LoadDefaultMenuList() {
- MenuListDataClass Temp_menuListDataClass = new MenuListDataClass();
- Temp_menuListDataClass.SetArrayGroup(API_Menu.SubMenuAddService.Name);
- ArrayList<String> arrayList = new ArrayList<String>();
- int ChildCount = 0;
- //[수정필요]
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
- arrayList.add(API_Menu.SubMenuAddService.Name_Schedule);
- ChildCount++;
- Temp_menuListDataClass.SetArrayChild(API_Menu.SubMenuAddService.Name, arrayList);
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
- Temp_menuListDataClass.idMappingTable = new MenuListDataClass.ChildIDMapping[ChildCount];
- for (int i = 0; i < ChildCount; i++) {
- Temp_menuListDataClass.idMappingTable[i] = new MenuListDataClass.ChildIDMapping();
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 Id를 임의로 입력(시작)
- if (arrayList.get(i).equals(API_Menu.SubMenuAddService.Name_Schedule)) {
- Temp_menuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuAddService.Schedule;
- Temp_menuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuAddService.Name_Schedule;
- }
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 Id를 임의로 입력(끝)
- }
- return Temp_menuListDataClass;
- }
- /**
- * Menu Event intent filter 등록
- **/
- private void reg_Receiver() {
- try {
- IntentFilter filter = new IntentFilter();
- filter.addAction("MENU_EVENT");
- registerReceiver(mWallPadAlertBR, filter);
- filter = new IntentFilter();
- filter.addAction(define.NOTIFY_DAIL);
- filter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
- registerReceiver(mWallPadJogBR, filter);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] reg_Receiver");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 조그버튼 입력 받을 시 처리
- **/
- BroadcastReceiver mWallPadJogBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- WpadActivity.setFinishTimerReset();
- }
- };
- // 메뉴에서 버튼 터치 처리
- BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- int groupPosition = intent.getIntExtra("groupPosition", -1);
- int childPosition = intent.getIntExtra("childPosition", -1);
- Log.i(TAG, "groupPosition :" + groupPosition + ", childPosition :" + childPosition);
- if ((groupPosition >= 0) && (childPosition >= 0)) {
- if (MenuOpen) {
- mSound.Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- if (menuListDataClass == null) {
- return;
- }
- String childName = menuListDataClass.arrayChild.get(menuListDataClass.arrayGroup.get(groupPosition)).get(childPosition);
- for (int i = 0; i < menuListDataClass.idMappingTable.length; i++) {
- if (menuListDataClass.idMappingTable[i].Name.equals(childName)) {
- API_Menu api_Menu = new API_Menu();
- int TempId = api_Menu.GetMyGroupID(getApplicationContext().getPackageName());
- int ChildId = menuListDataClass.idMappingTable[i].Id;
- int ChildGroupId = (ChildId / 1000) * 1000;
- Log.i(TAG, "Child Id :" + ChildId);
- if (TempId == 0) {
- return;
- }
- if (ChildGroupId == TempId) {
- boolean result = setChangeScreen(ChildId, false);
- if (!result) {
- setChangeScreen(mMenu.getStartId(), false);
- }
- WpadActivity.setFinishTimerReset();
- } else {
- //외부 앱 호출 후, 본 APP Finish 필요
- api_Menu.startSubScreenActivity(getApplicationContext(),
- menuListDataClass.idMappingTable[i].Id, API_Menu.MENU_START_OPTION_1, api_Menu.GetAPK_Name_ByID(ChildGroupId));
- Intent mIntent = new Intent();
- mIntent.putExtra("Finish_Kind", "HomeButton");
- MainActivity.this.setResult(RESULT_OK, mIntent);
- finish();
- }
- break;
- }
- }
- }
- }
- }
- };
- // 영상
- private MediaRecorder m_mediaRecorder;
- private final String VIDEO_TEMP_PATH = define.BESTIN_LOCATION + "VideoRecorded.mp4";
- private SurfaceHolder holder;
- private SurfaceView surface;
- public PlayerSurfaceView getTechWinSurfaceView() {
- PlayerSurfaceView mPlayerSurfaceView;
- mPlayerSurfaceView = (PlayerSurfaceView) findViewById(R.id.PlayerView);
- return mPlayerSurfaceView;
- }
- Camera wpCamera = null;
- public void mediaSurface() {
- Log.d(TAG, "[mediaSurface]");
- try {
- if (surface != null) {
- Log.v(TAG, "[mediaSurface] surface isn't null");
- surface.getHolder().removeCallback(wpVideoCallback);
- ScreenLayout.removeView(surface);
- }
- surface = new SurfaceView(this);
- holder = surface.getHolder();
- WpadRelativeLayoutParams params = new WpadRelativeLayoutParams(720, 540);
- params.setMargins(Common.ImgPosition.GetX(95), Common.ImgPosition.GetY(112), 0, 0);
- ScreenLayout.addView(surface, params);
- surface.getHolder().addCallback(wpVideoCallback);
- surface.setZOrderOnTop(true);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] mediaSurface()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private SurfaceHolder.Callback wpVideoCallback = new SurfaceHolder.Callback() {
- @Override
- public void surfaceCreated(SurfaceHolder holder) {
- Log.d(TAG, "[wpVideoCallback.surfaceCreated]");
- if (mV40IF != null) mV40IF.ctrlWallPadCamPower(true);
- try {
- boolean bAOS7 = false;
- if (Build.VERSION.SDK_INT > 23) bAOS7 = true;
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101) {
- Log.d(TAG, "[openCamera] Build.VERSION.SDK_INT [" + Build.VERSION.SDK_INT + "], bAOS7 [" + bAOS7 + "]");
- if (bAOS7) {
- // AOS 7.1.1
- wpCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT); // 확인완료 (JEFF, 2020.09.02)
- }
- else {
- // AOS 6.0
- wpCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- }
- }
- else {
- if (bAOS7) {
- /**
- * 확인완료 (JEFF, 2020.09.02)
- * IHN-1020B-I, IHN-D101-I, IHN-1010-I, IHN-HS101-I
- */
- // AOS 7.1.1
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_1020B_I && !getCompareBSPVersion("2020.09.08")) wpCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- else if (Version.getModelType() == Version.MODEL_TYPE.IHN_HS101_I && !getCompareBSPVersion("2020.06.11")) wpCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- else wpCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- }
- else {
- /**
- * 확인완료 (JEFF, 2020.09.11)
- * IHN-1010, IHN-HS101
- */
- // AOS 6.0
- wpCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK); // 확인완료 (JEFF, 2020.09.02)
- }
- }
- Camera.Parameters params = wpCamera.getParameters();
- params.setPictureSize(640, 480);
- wpCamera.setParameters(params);
- wpCamera.setPreviewDisplay(holder);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] wpVideoCallback.surfaceCreated()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- Log.d(TAG, "[wpVideoCallback.surfaceChanged]");
- wpCamera.startPreview();
- }
- @Override
- public void surfaceDestroyed(SurfaceHolder holder) {
- Log.d(TAG, "[wpVideoCallback.surfaceDestroyed]");
- if (mV40IF != null) mV40IF.ctrlWallPadCamPower(false);
- if (wpCamera != null) {
- wpCamera.stopPreview();
- wpCamera.release();
- wpCamera = null;
- }
- }
- };
- public boolean getSmartIoTCameraUsage() {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(this.getApplicationContext());
- try {
- if (mWallpadDeviceSet != null) {
- int[] anFrontCameraType = mWallpadDeviceSet.Get_RFDoorCAM_Info(); // 현관카메라 종류
- mWallpadDeviceSet.closeDB();
- // 현관카메라 종류
- if (anFrontCameraType != null) {
- if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART)) return true;
- else return false;
- }
- else {
- Log.w(TAG, "[getSmartIoTCameraUsage] anFrontCameraType is null!!");
- return false;
- }
- }
- else {
- Log.w(TAG, "[getSmartIoTCameraUsage] mWallpadDeviceSet is null!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getSmartIoTCameraUsage()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadDeviceSet.closeDB();
- return false;
- }
- public void getV40MicGain() {
- try {
- Log.d(TAG, "[getV40MicGain]");
- int nModelType = Version.getModelType();
- if (nModelType == Version.MODEL_TYPE.IHN_D101 || nModelType == Version.MODEL_TYPE.IHN_D101_I
- || nModelType == Version.MODEL_TYPE.IHN_D101K || nModelType == Version.MODEL_TYPE.IHN_D101K_I
- || nModelType == Version.MODEL_TYPE.IHN_1010GL || nModelType == Version.MODEL_TYPE.IHN_1010GL_I
- || nModelType == Version.MODEL_TYPE.IHN_1010GL_I_2443ALT || nModelType == Version.MODEL_TYPE.IHN_1010GL_I_6410ALT
- || nModelType == Version.MODEL_TYPE.IHN_D101_I_OCF) {
- if (mV40IF != null) Log.d(TAG, "[getV40MicGain] getMICGain() [" + mV40IF.getMICGain() + "]");
- } else Log.w(TAG, "[getV40MicGain] Not Supported MODEL!! MODEL_TYPE [" + nModelType + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getV40MicGain()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setV40MicGain(int nValue) {
- try {
- Log.d(TAG, "[setV40MicGain] nValue [" + nValue + "]");
- int nModelType = Version.getModelType();
- if (nModelType == Version.MODEL_TYPE.IHN_D101 || nModelType == Version.MODEL_TYPE.IHN_D101_I
- || nModelType == Version.MODEL_TYPE.IHN_D101K || nModelType == Version.MODEL_TYPE.IHN_D101K_I
- || nModelType == Version.MODEL_TYPE.IHN_1010GL || nModelType == Version.MODEL_TYPE.IHN_1010GL_I
- || nModelType == Version.MODEL_TYPE.IHN_1010GL_I_2443ALT || nModelType == Version.MODEL_TYPE.IHN_1010GL_I_6410ALT
- || nModelType == Version.MODEL_TYPE.IHN_D101_I_OCF) {
- if (mV40IF != null) mV40IF.setMICGain(nValue);
- } else Log.w(TAG, "[setV40MicGain] Not Supported MODEL!! MODEL_TYPE [" + nModelType + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40MicGain(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void mediaStartRecording() {
- try {
- if (m_mediaRecorder != null) {
- Log.d(TAG, "[mediaStartRecording] m_mediaRecorder isn't null!");
- m_mediaRecorder.stop();
- m_mediaRecorder.reset();
- m_mediaRecorder.release();
- m_mediaRecorder = null;
- }
- m_mediaRecorder = new MediaRecorder();
- Log.d(TAG, "[mediaStartRecording] ====== setAudioSource =====");
- mCameraOpenCheckHandler.sendEmptyMessage(0);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Throwable t) {
- //t.printStackTrace();
- LogUtil.errorLogInfo("", TAG, t);
- Log.w("printStackTrace : ", t);
- }
- }
- public void mediaStopRec() {
- if (m_mediaRecorder != null) {
- m_mediaRecorder.stop();
- m_mediaRecorder.reset();
- m_mediaRecorder.release();
- ScreenLayout.removeView(surface);
- m_mediaRecorder = null;
- if (mV40IF != null) mV40IF.ctrlWallPadCamPower(false);
- if (wpCamera != null) {
- wpCamera.stopPreview();
- wpCamera.release();
- wpCamera = null;
- }
- }
- }
- public void ReleaseSurface() {
- if (surface != null) {
- surface = null;
- }
- }
- private Handler mCameraOpenCheckHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- if (wpCamera != null) mCameraOpenCheckHandler.sendEmptyMessageDelayed(1, 10);
- else mCameraOpenCheckHandler.sendEmptyMessageDelayed(0, 10);
- } else if (msg.what == 1) {
- // 영상 메모 녹화 시작!!
- Log.d(TAG, "[mCameraOpenCheckHandler.handleMessage] Handler finish!! [CAMERA OPEN]");
- wpCamera.unlock();
- m_mediaRecorder.setCamera(wpCamera);
- m_mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- m_mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- m_mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
- m_mediaRecorder.setVideoSize(640, 480);
- m_mediaRecorder.setVideoEncodingBitRate(1024 * 1024);
- m_mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
- m_mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
- if (Build.VERSION.SDK_INT > 23) m_mediaRecorder.setVideoFrameRate(24);
- m_mediaRecorder.setOutputFile(VIDEO_TEMP_PATH);
- m_mediaRecorder.setPreviewDisplay(holder.getSurface());
- try {
- Log.d(TAG, "[mediaStartRecording] m_mediaRecorder.prepare");
- m_mediaRecorder.prepare();
- } catch (IllegalStateException e) {
- Log.e(TAG, "[IllegalStateException] mediaStartRecording: " + e.toString());
- } catch (IOException e) {
- Log.e(TAG, "[IOException] mediaStartRecording: " + e.toString());
- }
- m_mediaRecorder.start();
- }
- }
- };
- public void DisplayImageCam(byte[] pData, int offset, int length, int nID) {
- Log.d("test", "DisplayImageCam1");
- ImageView IV = (ImageView) findViewById(nID);
- Bitmap bMap = BitmapFactory.decodeByteArray(pData, offset, length);
- IV.setImageBitmap(bMap);
- }
- public enum MAINEVENT {
- BTN_HOME,
- BTN_BACK,
- BTN_MENU
- }
- public interface MainEventListener {
- public void onMainTouchEvent(MAINEVENT eEvent);
- }
- MainEventListener mMainEventListener;
- public void setMainEventListener(MainEventListener MEL) {
- mMainEventListener = MEL;
- }
- public void releaseMainEventListener() {
- mMainEventListener = null;
- }
- /**
- * 월패드 타입 판별
- * @return bResult
- * false: 메인월패드
- * true: 서브월패드
- */
- public boolean getAsSubWallPad() {
- boolean bResult = false;
- try {
- WallpadDeviceSet devSet = new WallpadDeviceSet(this);
- String[] DBinfo = devSet.GetSettingData("서브월패드");
- devSet.closeDB();
- if(DBinfo != null) {
- if (DBinfo[1].indexOf("사용함") > 0) bResult = true;
- else bResult = false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e("Common", "[Exception] getAsSubWallPad()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- Log.i(TAG, "[GetWallPadType] bResult [" + bResult + "]");
- return bResult;
- }
- private void setAudioMemoPlayVol(boolean bMemoPlay) {
- try {
- Log.d(TAG, "[setAudioMemoPlayVol] bMemoPlay [" + bMemoPlay + "]");
- if (bMemoPlay) MainActivity.mV40IF.setWallPadVolume_V40("0x0A00"); // FM8802 음량 올림
- MainActivity.mV40IF.setWallPadVolume_V40("0x0100");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] sendHandlerMsgDelayed(int what, int arg1, int arg2, long delay");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 절전모드에서 백라이트를 키는 경우, BSP에서 PowerManager 또는 속성값으로 상태를 구분하는데
- * BSP 버전에 따라 상이하게 동작하므로 BSP 버전 구분하여 절전모드 판별 필요
- * @return true: 기준 BSP 이후 버전, false: 기준 BSP 이전 버전
- */
- public static boolean getCompareBSPVersion(String version) {
- try {
- StringBuilder strBSPVersion = new StringBuilder();
- StringBuffer sysInfoBuffer = new StringBuffer();
- sysInfoBuffer.append(Build.DISPLAY);
- strBSPVersion.append(sysInfoBuffer.toString());
- String result = strBSPVersion.toString();
- Log.d(TAG, "[getCompareBSPVersion] result [" + result + "]");
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd");
- Date date = simpleDateFormat.parse(result);
- Date standardDate = simpleDateFormat.parse(version); // 비교 기준 BSP 버전
- if (date.compareTo(standardDate) >= 0) {
- Log.d(TAG, "[getCompareBSPVersion] BSP VERSION OVER!");
- return true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG,re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getCompareBSPVersion");
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- }
|