public void Fill(object result) { var ptr = XFSUtil.StructureToPtr(result, typeof(WFSCIMCASHINFO)); var data = (CimCashInfoObject)this.UnMarshal(ptr); this.TerminalCode = data.TerminalCode; this.CashIns = data.CashIns; this.Checksum = data.Checksum; this.TransactionCode = data.TransactionCode; this.usCount = data.usCount; }
public IntPtr ToPopinter() { WFSCDMDISPENSE param = new WFSCDMDISPENSE { bPresent = this.bPresent, fwPosition = this.fwPosition, lpDenomination = this.lpDenomination.ToPopinter(), usMixNumber = this.usMixNumber, usTellerID = this.usTellerID }; return(XFSUtil.StructureToPtr(param, typeof(WFSCDMDISPENSE))); }
public IntPtr ToPopinter() { WFSCDMDENOMINATION param = new WFSCDMDENOMINATION { cCurrencyID = this.cCurrencyID, lpulValues = IntPtr.Zero, ulAmount = ulAmount, ulCashBox = this.ulCashBox, usCount = this.usCount }; return(XFSUtil.StructureToPtr(param, typeof(WFSCDMDENOMINATION))); }
public IntPtr Marshal(CimCashInfoObject cashInfo) { WFSCIMCASHINFO dto = new WFSCIMCASHINFO(); dto.usCount = cashInfo.usCount; WFSCIMCASHIN[] cashunitstructs = new WFSCIMCASHIN[cashInfo.CashIns.Length]; for (int i = 0; i < cashInfo.CashIns.Length; i++) { cashunitstructs[i] = CashIn.convertToWFSCIMCASHIN(cashInfo.CashIns[i]); } dto.lppCashIn = XFSUtil.XFSArrayToPTR <WFSCIMCASHIN>(cashunitstructs); return(XFSUtil.StructureToPtr <WFSCIMCASHINFO>(dto)); }
public void ExcuteSiuCommand(int cmd, ServiceTypes serviceType) { WFSSIUSETGUIDLIGHT guidLight = new WFSSIUSETGUIDLIGHT(); var XFSDevice = XFS_DevicesCollection.Instance.GetValue(ServiceTypes.SIU); var GuidLightCtrl = GetGuidLights(serviceType); if (GuidLightCtrl != null) { guidLight.fwCommand = (LightControl)(ushort)cmd; guidLight.wGuidLight = (ushort)GetGuidLights(serviceType).Value; IntPtr ptr = XFSUtil.StructureToPtr(guidLight, typeof(WFSSIUSETGUIDLIGHT)); XFSDevice.ExecuteCommand(SIUDefinition.WFS_CMD_SIU_SET_GUIDLIGHT, ptr); Marshal.FreeHGlobal(ptr); } }
public IntPtr Marshal(CashInfoObject cashInfo) { WFS_CDM_CashUnit_INFO dto = new WFS_CDM_CashUnit_INFO(); dto.usCount = cashInfo.usCount; dto.usTellerID = cashInfo.TellerID; WFSCDMCASHUNIT[] cashunitstructs = new WFSCDMCASHUNIT[cashInfo.CashUnits.Length]; for (int i = 0; i < cashInfo.CashUnits.Length; i++) { cashunitstructs[i] = CashUnit.convertToWFSCDMCASHUNIT(cashInfo.CashUnits[i]); } dto.lppList = XFSUtil.XFSArrayToPTR <WFSCDMCASHUNIT>(cashunitstructs); return(XFSUtil.StructureToPtr <WFS_CDM_CashUnit_INFO>(dto)); }
protected override void OnMessage(MessageEventArgs e) { lock (syncObject) { try { L4Logger.Info("XfsCommandBehavior WebSocket_OnMessage => " + e.Data); JObject Parametrs = JObject.Parse(e.Data); var CommandType = (CommandType)Enum.ToObject(typeof(CommandType), int.Parse((string)Parametrs["CommandType"])); switch (CommandType) { case CommandType.Init: { //var Command = JsonConvert.DeserializeObject<XfsCommandBase<i>>(e.Data); //CurrentCommand = new XfsCommandBase<IXfsCommand> //{ // CommandType = Command.CommandType, // XfsCommand = Command.XfsCommand, // IsExecuteSuccessfully = Command.IsExecuteSuccessfully, // ServiceType = Command.ServiceType //}; //var XFSDevice = AddOrGetServiceBase(Command); //XFSDevice.OpenComplete += XFSDevice_OpenComplete; //XFSDevice.OpenError += XFSDevice_OpenError; //XFSDevice.RegisterComplete += XFSDevice_RegisterComplete; //XFSDevice.RegisterError += XFSDevice_RegisterError; break; } case CommandType.Open: { var Command = JsonConvert.DeserializeObject <XfsCommandBase <OpenCommand> >(e.Data); var XFSDevice = XFS_DevicesCollection.Instance.GetValue(Command.ServiceType); XFSDevice.ResetEvents(); XFSDevice.CurrentCommand = new XfsCommandBase <XfsCommand> { CommandType = CommandType.Open, XfsCommand = Command.XfsCommand, IsExecuteSuccessfully = Command.IsExecuteSuccessfully, ServiceType = Command.ServiceType }; XFSDevice.OpenComplete -= XFSDevice_OpenComplete; XFSDevice.OpenError -= XFSDevice_OpenError; XFSDevice.RegisterComplete -= XFSDevice_RegisterComplete; XFSDevice.RegisterError -= XFSDevice_RegisterError; XFSDevice.CancelComplete -= XFSDevice_CancelComplete; XFSDevice.CancelError -= XFSDevice_CancelError; XFSDevice.ExecuteComplete -= XFSDevice_ExecuteComplete; XFSDevice.ExecuteCompleteError -= XFSDevice_ExecuteCompleteError; XFSDevice.ExecuteEvent -= XFSDevice_ExecuteEvent; XFSDevice.OpenComplete += XFSDevice_OpenComplete; XFSDevice.OpenError += XFSDevice_OpenError; XFSDevice.RegisterComplete += XFSDevice_RegisterComplete; XFSDevice.RegisterError += XFSDevice_RegisterError; XFSDevice.CancelComplete += XFSDevice_CancelComplete; XFSDevice.CancelError += XFSDevice_CancelError; XFSDevice.ExecuteComplete += XFSDevice_ExecuteComplete; XFSDevice.ExecuteCompleteError += XFSDevice_ExecuteCompleteError; XFSDevice.ExecuteEvent += XFSDevice_ExecuteEvent; if (Command.XfsCommand.AcceptEvents != null) { XFSDevice.eventHandlers.Clear(); XFSDevice.eventHandlers.AddRange(Command.XfsCommand.AcceptEvents); } XFSDevice.Open(Command.XfsCommand.ServiceName); break; } case CommandType.Cancel: { XfsCommandBase <CancellCommand> Command = JsonConvert.DeserializeObject <XfsCommandBase <CancellCommand> >(e.Data); var XFSDevice = XFS_DevicesCollection.Instance.GetValue(Command.ServiceType); XFSDevice.CurrentCommand = new XfsCommandBase <XfsCommand> { CommandType = CommandType.Cancel, XfsCommand = Command.XfsCommand, IsExecuteSuccessfully = Command.IsExecuteSuccessfully, ServiceType = Command.ServiceType }; XFSDevice.Cancel(); break; } case CommandType.Getinfo: { try { XfsCommandBase <GetInfoCommand> Command = JsonConvert.DeserializeObject <XfsCommandBase <GetInfoCommand> >(e.Data); var XFSDevice = XFS_DevicesCollection.Instance.GetValue(Command.ServiceType); L4Logger.Info("Start get info for " + Command.ServiceType); XFSDevice.CurrentCommand = new XfsCommandBase <XfsCommand> { CommandType = CommandType.Getinfo, XfsCommand = Command.XfsCommand, IsExecuteSuccessfully = Command.IsExecuteSuccessfully, ServiceType = Command.ServiceType }; L4Logger.Info("call GetStatus"); var obj = (ISTATUS)Activator.CreateInstance(Command.XfsCommand.StatusType); XFSDevice.GetStatus(out obj, Command.XfsCommand.CommandCode, Command.XfsCommand.StatusType); L4Logger.Info(" Fill info data"); Command.XfsCommand.Status = obj; if (Command.XfsCommand.StatusTypeModel != null) { var model = (IXfsResultModel)Activator.CreateInstance(Command.XfsCommand.StatusTypeModel); model.Fill(obj); Command.XfsCommand.StatusModel = model; } L4Logger.Info("Call to send"); Command.IsExecuteSuccessfully = true; SendResponse(Command); } catch (Exception ex) { L4Logger.Error(ex); } break; } case CommandType.Execute: { XfsCommandBase <ExecuteCommand> Command = JsonConvert.DeserializeObject <XfsCommandBase <ExecuteCommand> >(e.Data); var XFSDevice = XFS_DevicesCollection.Instance.GetValue(Command.ServiceType); XFSDevice.CurrentCommand = new XfsCommandBase <XfsCommand> { CommandType = CommandType.Execute, XfsCommand = Command.XfsCommand, IsExecuteSuccessfully = Command.IsExecuteSuccessfully, ServiceType = Command.ServiceType }; if (Command.XfsCommand.CancelLastCommand) { XFSDevice.Cancel(false); } //unsafe { List <int> AcceptEvents = new List <int>(); if (Command.XfsCommand.AcceptEvents != null) { AcceptEvents.AddRange(Command.XfsCommand.AcceptEvents); } if (Command.XfsCommand.Events != null) { XFSDevice.eventHandlers.Clear(); XFSDevice.GlobalEvents.Clear(); XFSDevice.eventHandlers.AddRange(AcceptEvents); Command.XfsCommand.Events.ForEach(Event => { XFSDevice.eventHandlers.Add(Event.EventId); if (Event.IsGlobalEvent) { XFSDevice.GlobalEvents.Add(new Wrapper.Common.XFSDeviceBase.GlobalEvent { EventId = Event.EventId, EventParam = Event.EventParam, EventParamType = Event.EventParamType }); } }); } else { XFSDevice.eventHandlers.Clear(); XFSDevice.GlobalEvents.Clear(); XFSDevice.eventHandlers.AddRange(AcceptEvents); } XFSDevice.commandHandlers.Add(Command.XfsCommand.CommandCode); IntPtr cmdPtr = IntPtr.Zero; if (Command.XfsCommand.ParamModel != null) { //var objModel = Activator.CreateInstance(Command.XfsCommand.ParamModelType); var param = XFSUtil.Cast(Command.XfsCommand.ParamModel, Command.XfsCommand.ParamModelType); cmdPtr = (param as IXfsModel).ToPopinter(); } else { cmdPtr = XFSUtil.StructureToPtr(Command.XfsCommand.Param, Command.XfsCommand.PramType); } int hResult = XFSDevice.ExecuteCommand( Command.XfsCommand.CommandCode, cmdPtr, XFSDevice_ExecuteError); Marshal.FreeHGlobal(cmdPtr); if (hResult == XFS4NET.Model.Common.XFSDefinition.WFS_SUCCESS) { if (Command.XfsCommand.LightControlCommand != null) { ExcuteSiuCommand(Command.XfsCommand.LightControlCommand.ExecuteSIU, Command.ServiceType); } else { } } } break; } } } catch (Exception ex) { L4Logger.Error(ex); } } }