Skip to content

Commit

Permalink
[Refactor] Revise EuPI code
Browse files Browse the repository at this point in the history
  • Loading branch information
phj0407 authored Sep 5, 2022
1 parent 853b3f9 commit 900a904
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions app/src/main/java/com/euphonyio/orderwith/StoreActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class StoreActivity : ComponentActivity() {
EuPIRxManager = EuRxManager(EuOption.ModeType.EUPI)
EuPIRxManager.setOnWaveKeyDown(RequestCodeEnum.MENU_REQUEST.code.toInt()) {
Toast.makeText(this, "Menu request detected", Toast.LENGTH_SHORT).show()
Log.d(TAG, "mEuPIRxManagerMenu - Receive menu request.")
Log.d(TAG, "EuPIRxManager - Receive menu request.")
}
EuPIRxManager.setOnWaveKeyDown(RequestCodeEnum.ORDER_REQUEST.code.toInt()) {
Toast.makeText(this, "Order request detected", Toast.LENGTH_SHORT).show()
Log.d(TAG, "mEuPIRxManagerOrder - Receive order request.")
Log.d(TAG, "EuPIRxManager - Receive order request.")
}

var allMenu: List<Menu>
Expand All @@ -85,12 +85,9 @@ class StoreActivity : ComponentActivity() {
}

if (!allMenu.isNullOrEmpty()) {
if (mEuPIRxManagerOrder.listen()) {
Log.d(TAG, "mEuPIRxManagerOrder - listen success")
}
if (mEuPIRxManagerMenu.listen()) {
Log.d(TAG, "mEuPIRxManagerMenu - listen success")
}
if (EuPIRxManager.listen()) {
Log.d(TAG, "EuPIRxManager - listen success")
}else{Log.d(TAG, "EuPIRxManager - listen fail")
}else{Log.d(TAG, "Menu is empty")}
}

Expand All @@ -106,8 +103,7 @@ class StoreActivity : ComponentActivity() {

private fun stopEuphony() {
mTxManager.stop()
mEuPIRxManagerOrder.finish()
mEuPIRxManagerMenu.finish()
EuPIRxManager.finish()
}

private fun receiveOrder(letters: String, dbUtil: DBUtil) {
Expand Down

0 comments on commit 900a904

Please sign in to comment.