@@ -148,10 +148,11 @@ public class ProjectActivity extends Activity implements View.OnClickListener, B
148
148
private BroadcastReceiver connectionChangedReceiver = BLEConnectionHandler .bleConnectionChangedReceiver (this );
149
149
150
150
private Handler handler = new Handler ();
151
- private int countOfReconnecting ;
152
- private boolean sentPause ;
153
151
154
- private boolean notAValidFlashHexFile ;
152
+ // // REMOVE tryToConnectAgain
153
+ // private int countOfReconnecting;
154
+ // private boolean sentPause;
155
+ // private boolean notAValidFlashHexFile;
155
156
156
157
private boolean minimumPermissionsGranted ;
157
158
@@ -186,44 +187,45 @@ public void onClick(View v) {
186
187
}
187
188
};
188
189
189
- private final Runnable tryToConnectAgain = new Runnable () {
190
-
191
- @ Override
192
- public void run () {
193
- if (sentPause ) {
194
- countOfReconnecting ++;
195
- }
196
-
197
- final LocalBroadcastManager localBroadcastManager = LocalBroadcastManager
198
- .getInstance (ProjectActivity .this );
199
-
200
- if (countOfReconnecting == Constants .MAX_COUNT_OF_RE_CONNECTIONS_FOR_DFU ) {
201
- countOfReconnecting = 0 ;
202
- Intent intent = new Intent (DfuService .BROADCAST_ACTION );
203
- intent .putExtra (DfuService .EXTRA_ACTION , DfuService .ACTION_ABORT );
204
- localBroadcastManager .sendBroadcast (intent );
205
- } else {
206
- final int nextAction ;
207
- final long delayForNewlyBroadcast ;
208
-
209
- if (sentPause ) {
210
- nextAction = DfuService .ACTION_RESUME ;
211
- delayForNewlyBroadcast = Constants .TIME_FOR_CONNECTION_COMPLETED ;
212
- } else {
213
- nextAction = DfuService .ACTION_PAUSE ;
214
- delayForNewlyBroadcast = Constants .DELAY_BETWEEN_PAUSE_AND_RESUME ;
215
- }
216
-
217
- sentPause = !sentPause ;
218
-
219
- Intent intent = new Intent (DfuService .BROADCAST_ACTION );
220
- intent .putExtra (DfuService .EXTRA_ACTION , nextAction );
221
- localBroadcastManager .sendBroadcast (intent );
222
-
223
- handler .postDelayed (this , delayForNewlyBroadcast );
224
- }
225
- }
226
- };
190
+ // // REMOVE tryToConnectAgain
191
+ // private final Runnable tryToConnectAgain = new Runnable() {
192
+ //
193
+ // @Override
194
+ // public void run() {
195
+ // if (sentPause) {
196
+ // countOfReconnecting++;
197
+ // }
198
+ //
199
+ // final LocalBroadcastManager localBroadcastManager = LocalBroadcastManager
200
+ // .getInstance(ProjectActivity.this);
201
+ //
202
+ // if (countOfReconnecting == Constants.MAX_COUNT_OF_RE_CONNECTIONS_FOR_DFU) {
203
+ // countOfReconnecting = 0;
204
+ // Intent intent = new Intent(DfuService.BROADCAST_ACTION);
205
+ // intent.putExtra(DfuService.EXTRA_ACTION, DfuService.ACTION_ABORT);
206
+ // localBroadcastManager.sendBroadcast(intent);
207
+ // } else {
208
+ // final int nextAction;
209
+ // final long delayForNewlyBroadcast;
210
+ //
211
+ // if (sentPause) {
212
+ // nextAction = DfuService.ACTION_RESUME;
213
+ // delayForNewlyBroadcast = Constants.TIME_FOR_CONNECTION_COMPLETED;
214
+ // } else {
215
+ // nextAction = DfuService.ACTION_PAUSE;
216
+ // delayForNewlyBroadcast = Constants.DELAY_BETWEEN_PAUSE_AND_RESUME;
217
+ // }
218
+ //
219
+ // sentPause = !sentPause;
220
+ //
221
+ // Intent intent = new Intent(DfuService.BROADCAST_ACTION);
222
+ // intent.putExtra(DfuService.EXTRA_ACTION, nextAction);
223
+ // localBroadcastManager.sendBroadcast(intent);
224
+ //
225
+ // handler.postDelayed(this, delayForNewlyBroadcast);
226
+ // }
227
+ // }
228
+ // };
227
229
228
230
/**
229
231
* Allows to handle forced closing of the bluetooth service and
@@ -618,7 +620,7 @@ protected void onResume() {
618
620
@ Override
619
621
protected void onDestroy () {
620
622
621
- handler .removeCallbacks (tryToConnectAgain );
623
+ // handler.removeCallbacks(tryToConnectAgain); // REMOVE tryToConnectAgain
622
624
623
625
MBApp application = MBApp .getApp ();
624
626
@@ -2069,17 +2071,18 @@ public void onClick(View v) {
2069
2071
},//override click listener for ok button
2070
2072
null );//pass null to use default listener
2071
2073
2072
- countOfReconnecting = 0 ;
2073
- sentPause = false ;
2074
-
2075
- long delayForCheckOnConnection = Constants .TIME_FOR_CONNECTION_COMPLETED ;
2076
-
2077
- if (notAValidFlashHexFile ) {
2078
- notAValidFlashHexFile = false ;
2079
- delayForCheckOnConnection += Constants .JUST_PAIRED_DELAY_ON_CONNECTION ;
2080
- }
2081
-
2082
- handler .postDelayed (tryToConnectAgain , delayForCheckOnConnection );
2074
+ // // REMOVE tryToConnectAgain
2075
+ // countOfReconnecting = 0;
2076
+ // sentPause = false;
2077
+ //
2078
+ // long delayForCheckOnConnection = Constants.TIME_FOR_CONNECTION_COMPLETED;
2079
+ //
2080
+ // if (notAValidFlashHexFile) {
2081
+ // notAValidFlashHexFile = false;
2082
+ // delayForCheckOnConnection += Constants.JUST_PAIRED_DELAY_ON_CONNECTION;
2083
+ // }
2084
+ //
2085
+ // handler.postDelayed(tryToConnectAgain, delayForCheckOnConnection);
2083
2086
}
2084
2087
2085
2088
inInit = true ;
@@ -2163,7 +2166,7 @@ public void onClick(View v) {
2163
2166
popupOkHandler );//pass null to use default listener
2164
2167
2165
2168
dfuUnregister ();
2166
- removeReconnectionRunnable ();
2169
+ // removeReconnectionRunnable(); // REMOVE tryToConnectAgain
2167
2170
onFlashComplete ();
2168
2171
break ;
2169
2172
/*
@@ -2188,7 +2191,7 @@ public void onClick(View v) {
2188
2191
popupOkHandler);//pass null to use default listener
2189
2192
2190
2193
dfuUnregister();
2191
- removeReconnectionRunnable();
2194
+ // removeReconnectionRunnable();// REMOVE tryToConnectAgain
2192
2195
break;
2193
2196
*/
2194
2197
default :
@@ -2209,8 +2212,7 @@ public void onClick(View v) {
2209
2212
TYPE_PROGRESS_NOT_CANCELABLE , null , null );
2210
2213
2211
2214
inProgress = true ;
2212
-
2213
- removeReconnectionRunnable ();
2215
+ // removeReconnectionRunnable(); // REMOVE tryToConnectAgain
2214
2216
}
2215
2217
2216
2218
if ( state != progressState ) {
@@ -2221,9 +2223,10 @@ public void onClick(View v) {
2221
2223
} else if (intent .getAction ().equals (DfuService .BROADCAST_ERROR )) {
2222
2224
int errorCode = intent .getIntExtra (DfuService .EXTRA_DATA , 0 );
2223
2225
2224
- if (errorCode == DfuService .ERROR_FILE_INVALID ) {
2225
- notAValidFlashHexFile = true ;
2226
- }
2226
+ // // REMOVE tryToConnectAgain
2227
+ // if(errorCode == DfuService.ERROR_FILE_INVALID) {
2228
+ // notAValidFlashHexFile = true;
2229
+ // }
2227
2230
2228
2231
String error_message = GattError .parse (errorCode );
2229
2232
@@ -2239,7 +2242,7 @@ public void onClick(View v) {
2239
2242
MBApp application = MBApp .getApp ();
2240
2243
2241
2244
dfuUnregister ();
2242
- removeReconnectionRunnable ();
2245
+ // removeReconnectionRunnable(); // REMOVE tryToConnectAgain
2243
2246
//Update Stats
2244
2247
/*
2245
2248
GoogleAnalyticsManager.getInstance().sendFlashStats(
@@ -2300,11 +2303,12 @@ public void onClick(View v) {
2300
2303
2301
2304
}
2302
2305
2303
- private void removeReconnectionRunnable () {
2304
- handler .removeCallbacks (tryToConnectAgain );
2305
- countOfReconnecting = 0 ;
2306
- sentPause = false ;
2307
- }
2306
+ // // REMOVE tryToConnectAgain
2307
+ // private void removeReconnectionRunnable() {
2308
+ // handler.removeCallbacks(tryToConnectAgain);
2309
+ // countOfReconnecting = 0;
2310
+ // sentPause = false;
2311
+ // }
2308
2312
2309
2313
@ Override
2310
2314
public boolean onCreateOptionsMenu (Menu menu ) {
0 commit comments