public void PollShip(DataCenterLogic.DCASP.PollMessage msg) { DataCenterLogic.DCASP.PollShipRequest inValue = new DataCenterLogic.DCASP.PollShipRequest(); inValue.Body = new DataCenterLogic.DCASP.PollShipRequestBody(); inValue.Body.msg = msg; DataCenterLogic.DCASP.PollShipResponse retVal = ((DataCenterLogic.DCASP.LRITDCASPServiceSoap)(this)).PollShip(inValue); }
/// <summary> /// Envia el comando al ASP que sera transmitido al ASP /// </summary> /// <param name="startTime"></param> /// <param name="minutes">El periodo del reporte en minutos</param> /// <param name="ship"></param> /// <param name="poll"></param> public void CreatePollMessage(DateTime startTime, int minutes, Ship ship, PollAction poll) { //Only for satamatics if (ship.issata != 0) { var msg2 = new DataCenterLogic.DCASP.PollMessageSata(); msg2.equipmentId = ship.Mobile; if (poll == PollAction.Reprogram) { msg2.reprog = true; msg2.minutes = minutes; log.Info("CreatePollMessage: enviando PollAction.Reprogram al ASP"); } else if (poll == PollAction.Stop) { msg2.reprog = true; msg2.minutes = 0; log.Info("CreatePollMessage: enviando PollAction.Stop al ASP"); } else if (poll == PollAction.Report) { msg2.reprog = false; msg2.minutes = 0; log.Info("CreatePollMessage: enviando PollAction.Report al ASP"); } var cc2 = new DataCenterLogic.DCASP.LRITDCASPServiceSoapClient(); if (System.Configuration.ConfigurationManager.AppSettings["send2servers"] != "False") { cc2.PollShipSata(msg2); } return; } var msg = new DataCenterLogic.DCASP.PollMessage(); var spman = new ShipPositionManager(); var pos = spman.GetLastShipPosition(ship.IMONum); if (pos != null) { msg.OceanRegion = (DCASP.EOceanRegion)pos.Region; } else { msg.OceanRegion = DCASP.EOceanRegion.AORW; } msg.DNID = ship.DNID; msg.PollType = DCASP.EPollType.IndividualPoll; msg.ResponseType = DCASP.EResponseType.DataReport; msg.SubAddress = DCASP.ESubAddress.Others; msg.Address = ship.Mobile; msg.MemberNumber = ship.Member; switch (poll) { case PollAction.Report: { msg.CommandType = DCASP.ECommandType.DataReport; msg.StartFrame = 0; msg.NumberOfReports = 0; ShipManager.ChangeShipStatus(ShipStatus.Polling, ship); log.Info("Enviando Solicitud de report a ASP"); break; } case PollAction.Reprogram: { msg.CommandType = DCASP.ECommandType.ProgramDataReporting; msg.StartFrame = TimeToFrame(startTime.TimeOfDay); msg.NumberOfReports = MinutesToTimesPerDay(minutes); ShipManager.ChangeShipStatus(ShipStatus.Polling, ship); log.Info("Enviando Solicitud de report periodico a ASP"); break; } case PollAction.Stop: { msg.CommandType = DCASP.ECommandType.StopDataReserving; msg.StartFrame = 0; msg.NumberOfReports = 0; ShipManager.ChangeShipStatus(ShipStatus.Polling, ship); log.Info("Enviando Solicitud de Stop a ASP"); break; } } //UNCOMMENT! var cc = new DataCenterLogic.DCASP.LRITDCASPServiceSoapClient(); if (System.Configuration.ConfigurationManager.AppSettings["send2servers"] != "False") { cc.PollShip(msg); } }
public PollShipRequestBody(DataCenterLogic.DCASP.PollMessage msg) { this.msg = msg; }