Could anyone please give me any idea as to where to start my coding in order to get data from OPOS(Datalogic Magellan device) weighting and barcode scanning in C#?? For example, what library and what function I should be using for this case. I am clueless as I have already spent numerous of hours searching for an answer online. Not even came close online.
I don't know any api that I can use to get the weight and barcode for the usb device into my C# program.
I am currently using Datalogic scale. I tried the build-in windows reader but it didn't read in any data from the device.
First off, I used the Microsoft.PointOfService library which can directly create connection to most of the opos base machine. And make sure you have your Logical Device Name right! Very Very important. This is NOT any normal name you found in your regedit, it MUST be define manually by yourself inside the opos adk program that you installed along with the opos machine.
Then you can pass in the name as usual in your C# program.
For example: you set USB_Scale as your logical device name inside OPOS program
in C#
this.myDevice = explore.GetDevice("Scale", "USB_Scale");
Note: Make sure you set claim to 1000; It might not work if you didn't do so.
Also : this.myScale = ((Scale)explore.CreateInstance(myDevice)); <- this might help~
The rest is just straight forward.
Related
Have been struggling with finding a way to stream audio, from a file or web, to a specific output device, not just the default one. Tried using mciSendString and while the open command does accept a device id/filename I haven't found a way to make use of it, am not even sure if this is what I am looking for or not, but considering it says ... or the filename of the device driver am guessing yes(?), but correct me if I am wrong, and this isn't a specify your output device type parameter.
If it is the correct thing then how do you enumerate the installed device drivers, have looked into the IMMDevice interface because it seamed like it could have the file names stored in the registry, but non of the output device registry keys had a driver filename type value entry, or at least I haven't found one.
So my question is, how would you go about streaming audio to a specific output device, it doesn't have to be done through mciSendString, that's just something I looked into as it's one of the most talked about function when it comes to playing audio.
Note: please do not recommend me 3rd party libraries like NAudio, the reason I am asking this question is not get recommendations for libraries, otherwise I would have already used one and would have never written this, have just seen a lot of answers be like: Use {LibName}, it has what you want or something along those lines.
In case what's written is odd or incorrectly worded in places, basically this is what the end goal should be:
Installed Output Devices:
- Output1
- Output2
- Output3
Method For Playing:
//will play x.mp3 through output device 1
PlayAudio(output: "Output1", mp3File: "x.mp3");
//will play x.mp3 through output device 2
PlayAudio(output: "Output2", mp3File: "x.mp3");
//will play x.mp3 through output device 3
PlayAudio(output: "Output3", mp3File: "x.mp3");
You seem to be looking for this API:mciSendCommand()
To set the WaveAudio device (soundcard) used by the Multimedia
Control, you must use the mciSendCommand API. The Multimedia Control
does not directly provide a method to let you set the device used for
playing or recording.
Call mciSendCommand() with MCI_SET & MCI_WAVE_SET_PARMS
setting wOutput to the desired playback device's ID.
Then get IDDevice for mciSendCommand() via
mciGetDeviceID("waveaudio")
Its not 100% clear what wOutput wants, its probably the same ID as returned by waveOutGetDevCaps()
I am just a porter.
Please refer:
https://stackoverflow.com/a/13320137/11128312
https://stackoverflow.com/a/10968887/11128312
I want to add a backup functionality to my app in the sense that the app will allow users to create a self-contained environment (data + executable + autorun.inf file) on an external device (CD, CD-ROM or USB key) so that users can retrieve (in read only mode) their stored environment at a given point in time.
I've read here about making an auto-bootable USB (which I suspect will be the same for a CD or DVD).
edit I meant "auto-executing", not "auto-bootable"!
I know about IMAPI or other approaches that are now several years old. Is there any alternative/standard approach to create media this way? I'd like a generic way to create either CD/DVD or USB devices (non-bootable).
You need to make sure to not confuse Booting and Windows Autorun.
auto-bootable USB
refers to an external USB drive from which you can boot your computer.
I doubt that's what you are looking for, given the linked Stackexchange question. The information you already found is actually what you are looking for, and the advice given there seems pretty accurate.
What you need to do is:
Create the media with your data. In case of USB sticks this is as easy as copying the data to the stick. Optical media (CD/DVD) need to be burned, and that can only be done using the Windows API, which has already be discussed here.
If you want to use the Windows autorun feature (which I would ignore*), you'll need to create a file called Autorun.ini in the root directory of your media. You already have found the required content of that file here.
* Why I would skip the autorun feature.
First of all, there's no real alternative to the Windows autorun feature.
It was controversial, at best, in earlier versions of Windows. Since USB sticks went mainstream, autorun became nothing more than an automatic virus installation feature. Soon after everyone started disabling it. Because of this recent versions of Windows seem to have dropped it or disable it by default.
An exception to this would be the Icon=diskicon.ico option, which allows you to change the icon of the drive. This might be still working, even if autorun is disabled.
By plugging in a PNP device to a Windows PC I want to know if the device supports a feature of data transferring. I am majoraly interested in pushing some content to device.
So, for example when I am plugging in a Windows Phone I can see over windows managment query that 5 new devices are added
Name: Windows Phone
CompartibleId: USB\MS_COMP_MTP,
USB\Class_06&SubClass_01&Prot_01, USB\Class_06&SubClass_01,
USB\Class_06
Name: WinUsb Device
CompartibleId: USB\MS_COMP_WINUSB,
USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff,
USB\Class_ff
Name: WinUsb Device
CompartibleId: USB\MS_COMP_WINUSB,
USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff,
USB\Class_ff
Name: WinUsb Device
CompartibleId: USB\MS_COMP_WINUSB,
USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff,
USB\Class_ff
Name: USB Composite Device
CompartibleId:
USB\DevClass_00&SubClass_00&Prot_00, USB\DevClass_00&SubClass_00,
USB\DevClass_00, USB\COMPOSITE
How can I now get a glue that:
All the devices are parts of a single device
The device allows me to save a file on it
Find an indicator that certainly tells me about the suppoted file transfer protocol
In case if there are more than a sigle possiblility for file trasfer select the more fastest(or modern)
I will appreaciate any help even if you could just tell me a focused direction where I should continue my study/investigation.
I am looking at a generic way to work with devices. Desired implementation language is C#.
Firstly You can consult this codeproject it gives you details of Windows Device Drivers.
SharpUSBLib and HidLibrary are two widely used libraries you can even get a tutorial project with implementation here.
SharpUsbLib earlier version used to screw up systems.
Would prefer libusbdotnet.
If you have to work with an USB device (send requests, process responses), this library was the best solution I could find.
Pros:
Has all methods you need to work in synch or asynch mode.
Source code provided
Enough samples to start using it straight away.
Cons:
Poor documentation (it's common problem for open source projects). Basically, you can find just common description of methods in the CHM help file and that's it. But I still find provided samples and source code is enough for coding. Just sometimes I see a strange behaviour and want to know why it was implemented in this way and can't get even a hint...
Seems unsupported any more. Last version was issued in Oct 2010. And it's hard to get answers sometimes.
I have to make a program which monitor usb ports and when an usb device is plugged (joypad, flash drives, mouse, ecc...) I get a unique identifier (a deviceid or something else would be good).
At first I tried with C# using the system.management classes and querying the cim_logicaldevice class each second to get the new device plugged.
Some device returned more rows with DeviceID, but this isn't a problem. The problem is that the memory occupied by the program (in task manager) grows up constantly.
This is the source code:
http://pastebin.com/dQv3cMQC
Is there a way to avoid the growing of the memory usege?
I have to do this program in C++ or C# and it has to be the most efficient possible (because it has to be opened forever).
I would recommend looking at the USBView sample in the WDK. If you are unfamiliar with this, simply run it - this tool walks the entire USB tree on the system and prints out information and descriptor listings for each device.
In your case, I'd start at the RefreshTree() function in this sample, you can then follow the code to see how it enumerates the host controllers, hubs and finally devices. For each device that you find you can look at the bInterfaceClass in the interface descriptors to find out what types of interfaces it is advertising.
The easiest way to get the source to this sample is to install the 7.1.0 WDK which is currently available here: http://www.microsoft.com/en-us/download/details.aspx?id=11800
We are assigned to develop an application using C# that can transfer print jobs between printers. I have looked on the Windows API, and System.Printing namespace but I can't find a class or function that can do this. Is there a free library out there that is suitable for this? How will you do this using .Net or the Win32 API?
If nothing exists in the Win32 API, then there will be nothing in .NET.
Unless the printer drivers are identical then you may have problems because the printer jobs go through some processing by the driver before entering the queue.
Have you considered a single queue with multiple printers associated with it (this giving more capacity and redundancy in case of printer failure)?
Isn't this a problem of load-balancing/routing a particular job to the least busy printer?
I'm pretty sure you can just CopyFile a SPL file to a new printer port if it's the same driver. If you print in EMF, you may be able to go across different drivers.
The port names might be a bit tricky depending on how the printer(s) are attached. WinObj and the rules of dev naming will be handy for tracking it down.