diff --git a/.idea/libraries/GraphView_3_1_2.xml b/.idea/libraries/GraphView_3_1_2.xml index 970f273..78349eb 100755 --- a/.idea/libraries/GraphView_3_1_2.xml +++ b/.idea/libraries/GraphView_3_1_2.xml @@ -4,6 +4,8 @@ - + + + \ No newline at end of file diff --git a/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourSpeechCall.java b/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourSpeechCall.java index a5b46cd..1ecfd9d 100755 --- a/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourSpeechCall.java +++ b/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourSpeechCall.java @@ -44,12 +44,13 @@ public class UeBehaviourSpeechCall extends UeBehaviour{ TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); // Start Call - log.debug("Calling phone"); + log.debug("Starting Call"); CallUtil.startCall(phoneNumber); + Thread.sleep(1000); // Wait for call to start log.debug("Waiting for an answer"); - while(tm.getCallState() != TelephonyManager.CALL_STATE_OFFHOOK){ + while(tm.getCallState() == TelephonyManager.CALL_STATE_RINGING){ if(super.stopExecution()) return; super.setProgress(0.1f); @@ -58,10 +59,11 @@ public class UeBehaviourSpeechCall extends UeBehaviour{ log.debug("Starting call timer"); int elapsedTime = 0; - while(elapsedTime < length){ + int lengthMillisec = length*1000; + while(elapsedTime < lengthMillisec){ if(super.stopExecution()) return; - super.setProgress((float)elapsedTime/length); + super.setProgress((float)elapsedTime/lengthMillisec); Thread.sleep(SLEEP_PERIOD); elapsedTime += SLEEP_PERIOD; } diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java b/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java index e5181e2..33ce486 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java @@ -168,7 +168,10 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference return true; } else if (id == R.id.action_reset) { - currentExecutor.reset(); + if(currentExecutor != null) + currentExecutor.reset(); + if(statusFragment != null) + statusFragment.reset(); updateExecutionState(); } else if (id == R.id.action_edit) { diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java index 4ae8851..c8fce06 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java @@ -62,11 +62,12 @@ public class StatusFragment extends Fragment { rat_type = (TextView) view.findViewById(R.id.rat_type); // Init the graph - GraphViewData[] zeroPoint = new GraphViewData[]{new GraphViewData(0, 0)}; if(downGraph == null) - downGraph = new GraphViewSeries("Download Throughput", new GraphViewSeriesStyle(Color.GREEN, 3), zeroPoint); + downGraph = new GraphViewSeries("Download Throughput", new GraphViewSeriesStyle(Color.GREEN, 3), + new GraphViewData[]{new GraphViewData(0, 0)}); if(upGraph == null) - upGraph = new GraphViewSeries("Upload Throughput", new GraphViewSeriesStyle(Color.RED, 3), zeroPoint); + upGraph = new GraphViewSeries("Upload Throughput", new GraphViewSeriesStyle(Color.RED, 3), + new GraphViewData[]{new GraphViewData(0, 0)}); LineGraphView graphView = new LineGraphView(this.getActivity(), "GraphViewDemo"); graphView.addSeries(downGraph); @@ -130,6 +131,20 @@ public class StatusFragment extends Fragment { } } + public void reset(){ + if(downGraph != null) + downGraph.resetData(new GraphViewData[]{new GraphViewData(0, 0)}); + if(upGraph != null) + upGraph.resetData(new GraphViewData[]{new GraphViewData(0, 0)}); + x = 0; + down_speed.post(new Runnable() { + @Override + public void run() { + down_speed.setText(ThroughputCalculator.getBitThroughputString(0)); + up_speed.setText(ThroughputCalculator.getBitThroughputString(0)); + } + }); + } } \ No newline at end of file