using System;
using System.Text;
using System.Threading;
using Cosmos.UserFrame;
using Cosmos.Common;
//using Microsoft.PointOfService;
using System.ComponentModel;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : Msr 제어
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.OLEDevice
{
///
/// Msr 제어 CLASS
///
public class DeviceMsr : IMsrUs
{
///
/// StateServer Object (StateServer 객체)
///
public StateServer StateObject = (StateServer)StateServer.GetInstance();
///
/// Device 상태 정보 객체
///
public DeviceStatus devStatus = new DeviceStatus();
/////
///// Pos for .Net Msr 객체
/////
//private Msr msr = null;
/////
///// Pos for .Net의 Device 정보를 가져오기 위한 객체
/////
//private PosExplorer posExplorer = null;
private string m_sTrackData1 = string.Empty;
private string m_sTrackData2 = string.Empty;
private string m_sTrackData3 = string.Empty;
///
/// 이벤트 비동기 발생을 위한 대리자
///
private BackgroundWorker bw = null;
private int m_nErrorCount = 0;
///
/// 생성자
///
public DeviceMsr()
{
try
{
//posExplorer = new PosExplorer();
devStatus = (DeviceStatus)StateObject.DEVICE;
DeviceStatusInit();
bw = new BackgroundWorker();
m_nErrorCount = 0;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
"DevicePosPrinter.DeviceMsr()", ex.Message);
}
}
///
/// 장비의 Event 발생 Enable 상태 설정
/// True:사용가능, False:사용불가능
///
public bool DeviceEnabled
{
get
{
return false;
}
set
{
try
{
bool bRet = SetDeviceEnabled(value);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
"DeviceMsr.DeviceEnabled()", ex.Message);
}
}
}
///
/// 장비의 Event 발생 Enable 상태 설정
/// True:사용가능, False:사용불가능
///
private bool SetDeviceEnabled(bool bEnable)
{
bool bRet = false;
try
{
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
"DeviceMsr.SetDeviceEnabled()", ex.Message);
devStatus.Msr.Status = "DEVICE ENABLED FAIL";
}
return bRet;
}
///
/// 디바이스 Open시 처리함수
///
/// 장비종류(ex- "Msr","PosPrinter","Scanner"...)
/// 레지스트리 항목(ex- "DefaultMsr","DefaultPosPrinter","DefaultScanner"...)
///
public bool OpenDevice(string sDeviceType, string sLogicalName)
{
bool bRet = false;
try
{
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
"DeviceMsr.OpenDevice()", ex.Message);
devStatus.Msr.Open = false;
devStatus.Msr.Status = "DEVICE OPEN EXCEPTION";
return bRet;
}
return bRet;
}
///
/// Msr StateServer 정보 초기화
///
private void DeviceStatusInit()
{
devStatus.Msr.Track1Data = "";
devStatus.Msr.Track2Data = "";
devStatus.Msr.Track3Data = "";
devStatus.Msr.DeviceName = "";
devStatus.Msr.Status = "";
devStatus.Msr.Open = false;
}
///
/// 디바이스 Close시 처리함수
///
///
public bool CloseDevice()
{
bool bRet = false;
try
{
devStatus.Msr.Status = "CLOSE";
devStatus.Msr.Open = false;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
"DeviceMsr.CloseDevice()", ex.Message);
devStatus.Msr.Status = "CLOSE EXCEPTION";
}
return bRet;
}
}
}