Skip to content
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

Crash when decode packets in Buffer #8

Closed
zenithfurfid opened this issue May 5, 2022 · 6 comments
Closed

Crash when decode packets in Buffer #8

zenithfurfid opened this issue May 5, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@zenithfurfid
Copy link

Could you check - (void)decodePacketsInBufferAsync; in the CSLBleReader.m

NSUInteger findIndex = [filteredBuffer indexOfObject:barcode inSortedRange:searchRange options:NSBinarySearchingInsertionIndex | NSBinarySearchingFirstEqual usingComparator:^(id obj1, id obj2) { NSString* str1=((CSLReaderBarcode*)obj1).barcodeValue; NSString* str2=((CSLReaderBarcode*)obj2).barcodeValue; return [str1 compare:str2 options:NSCaseInsensitiveSearch]; }];
Here sometimes obj1 is CSLBleTag object and obj2 is CSLReaderBarcode.
So NSString* str1=((CSLReaderBarcode*)obj1).barcodeValue; crashes.

Suggetion:
You can add some filter functions above the codes so that we can handle only CSLReaderBarcode objects, what do you think?

Ditto

NSUInteger findIndex = [filteredBuffer indexOfObject:tag inSortedRange:searchRange options:NSBinarySearchingInsertionIndex | NSBinarySearchingFirstEqual usingComparator:^(id obj1, id obj2) { NSString* str1=((CSLBleTag*)obj1).EPC; NSString* str2=((CSLBleTag*)obj2).EPC; return [str1 compare:str2 options:NSCaseInsensitiveSearch]; }];
Here sometimes obj1 is CSLReaderBarcode and obj2 is CSLBleTag.
So NSString* str1=((CSLBleTag*)obj1).EPC; crashes.

@ksclam ksclam self-assigned this May 5, 2022
@ksclam ksclam added the enhancement New feature or request label May 5, 2022
@ksclam
Copy link
Contributor

ksclam commented May 5, 2022

At the moment, we have control on the demo application level so that the Buffer will be cleared every time when switching between RFID and barcode scanning as the buffer was originally designed to handle either RFID or barcode at a time. We will put in filter function on the library level for a better design that will avoid this issue.

@zenithfurfid
Copy link
Author

Thank you so much.
Could you let me know when you update it?

@zenithfurfid
Copy link
Author

Hi, when can I take an updated release?

@ksclam
Copy link
Contributor

ksclam commented May 9, 2022

We are looking into this and will get back to you shortly. At the same time, please kindly submit a request through https://www.convergence.com.hk/support/ for getting this prioritized.

@zenithfurfid
Copy link
Author

Ok, I will do.

@ksclam
Copy link
Contributor

ksclam commented May 18, 2022

Binary search insertions of the filteredBuffer can now hold both the CSLReaderBarcode and CSLBleTag objects, where the objects are being compared based on the EPC or barcode value only.

559daee

@ksclam ksclam closed this as completed May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants