pub fn open(interface: Rc<Interface>, port: &str) -> Result<Device> {
        let s = ffi::CString::new(port).unwrap();
        let raw = s.as_ptr();
        let mut id = 0;
        
        let res = unsafe { j2534_PassThruOpen(interface.handle, raw, &mut id as *mut libc::uint32_t) };
        if res != 0 {
            return Err(Error::from_code(res));
        }

        Ok(Device {interface, id})
    }
/// Creates a `Device` from the PassThru interface connected to the given port
/// 
/// # Arguments
/// 
/// * `port` - The port to search for a J2534 device
/// 
/// # Example
/// ```
/// use j2534::Interface;
/// let interface = Interface::new("C:\\j2534_driver.dll").unwrap();
/// let device = interface.open("COM2").unwrap();
/// ```
Creates a `Device` from the PassThru interface connected to the given port
Creates a ` Device ` from the PassThru interface connected to the given port
pub fn open(interface: Rc<Interface>, port: &str) -> Result<Device> {
        let s = ffi::CString::new(port).unwrap();
        let raw = s.as_ptr();
        let mut id = 0;
        let res = unsafe { j2534_PassThruOpen(interface.handle, raw, &mut id as *mut libc::uint32_t) };
        if res != 0 {
            return Err(Error::from_code(res));
        }
        Ok(Device {interface, id})
    }
pub fn open ( interface : Rc < Interface > , port : & str ) -> Result < Device > { let s = ffi :: CString :: new ( port ) . unwrap ( ) ; let raw = s . as_ptr ( ) ; let mut id = 0 ; let res = unsafe { j2534_PassThruOpen ( interface . handle , raw , & mut id as * mut libc :: uint32_t ) } ; if res != 0 { return Err ( Error :: from_code ( res ) ) ; } Ok ( Device { interface , id } ) }
Creates a `Device` from the PassThru interface connected to the given port
Creates a ` Device ` from the PassThru interface connected to the given port
interface
Rc<Interface>
port
&str
interface
Rc<Interface>
port
&str
example
```
use j2534::Interface;
let interface = Interface::new("C:\\j2534_driver.dll").unwrap();
let device = interface.open("COM2").unwrap();
```
` ` ` use j2534 :: Interface ; let interface = Interface :: new ( " C : \\ j2534_driver . dll " ) . unwrap () ; let device = interface . open ( " COM2 " ) . unwrap () ; ` ` `