Comments (10)
Expressing gratitude for your valuable suggestion @COM8 , I will endeavor to incorporate it and subsequently provide you with an update on its implementation.
from protocol-bt-cpp.
OK here is how I would do it:
- Remove all existing occurrences (calls) of
show_nfc_card_detection();
insideMainWindow.cpp
- Create a new event inside
CoffeeSelectionWidget.{cpp, hpp}
that forwards call toon_coffee_button_clicked();
- Remove the call
coffeeMaker->request_coffee(product);
insideon_coffee_button_clicked();
since we first want to authenticate. - Inside
MainWindow.cpp
subscribe to the newly created event inside for exampleprep_widget();
- Cache the requested product for example as a member inside
MainWindow.cpp
. - From inside the event handler call
show_nfc_card_detection();
- Inside
on_nfc_card_detected(...);
(MainWindow.cpp
) callcoffeeMaker->request_coffee(product);
with the before cached product. 🎉
Hope this rough sketch helps you.
from protocol-bt-cpp.
You need to call MainWindow::show_nfc_card_detection();
.
https://github.com/Jutta-Proto/gtk-ui/blob/d53f559c85e3346bf5d3142ff988deb408027772/src/ui/windows/MainWindow.hpp#L55
I would go into CoffeeSelectionWidget.{cpp, hpp}
. There look at how edit_custom_coffee_clicked
is implemented via signals. I would create a new signal that triggers once a beverage has been made.
Then go into MainWindow.{cpp, hpp}
and subscribe to it, like it's done with the edit_custom_coffee_clicked
signal. There than trigger MainWindow::show_nfc_card_detection();
.
from protocol-bt-cpp.
You need to call
MainWindow::show_nfc_card_detection();
. https://github.com/Jutta-Proto/gtk-ui/blob/d53f559c85e3346bf5d3142ff988deb408027772/src/ui/windows/MainWindow.hpp#L55I would go into
CoffeeSelectionWidget.{cpp, hpp}
. There look at howedit_custom_coffee_clicked
is implemented via signals. I would create a new signal that triggers once a beverage has been made.Then go into
MainWindow.{cpp, hpp}
and subscribe to it, like it's done with theedit_custom_coffee_clicked
signal. There than triggerMainWindow::show_nfc_card_detection();
.
Is it possible in this way to retrieve the status of an NFC reader to determine if a user has attached their card, prior to initiating a product request on a coffee machine? Specifically, the desired behavior is to restrict product requests until the user's card has been detected by the NFC reader. Although modifications were made to enable the NFC reader window to appear when a product is selected, the system is still initiating the UUID call for the product request without waiting for the card to be detected. Upon attaching an NFC card, the system is displaying the NFC card window again. This issue may be due to a my lack of familiarity with GTK
from protocol-bt-cpp.
The NFC card reader flow is as follows:
- User places its card on the reader.
- The reader reads the card and sends the number as simple keyboard input to the application.
- The application catches any keyboard input.
- If there are more than 8 chars as input in less than one second, the backend registers it as a NFC-card input. Code: https://github.com/Jutta-Proto/gtk-ui/blob/bt/src/backend/NfcCardReader.cpp#L83
What you probably want is to lock the coffee maker in between, so the user can not make beverages either via the screen, or by pressing a button on the coffee maker it self.
Take a look at CoffeeMaker::lock()
and CoffeeMaker::unlock()
defined here:
protocol-bt-cpp/src/include/jutta_bt_proto/CoffeeMaker.hpp
Lines 175 to 182 in e7876b8
I hope this helps since I did not totally understand what your issue is.
from protocol-bt-cpp.
I appreciate your time and prompt response. Please accept my apologies if the description of my problem or issue was difficult to understand.
The desired functionality includes the following steps:
- User selects a drink.
- A NFC card window is displayed.
- The user either attaches an NFC card or clicks on a "continue" button.
- The product making process is initiated only after the NFC card is attached or the "continue" button is clicked.
I hope that I have provided a clear and comprehensive understanding of the matter at hand.
from protocol-bt-cpp.
Aha! Now it makes sense. I will try to reply tomorrow once I'm back from work again.
from protocol-bt-cpp.
Great, I look forward to hearing back from you tomorrow. Have a productive day!
from protocol-bt-cpp.
I sincerely appreciate your explanation and your time. I now have a clear understanding. Thank you very much for your assistance. I'll try to implement it.
from protocol-bt-cpp.
I have successfully implemented the steps you specified. However, I have encountered a minor issue whereby the NFC detection window is hiden when I attach the card to the NFC reader, and subsequently reappears. It appears that the on_coffee_button_clicked() function is being invoked again as a result.
from protocol-bt-cpp.
Related Issues (10)
- Wifi Module HOT 3
- Coffee machine turning on via BT protocol HOT 5
- Fix conan GENERATORS for conan 2.x HOT 2
- Accessing to setting through BT protocol HOT 1
- Statistics via Bluetooth HOT 5
- Heartbeat Encoding example wrong? HOT 2
- Control Coffee Machine only with Bluetooth in Raspberry Pi HOT 21
- GTK-based program using BT protocol crashes with segmentation fault error HOT 12
- GTK-based application using BT protocol product selection issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protocol-bt-cpp.