Search in sources :

Example 1 with MainFrame

use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.

the class ARODataCollectorMenu method chooseDevice.

private IAroDevice chooseDevice(IAroDevices aroDevices, List<IDataCollector> collectors) {
    ArrayList<IAroDevice> deviceList = aroDevices.getDeviceList();
    IAroDevice device = null;
    int delayTimeDL = 0;
    int throttleDL = 0;
    int throttleUL = 0;
    boolean throttleDLEnable = false;
    boolean throttleULEnable = false;
    boolean profileBoolean = false;
    String traceFolderName = "";
    String profileLocation = "";
    if (((MainFrame) parent).getPreviousOptions() != null) {
        previousOptions = ((MainFrame) parent).getPreviousOptions();
    }
    metaDataModel = new MetaDataModel();
    DataCollectorSelectNStartDialog dialog = new DataCollectorSelectNStartDialog(((MainFrame) parent).getJFrame(), parent, deviceList, traceFolderName, collectors, true, previousOptions, metaDataModel);
    if (dialog.getResponse()) {
        device = dialog.getDevice();
        traceFolderName = dialog.getTraceFolder();
        device.setCollector(dialog.getCollectorOption());
        /*debug purpose*/
        delayTimeDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayDS();
        dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayUS();
        throttleDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleDL();
        throttleUL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleUL();
        throttleDLEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleDLEnabled();
        throttleULEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleULEnabled();
        profileLocation = dialog.getDeviceOptionPanel().getAttenuatorModel().getLocalPath();
        profileBoolean = dialog.getDeviceOptionPanel().getAttenuatorModel().isLoadProfile();
        LOG.info("set U delay: " + delayTimeDL + ", set D delay: " + delayTimeDL + ", set U throttle: " + throttleUL + ", set D throttle: " + throttleDL + ", set profile: " + profileBoolean + ", set profileLocation: " + profileLocation);
        if (device.isPlatform(IAroDevice.Platform.iOS)) {
            IDataCollector iosCollector = findIOSCollector(collectors);
            if ((throttleDLEnable || throttleULEnable) && !NetworkUtil.isNetworkUp(SharedNetIF)) {
                MessageDialogFactory.getInstance().showInformationDialog(((MainFrame) parent).getJFrame(), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.finalwarning"), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.noshared"));
                return null;
            }
            if (!checkSetSuPassword(iosCollector)) {
                return null;
            } else {
                LOG.info("pw validated");
            }
        }
        String traceFolderPath = (device.getPlatform().equals(IAroDevice.Platform.Android)) ? Util.getAROTraceDirAndroid() + System.getProperty("file.separator") + traceFolderName : Util.getAROTraceDirIOS() + System.getProperty("file.separator") + traceFolderName;
        String currentPath = ((MainFrame) parent).getTracePath();
        if (fileManager.directoryExistAndNotEmpty(traceFolderPath)) {
            int result = folderExistsDialog();
            if (result == JOptionPane.OK_OPTION) {
                if (traceFolderPath.equals(currentPath)) {
                    new MessageDialogFactory().showErrorDialog(null, ResourceBundleHelper.getMessageString("viewer.contentUnwritable"));
                    return null;
                }
                File mountPoint = fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT);
                if (fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT).exists() && device.getPlatform().equals(IAroDevice.Platform.iOS)) {
                    IExternalProcessRunner runner = new ExternalProcessRunnerImpl();
                    String results = runner.executeCmd(String.format("umount %s;rmdir %s", mountPoint, mountPoint));
                    if (!results.isEmpty()) {
                        new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " is BUSY");
                        return null;
                    } else {
                        int count = 0;
                        while (fileManager.directoryExistAndNotEmpty(mountPoint.toString())) {
                            if (++count > 5) {
                                new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " will not release, please detach the iOS device and delete the foldere manually");
                                return null;
                            }
                            try {
                                Thread.sleep(1000);
                            } catch (InterruptedException e) {
                                Log.error("sleep interrupted");
                            }
                        }
                    }
                }
                fileManager.deleteFolderContents(traceFolderPath);
            } else {
                return null;
            }
        }
        Hashtable<String, Object> extras = prepareStartCollectorExtras(device, traceFolderName, dialog);
        updateMetaData(device, traceFolderName, dialog);
        extras.put("DIALOG_SIZE", dialog.getBaseSize());
        if (dialog.getDeviceOptionPanel().getLabeledExpandedOptionFields().isVisible()) {
            extras.put("MetaDataExpanded", true);
        }
        ((MainFrame) parent).startCollector(device, traceFolderName, extras, metaDataModel);
    } else {
        traceFolderName = null;
    }
    dialog.dispose();
    return device;
}
Also used : MetaDataModel(com.att.aro.core.tracemetadata.pojo.MetaDataModel) MainFrame(com.att.aro.ui.view.MainFrame) IExternalProcessRunner(com.att.aro.core.commandline.IExternalProcessRunner) IAroDevice(com.att.aro.core.mobiledevice.pojo.IAroDevice) DataCollectorSelectNStartDialog(com.att.aro.ui.commonui.DataCollectorSelectNStartDialog) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) IDataCollector(com.att.aro.core.datacollector.IDataCollector) File(java.io.File) ExternalProcessRunnerImpl(com.att.aro.core.commandline.impl.ExternalProcessRunnerImpl)

Example 2 with MainFrame

use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.

the class OpenPcapFileDialog method reloadTrace.

private void reloadTrace() {
    LOG.info("Starting analysis");
    if (parent instanceof MainFrame) {
        if (StringUtils.isNotBlank(newPcapFileTracePath)) {
            parent.updateTracePath(new File(newPcapFileTracePath + Util.FILE_SEPARATOR + originalPcapFileObj.getName()));
        }
    }
    LOG.info("Ending analysis");
}
Also used : File(java.io.File) MainFrame(com.att.aro.ui.view.MainFrame)

Example 3 with MainFrame

use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.

the class JFxPlayerControl method setUpMediaPlayer.

private void setUpMediaPlayer() {
    AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
    if (null != filter) {
        Double startTime = filter.getTimeRange().getBeginTime();
        mediaPlayer.setStartTime(new Duration(startTime * 1000));
        updateControllerBar();
    }
    mediaPlayer.currentTimeProperty().addListener(new InvalidationListener() {

        @Override
        public void invalidated(Observable arg0) {
            updateControllerBar();
        }
    });
    mediaPlayer.setOnPlaying(new Runnable() {

        @Override
        public void run() {
            playButton.setText("||");
            diagnosticTabSynThread = new VideoSyncThread(jfxPlayer, diagnosticTab, videoOffset);
            new Thread(diagnosticTabSynThread).start();
        }
    });
    mediaPlayer.setOnPaused(new Runnable() {

        @Override
        public void run() {
            playButton.setText(">");
        }
    });
    mediaPlayer.setOnStopped(new Runnable() {

        @Override
        public void run() {
            Double startTime = 0.0;
            AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
            if (null != filter) {
                startTime = filter.getTimeRange().getBeginTime();
            }
            mediaPlayer.seek(new Duration(startTime));
            playButton.setText(">");
            timeSlider.setValue(startTime);
        }
    });
    mediaPlayer.setOnReady(new Runnable() {

        @Override
        public void run() {
            // Duration is available when player is ready (not available before that)
            duration = mediaPlayer.getMedia().getDuration();
            sliderMax = getVideoDuration() * FRAME_RATE;
            if (timeSlider != null) {
                timeSlider.setMax(sliderMax);
            }
            updateControllerBar();
        }
    });
    mediaPlayer.setOnEndOfMedia(new Runnable() {

        @Override
        public void run() {
            Double startTime = 0.0;
            AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
            if (null != filter) {
                startTime = filter.getTimeRange().getBeginTime();
            }
            mediaPlayer.seek(new Duration(startTime));
            mediaPlayer.pause();
            playButton.setText(">");
            timeSlider.setValue(startTime);
            updateTimeLabel();
        }
    });
}
Also used : AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) InvalidationListener(javafx.beans.InvalidationListener) Duration(javafx.util.Duration) Observable(javafx.beans.Observable) MainFrame(com.att.aro.ui.view.MainFrame)

Example 4 with MainFrame

use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.

the class SegmentTablePanel method reAnalyze.

protected void reAnalyze() {
    StreamingVideoData streamingVideoData = analyzerResult.getAnalyzerResult().getStreamingVideoData();
    if (streamingVideoData != null) {
        streamingVideoData.scanVideoStreams();
    }
    ((MainFrame) aroView).getDiagnosticTab().getGraphPanel().refresh(analyzerResult);
    analyzerResult = videoBestPractices.analyze(analyzerResult);
    ((MainFrame) aroView).getDiagnosticTab().getGraphPanel().setTraceData(analyzerResult);
    ((MainFrame) aroView).getVideoTab().refreshLocal(analyzerResult, false);
    ((MainFrame) ((MainFrame) aroView).getDiagnosticTab().getGraphPanel().getGraphPanelParent().getAroView()).refreshBestPracticesTab();
    if (!videoStream.getVideoEventMap().isEmpty()) {
        if (checkBoxVideo != null && checkBoxAudio != null && (checkBoxVideo.isVisible() || checkBoxAudio.isVisible())) {
            refresh(checkBoxVideo, checkBoxAudio);
        } else {
            refresh(null, null);
        }
    }
}
Also used : StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) MainFrame(com.att.aro.ui.view.MainFrame)

Example 5 with MainFrame

use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.

the class LoadManifestDialog method loadManifest.

/**
 * Copy a file, files or a folder of files into tracepath/downloads/ Will traverse folders within a folder
 */
protected void loadManifest(AnalysisFilter analysisfilter) {
    if (aroView.getTracePath() != null) {
        // Open filechooser
        JFileChooser fileChooser = new JFileChooser(aroView.getTracePath());
        fileChooser.setMultiSelectionEnabled(true);
        fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("mpd, m3u8 or json", "mpd", "m3u8", "json"));
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setAcceptAllFileFilterUsed(false);
        int result = fileChooser.showOpenDialog(this);
        if (result == JFileChooser.APPROVE_OPTION) {
            if (checkBoxCSI.isSelected() && analysisfilter != null) {
                String folderNameForCSIStuff = aroView.getTracePath() + File.separator + "CSI";
                String expectedManifestFileName = folderNameForCSIStuff + File.separator + fileChooser.getSelectedFile().getName();
                File expectedManifestFile = new File(expectedManifestFileName);
                try {
                    if (!fileChooser.getSelectedFile().getPath().equals(expectedManifestFileName) && !expectedManifestFile.exists()) {
                        IFileManager fileManager = new FileManagerImpl();
                        if (fileManager.directoryExistAndNotEmpty(expectedManifestFile.getParentFile().getPath())) {
                            if (folderExistsDialog() == JOptionPane.YES_OPTION) {
                                FileUtils.deleteDirectory(expectedManifestFile.getParentFile());
                            }
                        }
                        if (!Files.exists(expectedManifestFile.getParentFile().toPath())) {
                            Files.createDirectory(expectedManifestFile.getParentFile().toPath());
                        }
                        if (fileChooser.getSelectedFile().getParent().equals(aroView.getTracePath())) {
                            Files.move(fileChooser.getSelectedFile().toPath(), expectedManifestFile.toPath());
                        } else {
                            Files.copy(fileChooser.getSelectedFile().toPath(), expectedManifestFile.toPath());
                        }
                    }
                } catch (IOException ioe) {
                    expectedManifestFileName = fileChooser.getSelectedFile().getPath();
                }
                analysisfilter.setCSI(true);
                analysisfilter.setManifestFilePath(expectedManifestFileName);
                ((MainFrame) aroView).updateFilter(analysisfilter);
            } else {
                // save selected file/files inside downloads folder
                fileChooser.getSelectedFile().getPath();
                String downloadsPath = aroView.getTracePath() + Util.FILE_SEPARATOR + "downloads";
                try {
                    File[] files = fileChooser.getSelectedFiles();
                    if (!files[0].toString().equals(downloadsPath)) {
                        // expand out of folder
                        if (fileChooser.getSelectedFile().isDirectory()) {
                            files = files[0].listFiles();
                        }
                        if (null == files) {
                            return;
                        }
                        for (File file : files) {
                            if (file.isFile()) {
                                FileCopyUtils.copy(file, new File(downloadsPath, file.getName()));
                            }
                        }
                    } else {
                        LOG.error("user error :Chose downloads folder, will ignore");
                    }
                } catch (IOException e1) {
                    LOG.error("IOException :" + e1.getMessage());
                }
                // refresh analyzer
                aroView.updateTracePath(new File(aroView.getTracePath()));
            }
        }
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) IOException(java.io.IOException) FileNameExtensionFilter(javax.swing.filechooser.FileNameExtensionFilter) File(java.io.File) FileManagerImpl(com.att.aro.core.fileio.impl.FileManagerImpl) MainFrame(com.att.aro.ui.view.MainFrame) IFileManager(com.att.aro.core.fileio.IFileManager)

Aggregations

MainFrame (com.att.aro.ui.view.MainFrame)24 File (java.io.File)7 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)5 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)4 IOException (java.io.IOException)4 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 IFileManager (com.att.aro.core.fileio.IFileManager)2 FileManagerImpl (com.att.aro.core.fileio.impl.FileManagerImpl)2 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)2 StreamingVideoData (com.att.aro.core.videoanalysis.pojo.StreamingVideoData)2 EnableEscKeyCloseDialog (com.att.aro.ui.commonui.EnableEscKeyCloseDialog)2 MessageDialogFactory (com.att.aro.ui.commonui.MessageDialogFactory)2 TimeRangeAnalysisDialog (com.att.aro.ui.view.menu.tools.TimeRangeAnalysisDialog)2 JButton (javax.swing.JButton)2 FileNameExtensionFilter (javax.swing.filechooser.FileNameExtensionFilter)2 IDevice (com.android.ddmlib.IDevice)1 IExternalProcessRunner (com.att.aro.core.commandline.IExternalProcessRunner)1 ExternalProcessRunnerImpl (com.att.aro.core.commandline.impl.ExternalProcessRunnerImpl)1 ProfileType (com.att.aro.core.configuration.pojo.ProfileType)1