use of com.att.aro.core.mobiledevice.pojo.IAroDevice in project VideoOptimzer by attdevsupport.
the class AROController method startCollector.
/**
* Extract parameters from an AROCollectorActionEvent event. Initiate a
* collection on Android and iOS devices
*
* @param event
* @param actionCommand
* - "startCollector" or "startCollectorIos"
*/
private void startCollector(ActionEvent event, String actionCommand) {
StatusResult result;
this.theView.updateCollectorStatus(CollectorStatus.STARTING, null);
// reset so that a failure will be true
this.theView.setDeviceDataPulled(true);
if (event instanceof AROCollectorActionEvent) {
IAroDevice device = ((AROCollectorActionEvent) event).getDevice();
String traceName = ((AROCollectorActionEvent) event).getTrace();
extraParams = ((AROCollectorActionEvent) event).getExtraParams();
result = startCollector(device, traceName, extraParams);
LOG.info("---------- result: " + result.toString());
if (!result.isSuccess()) {
// report failure
if (result.getError().getCode() == 206) {
try {
(new File(traceFolderPath)).delete();
} catch (Exception e) {
LOG.warn("failed to delete trace folder :" + traceFolderPath);
}
this.theView.updateCollectorStatus(CollectorStatus.CANCELLED, result);
} else {
this.theView.updateCollectorStatus(null, result);
}
} else {
// apk has launched and been activated
if (!getVideoOption().equals(VideoOption.NONE) && "startCollector".equals(actionCommand)) {
this.theView.liveVideoDisplay(collector);
}
this.theView.updateCollectorStatus(CollectorStatus.STARTED, result);
}
if (device.getPlatform().equals(IAroDevice.Platform.iOS)) {
for (int i = 0; i < 30; i++) {
try {
if (!result.isSuccess() && result.getError().getCode() == 529) {
this.theView.updateCollectorStatus(CollectorStatus.CANCELLED, result);
this.theView.stopCollector();
break;
} else {
Thread.sleep(1000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
use of com.att.aro.core.mobiledevice.pojo.IAroDevice in project VideoOptimzer by attdevsupport.
the class AROController method getDevices.
private int getDevices(IAroDevices aroDevices, List<IDataCollector> collectors, DataCollectorType collectorType) {
int count = 0;
for (IDataCollector iDataCollector : collectors) {
if (iDataCollector.getType().equals(collectorType) && aroDevices != null) {
if (Util.isMacOS() && iDataCollector.getType().equals(DataCollectorType.IOS)) {
StatusResult status = new StatusResult();
IAroDevice[] aroDeviceArray = iDataCollector.getDevices(status);
aroDevices.addDeviceArray(aroDeviceArray);
count = aroDeviceArray == null ? 0 : aroDeviceArray.length;
} else {
IDevice[] androidDevices = getConnectedDevices();
if (androidDevices != null && androidDevices.length > 0) {
aroDevices.addDeviceArray(androidDevices);
}
count = androidDevices == null ? 0 : androidDevices.length;
}
}
}
return count;
}
use of com.att.aro.core.mobiledevice.pojo.IAroDevice in project VideoOptimzer by attdevsupport.
the class DeviceTablePanel method getContentTable.
/**
* Initializes and returns the RequestResponseTable.
*/
public DataTable<IAroDevice> getContentTable() {
if (contentTable == null) {
contentTable = new DataTable<IAroDevice>(tableModel);
contentTable.setName(ResourceBundleHelper.getMessageString("collector.device.list.tableName"));
contentTable.setAutoCreateRowSorter(true);
contentTable.setGridColor(Color.LIGHT_GRAY);
contentTable.setRowHeight(ROW_HEIGHT);
contentTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
contentTable.addMouseListener(this);
DataTablePopupMenu popupMenu = (DataTablePopupMenu) contentTable.getPopup();
popupMenu.initialize();
}
return contentTable;
}
use of com.att.aro.core.mobiledevice.pojo.IAroDevice in project VideoOptimzer by attdevsupport.
the class ARODataCollectorMenu method actionPerformed.
@Override
public void actionPerformed(ActionEvent aEvent) {
if (aEvent.getActionCommand().equalsIgnoreCase(menuItemDatacollectorStart)) {
Object event = aEvent.getSource();
if (event instanceof JMenuItem) {
List<IDataCollector> collectors = parent.getAvailableCollectors();
if (collectors == null || collectors.isEmpty()) {
MessageDialogFactory.showMessageDialog(((MainFrame) parent).getJFrame(), ResourceBundleHelper.getMessageString("collector.nocollectors"), ResourceBundleHelper.getMessageString("menu.error.title"), JOptionPane.ERROR_MESSAGE);
return;
}
LOG.info("collector count:" + collectors.size());
for (IDataCollector collector : collectors) {
LOG.info(collector.getName());
}
IAroDevices aroDevices = parent.getAroDevices();
IAroDevice device = null;
if (aroDevices.size() != 0) {
device = chooseDevice(aroDevices, collectors);
} else {
MessageDialogFactory.showMessageDialog(((MainFrame) parent).getJFrame(), ResourceBundleHelper.getMessageString("collector.nodevices"), ResourceBundleHelper.getMessageString("menu.error.title"), JOptionPane.INFORMATION_MESSAGE);
return;
}
if (device == null) {
MessageDialogFactory.showMessageDialog(((MainFrame) parent).getJFrame(), ResourceBundleHelper.getMessageString("collector.cancelled"), ResourceBundleHelper.getMessageString("menu.info.title"), JOptionPane.INFORMATION_MESSAGE);
return;
}
}
} else if (aEvent.getActionCommand().equalsIgnoreCase(menuItemDatacollectorStop)) {
((MainFrame) parent).stopCollector();
setStartMenuItem(true);
}
}
use of com.att.aro.core.mobiledevice.pojo.IAroDevice in project VideoOptimzer by attdevsupport.
the class Application method selectDevice.
private void selectDevice(ApplicationContext context, OutSave outSave) {
aroDevices = showDevices(context, cmds);
int selection = 0;
IAroDevice device = null;
// String selected = aroDevices.getId(3);
if (aroDevices.size() > 1) {
selection = -1;
do {
String range = "0-" + (aroDevices.size() - 1);
String message = "Select a device, q to quit :" + range;
String sValue = null;
try {
sValue = input(outSave, message, Pattern.compile("[" + range + "q]"));
if (sValue.contains("q")) {
restoreSystemOut(outSave);
System.exit(0);
}
selection = Integer.valueOf(sValue);
} catch (NumberFormatException e) {
outln("Illegal entry, unable to parse \"" + sValue + "\"");
}
} while (selection < 0 || selection >= aroDevices.size());
} else if (aroDevices.size() == 1 && aroDevices.getDevice(0).getState().equals(AroDeviceState.Available)) {
selection = 0;
} else {
errln("No devices available");
restoreSystemOut(outSave);
System.exit(0);
}
// have a selected device
device = aroDevices.getDevice(selection);
cmds.setDeviceid(device.getId());
// prepare collector choice
String requestCollector = cmds.getAsk();
if (cmds.getStartcollector() != null) {
requestCollector = cmds.getStartcollector();
}
if (!collectorCompatibility(requestCollector, device)) {
outln("Error :Incompatible collector for device:" + device.getPlatform() + ", collector:" + requestCollector);
System.exit(0);
}
String deviceCollector = collectorSanityCheck(requestCollector, device);
if (deviceCollector.startsWith("Error")) {
outln(deviceCollector);
System.exit(0);
}
if ("auto".equals(requestCollector)) {
// store the auto selection
cmds.setStartcollector(deviceCollector);
} else if (!requestCollector.equalsIgnoreCase(deviceCollector)) {
if (device.isRooted()) {
// run rooted or vpn on rooted
cmds.setStartcollector(requestCollector);
} else if (!device.isRooted() && !requestCollector.equals("vpn_collector")) {
// only run vpn on non-rooted
cmds.setStartcollector(requestCollector);
} else {
outln("Error: incompatable collector for chosen device");
System.exit(0);
}
} else {
// allow the asked collector
cmds.setStartcollector(requestCollector);
}
}
Aggregations