Beispiel #1
0
        // 13. ChannelGatherParam      HandleRef data为ChannelGatherParamA429Rx类型
        public uint ChannelGatherParam(ref ChannelGatherParamA429Rx gatherParameter, ParamOptionA429 paramOpt)
        {
            IntPtr ptr = _channelGatherParamRxIntPtr;

            byte[] bytes = _channelGatherParamRxInitArray;
            //获取数据前清空,内存中的数据
            if (paramOpt == ParamOptionA429.BHT_L1_PARAM_OPT_GET)
            {
                //获取数据前清空,内存中的数据
                Marshal.Copy(bytes, 0, ptr, bytes.Length);
            }
            else
            {
                //若设置,把ref类型参数中的数据写入到内存中
                byte[] parameterBytes = UtilityConvertor.StructToBytes(gatherParameter);
                Marshal.Copy(parameterBytes, 0, ptr, bytes.Length);
            }
            //调用方法,获取数据
            uint ret = NativeMethods429.ChannelGatherParam(DeviceID, ChannelID, ptr, paramOpt);

            //转换非托管数据为托管数据
            gatherParameter = null;
            if (ret == Normal)
            {
                gatherParameter = (ChannelGatherParamA429Rx)Marshal.PtrToStructure(ptr, typeof(ChannelGatherParamA429Rx));
            }
            return(ret);
        }
Beispiel #2
0
        public override string ErrorToString(uint errID)
        {
            IntPtr strIntPtr = NativeMethods429.ErrorToString(errID);
            string errorMsg  = Marshal.PtrToStringAnsi(strIntPtr);

            return(errorMsg);
        }
Beispiel #3
0
        //16. ChannelFilterCfgRx     HandleRef fltParam为ChannelFilterParamA429Rx类型
        //public uint ChannelFilterCfgRx(out ChannelFilterParamA429Rx filterParams)
        //{
        //    IntPtr ptr = _channelFilterParamIntPtr;
        //    byte[] bytes = _channelFilterParamInitArray;
        //    //获取数据前清空,内存中的数据
        //    Marshal.Copy(bytes, 0, ptr, bytes.Length);
        //    ChannelFilterParamA429Rx filterParam = filterParams;
        //    //调用方法,获取数据
        //    uint ret = NativeMethods429.ChannelFilterCfgRx(DeviceID, ChannelID, filterParam);
        //    //转换非托管数据为托管数据
        //    filterParams = null;
        //    if (ret == Normal)
        //    {
        //        filterParams = (ChannelFilterParamA429Rx)Marshal.PtrToStructure(ptr, typeof(ChannelFilterParamA429Rx));
        //    }
        //    return ret;
        //}
        //16. ChannelFilterCfgRx     HandleRef fltParam为ChannelFilterParamA429Rx类型 2017-07-18 by mayu
        public uint ChannelFilterCfgRxm(ChannelFilterParamA429Rx filterParam)
        {
            IntPtr ptr = _channelFilterParamIntPtr;

            Marshal.StructureToPtr(filterParam, ptr, true);//將傳入的結構參數送到非託管內存中
            uint   ret = NativeMethods429.ChannelFilterCfgRx(DeviceID, ChannelID, ptr);
            string s   = getMemory(filterParam);

            return(ret);
        }
Beispiel #4
0
        //12
        public uint ChannelPeriodParamTx(int period, ParamOptionA429 opt)
        {
            IntPtr ptr = _periodIntPtr;

            byte[] bytes = BitConverter.GetBytes(period);

            //设置托管数据到非托管内存
            Marshal.Copy(bytes, 0, ptr, bytes.Length);
            //调用方法,获取数据
            uint ret = NativeMethods429.ChannelPeriodParamTx(DeviceID, ChannelID, ptr, opt);

            return(ret);
        }
Beispiel #5
0
        //8. ChanInjectParamTx.   HandleRef injectParam为ChannelInjectParamA429Tx类型
        public uint ChannelInjectParamTx(out ChannelInjectParamA429Tx injectParam, ParamOptionA429 paramOpt)
        {
            IntPtr ptr = _channelInjectParamTxIntPtr;

            byte[] bytes = _channelInjectParamTxInitArray;
            //获取数据前清空,内存中的数据
            Marshal.Copy(bytes, 0, ptr, bytes.Length);
            //调用方法,获取数据
            uint ret = NativeMethods429.ChannelInjectParamTx(DeviceID, ChannelID, ptr, paramOpt);

            //转换非托管数据为托管数据
            injectParam = null;
            if (ret == Normal)
            {
                injectParam = (ChannelInjectParamA429Tx)Marshal.PtrToStructure(ptr, typeof(ChannelInjectParamA429Tx));
            }
            return(ret);
        }
Beispiel #6
0
        /* tx channel */

        // 5. ChannelMibGetTx      HandleRef data为MibDataA429类型
        public uint ChannelMibGetTx(out MibDataA429 data)
        {
            IntPtr ptr = _mibDataA429IntPtr;

            byte[] bytes = _mibDataA429InitArray;
            //获取数据前清空,内存中的数据
            Marshal.Copy(bytes, 0, ptr, bytes.Length);
            //调用方法,获取数据
            uint ret = NativeMethods429.ChannelMibGetTx(DeviceID, ChannelID, ptr);

            //转换非托管数据为托管数据
            data = null;
            if (ret == Normal)
            {
                data = (MibDataA429)Marshal.PtrToStructure(ptr, typeof(MibDataA429));
            }
            return(ret);
        }
Beispiel #7
0
        //17. ChannelRecvRx            HandleRef rxpBuf为RxpA429类型
        public uint ChannelRecvRx(out RxpA429 rxpBuf, uint maxRxp, out int rxpNum,
                                  WaitStatusA429 opt)
        {
            IntPtr ptr = _rxpA429IntPtr;

            byte[] bytes = _rxpA429InitArray;

            //获取数据前清空,内存中的数据
            Marshal.Copy(bytes, 0, ptr, bytes.Length);
            Marshal.Copy(_rxpNumInitArray, 0, _rxpNumIntPtr, _rxpNumInitArray.Length);
            //调用方法,获取数据
            uint ret = NativeMethods429.ChannelRecvRx(DeviceID, ChannelID, ptr, maxRxp, _rxpNumIntPtr, opt);

            //转换非托管数据为托管数据
            rxpBuf = null;
            rxpNum = 0;
            if (ret == Normal)
            {
                rxpBuf = (RxpA429)Marshal.PtrToStructure(ptr, typeof(RxpA429));
                rxpNum = (int)Marshal.PtrToStructure(_rxpNumIntPtr, typeof(int));
            }
            return(ret);
        }
Beispiel #8
0
        public uint DefaultInit(uint devID)
        {
            uint ret = NativeMethods429.DefaultInit(devID);

            return(ret);
        }
Beispiel #9
0
        public override uint DeviceRemove(uint devID)
        {
            uint ret = NativeMethods429.DeviceRemove(devID);

            return(ret);
        }
Beispiel #10
0
        //11. ChanSlopeCfgTx
        public uint ChannelSlopeCfgTx(SlopeA429 slope)
        {
            uint ret = NativeMethods429.ChannelSlopeCfgTx(DeviceID, ChannelID, slope);

            return(ret);
        }
Beispiel #11
0
        //10. ChanSendTx
        public uint ChannelSendTx(uint data, SendOptA429 opt)
        {
            uint ret = NativeMethods429.ChannelSendTx(DeviceID, ChannelID, opt, data);

            return(ret);
        }
Beispiel #12
0
        //9. ChanLoopTx
        public uint ChannelLoopTx(AbleStatusA429 opt)
        {
            uint ret = NativeMethods429.ChannelLoopTx(DeviceID, ChannelID, opt);

            return(ret);
        }
Beispiel #13
0
        // 6. ChannelMibClearTx

        public uint ChannelMibClearTx()
        {
            uint ret = NativeMethods429.ChannelMibClearTx(DeviceID, ChannelID);

            return(ret);
        }
        //设备信息写入
        public uint FpgaEepromWrite(uint devID, ushort addr, byte data)
        {
            uint ret = NativeMethods429.FpgaEepromWrite(devID, addr, data);

            return(ret);
        }
        //设备信息读取
        public uint FpgaEepromRead(uint devID, ushort addr, ref IntPtr data)
        {
            uint ret = NativeMethods429.FpgaEepromRead(devID, addr, data);

            return(ret);
        }