First of all no I'm not writing a keylogger... what I have is a barcode scanner that appears as a keyboard... well I need a way to use the scanner exclusively... this app will run in the background so I need ALL scanned data to scan into my app regardless of what app I'm using..
my guess is to make an invisible form that pops up and has focus when I pull up the screen that I need the barcode scanned..
Please take a look at my answer here How HID devices work when programming?
You can set up your scanner to function as a USB-HID device and capture PDF417 scanned data.
Don't know if you need to do anything special. From what I have worked in the past, scanners are not much more than a keyboard wedge device. Whatever field you are in, scan and as long as a simple barcode (code 39, code 128, similar) that are not complex, they should just fill in whatever field you are on.
Now, that being said, if you have a 2d barcode (PDF417), or other complex barcode that has capacity of larger amounts of data, special characters, etc., that you may need to do parsing, that goes an extra level.
If you could also provide maybe the specific device / manufacturer, there might be libraries that you can use to pre-capture the data and parse before sending forward.
FEEDBACK per comment.
I had to do a similar option of licenses, but limited states needed. Only a few states actually provide their specific format. Doing hospitality work, you probably need to cover most states, and probably skip over international and require that.
Also, having to push the results into whatever current app is, currently active, you might be able to capture in the background and push a Windows message of the final decoded to the active application. May need to dig into those API calls more directly.. Good luck, but I'll try to look into possible messaging for you too.
Related
I am working in C# Windows Forms, and would like to ensure that the content on my form is only output through an HDCP compliant stream using the system's hardware. This would require a multi-step process. A high level block-diagram description of the process would be:
determine if the display supports HDCP
determine if the graphics adapter supports HDCP
finally enabling the HDCP encryption on the output
If any of these stages report failure, it is then a trivial matter to black out the form.
I have done a minor amount of research into this manner, but cannot seem to find any detailed examples, leads, or instructions for accomplishing this. I have so far looked into using DirectX and Windows OPM, but have found insufficient help. The Windows PlayReady license also seems to touch up on this issue, but appears to be for pre-encrypted content (and is also quite expensive). Perhaps there is an approach that I have not noticed or thought about?
If you need any other information, please let me know.
Thank you in advance.
HDCP is nice to have but very hard to implement. Even if you have such a product on the market which does exactly what you want, it won't be certified by HDCP becuase it is easy to hack it. Most of the time, HDCP related things, for example the ROM where you store the HDCP keys, are hardware protected and can never be read out when your product is on the market. Sometimes you even need to hide the hardware paths from one component to another one to protect sniffing out your HDCP de-crypted data, for example, from between the graphics card chip and the HDMI connector.
To answer your question, you can only detect if the display supports HDCP or not if you can somehow read the EDID of the display. I don't think that you can do it using existing tools in windows. I might be wrong though.
I am adding Code 39 bar code scanning functionality to a C# asp.net web app. This function must work with iphone, ipad, android phone, and android tablet. I need the scanned bar code value to be passed back to my web app.
So far I have been able to make this work on android phone and android tablet using ZXing barcode scanner with this method. Unfortunately the current version of ZXing in the App Store (Version 1.1) is currently not capable of scanning 1D bar code types. Through much of my research I have seen that 1D barcode scanning has been ported to later IOS ZXing versions but I'm not an IOS developer and am unsure how to install or enable it.
I have also explored the possibility of using pic2shop's web solution but this only works with UPC and other commercial codes and the bar code must be Code 39 based on my clients requirements.
I have clients all over the country so I can not physically be on site for each one so I need all of the complexity to be on me in my code not on the end user. I realize that the IOS solution will probably not be the same as the droid but I need it to feel as close as possible for the end user because a few of my clients will be using multiple devices and I need to minimize the confusion.
I realize that I have a tall order with a lot of restrictions but any thoughts would be greatly appreciated.
I ended up using CNS Barcode for IOS devices. CNS is a good solution, it does everything that I need but it is not an ideal solution for two reasons:
It is not free. I have no problem with paying for apps, I think that a developer deserves every penny. In my case though this caused an inconveinence to my clients. The small cost is irrelevant when factoring in the benefit of the new functionality but it's hard to sell a product to a client then tell them to make it work you will need to buy this other product.
CNS does not return the result to the calling window/tab, it opens a new tab. In my case this is a problem because the barcode scanner is being used to scan id badges to clock in or clock out employees and may be done 50 times meaning 50 tabs opened.
I was able to create a solution for number two by creating a local key-value storage instance on the new tab along with a key-value change listener on the old tab:
window.addEventListener("storage", onStorageChanged, false);
function onStorageChanged(e)
{
if(/*check for appropriate key-value*/)
{
window.Close();
}
}
Note: This solution may have to be modified to pass the actual barcode result in the local key-value storage instance back to the original tab and use window.Close() to close the new tab if the original tab was not opened via javascript, which is probably more often the case, because window.Close() does not work for windows that were browsed to naturally (not opened with javascript).
Since the number 1 concern is only an inconvenience and the number 2 concern is fixable I will mark this as solved.
Here is another place I found that does it.
http://codecanyon.net/item/mobile-upc-scanner-with-web-proxy-api/10193177
I'm making a charity Windows Mobile 6 app in C# to help those affected by Alzheimer's.
The aim is for this app to let the carer set a boundary by tapping in Google maps to set points. The carer would then put the windows mobile device in the patient's hand bag or coat, so that when the patient walks out on their own, thinking that they are "going home", the carer receives an SMS text with their position, heading and speed.
However, I don't know how to...
Switch from app to google maps for mobile
tap to select points
import the coordinates of that point to my C# program
use the coordinates to Calculate the boundary
Send the text with the position information
Switch back to my C# program
HTC's HD2 comes with a compass that uses this "tap to select a point then return to app" functionality, so surely it's possible for us too?
If anyone would be able to give me a hand my out I would be EXTREMELY grateful as this will help all those affected by Alzheimer's and other similar conditions. My Gran, for example, recently started trying to walk back to the property she lived in 20 years ago...
Thanks everyone! This means sooo much! I'll even come and buy you a drink to say thanks!
James
Whatever technical issues you're considering, I think you should realize that this type of usage is, AFAICS, contrary to the terms of service of google maps. See:
http://code.google.com/apis/maps/terms.html
That is, you may only use the google maps content if its accessible for everybody, not just whomever you hand out your program to:
Your Maps API Implementation must be generally accessible to users without charge.
If you're building it as a web app, it must be accessible through the internet, not intranet:
[your Maps API Implementation must not:] operate only behind a firewall or only on an internal network (except during the development and testing phase).
Some of the terms in header 10 also seem applicable:
[you must not (nor may you permit anyone else to):]
10.8 use the Static Maps API other than in an implementation in a web browser;
10.9 use the Service or Content with any products, systems, or applications for or in connection with:
(a) real time navigation or route guidance, including but not limited to turn-by-turn route guidance that is synchronized to the position of a user's sensor-enabled device;
Why would you want to kludge something together like that? Trying to have your app interface with another application for which you don't have source, whether it's Google Maps fopr Mobile or anything else, is difficult and should only be used as a last resort.
If this app is going to be free and not require users to log in, you can use the Bing Maps Web Service API directly from your application without cost. You could then use built-in GPS through the GPSID APIs as well, and you'd have control over what data goes where, what maps to draw, etc.
This seems like a much easier path to achieve what you're after.
As a side note, I gave a link above for the GPSID sample from Microsoft. I'd recommend looking at it and the native GPSID APIs but the managed wrapper Microsoft provided is, IMO, pure garbage, so you might consider wrapping the lower APIs yourself.
To restate the problem I believe you're trying to solve:
You've a use case when a carer will sent up a "virtual boundary" on a device. If that device leaves the bounded area, you'd like an alert sent via SMS sent to a predefined recipient, saying where that device is.
My suggestion would be to use something like OpenStreetMap maps (as they're free) for when you're setting up the virtual boundary. For their tiles (each 256px square), there is a relatively trivial method for converting between lat/long and pixel co-ordinates.
You might also be able to do what you want by cannibalising one of their existing Windows Mobile applications intended for surveying, such as OSMtracker, which already includes the map controls, downloads and the like, just leaving point 5 and part of point 4 on your list to tackle.
I have a "Symbol" brand barcode scanner (USB) and I am trying to capture the data it scans from a barcode into my application (which is running as a service -- with no textbox control, of course).
The catch is that : Whenever you scan something, it acts like a keyboard and outputs the digits to anything that has focus (i.e notepad, word, etc).
My question is: How do I perform this barcode scan in the background and put it in a variable that I can use in my in C#.
So far, the only api's that I've found are for the .NET CF and I need this to be a
windows service.
Basically, I want to be able to send certain keystrokes to an application if the barcode = "123456789-0111" without interfering with the current window that has focus. After my application reads the barcode in then it will look for a certain program (launch it and set focus) and send keystrokes. I am using Code 128.
The HID mode will be your best best.
Put the barcode reader in HID mode and make your service capture the reader. When data comes in take a look at it and if it is one of your special barcodes you can act on it.
If the data is not one of your special barcodes then inject them as keydown/keyup windows messages so that it will seem to work in the same fashion as in keyboard emulation mode.
Put the scanner into USB mode. This is generally done by scanning a series of barcodes in your manual or printed out from the software provided from symbol.
With the scanner plugged in/docked connect to windows update. You'll get an update specific to that scanner. It won't work if if the scanner is not plugged in.
The scanner should map to a com port. This has typically been com 2 on the machines I've set it up on.
Download JustinIO. For my scanner, useful COM settings: Baud Rate: 9600, ByteSize 8, StopBits: 1 Parity: 0
Create a new CommPort instance. Set up a thread that does something like:
StringBuilder sb;
byte[] b;
do
{
b = commPort.Read(1);
sb.Append(Encoding.ASCII.GetChars(b));
Thread.Sleep(20); //symbol is slow...
} while(b.Length > 0);
Note: that's much crunched down from the code that I'm actually using so you'll need to modify it for your application.
Send the string to your application via whatever method seems appropriate.
The scanner is configured as HID (human interface device) and emulating keyboard.
To access it through Symbol's API, you probably have to disactivate current communication mode and set it to native one - should be documented in the scanner manual. Then you can access it directly without input field.
PS. I have no Symbol's scanner, but this is common to many devices.
It really depends upon the barcode scanner's api, and that is specific to the vendor. You'll need to get the the api for the scanner from the vendor, if you can't find it on their site you should just email their support, though you might find you have to buy the api.
First..
Ignore the .NET CF info for now as it probably pertains to the actual handheld unit. The mode of operation, pretending to be a keyboard, is referred to classically as a 'keyboard wedge'.
Second..
What kind of barcode symbologies are you attempting to use? And for what purposes? Or, mor directly,...What do the barcodes look like when scanned? (Do they contain special leading and trailing characters?)
Third... keep it simple... avoid the API unless it is necessary...
In the past when I've had to interface with barcode scanners, I've used a very simple approach in that my data entry form has the property of KeyPreview true and contains a method to detect and direct input originating from the scanner (by examining starting and trailing characters) to the appropriate control. Most of the scanners I've dealt with were programmable (usually via barcodes) to pass a custom set of characters to signal beginning and end of scanned input.
I hope that helps....
Here is a CodeProject sample that demonstrates how to set up global mouse and keyboard hooks in C#:
http://www.codeproject.com/KB/cs/globalhook.aspx
You could add this code to your console application, and then just monitor all keyboard input, looking for the specific codes you need. No API fuss or muss.
I'm writing a C# POS (point of sale) system that takes input from a keyboard wedge magcard reader. This means that any data it reads off of a mag stripe is entered as if it were typed on the keyboard very quickly. Currently I'm handling this by attaching to the KeyPress event and looking for a series of very fast key presses that contain the card swipe sentinel characters.
Is there a better way to deal with this sort of input?
Edit: The device does simply present the data as keystrokes and doesn't interface through some other driver. Also We use a wide range of these types of devices so ideally a method should work independent of the specific model of wedge being used. However if there is no other option I'll have to make do.
One thing you can do is that you should be able to configure your wedge reader so that it presents one or many escape characters before or after the string. You would use these escape characters to know that you are about to have (or just had) a magcard input.
This same technique is used by barcode reader devices so you application knows to get focus or handle the data input from the device.
The negative to this approach is that you have to properly configure your external devices. This can be a deployment issue.
This assumes that your devices simply present the data as keystrokes and don't interface through some other driver.
You can also use the Raw Input API if you know the Hardware IDs of the devices ahead of time. I blogged about this recently. It may be insane but it satisifed my requirement: the primary goal in my case was to be able to receive input even when the application lost focus because someone accidentally bumped into something while rummaging around to scan items on a pallet. The secondary goal is that I couldn't add any sentinel characters because that would have broken existing third-party applications being used with the scan guns.
I've done the sentinel character method before, however, both via a KeyPress attach or a low-level keyboard hook via SetWindowsHookEx() or via KeyPreview on your application's main form. If it meets your requirements, it's definitely much simpler and easier to use that method and to that end I second the recommendations already given.
I think you are handling it in an acceptable way, just be careful of how fast the card sends the data, we have wireless bar code scanner's, and now and again they throw the key strokes at the keyboard to fast for the application to handle.
also if you are distributing your software to other territories, then key stokes may be different, for example in Spain (I think, but may be France) the top line of the keyboard is !"£$%^&() opposed to the USA/UK 1234567890, and if your card reader is set to usa/uk then it will send !"£$%^&() in place of 1234567890, as the wedge just emulates that key been pressed and if windows interprets it different then its your problem.
Another vote for jttraino's idea. I do much the same with card-readers and cheque-readers in point-of-sale systems where we need to support keyboard wedge as well as USB and RS232.
Basically, choose a short sequence of characters unlikely to come from the keyboard, and program your message handling loop to see these characters arriving. If you get a completed stream of characters that match your pattern, you can decode the rest of your input until you hit your designated 'end' sequence, or until you decide the incoming sequence is in error. Select a string that is either difficult, or impossible, to enter from the regular keyboard into your app given things like edit masks and the behaviour of your various screens.
A good starting point is something like tilda-pling (~!) as those characters are not likely to appear in anyone's personal details and not likely to ever need to appear together in the text of a note, etc. :-)
The downside, exactly as jttraino said, is that you will probably have to configure/program each reader device itself. Some manufacturers make this fairly easy to do - whose kit are you using? Magtek? Welch Allyn?
I second #jttraino's idea.
It is the way to go for bar scan/code readers and other such devices that are plug and play (PnP). I have used the same technique to configure a couple of 1D and 2D bar code scanners in my previous assignment.