It's a blocking call and requires a minimum of 1 byte to proceed. So if I use this code int fromReader = ReaderStream.ReadByte() my thread is blocked. The problem with that is if I send a RFID command to the MSR device the MSR device doesn't respond back with anything. Well since both the SerialPort and the FileStream have a Stream object I decided to use that to read and write to that port. I'm not sure on that one since in Device Manager the Silicon labs Device Class Guid is the Ports GUID. As a FYI I have tried to use the Friendly name of both chips to get the COM port and the Silicon Labs one (for some strange reason) doesn't get listed using SetupAPI.GetDeviceDetails using the Ports GUID. The FTDI chip doesn't let me talk to the devices directly like that so I have to get the friendly name of the device then use mutex to pull out the COM port then create a SerialPort instance. Because it is plug and play I have the full hardware path available to me which I can then create a SafeFileHandle using a call to PInvoke and using that SafeFileHandle I create a FileStream. I wanted to use the plug and play features with POS for. Although my devices are the same, I have 2 different Virtual COM Port chips that communicate to those devices. NET to make a Service Object for my RFID and MSR device. What I'll probably have to do is edit this post a few times with more and more code to help me diagnose what the problem is. ![]() ![]() As is noted by the title I am getting an unhandled exception telling me my Safe handle has been closed. So this is a rather small question with a big explanation.
0 Comments
Leave a Reply. |