|
@@ -145,6 +145,12 @@ int MainClass::main()
|
145
|
145
|
}
|
146
|
146
|
action = Write;
|
147
|
147
|
}
|
|
148
|
+ else if (optionDevices.isSet()) {
|
|
149
|
+ action = Devices;
|
|
150
|
+ }
|
|
151
|
+ else if (optionTags.isSet()) {
|
|
152
|
+ action = Tags;
|
|
153
|
+ }
|
148
|
154
|
else {
|
149
|
155
|
std::cerr << "Must select an action (map|read|write|devices|tags)" << std::endl;
|
150
|
156
|
return EX_USAGE;
|
|
@@ -168,7 +174,7 @@ int MainClass::main()
|
168
|
174
|
{
|
169
|
175
|
auto devices = devicesResult.getData();
|
170
|
176
|
|
171
|
|
- if (optionDevices.isSet())
|
|
177
|
+ if (action == Devices)
|
172
|
178
|
{
|
173
|
179
|
for (auto device : devices) {
|
174
|
180
|
cout() << device->getConnStr() << std::endl;
|
|
@@ -192,17 +198,15 @@ int MainClass::main()
|
192
|
198
|
|
193
|
199
|
FreeFareDeviceBusiness freeFareDevice(device);
|
194
|
200
|
auto tagsResult = freeFareDevice.getTags();
|
195
|
|
- if (!tagsResult)
|
196
|
|
- {
|
|
201
|
+ if (!tagsResult) {
|
197
|
202
|
tagsResult.print();
|
198
|
203
|
res = EX_LIB_NFC_ERROR;
|
199
|
204
|
}
|
200
|
205
|
|
201
|
206
|
auto tags = tagsResult.getData();
|
202
|
207
|
|
203
|
|
- if (optionTags.isSet()) {
|
204
|
|
- for (auto tag : tags)
|
205
|
|
- {
|
|
208
|
+ if (action == Tags) {
|
|
209
|
+ for (auto tag : tags) {
|
206
|
210
|
cout() << "UID=" << tag->getUid() << " \tType=" << tag->getType() << std::endl;
|
207
|
211
|
}
|
208
|
212
|
}
|