/// <summary> /// 关闭USB端口 /// </summary> public static int Close(string Type) { int iret = -99; if (Type == "STT420") { iret = Ms.SetClose(); } else if (Type == "STT420II") { iret = Ms2.SetClose(); } return(iret); }
/// <summary> /// 获取设备状态 /// </summary> /// <returns></returns> public static int GetState(string Type) { try { if (Type == "STT420") { return(Ms.GetStatusPMDYJ()); } else if (Type == "STT420II") { return(Ms2.GetStatusPMDYJ()); } return(-1); } catch { } return(-1); }
/// <summary> /// 初始化Usb端口 /// </summary> /// <returns></returns> public static int Open(string Type) { try { int ret = -1; if (Type == "STT420") { ret = Ms.SetUsbportauto(); } else if (Type == "STT420II") { ret = Ms2.SetUsbportauto(); } if (ret == 0) { if (Type == "STT420") { ret = Ms.SetInit(); } else if (Type == "STT420II") { ret = Ms2.SetInit(); } if (ret == 0) { return(0); } else { return(-1); } } else { return(-2); } } catch { return(-1); } }
/// <summary> /// 打印文件 /// </summary> /// <param name="bmp8bitfile">8位Bmp文件路径</param> /// <returns></returns> public static int PrintBmp8(string Type, string bmp8bitfile) { int ret = -1; try { byte[] H = Encoding.ASCII.GetBytes(bmp8bitfile); if (Type == "STT420") { ret = Ms.PrintDiskbmpfile(ref H[0]); } else if (Type == "STT420II") { ret = Ms2.PrintDiskbmpfile(ref H[0]); } return(ret); } catch { return(-999); } }