use of com.att.aro.core.peripheral.pojo.RadioInfo in project VideoOptimzer by attdevsupport.
the class RadioInfoReaderImpl method readData.
@Override
public List<RadioInfo> readData(String directory, double startTime) {
List<RadioInfo> radioInfos = new ArrayList<RadioInfo>();
String filepath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.RADIO_EVENTS_FILE;
String[] lines = null;
if (!filereader.fileExist(filepath)) {
return radioInfos;
}
try {
lines = filereader.readAllLine(filepath);
} catch (IOException e1) {
LOGGER.error("failed to read Radio info file: " + filepath);
}
Double lastDbmValue = null;
if (lines != null && lines.length > 0) {
for (String strLineBuf : lines) {
String[] strFields = strLineBuf.split(" ");
try {
if (strFields.length == 2) {
double timestampVal = Util.normalizeTime(Double.parseDouble(strFields[0]), startTime);
double dbmValue = Double.parseDouble(strFields[1]);
// Special handling for lost or regained signal
if (lastDbmValue != null && timestampVal > 0.0 && (dbmValue >= 0.0 || lastDbmValue.doubleValue() >= 0.0) && dbmValue != lastDbmValue.doubleValue()) {
radioInfos.add(new RadioInfo(timestampVal, lastDbmValue.doubleValue()));
}
// Add radio event
radioInfos.add(new RadioInfo(timestampVal, dbmValue));
lastDbmValue = dbmValue;
} else if (strFields.length == 6) {
// LTE
double timestampVal = Util.normalizeTime(Double.parseDouble(strFields[0]), startTime);
RadioInfo radioInformation = new RadioInfo(timestampVal, Integer.parseInt(strFields[1]), Integer.parseInt(strFields[2]), Integer.parseInt(strFields[3]), Integer.parseInt(strFields[4]), Integer.parseInt(strFields[5]));
// Special handling for lost or regained signal
if (lastDbmValue != null && timestampVal > 0.0 && (radioInformation.getSignalStrength() >= 0.0 || lastDbmValue.doubleValue() >= 0.0) && radioInformation.getSignalStrength() != lastDbmValue.doubleValue()) {
radioInfos.add(new RadioInfo(timestampVal, lastDbmValue.doubleValue()));
}
// Add radio event
radioInfos.add(radioInformation);
lastDbmValue = radioInformation.getSignalStrength();
} else {
LOGGER.warn("Invalid radio_events entry: " + strLineBuf);
}
} catch (Exception e) {
LOGGER.warn("Unexpected error parsing radio event: " + strLineBuf, e);
}
}
}
return radioInfos;
}
use of com.att.aro.core.peripheral.pojo.RadioInfo in project VideoOptimzer by attdevsupport.
the class PktAnazlyzerTimeRangeImpl method getRadioInfosForTheTimeRange.
private void getRadioInfosForTheTimeRange(TraceDirectoryResult result, double beginTime, double endTime) {
List<RadioInfo> orifilteredRadioInfos = result.getRadioInfos();
List<RadioInfo> filteredRadioInfos = new ArrayList<RadioInfo>();
for (RadioInfo radioInfo : orifilteredRadioInfos) {
if (radioInfo.getTimeStamp() >= beginTime && radioInfo.getTimeStamp() <= endTime) {
filteredRadioInfos.add(radioInfo);
}
}
result.setRadioInfos(filteredRadioInfos);
// return filteredRadioInfos;
}
use of com.att.aro.core.peripheral.pojo.RadioInfo in project VideoOptimzer by attdevsupport.
the class TraceDataReaderImpl method readFileUtil.
/**
* some of the trace files read here
*
* Parses the user event trace
*
* @throws IOException
*
* Reads the screen rotations information contained in the
* "screen_rotations" file found inside the trace directory and adds
* them to the user events list.
* @throws IOException
* Reads the CPU trace information from the CPU file.
*
* @throws IOException
* Method to read the GPS data from the trace file and store it in
* the gpsInfos list. It also updates the active duration for GPS.
* Method to read the Bluetooth data from the trace file and store
* it in the bluetoothInfos list. It also updates the active
* duration for Bluetooth.
*
* @throws IOException
* Method to read the Camera data from the trace file and store it
* in the cameraInfos list. It also updates the active duration for
* Camera.
*
* Method to read the WIFI data from the trace file and store it in
* the wifiInfos list. It also updates the active duration for Wifi.
*
* Method to read the Screen State data from the trace file and
* store it in the ScreenStateInfos list.
*
* Method to read the Battery data from the trace file and store it
* in the batteryInfos list.
*
* Method to read the alarm event from the trace file and store it
* in the alarmInfos list.
*
* Reads the Radio data from the file and stores it in the
* RadioInfo.
* @param result
*/
public void readFileUtil(TraceDirectoryResult result) {
NetworkTypeObject obj = networktypereader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
if (obj != null) {
result.setNetworkTypeInfos(obj.getNetworkTypeInfos());
result.setNetworkTypesList(obj.getNetworkTypesList());
}
CollectOptions collectOptions = collectOptionsReader.readData(result.getTraceDirectory());
result.setCollectOptions(collectOptions);
List<UserEvent> userEvents = usereventreader.readData(result.getTraceDirectory(), result.getEventTime0(), result.getPcapTime0());
result.setUserEvents(userEvents);
List<UserEvent> list = this.screenrotationreader.readData(result.getTraceDirectory(), result.getPcapTime0());
result.setScreenRotationCounter(list.size());
result.getUserEvents().addAll(list);
List<TemperatureEvent> temperatureEvents = cputemperaturereader.readData(result.getTraceDirectory(), result.getPcapTime0());
result.setTemperatureInfos(temperatureEvents);
List<LocationEvent> locationEvents = locationreader.readData(result.getTraceDirectory(), result.getPcapTime0());
result.setLocationEventInfos(locationEvents);
CpuActivityList cpuActivityList = cpureader.readData(result.getTraceDirectory(), result.getPcapTime0());
result.setCpuActivityList(cpuActivityList);
List<GpsInfo> gpsInfos = gpsreader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
result.setGpsInfos(gpsInfos);
result.setGpsActiveDuration(gpsreader.getGpsActiveDuration());
List<BluetoothInfo> bluetoothInfos = bluetoothreader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
result.setBluetoothInfos(bluetoothInfos);
result.setBluetoothActiveDuration(bluetoothreader.getBluetoothActiveDuration());
List<WifiInfo> wifiInfos = wifireader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
result.setWifiInfos(wifiInfos);
result.setWifiActiveDuration(wifireader.getWifiActiveDuration());
List<CameraInfo> cameraInfos = camerareader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
result.setCameraInfos(cameraInfos);
result.setCameraActiveDuration(camerareader.getActiveDuration());
List<ThermalStatusInfo> thermalStatusInfos = new ThermalStatusReaderImpl(filereader).readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
result.setThermalstatusInfos(thermalStatusInfos);
List<ScreenStateInfo> screenStateInfos = screenstatereader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
result.setScreenStateInfos(screenStateInfos);
List<BatteryInfo> batteryInfos = batteryinforeader.readData(result.getTraceDirectory(), result.getPcapTime0());
result.setBatteryInfos(batteryInfos);
// alarm info from kernel log file
List<AlarmInfo> alarmInfos = alarminforeader.readData(result.getTraceDirectory(), result.getDumpsysEpochTimestamp(), result.getDumpsysElapsedTimestamp(), result.getTraceDateTime());
result.setAlarmInfos(alarmInfos);
List<RadioInfo> radioInfos = radioinforeader.readData(result.getTraceDirectory(), result.getPcapTime0());
result.setRadioInfos(radioInfos);
VideoStreamStartupData videoStreamStartupData = videoStartupReader.readData(result.getTraceDirectory());
result.setVideoStartupData(videoStreamStartupData);
result.setMetaData(metaDataReadWrite.readData(result.getTraceDirectory()));
}
use of com.att.aro.core.peripheral.pojo.RadioInfo in project VideoOptimzer by attdevsupport.
the class RadioPlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
XYSeries series = new XYSeries(0);
if (analysis == null) {
LOGGER.info("no trace data here");
} else {
TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
if (resultType.equals(TraceResultType.TRACE_FILE)) {
LOGGER.info("no trace folder data here");
} else {
TraceDirectoryResult traceResult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
radioInfos = traceResult.getRadioInfos();
if (radioInfos.size() > 0 && analysis.getAnalyzerResult().getFilter().getTimeRange() != null) {
RadioInfo first = radioInfos.get(0);
series.add(analysis.getAnalyzerResult().getFilter().getTimeRange().getBeginTime().doubleValue(), first.getSignalStrength() < 0 ? first.getSignalStrength() : MIN_SIGNAL);
}
for (RadioInfo ri : radioInfos) {
series.add(ri.getTimeStamp(), ri.getSignalStrength() < 0 ? ri.getSignalStrength() : MIN_SIGNAL);
}
if (radioInfos.size() > 0) {
RadioInfo last = radioInfos.get(radioInfos.size() - 1);
if (analysis.getAnalyzerResult().getFilter().getTimeRange() != null) {
series.add(analysis.getAnalyzerResult().getFilter().getTimeRange().getEndTime().doubleValue(), last.getSignalStrength() < 0 ? last.getSignalStrength() : MIN_SIGNAL);
} else {
series.add(traceResult.getTraceDuration(), last.getSignalStrength() < 0 ? last.getSignalStrength() : MIN_SIGNAL);
}
}
// Assign ToolTip to renderer
XYItemRenderer renderer = plot.getRenderer();
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
RadioInfo ri = radioInfos.get(Math.min(item, radioInfos.size() - 1));
if (ri.getSignalStrength() < 0) {
if (ri.isLte()) {
return MessageFormat.format(ResourceBundleHelper.getMessageString("radio.tooltip.lte"), ri.getLteRsrp(), ri.getLteRsrq());
} else {
return MessageFormat.format(ResourceBundleHelper.getMessageString("radio.tooltip"), ri.getSignalStrength());
}
} else {
return ResourceBundleHelper.getMessageString("radio.noSignal");
}
}
});
}
}
plot.setDataset(new XYSeriesCollection(series));
// return plot;
}
use of com.att.aro.core.peripheral.pojo.RadioInfo in project VideoOptimzer by attdevsupport.
the class PktAnazlyzerTimeRangeImplTest method getTimeRangeResultTest.
@Test
public void getTimeRangeResultTest() {
TraceDirectoryResult result = new TraceDirectoryResult();
List<UserEvent> userEvents = new ArrayList<UserEvent>();
userEvents.add(new UserEvent(UserEventType.KEY_HOME, 4.0, 3.0));
result.setUserEvents(userEvents);
List<GpsInfo> gpsInfos = new ArrayList<GpsInfo>();
gpsInfos.add(new GpsInfo(0.0, 0.9, GpsState.GPS_ACTIVE));
gpsInfos.add(new GpsInfo(1.0, 4.0, GpsState.GPS_ACTIVE));
gpsInfos.add(new GpsInfo(1.4, 12.0, GpsState.GPS_ACTIVE));
gpsInfos.add(new GpsInfo(12.4, 14.0, GpsState.GPS_ACTIVE));
result.setGpsInfos(gpsInfos);
List<BluetoothInfo> bluetoothInfos = new ArrayList<BluetoothInfo>();
bluetoothInfos.add(new BluetoothInfo(0.0, 3.0, BluetoothState.BLUETOOTH_CONNECTED));
bluetoothInfos.add(new BluetoothInfo(4.0, 10.0, BluetoothState.BLUETOOTH_CONNECTED));
bluetoothInfos.add(new BluetoothInfo(1.0, 13.0, BluetoothState.BLUETOOTH_DISCONNECTED));
bluetoothInfos.add(new BluetoothInfo(11.0, 16.0, BluetoothState.BLUETOOTH_CONNECTED));
result.setBluetoothInfos(bluetoothInfos);
List<CameraInfo> cameraInfos = new ArrayList<CameraInfo>();
cameraInfos.add(new CameraInfo(0.0, 1.0, CameraState.CAMERA_ON));
cameraInfos.add(new CameraInfo(3.0, 7.0, CameraState.CAMERA_ON));
cameraInfos.add(new CameraInfo(8.0, 14.0, CameraState.CAMERA_ON));
cameraInfos.add(new CameraInfo(1.0, 14.0, CameraState.CAMERA_ON));
cameraInfos.add(new CameraInfo(12.0, 15.0, CameraState.CAMERA_ON));
result.setCameraInfos(cameraInfos);
List<ScreenStateInfo> screenStateInfos = new ArrayList<ScreenStateInfo>();
ScreenStateInfo screenInfo01 = new ScreenStateInfo(0.0, 1.0, ScreenState.SCREEN_ON, " ", 5);
ScreenStateInfo screenInfo02 = new ScreenStateInfo(1.0, 12.0, ScreenState.SCREEN_ON, "", 3);
ScreenStateInfo screenInfo03 = new ScreenStateInfo(5.0, 9.0, ScreenState.SCREEN_ON, "", 2);
ScreenStateInfo screenInfo04 = new ScreenStateInfo(12.0, 15.0, ScreenState.SCREEN_ON, "", 4);
screenStateInfos.add(screenInfo01);
screenStateInfos.add(screenInfo02);
screenStateInfos.add(screenInfo03);
screenStateInfos.add(screenInfo04);
result.setScreenStateInfos(screenStateInfos);
List<RadioInfo> radioInfos = new ArrayList<RadioInfo>();
radioInfos.add(new RadioInfo(0.0, 3.0));
radioInfos.add(new RadioInfo(4.0, 8.0));
result.setRadioInfos(radioInfos);
List<BatteryInfo> batteryInfos = new ArrayList<BatteryInfo>();
batteryInfos.add(new BatteryInfo(3.0, true, 2, 3));
result.setBatteryInfos(batteryInfos);
List<WifiInfo> wifiInfos = new ArrayList<WifiInfo>();
wifiInfos.add(new WifiInfo(1.0, 2.0, WifiState.WIFI_CONNECTED, "", "", ""));
wifiInfos.add(new WifiInfo(1.0, 5.0, WifiState.WIFI_CONNECTING, "", "", ""));
wifiInfos.add(new WifiInfo(1.4, 13.0, WifiState.WIFI_CONNECTING, "", "", ""));
wifiInfos.add(new WifiInfo(9.0, 13.0, WifiState.WIFI_CONNECTING, "", "", ""));
result.setWifiInfos(wifiInfos);
List<NetworkType> networkTypesList = new ArrayList<NetworkType>();
networkTypesList.add(NetworkType.LTE);
result.setNetworkTypesList(networkTypesList);
List<NetworkBearerTypeInfo> networkTypeInfos = new ArrayList<NetworkBearerTypeInfo>();
networkTypeInfos.add(new NetworkBearerTypeInfo(1.0, 3.0, NetworkType.HSPA, NetworkType.OVERRIDE_NETWORK_TYPE_NONE));
networkTypeInfos.add(new NetworkBearerTypeInfo(8.0, 12.0, NetworkType.HSPA, NetworkType.OVERRIDE_NETWORK_TYPE_NONE));
result.setNetworkTypeInfos(networkTypeInfos);
TimeRange timeRange = new TimeRange(2.00, 11.00);
TraceDirectoryResult testResult = (TraceDirectoryResult) pktTimeUtil.getTimeRangeResult(result, timeRange);
assertEquals(1, testResult.getBatteryInfos().size());
assertEquals(2, testResult.getGpsInfos().size());
assertEquals(1, testResult.getBatteryInfos().size());
assertEquals(5, testResult.getCameraInfos().size());
assertEquals(2, testResult.getScreenStateInfos().size());
assertEquals(1, testResult.getRadioInfos().size());
assertEquals(3, testResult.getWifiInfos().size());
assertEquals(2, testResult.getNetworkTypeInfos().size());
}
Aggregations