1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use dpcdecl::*;
use std::os::raw::{c_char, c_int, c_void};

pub const tmsWaitInfinite: u32 = 0xFFFFFFFF;

extern "C" {
    pub fn DmgrGetVersion(szVersion: *mut c_char) -> BOOL;
    //DmgrGetLastError returns the last error per process which is updated when a DVC API function fails.
    pub fn DmgrGetLastError() -> ERC;
    pub fn DmgrSzFromErc(erc: c_int, szErc: *mut c_char, szErcMessage: *mut c_char) -> BOOL;

    //OPEN & CLOSE functions
    pub fn DmgrOpen(phif: *mut HIF, szSel: *mut c_char) -> BOOL;
    pub fn DmgrOpenEx(phif: *mut HIF, szSel: *mut c_char, dtpTable: DTP, dtpDisc: DTP) -> BOOL;
    pub fn DmgrClose(hif: HIF) -> BOOL;

    //ENUMERATION functions
    pub fn DmgrEnumDevices(pcdvc: *mut c_int) -> BOOL;
    pub fn DmgrEnumDevicesEx(
        pcdvc: *mut c_int,
        dtpTable: DTP,
        dtpDisc: DTP,
        dinfosel: DINFO,
        pInfoSel: *mut c_void,
    ) -> BOOL;
    pub fn DmgrStartEnum(
        dtpTable: DTP,
        dtpDisc: DTP,
        dinfoSel: DINFO,
        pInfoSel: *mut c_void,
    ) -> BOOL;
    pub fn DmgrIsEnumFinished() -> BOOL;
    pub fn DmgrStopEnum() -> BOOL;
    pub fn DmgrGetEnumCount(pcdvc: *mut c_int) -> BOOL;
    pub fn DmgrGetDvc(idvc: c_int, pdvc: *mut DVC) -> BOOL;
    pub fn DmgrFreeDvcEnum() -> BOOL;

    //TRANSFER status and control functions
    pub fn DmgrGetTransResult(
        hif: HIF,
        pdwDataOut: *mut u32,
        pdwDataIn: *mut u32,
        tmsWait: u32,
    ) -> BOOL;
    pub fn DmgrCancelTrans(hif: HIF) -> BOOL;
    pub fn DmgrSetTransTimeout(hif: HIF, tmsTimeout: u32) -> BOOL;
    pub fn DmgrGetTransTimeout(hif: HIF, ptmsTimeout: *mut u32) -> BOOL;

    pub fn DmgrDvcTblAdd(pdvc: *mut DVC) -> BOOL;
    pub fn DmgrDvcTblRem(szAlias: *mut c_char) -> BOOL;
    pub fn DmgrDvcTblSave() -> BOOL;

    //Device transport type management functions
    pub fn DmgrGetDtpCount() -> c_int;
    pub fn DmgrGetDtpFromIndex(idtp: c_int, pdtp: *mut DTP) -> BOOL;
    pub fn DmgrGetDtpString(dtp: DTP, szDtpString: *mut c_char) -> BOOL;

    //Miscellaneous functions
    pub fn DmgrSetInfo(pdvc: *mut DVC, dinfo: DINFO, pvInfoSet: *mut c_void) -> BOOL;
    pub fn DmgrGetInfo(pdvc: *mut DVC, dinfo: DINFO, pvInfoGet: *mut c_void) -> BOOL;

    pub fn DmgrGetDvcFromHif(hif: HIF, pdvc: *mut DVC) -> BOOL;
}