-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NDEF_Buffer limitations and overflows #31
Conversation
This allows IdentifyNDEF to work when the NDEF is larger than the default NDEF_MAX_SIZE
The default buffer of 100 bytes is too small for Wifi and VCard. Further, using the default buffer prevents a user from picking a buffer size more suited to their processor environment and tag needs. This change retains backwards API compatibility but allows a user to provider their own buffer as part of begin()
Maybe just allow buffer length to be redefined would be enough ? |
Hi @fpistm , I thought of that but decided on implementing an alternative approach for a few reasons:
|
That is normal as sketch fil is converted as ino.cpp. code should be : + #ifndef NDEF_MAX_SIZE
#define NDEF_MAX_SIZE (100)
+ #endif
+ #ifndef NDEF_RECORD_MAX_SIZE
#define NDEF_RECORD_MAX_SIZE (100)
+ #endif Then thanks the build_opt.h you can simply set: |
Hello @fpistm , |
Right. I know ESP can do this as they contact me to know how it was done on our side and implements something similar. One drawback I can see with this PR is the default buffer is always allocated even if it is not used. |
@cparata from my research, I agree with you. The ability to use That said, even for environments that support @fpistm I kept the default buffer for API backwards compatibility, if you are willing to break APIs that I would personally choose to remove the default buffer. I didn't use |
Hello all, |
When I was working with larger NDEF records (WifiToken and VCard) I noticed limitations that were due to
NDEF_Buffer
having a maximum size ofNDEF_MAX_SIZE
which was set to 100 bytes. The initial issue was thatIdentifyNDEF
could be used to determine the NDEF_Type once a WifiToken or VCard was written to the tag. Upon further inspection, even writing a VCard was causing an overflow ofNDEF_Buffer
.This PR addresses the limitations of NDEF_Buffer size without breaking backwards compatibility or behavior where the smaller NDEF buffer was expected or required. It also doesn't require the user to edit the library itself to increase the buffer size. This is accomplished by allowing
begin
to take an optional buffer to use instead of the default buffer. This gives the application control over the size of the buffer based on it's needs.In addition, some new functions and refactoring was performed to simplify use of the class and make maintenance eaiser.