12345678910111213141516171819202122232425262728293031 |
- //
- // Created by robin on 6/19/16.
- //
-
- #include "FreeFareDeviceInternal.h"
-
- namespace LibNfc
- {
- namespace FreeFare
- {
-
- FreeFareDeviceInternal::FreeFareDeviceInternal(std::shared_ptr<LibNfc::Core::NfcDeviceInternal> device)
- : _device(device)
- {
- }
-
- LibNfc::Utils::Result<std::vector<std::shared_ptr<FreeFareTagInternal>>> FreeFareDeviceInternal::getTags()
- {
- FreefareTag* tags = freefare_get_tags(_device->getDevice());
- if (!tags) {
- return LibNfc::Utils::Result<std::vector<std::shared_ptr<FreeFareTagInternal>>>::error("Failed to get MIFARE tags");
- }
- std::vector<std::shared_ptr<FreeFareTagInternal>> tagList;
- for (size_t i = 0; tags[i] != 0; ++i) {
- tagList.push_back(std::make_shared<FreeFareTagInternal>(tags[i]));
- }
- return LibNfc::Utils::Result<std::vector<std::shared_ptr<FreeFareTagInternal>>>::ok(tagList);
- }
-
- }; // FreeFare
- }; // LibNfc
|