I have created a watcher to connect to BarcodeScanner using Windows.Devices.PointOfService
var watcher = DeviceInformation.CreateWatcher(BarcodeScanner.GetDeviceSelector());
var id = "";
watcher.Added += async (sender, information) =>
{
id = information.Id;
var barcodeScanner = await BarcodeScanner.FromIdAsync(id);
...
}
information parameter contains all data releted to my barcodeScanner, but when i try to get it with FromIdAsync is always null.
Those are data contained into information
- information {Windows.Devices.Enumeration.DeviceInformation} Windows.Devices.Enumeration.DeviceInformation
EnclosureLocation null Windows.Devices.Enumeration.EnclosureLocation
Id "\\\\?\\HID#VID_0536&PID_02E1&MI_01#c&d907bf5&0&0000#{c243ffbd-3afc-45e9-b3d3-2ba18bc7ebc5}\\POSBarcodeScanner" string
IsDefault false bool
IsEnabled true bool
Kind DeviceInterface Windows.Devices.Enumeration.DeviceInformationKind
Name "3800G" string
+ Pairing {Windows.Devices.Enumeration.DeviceInformationPairing} Windows.Devices.Enumeration.DeviceInformationPairing
+ Properties {System.__ComObject} System.Collections.Generic.IReadOnlyDictionary<string, object> {System.__ComObject}
+ Native View 0x1d148140 <Information not available, no symbols loaded for Windows.Devices.Enumeration.dll> IUnknown *
This device is listed as enabled to be accessed with POS.
Where I'm wrong? I have tried also to create the watcher behind a button click, but nothigs change.
If the model name of the scanner you are using is "3800G" as in the question code, it may not be supported by Windows.Devices.PointOfService.
A list of supported models is below.
Supported Point of Service Peripherals
If you want to use it with Windows.Devices.PointOfService, please change it to the model described in this.
In Addition:
Unified POS standard and Windows® Embedded for Point of Service are OPOS/POS for.NET/JavaPOS API. It is not Windows.Devices.PointOfService API.
That model is not listed on Honeywell's site.
And, sales agencies in Japan may be displayed as sales ended. Probably it is an old model. It is better to switch to a new model.
For example, the USB HID Bar code scanner mode setting is described on page 21 of the detailed manual of 1900 series.
If this mode setting description is not in the 3800G manual, you can not use Windows.Devices.PointOfService API on 3800G.
If you can set it, you will be able to use it if you install a device driver corresponding to this mode.
#Luigi Saggese,
You must first put this scanner into USB HID Barcode Scanner Mode. Please see Page 1-3 of the Honeywell 3800g Users Guide for the programming code to put the scanner into this mode.
Once the scanner is in this mode, you should see a POS Barcode Scanner node in Windows Device Manager. The specific scanner will show up in Device Manager as POS HID Barcode Scanner since it is using an in-box class driver which supports the USB HID POS Scanner protocol. At this point it should work with your Watcher.
Terry Warwick, Microsoft
Related
What I need is a way to find out the curresponding HID of a SharpDX.DirectInput DeviceInstance.
What I have on DirectInput side is :
ProductId -> 00060079-0000-0000-0000-504944564944 (always the same)
InstanceId -> 8e3d89c0-6436-11e9-8004-444553540000 (dynamic / changes every time PC starts)
On HID side :
VendorID=0x0079
ProductID=0x0006,
Version=263,
DevicePath=\\?\hid#vid_0079&pid_0006#8&1ec29a1c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
I can see that the HID vendorId and ProductId are used to build the DirectInput ProductId. the problem is that I have multiple controllers connected with the same VendorId and ProductId (they are the same brand)
is there a way to do this? to know the HID devicePath of an DirectInput InstanceId?
For context:
I'm writing a software to automatic configure many controllers on many emulators for my custom arcade machine. The emulators use a combination of DirectInput/XInput/DSUClient (https://github.com/v1993/cemuhook-protocol). So, for each connected controller, I need to know all controllers info to be able to correctly configure each one on each emulator.
For now as a (very bad) workaround, i'm listening to inputs from DirectInput separeted from HID and when the reading occurs I know that the HID device is the DirectInput device because they occured (almost) on the same time.
I've already tried "Win32_PnPEntity" with "ManagementObjectSearcher" but had no luck
There is DIPROP_GUIDANDPATH property that could be requested via IDirectInputDevice8::GetProperty API. It will return HID device path.
In SharpDX it is represented by SharpDX.DirectInput.PropertyGuidAndPath struct.
I ended up finding the solution...
DirectInput directInput = new DirectInput();
foreach (var deviceInstance in directInput.GetDevices())
{
var joystick = new Joystick(directInput, deviceInstance.InstanceGuid);
Console.WriteLine(joystick.Properties.InterfacePath)
}
I am developing custom HID device. I can see the name in device manager (MyCustomDevice). However when I find the device using DeviceWatcher, the DeviceInformation.Name property has value Unknown USB Device (Port Reset Failed). Other applications using WIN32 apis can get correct name of device without problem.
My code:
// Selector for enabled HID devices
string selector = "System.Devices.InterfaceClassGuid:=\"{4D1E55B2-F16F-11CF-88CB-001111000030}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True";
_watcher = DeviceInformation.CreateWatcher(selector, properties);
_watcher.Added += (s, deviceInformation) => {
Console.WriteLine(deviceInformation.Name); // prints "Unknown USB Device (Port Reset Failed)"
};
Device functions correctly, I can communicate with it - the only problem is this Name. Is there possibility to fix it other than going back to WIN32?
To clarify things:
The device uses standard hidusb.sys driver, and there are no yellow exclamation marks in device manager.
I am trying to access the GPIO on my custom SBC using Windows 10 IoT Core. I have discovered that I must use LightningProviders to accomplish this . So I tried to follow this guide to use lightning providers properly.
I used very simple code:
if (LightningProvider.IsLightningEnabled)
{
LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
}
GpioStatus = "Initializing...";
var gpio = GpioController.GetDefault();
if (gpio == null)
{
GpioStatus = "There is no GPIO controller on this device.";
}
else
{
gpio.OpenPin(1).Write(GpioPinValue.High);
GpioStatus = gpio.OpenPin(1).Read().ToString();
}
Where GpioStatus is output text on a UI.
I discovered that if I run the LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider(); line outside of the enabled check, it picks up the GPIO controller and lets me detect how many pins I have and read them (All low). However I can't change the DriveMode or write to the pins without error. The error I get just says to Make sure the LightningProviders are enabled.
This brings me back to the guide I linked at the start. It suggests to enable DMAP drivers using the Device Portal for W10IoT or DMAPUtil.exe. I have tried both. In the Device Portal the area where it should be is just blank. And in the command line trying to use the DMAPUtil.exe only returns that dmaputil.exe is not available on this system.
Therefore I am asking if there is any other way to enable the LightningProviders or if there a way to know if they are incompatible with my board?
Thanks!
UPDATE
Also tried using the devcon.exe commands in the W10IoT Command line.
I am able to locate the Direct memory access controller but when i do devcon.exe enable *PNP0200 it says it is enabled but remains disabled when checked with devcon.exe status *PNP0200
Please confirm if you have added the IOT_DMAP_DRIVER feature in your OEMInput.xml, this feature will add the DMAP driver in the image. If IOT_DMAP_DRIVER is removed from the OEMInput.xml, the Default Driver Controller will be blank in device protal, and dmaputil will be not available on Windows IoT Core. Please see the IoT Core feature list.
Update:
You can download the source of Lighting Provider, and then deploy and debug in your custom image.
I am using Lecia Disto e7100i which basically measures distance and area using laser. This device has bluetooth and can be paired with windows.
I am trying to develop an wpf app that reads the mesaured data using c#
There is no sdk that comes along with the device.
I have tried to use 32feet.Net but since there is no proper documentation I don't know where to start.
Is there any way that I can do to solve my problem?
This is not a full response, instead its more of a guideline on how to resolve your issue:
Pair the device with your Computer
Run the included software that displays the data somehow
Use WireShark to analyze the traffic
see if it is a standard protocol type or something custom
understand the protocol and reimplement it using c# and BluetoothSockets
To get started, you can try:
var client = new BluetoothClient();
// Select the bluetooth device
var dlg = new SelectBluetoothDeviceDialog();
DialogResult result = dlg.ShowDialog(this);
if (result != DialogResult.OK)
{
return;
}
BluetoothDeviceInfo device = dlg.SelectedDevice;
BluetoothAddress addr = device.DeviceAddress;
Console.WriteLine(device.DeviceName);
BluetoothSecurity.PairRequest(addr, "PIN"); // set the pin here or take user input
device.SetServiceState(BluetoothService.HumanInterfaceDevice, true);
Thread.Sleep(100); // Precautionary
if (device.InstalledServices.Length == 0)
{
// handle appropriately
}
client.Connect(addr, BluetoothService.HumanInterfaceDevice);
Also make sure that
Device appears in "Bluetooth devices" in the "Control panel".
Device is HID or change code accordingly.
Hope it helps. Cheers!
Try this demo project, and the following articles after that one.
Try to follow this tutorial
Here you can see a direct answer by the mantainer of 32feet, with which you can get in touch
Check also this answer
I have gone through Microsoft Developer website. There is development using pointOfService. but I am getting error in:
scanner = await BarcodeScanner.GetDefaultAsync();
SAYING: IAsyncOperation does not contain definition for GetAwaiter
May be I am missing any Reference but not sure which one.
If there is any other way to do please share it. And one Important thing I am developing Windows Desktop Application.
Complete Code is:
private async Task<bool> CreateDefaultScannerObject()
{
if (scanner == null)
{
UpdateOutput("Creating Barcode Scanner object.");
scanner = await BarcodeScanner.GetDefaultAsync();
if (scanner != null)
{
UpdateOutput("Default Barcode Scanner created.");
UpdateOutput("Device Id is:" + scanner.DeviceId);
}
else
{
UpdateOutput("Barcode Scanner not found. Please connect a Barcode Scanner.");
return false;
}
}
return true;
}
You cannot use the BarcodeScanner class in a Desktop application. This class is part of the new "Universal Windows Platform" that only works in Universal Apps for Windows 8 and Windows 10.
The easiest way to use barcode scanners is by having them emulate the keyboard. You can configure the scanners to send prefix and suffix characters before and after the actual code.
Usually, you will configure "Return" as the suffix and some special code that the user usually never enters as the prefix.
If you process all keypress events in your application you can react to receiving the configured prefix by clearing and setting focus to a textbox that is meant to receive the barcode. The barcode is then (via the keyboard emulation) inserted into the textbox and return is pressed.
The textbox can then process this the same way as if a user had entered the code into the textbox and pressed Return.
For some more details and code samples see http://www.codeproject.com/Articles/296533/Using-a-bar-code-scanner-in-NET