Skip to content

Commit a2b252a

Browse files
committed
renovated get/send configuration base on new bleManager.
1 parent 9b45a85 commit a2b252a

15 files changed

Lines changed: 1088 additions & 742 deletions

app/src/main/java/com/firstbuild/androidapp/Paragon/GetReadyFragment.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import com.firstbuild.androidapp.ParagonValues;
1717
import com.firstbuild.androidapp.R;
1818
import com.firstbuild.androidapp.paragon.dataModel.RecipeManager;
19+
import com.firstbuild.androidapp.productManager.ProductInfo;
20+
import com.firstbuild.androidapp.productManager.ProductManager;
1921

2022
/**
2123
* A simple {@link Fragment} subclass.
@@ -56,7 +58,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
5658
.callback(new MaterialDialog.ButtonCallback() {
5759
@Override
5860
public void onPositive(MaterialDialog dialog) {
59-
RecipeManager.getInstance().sendCurrentStages();
61+
// TODO: Block RecipeManager until multi-stage activated.
62+
// RecipeManager.getInstance().sendCurrentStages();
6063
}
6164

6265
@Override
@@ -70,20 +73,22 @@ public void onNeutral(MaterialDialog dialog) {
7073
})
7174
.cancelable(false).build();
7275

76+
ProductInfo product = ProductManager.getInstance().getCurrent();
7377

74-
if (attached.getCookMode() != ParagonValues.CURRENT_COOK_MODE_RAPID &&
75-
attached.getCookMode() != ParagonValues.CURRENT_COOK_MODE_GENTLE) {
76-
dialogTryAgain.show();
77-
}
78-
else {
79-
//do nothing.
80-
}
78+
// if (product.getErdCurrentCookMode() != ParagonValues.CURRENT_COOK_MODE_RAPID &&
79+
// product.getErdCurrentCookMode() != ParagonValues.CURRENT_COOK_MODE_GENTLE) {
80+
// dialogTryAgain.show();
81+
// }
82+
// else {
83+
// //do nothing.
84+
// }
8185

8286

8387
return view;
8488
}
8589

86-
public void onCookModeChanged(byte cookMode){
90+
public void onCookModeChanged(){
91+
byte cookMode = ProductManager.getInstance().getCurrent().getErdCurrentCookMode();
8792

8893
if(cookMode == ParagonValues.CURRENT_COOK_MODE_RAPID ||
8994
cookMode == ParagonValues.CURRENT_COOK_MODE_GENTLE){

app/src/main/java/com/firstbuild/androidapp/Paragon/MultiStageStatusFragment.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import com.firstbuild.androidapp.paragon.dataModel.RecipeInfo;
1818
import com.firstbuild.androidapp.paragon.dataModel.RecipeManager;
1919
import com.firstbuild.androidapp.paragon.dataModel.StageInfo;
20+
import com.firstbuild.androidapp.productManager.ProductInfo;
21+
import com.firstbuild.androidapp.productManager.ProductManager;
2022
import com.firstbuild.commonframework.bleManager.BleManager;
2123
import com.firstbuild.viewUtil.gridCircleView;
2224

@@ -150,10 +152,10 @@ public void onClick(View view) {
150152
/**
151153
* Update cooking state, Off -> Heating -> Ready -> Cooking -> Done
152154
*
153-
* @param state
154155
*/
155-
public void updateCookStatus(byte state) {
156-
Log.d(TAG, "updateCookStatus IN " + state);
156+
public void updateCookState() {
157+
byte state = ProductManager.getInstance().getCurrent().getErdCookState();
158+
Log.d(TAG, "updateCookState IN " + state);
157159

158160
switch (state) {
159161
case ParagonValues.COOK_STATE_OFF:
@@ -339,7 +341,7 @@ public void updateUiCurrentTemp() {
339341

340342
if (cookState == MULTI_STAGE_COOK_STATE.STATE_HEAT_COOL) {
341343

342-
int currentTemp = Math.round(attached.getCurrentTemp());
344+
int currentTemp = Math.round(ProductManager.getInstance().getCurrent().getErdCurrentTemp());
343345
int targetTep = stageInfo.getTemp();
344346

345347
if(currentTemp < targetTep){
@@ -365,9 +367,11 @@ public void updateUiCurrentTemp() {
365367
/**
366368
* Update UI current elapsed time. Elapsed time is increase from 0 until selected cook time.
367369
*
368-
* @param elapsedTime ingeter value of elapsed time.
369370
*/
370-
public void updateUiElapsedTime(int elapsedTime) {
371+
public void updateUiElapsedTime() {
372+
ProductInfo productInfo = ProductManager.getInstance().getCurrent();
373+
int elapsedTime = productInfo.getErdElapsedTime();
374+
371375
Log.d(TAG, "updateUiElapsedTime :" + elapsedTime);
372376
StageInfo stageInfo = RecipeManager.getInstance().getCurrentStage();
373377

@@ -388,9 +392,9 @@ public void updateUiElapsedTime(int elapsedTime) {
388392

389393
/**
390394
* Udate new stage get from BLE master.
391-
* @param newStage integer value of stage 1 - 5.
392395
*/
393-
public void updateCookStage(int newStage) {
396+
public void updateCookStage() {
397+
int newStage = ProductManager.getInstance().getCurrent().getErdCookStage();
394398
RecipeManager.getInstance().setCurrentStage(newStage-1);
395399

396400
attached.setTitle("Stage "+newStage);

0 commit comments

Comments
 (0)