Setting low level flag for Serial Port in Java

Discussion in 'Java' started by Homer, Jul 16, 2007.

  1. Homer

    Homer Guest

    Hi All,

    How can I set a low level flag for Serial Port. Using C++ I can say:

    if((m_hComaptm=::CreateFile(/*(LPCTSTR)port,*/"COM1", GENERIC_READ|
    GENERIC_WRITE, 0, NULL,
    OPEN_EXISTING, FILE_FLAG_OVERLAPPED,
    NULL))==INVALID_HANDLE_VALUE)
    {
    IsError();// to format system error
    printf("Failed to access COM1...\n");
    return NULL;
    }
    ::SetupComm(m_hComaptm, 1024,1024);
    DCB m_dcb;
    ::GetCommState(m_hComaptm,&m_dcb);
    // m_dcb.BaudRate = CBR_9600;
    // m_dcb.fBinary = 1;
    // m_dcb.fParity = 0;
    // m_dcb.fOutxCtsFlow = 0;
    // m_dcb.fOutxDsrFlow = 0;
    // m_dcb.fDtrControl = DTR_CONTROL_ENABLE;
    // m_dcb.fDsrSensitivity = 0;


    I am using Java Win32Com library and trying to set fDsrSensitivity to
    Zero in Java but there is no such a function. any idea?


    Thanks in advance,

    Homer
     
    Homer, Jul 16, 2007
    #1
    1. Advertising

  2. Homer wrote:
    > Hi All,
    >
    > How can I set a low level flag for Serial Port. Using C++ I can say:
    >
    > if((m_hComaptm=::CreateFile(/*(LPCTSTR)port,*/"COM1", GENERIC_READ|
    > GENERIC_WRITE, 0, NULL,
    > OPEN_EXISTING, FILE_FLAG_OVERLAPPED,
    > NULL))==INVALID_HANDLE_VALUE)
    > {
    > IsError();// to format system error
    > printf("Failed to access COM1...\n");
    > return NULL;
    > }
    > ::SetupComm(m_hComaptm, 1024,1024);
    > DCB m_dcb;
    > ::GetCommState(m_hComaptm,&m_dcb);
    > // m_dcb.BaudRate = CBR_9600;
    > // m_dcb.fBinary = 1;
    > // m_dcb.fParity = 0;
    > // m_dcb.fOutxCtsFlow = 0;
    > // m_dcb.fOutxDsrFlow = 0;
    > // m_dcb.fDtrControl = DTR_CONTROL_ENABLE;
    > // m_dcb.fDsrSensitivity = 0;
    >
    >
    > I am using Java Win32Com library and trying to set fDsrSensitivity to
    > Zero in Java but there is no such a function. any idea?
    >
    >
    > Thanks in advance,
    >
    > Homer
    >


    What does it do? I've never seen that before. It is not a function of
    the UART, is it a Windows driver function?

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jul 16, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page