[UI Hierarchy] Checking Protocol version
authorjungwook.ryu <jungwook.ryu@samsung.com>
Wed, 23 Dec 2015 11:06:25 +0000 (20:06 +0900)
committerjungwook.ryu <jungwook.ryu@samsung.com>
Wed, 23 Dec 2015 11:06:25 +0000 (20:06 +0900)
Change-Id: I6085797782e7ccde57237d267c37062edf4b93d6
Signed-off-by: jungwook.ryu <jungwook.ryu@samsung.com>
org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/setting
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UIHierarchyPageLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UIHierarchyPageLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/Protocol.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/p41/Communicator41.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/hierarchy/tree/HierarchyTreeViewToolbar.java

index dcd7fb1..e85d034 100644 (file)
@@ -9,12 +9,6 @@ Total Overhead Range|1000000|3000000|7000000|15000000
 mobile|Protocol Version|4.0
 mobile|Available Template List|1|2|3|4|5|6|7|8|9|10
 mobile|Selected Template|1
-mobile|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
-mobile|Selected Feature List|1|5|1000:1000|100|101|1001:10
-mobile|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
-mobile|Protocol Version|4.1
-mobile|Available Template List|1|2|3|4|5|6|7|8|9|10
-mobile|Selected Template|1
 mobile|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204|206
 mobile|Selected Feature List|1|5|1000:1000|100|101|1001:10
 mobile|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
index 015da6d..5276875 100644 (file)
@@ -48,6 +48,7 @@ public class UIHierarchyPageLabels extends NLS {
        public static String UIHIERARCHY_EXPORT_DIALOG_TITLE;
        public static String UIHIERARCHY_EXPORT_DIALOG_ERROR_MESSAGE;
        public static String UIHIERARCHY_EXPORT_PROGRESS_MESSAGE;
+       public static String UIHIERARCHY_NOT_SUPPORT_DEVICE;
 
        static {
                // initialize resource bundle
index 4e075e5..b161f38 100644 (file)
@@ -15,4 +15,5 @@ UIHIERARCHY_EXPORT_BUTTON_TOOLTIP=Export tree view to picture file (.png)
 UIHIERARCHY_EXPORT_DIALOG_TITLE=Export image
 UIHIERARCHY_EXPORT_DIALOG_ERROR_MESSAGE=Failed to export image
 UIHIERARCHY_EXPORT_PROGRESS_MESSAGE=Exporting image file
+UIHIERARCHY_NOT_SUPPORT_DEVICE=This device does not support UI Hierarchy viewer.
 
index af71467..abdae32 100644 (file)
@@ -32,6 +32,7 @@ import java.util.Map;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.protocol.p30.ProtocolConfig30;
 import org.tizen.dynamicanalyzer.protocol.p40.ProtocolConfig40;
+import org.tizen.dynamicanalyzer.protocol.p41.ProtocolConfig41;
 import org.tizen.dynamicanalyzer.setting.Feature;
 
 public enum Protocol {
@@ -121,6 +122,9 @@ public enum Protocol {
                case VERSION_40:
                        configs = ProtocolConfig40.getProtocolConfig(feature);
                        break;
+               case VERSION_41:
+                       configs = ProtocolConfig41.getProtocolConfig(feature);
+                       break;  
                default: // unknown protocol
                        throw new UnknownProtocolException();
                }
index d1a35aa..daa0cda 100644 (file)
@@ -27,6 +27,7 @@
 package org.tizen.dynamicanalyzer.protocol.p41;
 
 import java.io.File;
+import java.util.Set;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.DAResult;
@@ -39,6 +40,9 @@ import org.tizen.dynamicanalyzer.communicator.ProtocolSerializer;
 import org.tizen.dynamicanalyzer.communicator.UnsupportedProtocolException;
 import org.tizen.dynamicanalyzer.control.IProgress;
 import org.tizen.dynamicanalyzer.protocol.p40.Communicator40;
+import org.tizen.dynamicanalyzer.setting.Feature;
+import org.tizen.dynamicanalyzer.setting.SettingDataManager;
+import org.tizen.dynamicanalyzer.setting.TargetData;
 import org.tizen.dynamicanalyzer.swap.communicator.SwapErrorCode;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.utils.DownloadContentfileManager;
@@ -50,6 +54,42 @@ public class Communicator41 extends Communicator40 {
        }
 
        @Override
+       public DAResult sendConfigurationMessage(IProgress progress) {
+               // send config message
+               ProtocolSerializer ps = new ProtocolSerializer();
+               ps.setMessageID(ProtocolConstant41.MSG_CONFIG);
+
+               // set feature flag value
+               Set<Feature> selectedFeatures = SettingDataManager.INSTANCE.getSelectedFeatureSet();
+               byte[] featureFlag = ProtocolConfig41.getFeatureFlagValue(selectedFeatures);
+               ps.putByteArray(featureFlag);
+
+               // set sampling period value
+               TargetData target = SettingDataManager.INSTANCE.getConnectedTarget();
+               int systemPeriod = target.getSelectedFeatureValue(Feature.SYSTEM_SAMPLING_RATE);
+               if (systemPeriod < 0) {
+                       systemPeriod = Feature.SYSTEM_SAMPLING_RATE.getData().getDefaultValue();
+               }
+               int samplingPeriod = target.getSelectedFeatureValue(Feature.FUNCTION_SAMPLING_RATE);
+               if (samplingPeriod < 0) {
+                       samplingPeriod = Feature.FUNCTION_SAMPLING_RATE.getData().getDefaultValue();
+               }
+               ps.putInt(systemPeriod);
+               ps.putInt(samplingPeriod);
+
+               byte[] msg = ps.toByteArray();
+
+               AckMessage result = parent.handleControlMessage(msg);
+
+               if (result != null && result.isSuccess()
+                               && result.isCorrectID(ProtocolConstant41.MSG_CONFIG_ACK)) {
+                       return new DAResult(ErrorCode.SUCCESS);
+               } else {
+                       return new DAResult(ErrorCode.ERR_CONFIG_FAILED);
+               }
+       }
+
+       @Override
        public DAResult sendUIHierarchyMessage(IProgress progress, int requestOption)
                        throws InterruptedException, UnsupportedProtocolException {
                ProtocolSerializer ps = new ProtocolSerializer();
index aa83a0b..3faf307 100644 (file)
@@ -139,6 +139,7 @@ public class HierarchyTreeViewToolbar extends Composite {
                                        } catch (InterruptedException e) {
                                                Logger.exception(e);
                                        } catch (UnsupportedProtocolException e) {
+                                               UIAction.showWarning(UIHierarchyPageLabels.UIHIERARCHY_NOT_SUPPORT_DEVICE);
                                                Logger.exception(e);
                                        }
                                }