DTL_READ_W (dtl)
Last changed: -71.87.24.210

.
Summary
TODO - a short description

C# Signature:

[DllImport("dtl.dll", SetLastError=true)]
static extern public int DTL_READ_W(int name_id, byte[] data, ref uint iostat, int timeout);

VB Signature:

Declare Function DTL_READ_W Lib "dtl.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    public static int DtlReadW(int nameId, byte[] readData, ref uint ioStat, int timeOut)
    {
        new UIPermission(UIPermissionWindow.AllWindows).Demand();
        return (UnsafeNativeMethods.DTL_READ_W(nameId, readData, ref ioStat, timeOut));
    }

    bool DtlStatusOk(string dtlFunction, int dtlSts, ref string errorText, string address = null, int ioStat = 0, bool logIt = false)
    {
        var msg = new StringBuilder(256);

        if (dtlSts != DtlSuccess)
        {
        if (ioStat == 0)
        {
            ioStat = dtlSts;
        }

        Dtl.DtlErrorS(ioStat, msg, msg.MaxCapacity);

        if (address != null)
        {
            errorText = dtlFunction + ": " + address + ' ' + msg;
        }

        else
        {
            errorText = dtlFunction + ": " + msg;
        }

        if (logIt)
        {
            _logger.Warn(LoggerEvent.RockwellPlcError, msg.ToString());
        }

        return (false);
        }

        return (true);
    }

    public override bool ReadFromPlc()
    {
        uint ioStat = 0;
        bool done = false;
        int dtlSts = DtlSuccess;
        string msg = " ";

        Array.Clear(_rawData, 0, _rawData.Length);

        if (_defined)
        {
        for (int i = 0; i < RetryMax && !done; i++)
        {
            dtlSts = Dtl.DtlReadW(_nameId, _rawData, ref ioStat, TimeoutInMs);

            if (DtlStatusOk("DtlReadW", dtlSts, ref msg, "", 0, true))
            {
            done = true;
            }
        }
        }

        else
        {
        msg = string.Format("{0}", "Dtl data file has not been defined");
        _logger.Error(LoggerEvent.RockwellPlcError, msg);
        throw new PlcException();
        }

        if (DtlStatusOk("DtlReadW", dtlSts, ref msg, "", 0, true))
        {
        DataCurrent = true;
        return true;
        }

        return false;
    }

Documentation
DTL_READ_W on MSDN