#include "nfc/aid_data.h"
#include "common/logger.h"
+#include "nfc/nfc_util.h"
namespace extension {
namespace nfc {
-AIDData::AIDData(nfc_se_type_e se_type, const char* aid, bool read_only)
+AIDData::AIDData(std::string se_type, std::string aid, bool read_only)
: se_type_(se_type),
aid_(aid),
read_only_(read_only)
picojson::value retval = picojson::value(picojson::object());
picojson::object& obj = retval.get<picojson::object>();
- obj["aid"] = picojson::value();
- obj["type"] = picojson::value();
- obj["readOnly"] = picojson::value();
+ obj["aid"] = picojson::value(aid_);
+ obj["type"] = picojson::value(se_type_);
+ obj["readOnly"] = picojson::value(read_only_);
return retval;
}
class AIDData {
public:
- AIDData(nfc_se_type_e se_type, const char* aid, bool read_only);
+ AIDData(std::string se_type, std::string aid, bool read_only);
picojson::value toJSON() const;
private:
- nfc_se_type_e se_type_;
- const char* aid_;
+ std::string se_type_;
+ std::string aid_;
bool read_only_;
};
AssertMsg(aid, "Poiner can not be null!");
AssertMsg(user_data, "Poiner can not be null!");
AIDDataVector* aids = static_cast<AIDDataVector*>(user_data);
- aids->push_back(AIDData(se_type, aid, read_only));
+ std::string aid_str = std::string(aid);
+ aids->push_back(AIDData(std::string(NFCUtil::ToStr(se_type)), aid_str, read_only));
};
void NFCAdapter::GetAIDsForCategory(