private static void AddDeviceCallbackF(int deviceType, IntPtr deviceHandlePtr, IntPtr deviceNamePtr) { if (deviceType < (int)DeviceType.APPLICATIONS) { var deviceHandle = IntPtrHelper.IntPtrToUTF8string(deviceHandlePtr); var deviceName = IntPtrHelper.IntPtrToUTF8string(deviceNamePtr); log.Info("AddDeviceCallback: deviceType:" + deviceType + " deviceHandle:" + deviceHandle + " deviceName:" + deviceName); var device = new Device((DeviceType)deviceType, deviceHandle, deviceName); deviceManager.AddDevice(device); } else { throw new Exception(string.Format("DeviceType:{0} 设备不支持", deviceType)); } }
private 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); } }
public static string GetVersion() { var intPtrVersion = WrapperInterface.getVersion(); return(IntPtrHelper.IntPtrToUTF8string(intPtrVersion)); }