Exemple #1
0
        public static void AddDeviceCallbackF(int deviceType, IntPtr deviceHandlePtr, IntPtr deviceNamePtr)
        {
            var deviceHandle = IntPtrHelper.IntPtrToUTF8string(deviceHandlePtr);
            var deviceName   = IntPtrHelper.IntPtrToUTF8string(deviceNamePtr);

            log.Info("AddDeviceCallback: deviceType:" + deviceType + "  deviceHandle:" + deviceHandle + "  deviceName:" + deviceName);
            Device device           = null;
            string resultDeviceName = deviceName + "(" + deviceManager.GetDeviceCount() + ")";

            device = new Device((DeviceTypeEnum)deviceType, deviceHandle, resultDeviceName, IntPtr.Zero);
            if (null != device)
            {
                deviceManager.AddDevice(device);/*add device to device manger's hash table*/
            }
            else
            {
                log.Error("add a null device");
            }
        }
Exemple #2
0
        public static void AddLogCallbackF(ulong timestamp, bool expired, int funclevel, ulong pid, ulong tid, IntPtr lev, IntPtr comp, IntPtr msg, int len)
        {
            var output    = string.Empty;
            var level     = IntPtrHelper.IntPtrToUTF8string(lev);
            var component = IntPtrHelper.IntPtrTostring(comp);
            var message   = IntPtrHelper.IntPtrTostring(msg);

            if (string.IsNullOrEmpty(component))
            {
                component = "wrapper";
            }

            output += string.Format("[PID:{0}][TID:{1}] ", pid, tid);;

            for (int i = 0; i < funclevel; i++)
            {
                output += "--";
            }
            output += level.ToString();

            if (level == "DEBUG")
            {
                log.Debug(output);
            }
            else if (level == "INFO")
            {
                log.Info(output);
            }
            else if (level == "WARN")
            {
                log.Warn(output);
            }
            else if (level == "ERROR")
            {
                log.Error(output);
            }
            else
            {
                log.Fatal(output);
            }
        }
Exemple #3
0
        public static string GetVersion()
        {
            var intPtrVersion = WrapperInterface.getVersion();

            return(IntPtrHelper.IntPtrToUTF8string(intPtrVersion));
        }