Renaming a selected Serial Port from COMX to COMY using C# - c#

I can currently read and write to my serial ports on the machine, but I wish to be able to change from, for example, COM3 to COM4 within my program. I can't find a way to do this online - I've seen you can potentially use Windows Developer Kit but unsure as to whether that can be used with C#? Thanks.

Related

Cannot acquire serial port names in WinForms

I am intend to design a GUI for my arduino project. However, I couldn’t get serial port names. I inserted the necessary library, and used SerialPort.GetPortNames() method. Then, I tried to add port names into ComboBox, also tried ListBox later, via foreach function. Eventually, I couldn’t see any port name neither in the program nor in the Item->(Collectibles). However, I used a button which shows port names in MessageBox, and I saw only COM3 and COM4.
I am sorry if I am confusing, thank you for yourr further comments.

DHT11 + Arduino UNO + Raspberry pi3 + Windows Remote Arduino

I need to read with C# UWP App, a DHT11/DHT22 sensor to get temperature and the arduino is conected to an Arduino UNO.
Can I use "digitalRead" at sensor PIN and converte the values using C# library
'sensors.dht'? Or I need to change the FirmataStandard sketch to include dht library and receive the values "cleaned"?
Thanks very much!
In theory, your plan is possible utilizing Windows Remote Arduino.
But currently, there is no official solution for your user case.
So you may need do some work by yourself. You need modify GPIO OneWire DHT11 library to fit your solution, such as, replace Windows::Devices::Gpio::GpioPin::Read() with Microsoft::Maker::RemoteWiring::RemoteDevice::digitalRead() and so on. Also note the time sequence due to DHT11/22 datasheet.
Finally, you may need sufficient test to ensure this solution works as expected.

Intercept and modify USB packets

The project is as follows;
I would like to create an application that will be able to see packets going to a USB device. When a certain bit of data that is known is sent to the device, the returning data will be intercepted and modified before the application requesting it, gets it. I have used a USB sniffer to see the packets being sent and I know exactly what bits need to be changed. My two questions are;
Is this a possible software solution?
Will this have to be a hardware solution?
Additional Information –
The USB device uses a FTDI245R chip for communication. I know the VID and PID of the device.
I have experience programming in vb.net and C# but I have never done anything with USB
I would like the application to be able to have a number entered and changed to hex data and that is what would be sent to the device. The number being entered would be changed frequently.
Any input is appreciated.
It sounds to me like you want an upper filter driver to the FTDI driver. I don't know what class or type of device you are using or if it has a vendor specific driver or not, but here is a sample that shows how to create an upper filter to a vendor specific driver. This example uses the OSRUSBFX2 device and sample driver in the WDK, you'll want to change the code to work and interface with the FTDI driver instead.

Reading printer data

I've been presented with a task where I'm unfamiliar with concepts.
Task - read printer data stream from a POS system.
Terms mentioned
ESC/P
I have to read values coming from a POS system. My first question is how can you determine the start and end of a print job?
I guess I'm looking for control characters of a printer maybe?
Also, is there a way to simulate this without interrupting the POS?
Anyone know good examples or references they are familiar with themselves?
Learn about Printdocument class
It has BeginPrint, and EndPrint event. You can subscribe to them with an eventhandler.
I'm not familiar with POS system, but i hope it's helpful for your first question.
You first need to know how is the POS system connected to your computer. It could be LPT port, COM port, or USB port. Then you can figure out how to read the data.
But under Windows, LPT may be held by printer spooler. You may need to disable spooler before talking to LPT1 directly.
Normally, it's easier to do these kind of stuff using C++, directly using Win32 API.

Datalogic Barcode/Weight Scanner

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.

Categories