use of com.att.aro.core.peripheral.pojo.BluetoothInfo in project VideoOptimzer by attdevsupport.
the class BluetoothPlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
if (analysis != null) {
bluetoothData.removeAllSeries();
XYIntervalSeries bluetoothConnected = new XYIntervalSeries(BluetoothState.BLUETOOTH_CONNECTED);
XYIntervalSeries bluetoothDisconnected = new XYIntervalSeries(BluetoothState.BLUETOOTH_DISCONNECTED);
XYIntervalSeries bluetoothOff = new XYIntervalSeries(BluetoothState.BLUETOOTH_TURNED_OFF);
XYIntervalSeries bluetoothOn = new XYIntervalSeries(BluetoothState.BLUETOOTH_TURNED_ON);
XYIntervalSeries bluetoothUnknown = new XYIntervalSeries(BluetoothState.BLUETOOTH_UNKNOWN);
bluetoothData.addSeries(bluetoothConnected);
bluetoothData.addSeries(bluetoothDisconnected);
bluetoothData.addSeries(bluetoothOff);
bluetoothData.addSeries(bluetoothOn);
bluetoothData.addSeries(bluetoothUnknown);
// Populate the data set
Iterator<BluetoothInfo> iter = analysis.getAnalyzerResult().getTraceresult().getBluetoothInfos().iterator();
XYIntervalSeries series;
if (iter.hasNext()) {
while (iter.hasNext()) {
BluetoothInfo btEvent = iter.next();
if (btEvent.getBluetoothState() == null) {
series = bluetoothUnknown;
} else {
switch(btEvent.getBluetoothState()) {
case BLUETOOTH_CONNECTED:
series = bluetoothConnected;
break;
case BLUETOOTH_DISCONNECTED:
series = bluetoothDisconnected;
break;
case BLUETOOTH_TURNED_ON:
series = bluetoothOn;
break;
case BLUETOOTH_TURNED_OFF:
series = bluetoothOff;
break;
default:
series = bluetoothUnknown;
break;
}
}
series.add(btEvent.getBeginTimeStamp(), btEvent.getBeginTimeStamp(), btEvent.getEndTimeStamp(), 0.5, 0, 1);
}
}
XYItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_CONNECTED), new Color(34, 177, 76));
renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_DISCONNECTED), Color.YELLOW);
renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_TURNED_OFF), new Color(216, 132, 138));
renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_TURNED_ON), new Color(162, 226, 98));
renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_UNKNOWN), new Color(154, 154, 154));
// Assign ToolTip to renderer
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
BluetoothState eventType = (BluetoothState) bluetoothData.getSeries(series).getKey();
return MessageFormat.format(ResourceBundleHelper.getMessageString("bluetooth.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(eventType));
}
});
}
plot.setDataset(bluetoothData);
// return plot;
}
use of com.att.aro.core.peripheral.pojo.BluetoothInfo in project VideoOptimzer by attdevsupport.
the class PktAnazlyzerTimeRangeImpl method getBluetoothInfosForTheTimeRange.
/**
* Returns the list of bluetooth events filtered based on the time range.
*/
private void getBluetoothInfosForTheTimeRange(TraceDirectoryResult result, double beginTime, double endTime) {
List<BluetoothInfo> orifilteredBluetoothInfos = result.getBluetoothInfos();
List<BluetoothInfo> filteredBluetoothInfos = new ArrayList<BluetoothInfo>();
BluetoothInfo filteredBluetoothInfo = null;
double bluetoothActiveDuration = 0.0;
for (BluetoothInfo bluetoothInfo : orifilteredBluetoothInfos) {
if (bluetoothInfo.getBeginTimeStamp() >= beginTime && bluetoothInfo.getEndTimeStamp() <= endTime) {
filteredBluetoothInfo = bluetoothInfo;
filteredBluetoothInfos.add(filteredBluetoothInfo);
if (filteredBluetoothInfo.getBluetoothState() == BluetoothState.BLUETOOTH_CONNECTED) {
bluetoothActiveDuration += filteredBluetoothInfo.getEndTimeStamp() - filteredBluetoothInfo.getBeginTimeStamp();
}
} else if (bluetoothInfo.getBeginTimeStamp() <= beginTime && bluetoothInfo.getEndTimeStamp() <= endTime && bluetoothInfo.getEndTimeStamp() > beginTime) {
filteredBluetoothInfo = new BluetoothInfo(beginTime, bluetoothInfo.getEndTimeStamp(), bluetoothInfo.getBluetoothState());
filteredBluetoothInfos.add(filteredBluetoothInfo);
if (filteredBluetoothInfo.getBluetoothState() == BluetoothState.BLUETOOTH_CONNECTED) {
bluetoothActiveDuration += filteredBluetoothInfo.getEndTimeStamp() - filteredBluetoothInfo.getBeginTimeStamp();
}
} else if (bluetoothInfo.getBeginTimeStamp() <= beginTime && bluetoothInfo.getEndTimeStamp() >= endTime) {
filteredBluetoothInfo = new BluetoothInfo(beginTime, endTime, bluetoothInfo.getBluetoothState());
filteredBluetoothInfos.add(filteredBluetoothInfo);
if (filteredBluetoothInfo.getBluetoothState() == BluetoothState.BLUETOOTH_CONNECTED) {
bluetoothActiveDuration += filteredBluetoothInfo.getEndTimeStamp() - filteredBluetoothInfo.getBeginTimeStamp();
}
} else if (bluetoothInfo.getBeginTimeStamp() >= beginTime && bluetoothInfo.getBeginTimeStamp() < endTime && bluetoothInfo.getEndTimeStamp() >= endTime) {
filteredBluetoothInfo = new BluetoothInfo(bluetoothInfo.getBeginTimeStamp(), endTime, bluetoothInfo.getBluetoothState());
filteredBluetoothInfos.add(filteredBluetoothInfo);
if (filteredBluetoothInfo.getBluetoothState() == BluetoothState.BLUETOOTH_CONNECTED) {
bluetoothActiveDuration += filteredBluetoothInfo.getEndTimeStamp() - filteredBluetoothInfo.getBeginTimeStamp();
}
}
}
result.setBluetoothInfos(filteredBluetoothInfos);
result.setBluetoothActiveDuration(bluetoothActiveDuration);
// return filteredBluetoothInfos;
}
use of com.att.aro.core.peripheral.pojo.BluetoothInfo 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