08-12-2010 06:54 AM
Has anyone written a VI to read a Symbol Tech barcode scanner using SNAPI?
08-12-2010 09:37 AM
What is SNAPI? Is that some sort of protocol? Never heard of it. Is it some SDK? Is there a DLL? If so, use the Call Library Function Node to call DLLs. Plenty of literature in the NI KnowledgeBase, this forum, and the LabVIEW Help on calling DLLs, and tons of examples.
08-12-2010 12:08 PM
SNAPI is the "Symbol Native Programming Interface". It is used to communicate with Symbol Technologies barcode scanners. It is not quite as simple as just using a DLL. It also involves allocating data buffers for data transfer, and communicating via Windows Messages. All interesting topics, but I will probably go the way of a handheld keyboard wedge type scanner to save time if a driver VI is not already available.
11-01-2010 12:00 PM
Hi Jim, did you ever come across a LabVIEW driver for your Symbol barcode scanner?
11-02-2010 06:27 AM
Hi jmcbee,
I was looking at the Symbol unit because it is a fixed mount device, and I thought that would be better for our operators than a handheld unit. While trying to decide what to do, I found a wireless handheld that was sitting around (keyboard wedge type), and it works great.
11-02-2010 06:48 AM
11-02-2010 07:51 AM
No problem Jon. Their MS4407 looks like a really nice unit, and I may need to go with it on my next project. If you head down the SNAPI road, let me know how you fare, I may be following you!
Jim
05-31-2012 09:21 AM
Hi,
I am trying to decode the data from a symbol scanner using SNAPI dll, I was able to connect and pull trigger but I do not how to decode the data scanned. Could somebody help me? Attached is the example with the dll.
Thanks
Omar
06-16-2012 02:55 PM
Is posible to share the snapi file in Labview 2009..?
Thanks.
Cabrerao
06-17-2012 03:06 AM - edited 06-17-2012 03:15 AM
There is no data to decode in your VI at all, since the SNAPI interface doesn't make the data available through it's DLL interface in a convinient way. This is what the previous poster Imtis was refering to, about having to provide buffer memory to set with the SNAPI_SetDecodeBuffer() function. However you can't just create a LabVIEW array and pass it to this function since LabVIEW only guaranttees a buffer passed to the DLL to be valid for as long as the function call lasts, but this function wants to hold onto that buffer to fill it in later on. So here you have to create your own buffer by calling a LabVIEW or Windows memory manager C function to alllocate that buffer and pass it to this function. And you need to manage that buffer yourself as well, if you don't want to create a potential memory leak.
Also all communication from the DLL about events, such as decocded data being available in the previously passed in buffer are sent back to the application to the window whose handle you need to pass as first parameter to SNAPI_Init() function. And then you need to install a Windwos message hook handler for that window. This can be done with the Windows message queue example floating around on the NI site, but it is absolutely not trivial.
In conclusionh, while it is not impossible to interface SNAPI from LabVIEW, it is a whole bunch of work, and requires quite a bit fairly involved C programming knowledge, since this API was designed to be called from a C application, not a high level 4th generation language like LabVIEW. Personally I would write a C intermediate DLL that translates the SNAPI window messages into LabVIEW user events, but I would estimate that to take probably 3 to 4 days of full programming to make it a LabVIEW library that I would feel comfortable to share for use by normal LabVIEW programmers.
Unless you know a fair amount about pointers and such in C, I think this is not a project to start learning it.
One last point: I'm not sure there is a 64 bit SNAPI version, but in order for the LabVIEW VI library to work for such a 64 Bit DLL too, without having to go through the entire library again, you should configure all parameters that represent handles to be of pointer sized integer size. Otherwise your library would crash if you ever upgrade to the 64 Bit DLL and 64 Bit LabVIEW. This BTW includes almost all Windows handles, so also HWNDs.