|
|
using System; using System.Collections.Generic;
namespace Mirle.Component.API.ShuttleCarController.Models { /// <summary>
/// Shuttle message extensions
/// </summary>
public static class WrapperMessageExtensions { /// <summary>
/// Get ID 9012 shuttle car controller online response
/// </summary>
/// <param name="result">Online permit result</param>
/// <returns>Shuttle car controller online response message</returns>
public static WrapperMessage Get_ID_9012_ShuttleCOnlineResponse(bool result) { return new WrapperMessage() { ID = 12, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S12 = new S12_ShuttleCOnlineResponse() { ReplyCode = result ? 0 : 1 } }; } /// <summary>
/// Get ID 9014 Shuttle car controller offline response
/// </summary>
/// <param name="result">Offline permit result</param>
/// <returns>Shuttle car controller offline response message</returns>
public static WrapperMessage Get_ID_9014_ShuttleOfflineResponse(bool result) { return new WrapperMessage() { ID = 14, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S14 = new S14_ShuttleCOfflineResponse() { ReplyCode = result ? 0 : 1 } }; } /// <summary>
/// Get ID 9015 Datetime sync report
/// </summary>
/// <returns>Datetime sync report message</returns>
public static WrapperMessage Get_ID_9015_DateTimeSyncReport() { return new WrapperMessage() { ID = 15, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P15 = new P15_DateTimeSyncRequest() { SyncDateTime = DateTime.Now.ToString("yyyyMMddHHmmssff") } }; } /// <summary>
/// Get ID 9021 release repair door interlock request
/// </summary>
/// <param name="repairDoorID">Repair door ID</param>
/// <returns>Release repair door interlock request message</returns>
public static WrapperMessage Get_ID_9021_ReleaseRepairDoorInterlockRequest(string repairDoorID) { return new WrapperMessage() { ID = 21, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P21 = new P21_ReleaseRepairDoorInterlockRequest() { RepairDoorID = repairDoorID } }; } /// <summary>
/// Get ID 9023 cancel release repair door interlock request
/// </summary>
/// <param name="repairDoorID">Repair door ID</param>
/// <returns>Cancel release repair door interlock request message</returns>
public static WrapperMessage Get_ID_9023_CancelReleaseRepairDoorInterlockRequest(string repairDoorID) { return new WrapperMessage() { ID = 23, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P23 = new P23_CancelReleaseRepairDoorInterlockRequest() { RepairDoorID = repairDoorID } }; } /// <summary>
/// Get ID 9026 release repair door status response
/// </summary>
/// <param name="result">Process result</param>
/// <returns>Release repair door status response message</returns>
public static WrapperMessage Get_ID_9026_ReleaseRepairDoorStatusResponse(bool result) { return new WrapperMessage() { ID = 26, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S26 = new S26_RepairDoorReleaseStatusResponse() { ReplyCode = result ? 0 : 1 } }; } /// <summary>
/// Get ID 9029 repair door interlock status change report
/// </summary>
/// <param name="repairDoorID">Repair door ID</param>
/// <param name="doorStatus">Repair door stauts</param>
/// <param name="doorLockStatus">Repair door lock status</param>
/// <returns>Repair door interlock status change report message</returns>
public static WrapperMessage Get_ID_9029_RepariDoorInterlockStatusChangeReport(string repairDoorID, int doorStatus, int doorLockStatus) { return new WrapperMessage() { ID = 29, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P29 = new P29_RepairDoorInterlockStatusChangeReport() { RepairDoorID = repairDoorID, DoorStatus = doorStatus, DoorLockStatus = doorLockStatus } }; } /// <summary>
/// Get ID 9032 fire door response
/// </summary>
/// <param name="result">Process result</param>
/// <param name="doorID">Rolling door ID</param>
/// <param name="doorAction">Rolling door action</param>
/// <param name="crossingLock">Rolling crossing lock status</param>
/// <returns>Fire door response message</returns>
public static WrapperMessage Get_ID_9032_FireDoorResponse(bool result, string doorID, int doorAction, int crossingLock) { return new WrapperMessage() { ID = 32, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S32 = new S32_FireDoorResponse() { ReplyCode = result ? 0 : 1, DoorID = doorID, DoorAction = doorAction, DoorLockStateCode = crossingLock } }; } /// <summary>
/// Get ID 9036 query fire door status response
/// </summary>
/// <param name="doorListStatus">Class for door list status</param>
/// <returns>Query fire door status response message</returns>
public static WrapperMessage Get_ID_9036_QueryFireDoorStatusResponse(List<DoorStatus> doorListStatus) { WrapperMessage wrapper_message = new WrapperMessage() { ID = 36, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S36 = new S36_QueryFireDoorStatusResponse() { } }; wrapper_message.S36.DoorList.Add(doorListStatus); return wrapper_message; } /// <summary>
/// Get ID 9041 command request message
/// </summary>
/// <param name="commandID">Controller command ID</param>
/// <param name="cmdType">Controller command type</param>
/// <param name="priority">Task priority</param>
/// <param name="source">Source position</param>
/// <param name="destination">Destination position</param>
/// <param name="cassetteID">Cassette ID</param>
/// <param name="cassetteType">Cassette type</param>
/// <param name="vehicleID">Vehicle ID</param>
/// <returns>Command request message</returns>
public static WrapperMessage Get_ID_9041_CommandRequest(string commandID, int cmdType, int priority, string source, string destination, string cassetteID, int cassetteType, int vehicleID = 0) { return new WrapperMessage() { ID = 41, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P41 = new P41_CommandRequest() { CmdID = commandID, CmdType = cmdType, Priority = priority, Source = source, Destination = destination, CstID = cassetteID, CstType = cassetteType, VehicleID = vehicleID } }; } /// <summary>
/// Get ID 9043 command cancel request
/// </summary>
/// <param name="commandID">Controller command ID</param>
/// <returns>Command cancel request message</returns>
public static WrapperMessage Get_ID_9043_CommandCancelRequest(string commandID) { return new WrapperMessage() { ID = 43, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P43 = new P43_CancelCommandRequest() { CmdID = commandID } }; } /// <summary>
/// Get ID 9045 pause request
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="pauseType">Pause type</param>
/// <returns>Pause request message</returns>
public static WrapperMessage Get_ID_9045_PauseRequest(PauseEvent eventType, int pauseType) { return new WrapperMessage() { ID = 45, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P45 = new P45_PauseRequest() { EventType = eventType, PauseType = pauseType } }; }
/// <summary>
/// Get ID 9052 alarm response
/// </summary>
/// <param name="result">Process result</param>
/// <returns>Alarm response message</returns>
public static WrapperMessage Get_ID_9052_AlarmResponse(bool result) { return new WrapperMessage() { ID = 52, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S52 = new S52_AlarmResponse() { ReplyCode = result ? 0 : 1 } }; } /// <summary>
/// Get ID 9062 command status response
/// </summary>
/// <param name="result">Receive and check result</param>
/// <param name="commandID">Controller's command ID</param>
/// <param name="commandStatus">Controller's command status</param>
/// <returns>Command status response message</returns>
public static WrapperMessage Get_ID_9062_CommandStatusResponse(bool result, string commandID, int commandStatus) { return new WrapperMessage() { ID = 62, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S62 = new S62_CommandStatusResponse() { ReplyCode = result ? 0 : 1, CmdID = commandID, CmdStatus = commandStatus } }; } /// <summary>
/// Get ID 9065 query all command status request
/// </summary>
/// <returns>Query all command status request message</returns>
public static WrapperMessage Get_ID_9065_QueryAllCommandStatusRequest() { return new WrapperMessage() { ID = 65, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P65 = new P65_QueryAllCOmmandStatusRequest() {
} }; } /// <summary>
/// Get ID 9068 vehicle status response
/// </summary>
/// <param name="result">Process result</param>
/// <returns>Vehicle status response message</returns>
public static WrapperMessage Get_ID_9068_VehicleStatusResponse(bool result) { return new WrapperMessage() { ID = 68, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S68 = new S68_VehicleStatusResponse() { ReplyCode = result ? 0 : 1 } }; } /// <summary>
/// Get ID 9069 query vehicle status request
/// </summary>
/// <param name="queryType">Query type</param>
/// <param name="vehicleID">Vehicle ID</param>
/// <returns>Query vehicle status request message</returns>
public static WrapperMessage Get_ID_9069_QueryVehicleStatusRequest(int queryType, int vehicleID = 0) { return new WrapperMessage() { ID = 69, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P69 = new P69_QueryVehicleStatusRequest() { QueryType = queryType, VehicleID = vehicleID } }; } /// <summary>
/// Get ID 9083 Change layer response
/// </summary>
/// <param name="commandID">Shuttle car controller command ID</param>
/// <param name="source">Source floor</param>
/// <param name="destination">Destination floor</param>
/// <param name="lifterID">Lifter ID</param>
/// <param name="result">Process result</param>
/// <returns>Change layer response message</returns>
public static WrapperMessage Get_ID_9084_ChangeLayerResponse(string commandID, int source, int destination, int lifterID, bool result) { return new WrapperMessage() { ID = 84, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), S84 = new S84_ChangeLayerResponse() { CmdID = commandID, SourceLayer = source, DestinationLayer = destination, LifterID = lifterID, ReplyCode = result ? 0 : 1 } }; } /// <summary>
/// Get ID 9091 lifter arrival report
/// </summary>
/// <param name="lifterID">Lifter ID</param>
/// <param name="lifterLocation">Lifter current floor</param>
/// <returns>Lifter arrival report message</returns>
public static WrapperMessage Get_ID_9091_LifterArrivalReport(int lifterID, int lifterLocation) { return new WrapperMessage() { ID = 91, LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"), P91 = new P91_LifterArrivalReport() { LifterID = lifterID, LifterLocation = lifterLocation } }; } } }
|