Keypop Reader C++ API - 2.1.0
Component of the Keypop C++ API
CardReaderEvent.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional *
5 * information regarding copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the *
8 * terms of the MIT License which is available at *
9 * https://opensource.org/licenses/MIT *
10 * *
11 * SPDX-License-Identifier: MIT *
12 ******************************************************************************/
13
14#pragma once
15
16#include <memory>
17#include <ostream>
18#include <string>
19
21
22namespace keypop {
23namespace reader {
24
26
36public:
42 enum Type {
49
56
63
70 };
71
78 virtual const std::string& getReaderName() const = 0;
79
86 virtual Type getType() const = 0;
87
103 virtual const std::shared_ptr<ScheduledCardSelectionsResponse>
105};
106
114inline std::ostream&
115operator<<(std::ostream& os, const CardReaderEvent::Type type)
116{
117 switch (type) {
118 case CardReaderEvent::Type::CARD_INSERTED:
119 os << "CARD_INSERTED";
120 break;
121 case CardReaderEvent::Type::CARD_MATCHED:
122 os << "CARD_MATCHED";
123 break;
124 case CardReaderEvent::Type::CARD_REMOVED:
125 os << "CARD_REMOVED";
126 break;
127 case CardReaderEvent::Type::UNAVAILABLE:
128 os << "UNAVAILABLE";
129 break;
130 default:
131 os << "UNKNOWN_TYPE(" << static_cast<int>(type) << ")";
132 break;
133 }
134 return os;
135}
136
137} /* namespace reader */
138} /* namespace keypop */
Card event data container indicating a change of state.
virtual Type getType() const =0
Returns the reader event type.
virtual const std::string & getReaderName() const =0
Returns the name of the reader that generated the event.
@ UNAVAILABLE
The reader has become unavailable.
@ CARD_REMOVED
The card has been removed from the reader.
@ CARD_INSERTED
A card has been inserted with or without specific selection.
@ CARD_MATCHED
A card has been inserted that matches the selection.
virtual const std::shared_ptr< ScheduledCardSelectionsResponse > getScheduledCardSelectionsResponse() const =0
Returns the card selection responses when it is available and null in all other cases.
Response of the execution of a scheduled selection scenario provided by a calypsonet::terminal::reade...
std::ostream & operator<<(std::ostream &os, const CardReaderEvent::Type type)
Operator << for CardReaderEvent::Type enum to enable readable logging.