コード例 #1
0
        /// <summary>
        /// Load the dll and do the bindings
        /// </summary>
        /// <param name="dllLocation">location of dll</param>
        public void bindDll(string dllLocation)
        {
            IntPtr ptrDll = LoadLibrary(dllLocation);

            if (ptrDll == IntPtr.Zero)
            {
                throw new Exception(String.Format("Cannot find {0}", dllLocation));
            }

            maxDatagramSizeRaw                 = (_maxDatagramSizeRaw)bindItem(ptrDll, "maxDatagramSizeRaw", typeof(_maxDatagramSizeRaw));
            maxDebugStringSize                 = (_maxDebugStringSize)bindItem(ptrDll, "maxDebugStringSize", typeof(_maxDebugStringSize));
            revisionLevel                      = (_revisionLevel)bindItem(ptrDll, "revisionLevel", typeof(_revisionLevel));
            encodeRebootReqDlMsg               = (_encodeRebootReqDlMsg)bindItem(ptrDll, "encodeRebootReqDlMsg", typeof(_encodeRebootReqDlMsg));
            encodeIntervalsGetReqDlMsg         = (_encodeIntervalsGetReqDlMsg)bindItem(ptrDll, "encodeIntervalsGetReqDlMsg", typeof(_encodeIntervalsGetReqDlMsg));
            encodeReportingIntervalSetReqDlMsg = (_encodeReportingIntervalSetReqDlMsg)bindItem(ptrDll, "encodeReportingIntervalSetReqDlMsg", typeof(_encodeReportingIntervalSetReqDlMsg));
            encodeHeartbeatSetReqDlMsg         = (_encodeHeartbeatSetReqDlMsg)bindItem(ptrDll, "encodeHeartbeatSetReqDlMsg", typeof(_encodeHeartbeatSetReqDlMsg));
            encodeSensorsReportGetReqDlMsg     = (_encodeSensorsReportGetReqDlMsg)bindItem(ptrDll, "encodeSensorsReportGetReqDlMsg", typeof(_encodeSensorsReportGetReqDlMsg));
            encodeTrafficReportGetReqDlMsg     = (_encodeTrafficReportGetReqDlMsg)bindItem(ptrDll, "encodeTrafficReportGetReqDlMsg", typeof(_encodeTrafficReportGetReqDlMsg));
            decodeUlMsgType                    = (_decodeUlMsgType)bindItem(ptrDll, "decodeUlMsgType", typeof(_decodeUlMsgType));
            decodeUlMsgInitInd                 = (_decodeUlMsgInitInd)bindItem(ptrDll, "decodeUlMsgInitInd", typeof(_decodeUlMsgInitInd));
            decodeUlMsgIntervalsGetCnf         = (_decodeUlMsgIntervalsGetCnf)bindItem(ptrDll, "decodeUlMsgIntervalsGetCnf", typeof(_decodeUlMsgIntervalsGetCnf));
            decodeUlMsgReportingIntervalSetCnf = (_decodeUlMsgReportingIntervalSetCnf)bindItem(ptrDll, "decodeUlMsgReportingIntervalSetCnf", typeof(_decodeUlMsgReportingIntervalSetCnf));
            decodeUlMsgHeartbeatSetCnf         = (_decodeUlMsgHeartbeatSetCnf)bindItem(ptrDll, "decodeUlMsgHeartbeatSetCnf", typeof(_decodeUlMsgHeartbeatSetCnf));
            decodeUlMsgPollInd                 = (_decodeUlMsgPollInd)bindItem(ptrDll, "decodeUlMsgPollInd", typeof(_decodeUlMsgPollInd));
            decodeUlMsgSensorsReportxxx        = (_decodeUlMsgSensorsReportxxx)bindItem(ptrDll, "decodeUlMsgSensorsReportxxx", typeof(_decodeUlMsgSensorsReportxxx));
            decodeUlMsgTrafficReportGetCnf     = (_decodeUlMsgTrafficReportGetCnf)bindItem(ptrDll, "decodeUlMsgTrafficReportGetCnf", typeof(_decodeUlMsgTrafficReportGetCnf));
            decodeUlMsgTrafficReportInd        = (_decodeUlMsgTrafficReportInd)bindItem(ptrDll, "decodeUlMsgTrafficReportInd", typeof(_decodeUlMsgTrafficReportInd));
            decodeUlMsgDebugInd                = (_decodeUlMsgDebugInd)bindItem(ptrDll, "decodeUlMsgDebugInd", typeof(_decodeUlMsgDebugInd));
            initDll = (_initDll)bindItem(ptrDll, "initDll", typeof(_initDll));
            initDll(guiPrintToConsole);
        }
コード例 #2
0
        /// <summary>
        /// Load the dll and do the bindings
        /// </summary>
        /// <param name="dllLocation">location of dll</param>
        public void bindDll(string dllLocation)
        {
            IntPtr ptrDll = LoadLibrary (dllLocation);

            if (ptrDll == IntPtr.Zero) throw new Exception (String.Format ("Cannot find {0}", dllLocation));

            maxDatagramSizeRaw = (_maxDatagramSizeRaw)bindItem(ptrDll, "maxDatagramSizeRaw", typeof(_maxDatagramSizeRaw));
            maxDebugStringSize = (_maxDebugStringSize)bindItem(ptrDll, "maxDebugStringSize", typeof(_maxDebugStringSize));
            revisionLevel = (_revisionLevel)bindItem(ptrDll, "revisionLevel", typeof(_revisionLevel));
            encodeRebootReqDlMsg = (_encodeRebootReqDlMsg)bindItem(ptrDll, "encodeRebootReqDlMsg", typeof(_encodeRebootReqDlMsg));
            encodeIntervalsGetReqDlMsg = (_encodeIntervalsGetReqDlMsg)bindItem(ptrDll, "encodeIntervalsGetReqDlMsg", typeof(_encodeIntervalsGetReqDlMsg));
            encodeReportingIntervalSetReqDlMsg = (_encodeReportingIntervalSetReqDlMsg)bindItem(ptrDll, "encodeReportingIntervalSetReqDlMsg", typeof(_encodeReportingIntervalSetReqDlMsg));
            encodeHeartbeatSetReqDlMsg = (_encodeHeartbeatSetReqDlMsg)bindItem(ptrDll, "encodeHeartbeatSetReqDlMsg", typeof(_encodeHeartbeatSetReqDlMsg));
            encodeSensorsReportGetReqDlMsg = (_encodeSensorsReportGetReqDlMsg)bindItem(ptrDll, "encodeSensorsReportGetReqDlMsg", typeof(_encodeSensorsReportGetReqDlMsg));
            encodeTrafficReportGetReqDlMsg = (_encodeTrafficReportGetReqDlMsg)bindItem(ptrDll, "encodeTrafficReportGetReqDlMsg", typeof(_encodeTrafficReportGetReqDlMsg));
            decodeUlMsgType = (_decodeUlMsgType)bindItem(ptrDll, "decodeUlMsgType", typeof(_decodeUlMsgType));
            decodeUlMsgInitInd = (_decodeUlMsgInitInd)bindItem(ptrDll, "decodeUlMsgInitInd", typeof(_decodeUlMsgInitInd));
            decodeUlMsgIntervalsGetCnf = (_decodeUlMsgIntervalsGetCnf)bindItem(ptrDll, "decodeUlMsgIntervalsGetCnf", typeof(_decodeUlMsgIntervalsGetCnf));
            decodeUlMsgReportingIntervalSetCnf = (_decodeUlMsgReportingIntervalSetCnf)bindItem(ptrDll, "decodeUlMsgReportingIntervalSetCnf", typeof(_decodeUlMsgReportingIntervalSetCnf));
            decodeUlMsgHeartbeatSetCnf = (_decodeUlMsgHeartbeatSetCnf)bindItem(ptrDll, "decodeUlMsgHeartbeatSetCnf", typeof(_decodeUlMsgHeartbeatSetCnf));
            decodeUlMsgPollInd = (_decodeUlMsgPollInd)bindItem(ptrDll, "decodeUlMsgPollInd", typeof(_decodeUlMsgPollInd));
            decodeUlMsgSensorsReportxxx = (_decodeUlMsgSensorsReportxxx)bindItem(ptrDll, "decodeUlMsgSensorsReportxxx", typeof(_decodeUlMsgSensorsReportxxx));
            decodeUlMsgTrafficReportGetCnf = (_decodeUlMsgTrafficReportGetCnf)bindItem(ptrDll, "decodeUlMsgTrafficReportGetCnf", typeof(_decodeUlMsgTrafficReportGetCnf));
            decodeUlMsgTrafficReportInd = (_decodeUlMsgTrafficReportInd)bindItem(ptrDll, "decodeUlMsgTrafficReportInd", typeof(_decodeUlMsgTrafficReportInd));
            decodeUlMsgDebugInd = (_decodeUlMsgDebugInd)bindItem(ptrDll, "decodeUlMsgDebugInd", typeof(_decodeUlMsgDebugInd));
            initDll = (_initDll)bindItem(ptrDll, "initDll", typeof(_initDll));
            initDll (guiPrintToConsole);
        }