camera-option: Introduced new camera option.
authorminkee.lee <minkee.lee@samsung.com>
Fri, 12 Jun 2015 10:55:17 +0000 (19:55 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Mon, 15 Jun 2015 11:44:06 +0000 (20:44 +0900)
Change-Id: I5cf03e1971f558c442b9f94058f7622a3a13e3e3
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
src/org/tizen/emulator/manager/resources/FilePathResources.java
src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java
src/org/tizen/emulator/manager/ui/detail/item/ItemName.java
src/org/tizen/emulator/manager/ui/detail/item/property/CameraImageSubViewItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/detail/item/property/CameraTypeSubViewItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/detail/item/property/CameraViewItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/vms/helper/HelperClass.java
src/org/tizen/emulator/manager/vms/helper/ProcessResult.java
src/org/tizen/emulator/manager/vms/option/CameraOption.java [new file with mode: 0644]

index 9487ae3..d4a66c9 100644 (file)
@@ -84,6 +84,8 @@ public class FilePathResources {
        private final static String vms_suffix = File.separator + "vms";
 
        private final static String qemuImg_suffic = File.separator + "qemu-img";
+       private final static String checkCam_suffix = File.separator + "check-cam"
+                       + (EmulatorManager.isWin() ? ".exe" : "") ;
 
        private static String currentPath;
        private static String sdkPath = null;
@@ -372,6 +374,14 @@ public class FilePathResources {
                return getEmulatorToolPath() + qemuImg_suffic;
        }
 
+       public static String getCheckCamPath() {
+               return getEmulatorToolPath() + checkCam_suffix;
+       }
+
+       public static String getEmulatorImagePath(String platformVersion) {
+               return getEmulatorPath(platformVersion) + images_suffix;
+       }
+
        public static String getEmulatorDataPath(String platformVersion) {
                return getEmulatorPath(platformVersion) + data_suffix;
        }
@@ -410,6 +420,7 @@ public class FilePathResources {
                }
                return latestVersion;
        }
+
 /*
        public String getArchPath(){
                return arcPath;
index 1c5dab9..9b329a7 100644 (file)
@@ -75,6 +75,7 @@ public abstract class CommonItemListFactory implements IItemListFactory{
        public static String ITEM_NET_IP_INFO = "netIpInfo";
        public static String ITEM_NET_DNS = "netDns";
        public static String ITEM_NET_MAC = "netMac";
+       public static String ITEM_CAMERA = "camera";
 
        public static ObjectFactory factory = new ObjectFactory();
 
index 6f7ccea..4f03b5a 100644 (file)
@@ -42,6 +42,7 @@ public class ItemName {
        public static final String SENSOR = "sensor";
        public static final String DEVICE = "device";
        public static final String JACK = "jack";
+       public static final String CAMERA = "camera";
 
        public static final String NET_CONFIG = "netConfig";
        public static final String NET_PROXY = "proxy";
diff --git a/src/org/tizen/emulator/manager/ui/detail/item/property/CameraImageSubViewItem.java b/src/org/tizen/emulator/manager/ui/detail/item/property/CameraImageSubViewItem.java
new file mode 100644 (file)
index 0000000..57a611b
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.detail.item.property;
+
+import java.io.File;
+import java.util.Arrays;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.resources.FilePathResources;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
+import org.tizen.emulator.manager.ui.detail.item.template.FileSubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.xml.template.Item;
+
+public class CameraImageSubViewItem extends FileSubViewItem {
+
+       private final CameraViewItem cameraViewItem;
+       String platformVersion;
+       private static final String DEFAULT_FRONT_IMG = "default-image1.gif";
+       private static final String DEFAULT_REAR_IMG = "default-image2.gif";
+
+       public CameraImageSubViewItem(LabelViewItem parentItem, Composite comp,
+                       Item template) {
+               super(parentItem, comp, template);
+               cameraViewItem = (CameraViewItem) parentItem;
+
+               filters.addAll(Arrays.asList("*.gif", "*.png", "*.bmp", "*.jpg", "*.jpeg", "*.*"));
+       }
+
+       @Override
+       public boolean settingModifyItem(VMPropertyValue value) {
+               platformVersion = value.baseImage.getVersion();
+               newValue = getModifyValue(value);
+               setPathLabel();
+
+               CameraTypeSubViewItem typeItem = cameraViewItem.getCameraTypeItem(name);
+               if (typeItem != null) {
+                       if (typeItem.isVirtualSelected(value)) {
+                               activate();
+                       } else {
+                               deactivate();
+                       }
+               }
+               return true;
+       }
+
+       public void reset(String cameraType) {
+               if (CameraViewItem.VALUE_VIRTUAL.equals(cameraType)) {
+                       activate();
+               } else {
+                       deactivate();
+               }
+       }
+
+       public void activate() {
+               setEnabled(true);
+               if (newValue == null || newValue.isEmpty()) {
+                       newValue = FilePathResources.getEmulatorImagePath(platformVersion)
+                                       + File.separator
+                                       + (CameraViewItem.ITEM_FRONT_IMAGE.equals(name) ? DEFAULT_FRONT_IMG
+                                                       : DEFAULT_REAR_IMG);
+               }
+               setPathLabel();
+       }
+
+       public void deactivate() {
+               newValue = "";
+               setPathLabel();
+               setEnabled(false);
+       }
+
+       private void setPathLabel() {
+               String fileName = newValue.substring(
+                               newValue.lastIndexOf(File.separator) + 1, newValue.length());
+               filePathLabel.setText(fileName);
+               filePathLabel.setToolTipText(newValue);
+       }
+
+       @Override
+       public ItemState checkValue() {
+
+               itemState.setNormal();
+               CameraTypeSubViewItem cameraType = cameraViewItem.getCameraTypeItem(name);
+               if (cameraType.isVirtualSelected()) {
+                       if (newValue == null || newValue.isEmpty()) {
+                               itemState.setError("Please select image file for virtual camera.");
+                       } else {
+                               File f = new File(newValue);
+                               if (!f.exists()) {
+                                       itemState.setError("Virtual camera image file is not exist.");
+                               }
+                       }
+               }
+               return itemState;
+       }
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/detail/item/property/CameraTypeSubViewItem.java b/src/org/tizen/emulator/manager/ui/detail/item/property/CameraTypeSubViewItem.java
new file mode 100644 (file)
index 0000000..224869f
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.detail.item.property;
+
+import java.util.List;
+
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.ui.detail.item.template.ComboSubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.xml.template.Item;
+import org.tizen.emulator.manager.vms.xml.template.Option;
+
+public class CameraTypeSubViewItem extends ComboSubViewItem {
+
+       private final CameraViewItem cameraViewItem;
+
+       public CameraTypeSubViewItem(LabelViewItem parentItem, Composite comp,
+                       Item template) {
+               super(parentItem, comp, template);
+               cameraViewItem = (CameraViewItem) parentItem;
+       }
+
+       @Override
+       public String getValue() {
+               return newValue;
+       }
+
+       @Override
+       protected void parseOption(List<Option> optionList) {
+               comboOptions.add(CameraViewItem.VALUE_WEBCAM);
+               comboOptions.add(CameraViewItem.VALUE_VIRTUAL);
+               comboOptions.add(CameraViewItem.VALUE_NONE);
+       }
+
+       @Override
+       public boolean settingModifyItem(VMPropertyValue value) {
+               newValue = value.getAdvancedOptionSubValue(parentItem.getName(), name);
+
+               // Set default if first create.
+               if (parentItem.isCreateMode()) {
+                       if (!isInComboOptions(newValue)) {
+                               // Rear : webcam (if webcam available)
+                               if (isRear() && CameraViewItem.isWebcamSupport()) {
+                                       newValue = CameraViewItem.VALUE_WEBCAM;
+
+                                       // Front : virtual
+                               } else {
+                                       newValue = CameraViewItem.VALUE_VIRTUAL;
+                               }
+                       }
+               }
+
+               // make option list
+               combo.removeAll();
+               for (String s : comboOptions) {
+                       addItem(s);
+               }
+
+               // select value, set index
+               int index = -1;
+               for (int i = 0; i < combo.getItemCount(); i++) {
+                       if (combo.getItem(i).equals(newValue)) {
+                               index = i;
+                               break;
+                       }
+               }
+               if (index == -1) {
+                       if (addItem(newValue)) {
+                               index = combo.getItemCount() - 1;
+                       } else {
+                               index = 0;
+                       }
+               }
+               combo.select(index);
+               oldValue = newValue = combo.getItem(index);
+
+               return true;
+
+       }
+
+       @Override
+       protected void addComboBoxListener() {
+               combo.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               newValue = combo.getText();
+
+                               // Reset image item.
+                               CameraImageSubViewItem imageItem = cameraViewItem
+                                               .getCameraImageItem(name);
+                               if (imageItem != null) {
+                                       imageItem.reset(newValue);
+                               }
+
+                               // Reset another type item
+                               CameraTypeSubViewItem anotherCameraItem = cameraViewItem
+                                               .getAnotherCameraTypeItem(name);
+                               if (anotherCameraItem != null) {
+                                       anotherCameraItem.reset(newValue);
+                               }
+
+                               if (parentItem.isCreateMode()) {
+                                       parentItem.getListener().changeCreateConfirmButton();
+                               } else {
+                                       parentItem.getListener().changeModifyConfirmButton(
+                                                       parentItem.getThis());
+                               }
+
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                               // TODO Auto-generated method stub
+                       }
+               });
+       }
+
+       private boolean isRear() {
+               return CameraViewItem.ITEM_REAR_TYPE.equals(name);
+       }
+
+       private boolean addItem(String type) {
+               if (CameraViewItem.VALUE_WEBCAM.equals(type)
+                               && !CameraViewItem.isWebcamSupport()) {
+                       return false;
+               }
+               combo.add(type);
+               return true;
+       }
+
+       public void reset(String anotherCameraType) {
+               if (CameraViewItem.VALUE_WEBCAM.equals(anotherCameraType)) {
+                       // remove webcam if exist.
+                       int index = -1;
+                       for (int i = 0; i < combo.getItemCount(); i++) {
+                               if (combo.getItem(i).equals(CameraViewItem.VALUE_WEBCAM)) {
+                                       index = i;
+                               }
+                       }
+                       if (index > -1) {
+                               combo.remove(index);
+                               selectCombo();
+                       }
+
+               } else {
+                       // Add webcam if not exist.
+                       if (CameraViewItem.isWebcamSupport()) {
+                               boolean addWebcam = true;
+                               for (int i = 0; i < combo.getItemCount(); i++) {
+                                       if (combo.getItem(i).equals(CameraViewItem.VALUE_WEBCAM)) {
+                                               addWebcam = false;
+                                               break;
+                                       }
+                               }
+                               if (addWebcam) {
+                                       combo.add(CameraViewItem.VALUE_WEBCAM, 0);
+                                       selectCombo();
+                               }
+                       }
+               }
+       }
+
+       private void selectCombo() {
+               // select value, set index
+               for (int i = 0; i < combo.getItemCount(); i++) {
+                       if (combo.getItem(i).equals(newValue)) {
+                               combo.select(i);
+                               break;
+                       }
+               }
+       }
+
+       private boolean isInComboOptions(String value) {
+               for (String str : comboOptions) {
+                       if (str.equals(value)) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       public boolean isWebcamSelected(VMPropertyValue value) {
+               String type = newValue;
+               if (type == null || !isInComboOptions(type)) {
+                       type = value.getAdvancedOptionSubValue(parentItem.getName(), name);
+               }
+               if (CameraViewItem.VALUE_WEBCAM.equals(type)) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       public boolean isVirtualSelected(VMPropertyValue value) {
+               String type = newValue;
+               if (type == null || !isInComboOptions(type)) {
+                       type = value.getAdvancedOptionSubValue(parentItem.getName(), name);
+               }
+               if (CameraViewItem.VALUE_VIRTUAL.equals(type)) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       public boolean isVirtualSelected() {
+               if (CameraViewItem.VALUE_VIRTUAL.equals(newValue)) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/detail/item/property/CameraViewItem.java b/src/org/tizen/emulator/manager/ui/detail/item/property/CameraViewItem.java
new file mode 100644 (file)
index 0000000..8c6885c
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.detail.item.property;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.tizen.emulator.manager.resources.FilePathResources;
+import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.DetailSubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.helper.HelperClass;
+import org.tizen.emulator.manager.vms.helper.ProcessResult;
+import org.tizen.emulator.manager.vms.xml.template.Item;
+
+public class CameraViewItem extends LabelViewItem {
+
+       public static String ITEM_FRONT_TYPE = "frontType";
+       public static String ITEM_FRONT_IMAGE = "frontImage";
+       public static String ITEM_REAR_TYPE = "rearType";
+       public static String ITEM_REAR_IMAGE = "rearImage";
+
+       private CameraTypeSubViewItem frontTypeItem;
+       private CameraImageSubViewItem frontImageItem;
+       private CameraTypeSubViewItem rearTypeItem;
+       private CameraImageSubViewItem rearImageItem;
+
+       public static final String VALUE_NONE = "(none)";
+       public static final String VALUE_WEBCAM = "Webcam";
+       public static final String VALUE_VIRTUAL = "Virtual";
+
+       public static boolean webcamSupport = checkWebcam();
+
+       public CameraViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
+               super(template, lineLabelViewItem);
+       }
+
+       public CameraTypeSubViewItem getAnotherCameraTypeItem(String typeItemName) {
+               if (typeItemName.equals(ITEM_FRONT_TYPE)) {
+                       return rearTypeItem;
+               } else {
+                       return frontTypeItem;
+               }
+       }
+
+       public CameraImageSubViewItem getCameraImageItem(String typeItemName) {
+               if (typeItemName.equals(ITEM_FRONT_TYPE)) {
+                       return frontImageItem;
+               } else {
+                       return rearImageItem;
+               }
+       }
+
+       public CameraTypeSubViewItem getCameraTypeItem(String imageItemName) {
+               if (imageItemName.equals(ITEM_FRONT_IMAGE)) {
+                       return frontTypeItem;
+               } else {
+                       return rearTypeItem;
+               }
+       }
+
+       private static boolean checkWebcam() {
+               ProcessResult res = HelperClass.runProcess(Arrays
+                               .asList(FilePathResources.getCheckCamPath()));
+               int result = res.getExitValue();
+               if (result == 1) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       public static boolean isWebcamSupport() {
+//              return webcamSupport;
+               return true; // TODO for test
+       }
+
+       @Override
+       public boolean settingModifyItem(VMPropertyValue value) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
+                       subItem.settingModifyItem(value);
+               }
+               String rearType = rearTypeItem.getValue();
+               String frontType = frontTypeItem.getValue();
+               frontTypeItem.reset(rearType);
+               rearTypeItem.reset(frontType);
+               frontImageItem.reset(frontType);
+               rearImageItem.reset(rearType);
+
+               return true;
+       }
+       @Override
+       protected List<DetailSubViewItem> getSubItemList() {
+               if (subItemList == null) {
+                       subItemList = new ArrayList<DetailSubViewItem>();
+
+                       List<Item> itemList = template.getItem();
+                       int i = 0;
+                       for (Item item : itemList) {
+                               String itemName = item.getName();
+                               if (itemName.equals(ITEM_FRONT_TYPE)) {
+                                       frontTypeItem = new CameraTypeSubViewItem(this,
+                                                       compList.get(i++), item);
+                                       subItemList.add(frontTypeItem);
+
+                               } else if (itemName.equals(ITEM_FRONT_IMAGE)) {
+                                       frontImageItem = new CameraImageSubViewItem(this,
+                                                       compList.get(i++), item);
+                                       subItemList.add(frontImageItem);
+
+                               } else if (itemName.equals(ITEM_REAR_TYPE)) {
+                                       rearTypeItem = new CameraTypeSubViewItem(this,
+                                                       compList.get(i++), item);
+                                       subItemList.add(rearTypeItem);
+
+                               } else if (itemName.equals(ITEM_REAR_IMAGE)) {
+                                       rearImageItem = new CameraImageSubViewItem(this,
+                                                       compList.get(i++), item);
+                                       subItemList.add(rearImageItem);
+                               }
+                       }
+               }
+               return subItemList;
+       }
+
+}
index 27e2953..5d5e407 100644 (file)
@@ -264,8 +264,8 @@ public class HelperClass {
                        result.setStdErrMsg(Arrays.asList(e.getMessage()));
 
                } catch (InterruptedException e) {
-                       result = new ProcessResult(false, EXIT_VALUE_PROCESS_STARTED_FAILURE);
                        EMLogger.getLogger().info("Process end with interrupt. " + e.getMessage());
+                       result = new ProcessResult(false, EXIT_VALUE_PROCESS_STARTED_FAILURE);
                        result.setStdErrMsg(Arrays.asList(e.getMessage()));
                }
 
index e23803e..cf7bfe6 100644 (file)
@@ -32,6 +32,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class ProcessResult {
+
        boolean isStartedSuccessfully;
        int exitValue;
        List<String> stdOutMsg = new ArrayList<String>();
diff --git a/src/org/tizen/emulator/manager/vms/option/CameraOption.java b/src/org/tizen/emulator/manager/vms/option/CameraOption.java
new file mode 100644 (file)
index 0000000..fe9a5e9
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.vms.option;
+
+import org.tizen.emulator.manager.ui.detail.item.ItemName;
+import org.tizen.emulator.manager.ui.detail.item.property.CameraViewItem;
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.helper.VMWorkerException;
+
+public class CameraOption extends Option {
+
+       @Override
+       public void getLaunchArgument(LaunchConfig config, VMProperty property)
+                       throws VMWorkerException {
+
+               // Check front camera.
+               String frontCameraType = property.getPropertyValue()
+                               .getAdvancedOptionSubValue(ItemName.CAMERA, CameraViewItem.ITEM_FRONT_TYPE);
+               if (CameraViewItem.VALUE_WEBCAM.equals(frontCameraType)) {
+                       // front, webcam
+                       config.addQemuOption("-device", "maru-camera,index=1");
+
+               } else if (CameraViewItem.VALUE_VIRTUAL.equals(frontCameraType)) {
+                       String imagePath = property.getPropertyValue()
+                               .getAdvancedOptionSubValue(ItemName.CAMERA, CameraViewItem.ITEM_FRONT_IMAGE);
+                       // front, virtual
+                       config.addQemuOption("-device", "maru-camera,index=1,path=" + imagePath);
+               }
+
+               // Check rear camera.
+               String rearCameraType = property.getPropertyValue()
+                               .getAdvancedOptionSubValue(ItemName.CAMERA, CameraViewItem.ITEM_REAR_TYPE);
+               if (CameraViewItem.VALUE_WEBCAM.equals(rearCameraType)) {
+                       // rear, webcam
+                       config.addQemuOption("-device", "maru-camera,index=0");
+
+               } else if (CameraViewItem.VALUE_VIRTUAL.equals(rearCameraType)) {
+                       String imagePath = property.getPropertyValue()
+                               .getAdvancedOptionSubValue(ItemName.CAMERA, CameraViewItem.ITEM_REAR_IMAGE);
+                       // rear, virtual
+                       config.addQemuOption("-device", "maru-camera,index=0,path=" + imagePath);
+               }
+
+       }
+
+}