You are reading a single comment by @allObjects and its replies.
Click here to read the full conversation.
-
Big thanks to you guys @PaddeK and @allObjects. I highly appreciate your efforts!
Big thanks to you guys @PaddeK and @allObjects. I highly appreciate your efforts!
@user81574, I suggest you move on with PaddeK's code. Again, thanks @PaddeK for sharing. It does not need much to get it to completion for enroll and the other functions you would like to have at your (coding-)finger-tips. (Sticking on my path would over several serious transformation steps - such as adding the parser and promise - lead to a solution too... but I like to use invented wheels... in favor of saving the - non-recoverable - resource called Time for getting after the not yet invented ones...).
For example, for the enroll function, just add the application callback into the method signature (line 11):
and use it (in lines 21 and 22):
If you want to have your callback execution to happen in its own Espruino JavaScript single-thread 'task', pack the callback invocation in
setTimeout(...
:This will allow other pending - and may be more pressing - 'tasks' to get a chance to do their thing. Applied throughout the whole application makes your application behave like a TSO - (processor) time sharing option - environment for each of the tasks, where you run less into timely-ness contentions (buffer overflow, stacking up to many and/or 'losing' events,...) - from the single core /360 times...
For adding more to the module, such as getting the extra information on open, add a method
.open(...
following the same pattern as.enroll(...
with callback, and adjust thesuccessHandler
accordingly.To make operations very robust, always begin with an
open(
and end with aclose
(to be added in bothsuccessHandler
anderrorHandler
. I do not know the finger print reader's sequencing control, but having a clear begin and end always helps - like demarcation of a transaction: begin and end with commit or rollback (a-la successHandler and errorHandler, respectively).Putting all in one single module is no difficult either. Just add the code into the first piece of code from @PaddeK.
This conversation was great pleasure for me and makes me conclude: Old dog, new tricks? ...still works.