LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SNAPI

Has anyone written a VI to read a Symbol Tech barcode scanner using SNAPI?

Jim

LV 2020
0 Kudos
Message 1 of 16
(7,852 Views)

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.

0 Kudos
Message 2 of 16
(7,837 Views)

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.

Jim

LV 2020
0 Kudos
Message 3 of 16
(7,828 Views)

Hi Jim,  did you ever come across a LabVIEW driver for your Symbol barcode scanner?

0 Kudos
Message 4 of 16
(7,745 Views)

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.

Jim

LV 2020
0 Kudos
Message 5 of 16
(7,724 Views)

Hi Jim,

 

Thanks for getting back to me so quickly, I appreciate it.

 

-Jon

0 Kudos
Message 6 of 16
(7,719 Views)

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

Jim

LV 2020
0 Kudos
Message 7 of 16
(7,712 Views)

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

0 Kudos
Message 8 of 16
(7,422 Views)

Is posible to share the snapi file in Labview 2009..?

 

Thanks.

 

Cabrerao

0 Kudos
Message 9 of 16
(7,394 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 16
(7,378 Views)