I'm working on an access control windows application, I'm using .Net and a simple Barcode readers.
In my app, I'd like to use 2 barcode readers installed on the same computer in differents USB ports
First to log entrance.
Second to log exit.
How can I retrieve which Barcode reader was been used to log ? (the one plugged on USB port 1 or 2)
>> here is an explanatory diagram
#Abd13t,
If you are using the scanner in keyboard wedge mode and both scanners are going to be reading the same barcode, one way to do this would be to add different prefixes that your scanner appends to the data event.
If you using an OPOS or POS for .NET implementation your data events should be associated with a specific device.
In order to help you further, we would need more details.
Terry Warwick, Microsoft
Related
I made a Windows Form Application in order to be able to read barcodes, but when some multiple scanners are connected to the same PC and they scan something in the same time, the output values are mixed.
The idea is that every scanned barcode have to be added in an Excel file, but if the characters are mixed I cannot add the correct values. I use the KeyPress event of the form because it's a Keyboard Wedge Emulator.
The scanner is an LS2208 by Motorola Symbols. I understand that Microsoft Point of Service library won't work with this scanner model. Do you have any idea on this matter?
The LS2208 does not support Windows.Devices.PointOfService, but it does support OPOS.
And the fact that it supports OPOS can also be used with POS for.NET.
If you are developing your application in C# and are looking for a way other than the Keyboard Wedge Emulator, you can use these.
Windows.Devices.PointOfService: LS2208 unsupported
Supported Point of Service Peripherals
This mode is similar to connecting with a serial port.
SYMBOL LS2208 GENERAL PURPOSE BARCODE SCANNER SUPPORT
LS2208 Product Reference Guide (en)
Please refer Page 35 USB Device Type -> OPOS(IBM Hand-held with Full Disable)
OPOS:
OPOS DRIVER
SCANNER SDK FOR WINDOWS
POS for.NET:
POS for .NET v1.14.1 SDK Documentation
Microsoft Point of Service for .NET v1.14.1 (POS for.NET)
Or if you don't want to use the above library, you can connect with a serial port and control it directly.
Please refer Product Reference Guide Page 36 -> USB CDC Host
USB CDC DRIVER FOR WINDOWS
I am trying to programmatically access internal device counters of a document scanning device that is connected via USB to my computer. I am NOT interested in the data that a scanner normally outputs (content of scanned pages, etc)! Instead, I would like to know how many pages were scanned so far. Does anyone have a clue on how to access such data? SNMP is usually the way to go for such device counters, but not with USB devices (at least I am not aware of how to do it).
OS is Windows 7, programming language is C#, and the scanning device is a Canon DR-M160 (hopefully this shouldn't matter, as I try to create a vendor-independend solution).
I have written an c# 4.0 application that analyses the microphone input and records DTMF tones that represent credit card numbers entered by our clients. This all works well, but since we are working under PCI Compliance (see www.pcisecuritystandards.org), we don't want to allow the logged in user (call centre staff) to listen or even record the microphone input so that they then can parse the credit card numbers on their own with a 3rd party app or their phones. So the question I have is:
How can I restrict the microphone input to a specific application so
that it can't be heard or recorded somewhere else?
If there is no solution to this, the 2nd question arises:
How can I restrict the microphone input to a specific user so that it
can't be heard or recorded somewhere else (I could run the software
as a Windows service under specific user credentials)?
Kind regards,
JB
The main way to restrict access to device is setting of Security Descriptor on the device. So granting of the permission for specific user group is the way in which you should go.
The exact implementation for Windows XP could be different from later versions of Windows. Windows 8 have new possibilities too. Audio Mixer APIs can be used in Windows XP. Starting with Vista Windows Multimedia Device (MMDevice) API can be used. MMDevice API's implementation of the property store. You can use IPropertyStore::SetValue and IPropertyStore::Commit to change properties. Unified Device Property Model are introduced starting with Windows Vista. There are different Windows API which uses internally SetupAPI to access to devices and to set it's properties (see here). I think that you should set PKEY_Device_SecuritySDS property to secure device. One can use old APIs like SetupDiSetDeviceRegistryProperty and SetupDiSetClassRegistryProperty to set the properties on Windows XP (see here).
If I start on my computer devmgmt.msc and examine default property of microphone device then I can see Security Descriptor
What you need is to change it so that only specific user groups (or users) access it.
There are PKEY_Device_SecuritySDS and PKEY_Device_Security properties which can be change by SetupDiSetDeviceProperty and SPDRP_SECURITY_SDS or SPDRP_SECURITY (see here). Usage of SDS parameters (PKEY_Device_SecuritySDS or SPDRP_SECURITY_SDS) could be easier because there use readable Security Descriptor Definition Language (SDDL).
After you change security descriptor on the device you need use SetupDiSetClassInstallParams and SetupDiCallClassInstaller with DIF_PROPERTYCHANGE and DICS_PROPCHANGE to reset the device. You can find the code example in the source code of devcon utility on WinDDK. Alternatively you can use CM_Disable_DevNode and CM_Enable_DevNode to restart it with new properties.
You should be able to do it with the Core Audio API. For each playback device and capture device in the system, you can control whether the device can be used in exclusive mode.
One drawback - there is no support for Core Audio API under Windows XP.
I think the solution to your problem is to write a KS Filter
Create a Kernel Streaming filter that is able to decode the DTMF on demand of your application and send the decoded data to your application. When the filter is in DTMF decoding mode, it just outputs silence to the rest of the filter stack.
If an USB audio device is used, you could also write a GFX Filter instead, which can be configured on a per-user-base. But this only seems to work for 32-bit operating systems. WinDDK has a sample called gfxswap.xp.
You can use ASIO audio drivers in your application.
ASIO is a technology developed by Steinberg to provide low latency audio input and output, and as a side effect, requiring a device using an ASIO driver completely restricts the device use to the process that required it, in addition to multiple other advantages that may be irrelevant to your needs.
It is available for every soundcard thanks to the ASIO4ALL project, so compatibility won't be an issue as long as you provide it with your application
For more informations, check out the wikipedia article about ASIO here, or pick up the SDK here ( you will need to register a Steinberg Developer account to proceed )
Will it be helpful if you can control (MUTE) the VOLUME of the sound device and set it back to it's former state once you are done? You can look at this link for ideas. Good luck.
I'm trying to contact an usb barcode scanner as a serial port, using his virtual COM port name and the Serial Port class.
The reason I'm trying to do it this way is to avoid using the scanner as a keyboard wedge since I need the possibility to scan even when the form is hidden.
Problem is that when I connect the barcode scanner to the usb port, and I run the "GetPortNames" function, I get an empty list. Any suggestions why? Thanks
Typically many USB barcode scanners will just appear as virtual keyboard devices - not virtual COM ports. That would explain why it doesn't appear.
Does your scanner support some kind of serial emulation mode? You may need to configure it or install different drivers to enable this. Does it appear as a serial port in Device Manager? (Look under the Ports tree)
As an aside:
Take a look at this question if you find that the 'keyboard mode' is the only one supported:
Reading a barcode using a USB barcode scanner along with ignoring keyboard data input while scanner product id and vendor id are not known
This question refers to this article with a large amount of good information relating to keyboard hooks and filtering out the scanned barcodes:
http://nicholas.piasecki.name/blog/2009/02/distinguishing-barcode-scanners-from-the-keyboard-in-winforms/
I cannot guarantee that it will work with your specific device, but I've seen code that solved a similar problem once. The solution was looking for the port name in the registry.
The code for it can be found in the open source project ez430chronosnet; a .NET library that can access TI's EZ430 Chronos watch via its USB dongle.
You'll want to look at the PortName.cs file that looks for the name in the registry (it will at least point you to the right keys) and the Chronos.cs file that does the actual port opening with SerialPort.
We have a large number of Window Mobile Devices (Symbol MC35 & MC70). I want to write a small app that gets the device serial number and simcard serial number (not phone number). I have tryed using the Symbol SDK and I can get the Device Serial Number for the MC70s as they have a Electronic Serial Number Module. But not sure how to get the Sim Details.
If i am unable to get the Device Serial Number From the MC35s can I get the IMEI number?
The porpose behind this is so I can keep a upto date record of what sim is in what handheld as any time. I am going to write the data to a registy file where SOTI Mobile Control will link it to that handheld.
You're after the lineGetGeneralInfo TAPI call. You want to look at the subscriber number, which is located using the dwSubscriberNumberSize and dwSubscriberNumberOffset members of the LINEGENERALINFO structure the call returns.
See here for SIM management functions. I can't find anything for retrieving a SIM ID, if such a thing exists. I suppose that you can identify the SIM by the phone number. Is it possible two different SIMs to have the same phone number? To get the phone number there is the GetPhoneNumber sample in the Windows Mobile SDK.
As for identifying the phone, the correct way is to read the Device ID. Again there is the GetDeviceID sample in the SDK (Both are in Common\CPP\Win32). Copying from the sample's read me:
GetDeviceUniqueID protects the privacy
of a device. Multiple applications
need to use a device's unique
identifier to communicate with
servers. To protect a device's
privacy, multiple servers should not
be able to correlate data from the
same device. GetDeviceUniqueID does
not use any additional information
other than the data that is provided
by the application, so any
application that passes in the same
application data buffer will obtain
the same hash. This API can be called
be any application regardless of the
trust level of the application.
If you want to retrieve the IMEI, see for example here.