21 lines
596 B
C++
21 lines
596 B
C++
void
|
|
atm::getting_pin()
|
|
{
|
|
incoming.wait()
|
|
.handle<digit_pressed>([&](digit_pressed const& msg) {
|
|
unsigned const pin_length = 4;
|
|
pin += msg.digit;
|
|
if (pin.length() == pin_length) {
|
|
bank.send(verify_pin(account, pin, incoming));
|
|
state = &atm::verifying_pin;
|
|
}
|
|
})
|
|
.handle<clear_last_pressed>([&](clear_last_pressed const& msg) {
|
|
if (!pin.empty()) {
|
|
pin.resize(pin.length() - 1);
|
|
}
|
|
})
|
|
.handle<cancel_pressed>(
|
|
[&](cancel_pressed const& msg) { state = &atm::done_processing; });
|
|
}
|