Search in sources :

Example 1 with TraceResultType

use of com.att.aro.core.packetanalysis.pojo.TraceResultType in project VideoOptimzer by attdevsupport.

the class HtmlReportImpl method getTraceRows.

private String getTraceRows(PacketAnalyzerResult analyzerResults) {
    StringBuilder sbuilder = new StringBuilder(180);
    AbstractTraceResult traceResults = analyzerResults.getTraceresult();
    if (traceResults != null) {
        sbuilder.append(tableLIne() + "<th>Date</th><td>" + traceResults.getTraceDateTime() + tableChange() + System.getProperty(lineSeperator()));
        // if it is from rooted collector and load from trace trace folder
        TraceResultType traceType = traceResults.getTraceResultType();
        if (TraceResultType.TRACE_DIRECTORY.equals(traceType)) {
            TraceDirectoryResult traceDirResult = (TraceDirectoryResult) traceResults;
            sbuilder.append(tableLIne());
            sbuilder.append("<th>Device Make/Model</th>");
            if (traceDirResult.getDeviceMake() != null && traceDirResult.getDeviceModel() != null) {
                sbuilder.append("<td>" + traceDirResult.getDeviceMake() + " / " + traceDirResult.getDeviceModel() + "</td>");
            } else {
                sbuilder.append("<p>Not Available</p>");
            }
            sbuilder.append("</tr>");
            sbuilder.append(System.getProperty(lineSeperator()));
            sbuilder.append(tableLIne());
            sbuilder.append("<th>Platform Version</th>");
            if (traceDirResult.getOsType() != null && traceDirResult.getOsVersion() != null) {
                sbuilder.append("<td>" + traceDirResult.getOsType() + " / " + traceDirResult.getOsVersion() + "</td>");
            } else {
                sbuilder.append("<p>Not Available</p>");
            }
            sbuilder.append("</tr>");
            sbuilder.append(System.getProperty(lineSeperator()));
            // Append display resolution
            String displayResolutionValue = String.format("%s (Width: %s, Height: %s)", traceDirResult.getCollectOptions().getOrientation(), String.valueOf(traceDirResult.getDeviceScreenSizeX()), String.valueOf(traceDirResult.getDeviceScreenSizeY()));
            sbuilder.append(tableLIne());
            sbuilder.append("<th>Display Resolution</th>");
            sbuilder.append("<td>" + displayResolutionValue + "</td>");
            sbuilder.append("</tr>");
            sbuilder.append(System.getProperty(lineSeperator()));
        }
    }
    return sbuilder.toString();
}
Also used : AbstractTraceResult(com.att.aro.core.packetanalysis.pojo.AbstractTraceResult) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType)

Example 2 with TraceResultType

use of com.att.aro.core.packetanalysis.pojo.TraceResultType in project VideoOptimzer by attdevsupport.

the class WakeLockPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    XYIntervalSeriesCollection wakelockData = new XYIntervalSeriesCollection();
    if (analysis == null) {
        LOGGER.info("analysis data is null");
    } else {
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("didn't get analysis trace data!");
        } else {
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            XYIntervalSeries series = new XYIntervalSeries(WakelockState.WAKELOCK_ACQUIRED);
            wakelockData.addSeries(series);
            // Populate the data set
            Iterator<WakelockInfo> iter = traceresult.getWakelockInfos().iterator();
            if (iter.hasNext()) {
                WakelockInfo lastEvent = iter.next();
                LOGGER.debug("Wakelock Plotting");
                // Check whether WAKELOCK was acquired before logging begins.
                if (lastEvent.getWakelockState() == WakelockState.WAKELOCK_RELEASED) {
                    series.add(0, 0, lastEvent.getBeginTimeStamp(), 0.5, 0, 1);
                    dataMap.put(lastEvent.getBeginTimeStamp(), lastEvent);
                }
                while (iter.hasNext()) {
                    WakelockInfo currEvent = iter.next();
                    if (lastEvent.getWakelockState() == WakelockState.WAKELOCK_ACQUIRED) {
                        LOGGER.debug("Wakelock acquired curr " + currEvent.getBeginTimeStamp());
                        LOGGER.debug("Wakelock acquired last " + lastEvent.getBeginTimeStamp());
                        series.add(lastEvent.getBeginTimeStamp(), lastEvent.getBeginTimeStamp(), currEvent.getBeginTimeStamp(), 0.5, 0, 1);
                        dataMap.put(lastEvent.getBeginTimeStamp(), lastEvent);
                    }
                    lastEvent = currEvent;
                }
                if (lastEvent.getWakelockState() == WakelockState.WAKELOCK_ACQUIRED) {
                    series.add(lastEvent.getBeginTimeStamp(), lastEvent.getBeginTimeStamp(), traceresult.getTraceDuration(), 0.5, 0, 1);
                    dataMap.put(lastEvent.getBeginTimeStamp(), lastEvent);
                }
            }
            // Assign ToolTip to renderer
            XYItemRenderer renderer = plot.getRenderer();
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    WakelockInfo wi = dataMap.get(dataset.getXValue(series, item));
                    if (wi != null) {
                        StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("wakelock.tooltip.prefix"));
                        displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("wakelock.tooltip.content"), ResourceBundleHelper.getEnumString(wi.getWakelockState()), wi.getBeginTimeStamp()));
                        displayInfo.append(ResourceBundleHelper.getMessageString("wakelock.tooltip.suffix"));
                        return displayInfo.toString();
                    }
                    return null;
                }
            });
        }
    }
    plot.setDataset(wakelockData);
// return plot;
}
Also used : TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) XYDataset(org.jfree.data.xy.XYDataset) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) WakelockInfo(com.att.aro.core.peripheral.pojo.WakelockInfo)

Example 3 with TraceResultType

use of com.att.aro.core.packetanalysis.pojo.TraceResultType in project VideoOptimzer by attdevsupport.

the class VideoPlayerController method update.

@Override
public void update(Observable observable, Object model) {
    traceResult = ((AROTraceData) model).getAnalyzerResult().getTraceresult();
    TraceResultType traceResultType = traceResult.getTraceResultType();
    traceDirectory = traceResult.getTraceDirectory();
    if (traceDirectory == null) {
        LOGGER.error("Trace dir is null, error launching video player.");
        return;
    }
    if (traceResultType == TraceResultType.TRACE_FILE || !(VideoUtil.mp4VideoExists(traceDirectory) || VideoUtil.movVideoExists(traceDirectory))) {
        currentPlayer.clear();
        currentPlayer.notifyLauncher(false);
        return;
    }
    IVideoPlayer player = getPlayer(VideoPlayerType.MP4_VLCJ);
    ;
    if (player == null) {
        LOGGER.error("Error launching video player - no appropriate Mp4 or Mov player found");
        return;
    }
    player.loadVideo(traceResult);
    diagnosticsTab.setVideoPlayer(player);
    setCurrentVideoPlayer(player);
    player.notifyLauncher(true);
}
Also used : AROTraceData(com.att.aro.core.pojo.AROTraceData) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType)

Example 4 with TraceResultType

use of com.att.aro.core.packetanalysis.pojo.TraceResultType in project VideoOptimzer by attdevsupport.

the class WifiPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    wifiData = new XYIntervalSeriesCollection();
    if (analysis == null) {
        LOGGER.info("didn't get analysis trace data!  ");
    } else {
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("it is not contain the file ");
        } else {
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            Map<WifiState, XYIntervalSeries> seriesMap = new EnumMap<WifiState, XYIntervalSeries>(WifiState.class);
            for (WifiState eventType : WifiState.values()) {
                XYIntervalSeries series = new XYIntervalSeries(eventType);
                seriesMap.put(eventType, series);
                switch(eventType) {
                    case WIFI_UNKNOWN:
                    case WIFI_DISABLED:
                        // Don't chart these
                        break;
                    default:
                        wifiData.addSeries(series);
                        break;
                }
            }
            // Populate the data set
            List<WifiInfo> wifiInfos = traceresult.getWifiInfos();
            final Map<Double, WifiInfo> eventMap = new HashMap<Double, WifiInfo>(wifiInfos.size());
            Iterator<WifiInfo> iter = wifiInfos.iterator();
            if (iter.hasNext()) {
                while (iter.hasNext()) {
                    WifiInfo wifiEvent = iter.next();
                    seriesMap.get(wifiEvent.getWifiState()).add(wifiEvent.getBeginTimeStamp(), wifiEvent.getBeginTimeStamp(), wifiEvent.getEndTimeStamp(), 0.5, 0, 1);
                    eventMap.put(wifiEvent.getBeginTimeStamp(), wifiEvent);
                }
            }
            XYItemRenderer renderer = plot.getRenderer();
            for (WifiState eventType : WifiState.values()) {
                Color paint;
                switch(eventType) {
                    case WIFI_CONNECTED:
                    case WIFI_CONNECTING:
                    case WIFI_DISCONNECTING:
                        paint = new Color(34, 177, 76);
                        break;
                    case WIFI_DISCONNECTED:
                    case WIFI_SUSPENDED:
                        paint = Color.YELLOW;
                        break;
                    default:
                        paint = Color.WHITE;
                        break;
                }
                int index = wifiData.indexOf(eventType);
                if (index >= 0) {
                    renderer.setSeriesPaint(index, paint);
                }
            }
            // Assign ToolTip to renderer
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    WifiState eventType = (WifiState) wifiData.getSeries(series).getKey();
                    StringBuffer message = new StringBuffer(ResourceBundleHelper.getMessageString("wifi.tooltip.prefix"));
                    message.append(MessageFormat.format(ResourceBundleHelper.getMessageString("wifi.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(eventType)));
                    switch(eventType) {
                        case WIFI_CONNECTED:
                            WifiInfo info = eventMap.get(dataset.getX(series, item));
                            if (info != null && info.getWifiState() == WifiState.WIFI_CONNECTED) {
                                message.append(MessageFormat.format(ResourceBundleHelper.getMessageString("wifi.connTooltip"), info.getWifiMacAddress(), info.getWifiRSSI(), info.getWifiSSID()));
                            }
                            break;
                        default:
                            break;
                    }
                    message.append(ResourceBundleHelper.getMessageString("wifi.tooltip.suffix"));
                    return message.toString();
                }
            });
        }
    }
    plot.setDataset(wifiData);
// return plot;
}
Also used : HashMap(java.util.HashMap) Color(java.awt.Color) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) WifiInfo(com.att.aro.core.peripheral.pojo.WifiInfo) XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) WifiState(com.att.aro.core.peripheral.pojo.WifiInfo.WifiState) XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) XYDataset(org.jfree.data.xy.XYDataset) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) EnumMap(java.util.EnumMap)

Example 5 with TraceResultType

use of com.att.aro.core.packetanalysis.pojo.TraceResultType in project VideoOptimzer by attdevsupport.

the class GpsPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis == null) {
        LOGGER.info("analysis data is null");
        return;
    }
    gpsData.removeAllSeries();
    locationData.removeAllSeries();
    TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
    if (resultType.equals(TraceResultType.TRACE_FILE)) {
        LOGGER.info("didn't get analysis trace data!");
    } else {
        try {
            image = ImageIO.read(GpsPlot.class.getResourceAsStream("/images/location.png"));
            image = ImageHelper.resize(image, 12, 12);
        } catch (IOException e) {
            e.printStackTrace();
        }
        // create the GPS dataset...
        Map<GpsState, XYIntervalSeries> seriesMap = new EnumMap<GpsState, XYIntervalSeries>(GpsState.class);
        for (GpsState eventType : GpsState.values()) {
            XYIntervalSeries series = new XYIntervalSeries(eventType);
            seriesMap.put(eventType, series);
            gpsData.addSeries(series);
        }
        series = new XYSeries("location");
        TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
        listLocationEvent = (ArrayList<LocationEvent>) traceresult.getLocationEventInfos();
        for (int idx = 0; idx < listLocationEvent.size(); idx++) {
            series.add(listLocationEvent.get(idx).getTimeRecorded(), 0.5);
        }
        locationData.addSeries(series);
        Iterator<GpsInfo> iter = analysis.getAnalyzerResult().getTraceresult().getGpsInfos().iterator();
        if (iter.hasNext()) {
            while (iter.hasNext()) {
                GpsInfo gpsEvent = iter.next();
                if (gpsEvent.getGpsState() != GpsState.GPS_DISABLED) {
                    seriesMap.get(gpsEvent.getGpsState()).add(gpsEvent.getBeginTimeStamp(), gpsEvent.getBeginTimeStamp(), gpsEvent.getEndTimeStamp(), 0.5, 0, 1);
                }
            }
        }
        XYItemRenderer renderer = plot.getRenderer(0);
        // Looks like renderer is using the index descending order, so setting the index of the GPS background as 2 & location information index as 1.
        if (renderer == null) {
            renderer = plot.getRenderer(2);
        }
        renderer.setSeriesPaint(gpsData.indexOf(GpsState.GPS_STANDBY), Color.YELLOW);
        renderer.setSeriesPaint(gpsData.indexOf(GpsState.GPS_ACTIVE), new Color(34, 177, 76));
        // Assign ToolTip to renderer
        renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                GpsState eventType = (GpsState) gpsData.getSeries(series).getKey();
                return MessageFormat.format(ResourceBundleHelper.getMessageString("gps.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(eventType));
            }
        });
        plot.setRenderer(2, renderer);
        // Assign ToolTip to renderer
        LocationImageRenderer renderer_loc = new LocationImageRenderer();
        plot.setRenderer(1, renderer_loc);
        renderer_loc.setBaseToolTipGenerator(new XYToolTipGenerator() {

            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                // Update tooltip of location data
                LocationEvent event = listLocationEvent.get(item);
                StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("location.tooltip.prefix"));
                displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("location.tooltip.content"), event.getTimeRecorded(), event.getLatitude(), event.getLongitude(), event.getProvider(), event.getLocality()));
                displayInfo.append(ResourceBundleHelper.getMessageString("location.tooltip.suffix"));
                return displayInfo.toString();
            }
        });
    }
    plot.setDataset(2, gpsData);
    plot.setDataset(1, locationData);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) Color(java.awt.Color) GpsInfo(com.att.aro.core.peripheral.pojo.GpsInfo) IOException(java.io.IOException) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) GpsState(com.att.aro.core.peripheral.pojo.GpsInfo.GpsState) XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) XYDataset(org.jfree.data.xy.XYDataset) StandardXYItemRenderer(org.jfree.chart.renderer.xy.StandardXYItemRenderer) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) EnumMap(java.util.EnumMap) LocationEvent(com.att.aro.core.peripheral.pojo.LocationEvent)

Aggregations

TraceResultType (com.att.aro.core.packetanalysis.pojo.TraceResultType)14 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)13 XYToolTipGenerator (org.jfree.chart.labels.XYToolTipGenerator)9 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)9 XYDataset (org.jfree.data.xy.XYDataset)9 XYSeries (org.jfree.data.xy.XYSeries)7 XYIntervalSeries (org.jfree.data.xy.XYIntervalSeries)6 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)4 EnumMap (java.util.EnumMap)3 XYIntervalSeriesCollection (org.jfree.data.xy.XYIntervalSeriesCollection)3 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)2 Color (java.awt.Color)2 HashMap (java.util.HashMap)2 AbstractTraceResult (com.att.aro.core.packetanalysis.pojo.AbstractTraceResult)1 ScheduledAlarmInfo (com.att.aro.core.packetanalysis.pojo.ScheduledAlarmInfo)1 AlarmInfo (com.att.aro.core.peripheral.pojo.AlarmInfo)1 AlarmType (com.att.aro.core.peripheral.pojo.AlarmInfo.AlarmType)1 AttenuatorEvent (com.att.aro.core.peripheral.pojo.AttenuatorEvent)1 BatteryInfo (com.att.aro.core.peripheral.pojo.BatteryInfo)1 CpuActivity (com.att.aro.core.peripheral.pojo.CpuActivity)1