Results 1 to 8 of 8

Thread: Checking if hardware is connected

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    4

    Question Checking if hardware is connected

    Hi all VB expert,
    I have a problem with COM port connection problem. I try to look up a help from any VB forum, but I still can't find a solution. All the forum I found, just teach me how to detect the serial port available in the PC, but not testing on whether the port is connected with hardware. Is that possible to do? Please help. Thanks

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    4

    Re: Checking if hardware is connected

    Is that mean there are no solution for this problem? Why no body can help me here?

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: Checking if hardware is connected

    Whether it's possible to detect whether your hardware is connected depends on what the hardware is. You can detect some hardware, but there's hardware you can't detect. What kind of hardware are you trying to detect?

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    4

    Re: Checking if hardware is connected

    Actually, What I am try to do is checking whether the port is not connected, then I will try to let the user know that hardware (ie. barcode reader) is not exist. Using mscomm.portopen just tell me that I have a serial port 'COM1' in my computer, but not checking whether the port is connecting to the hardware or not.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: Checking if hardware is connected

    Check the documentation for the reader - see if it will respond to any particular input. For example, a Hayes-compatible modem will respond to "ATI" with a certain string. If the reader does something like that, send the string it responds to and look for the proper response while a timer is running. If the timer times out (set it for twice as long or three times as long as it normally takes for the reader to respond), there's no reader connected.

    If there's no string the reader will respond to, and it doesn't set any of the handshake lines, there's no way to tell if it's connected. (If it sets handshake lines you can tell that something is connected by checking the status bits, but you can't tell what the connected hardware is.)

  6. #6
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: Checking if hardware is connected

    You can check the DSR and CTS lines, if a harware device is connected to the COMM-port.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: Checking if hardware is connected

    IF the device does any handshaking. Quite a few serial devices don't.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    4

    Re: Checking if hardware is connected

    Quote Originally Posted by namrekka
    You can check the DSR and CTS lines, if a harware device is connected to the COMM-port.
    Thank you very much, you have solve my problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width