drivers/can_uvccm_win32/can_uvccm_win32.cpp
changeset 267 96c688ebcde7
parent 255 7b9f36dbfe5f
child 365 9b76e0881beb
equal deleted inserted replaced
266:8678a3cf7fe7 267:96c688ebcde7
    71    }
    71    }
    72 
    72 
    73 bool can_uvccm_win32::send(const Message *m)
    73 bool can_uvccm_win32::send(const Message *m)
    74    {
    74    {
    75    if (m_port == INVALID_HANDLE_VALUE)
    75    if (m_port == INVALID_HANDLE_VALUE)
    76       return false;
    76       return true;
    77 
    77 
    78    // build can_uvccm_win32 command string
    78    // build can_uvccm_win32 command string
    79    std::string can_cmd;
    79    std::string can_cmd;
    80    set_can_data(*m, can_cmd);
    80    set_can_data(*m, can_cmd);
    81 
    81 
    91    ::WaitForSingleObject(overlapped.hEvent, WRITE_TIMEOUT);
    91    ::WaitForSingleObject(overlapped.hEvent, WRITE_TIMEOUT);
    92    // get number of bytes written
    92    // get number of bytes written
    93    ::GetOverlappedResult(m_port, &overlapped, &bytes_written, FALSE);
    93    ::GetOverlappedResult(m_port, &overlapped, &bytes_written, FALSE);
    94 
    94 
    95    bool result = (bytes_written == can_cmd.size());
    95    bool result = (bytes_written == can_cmd.size());
    96 
    96    
    97    return result;
    97    return false;
    98    }
    98    }
    99 
    99 
   100 
   100 
   101 bool can_uvccm_win32::receive(Message *m)
   101 bool can_uvccm_win32::receive(Message *m)
   102    {
   102    {