| 236 | } |
| 237 | |
| 238 | bool buildNdefMessageFromStruct(const RFIDInterface::NdefMessage &src, std::vector<uint8_t> &ndefOut) { |
| 239 | ndefOut.clear(); |
| 240 | if (src.messageSize == 0) return false; |
| 241 | if (src.payloadSize == 0) return false; |
| 242 | |
| 243 | ndefOut.reserve(4 + src.payloadSize); |
| 244 | ndefOut.push_back(src.header); |
| 245 | ndefOut.push_back(src.tnf); |
| 246 | ndefOut.push_back(src.payloadSize); |
| 247 | ndefOut.push_back(src.payloadType); |
| 248 | ndefOut.insert(ndefOut.end(), src.payload, src.payload + src.payloadSize); |
| 249 | |
| 250 | return ndefOut.size() == src.messageSize; |
| 251 | } |
| 252 | } // namespace |
| 253 | |
| 254 | PN532::PN532(CONNECTION_TYPE connection_type) { |