using System;
using System.Collections.Generic;
namespace Mirle.Component.API.ShuttleCarController.Models
{
///
/// Shuttle message extensions
///
public static class WrapperMessageExtensions
{
///
/// Get ID 9012 shuttle car controller online response
///
/// Online permit result
/// Shuttle car controller online response message
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
}
};
}
///
/// Get ID 9014 Shuttle car controller offline response
///
/// Offline permit result
/// Shuttle car controller offline response message
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
}
};
}
///
/// Get ID 9015 Datetime sync report
///
/// Datetime sync report message
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")
}
};
}
///
/// Get ID 9021 release repair door interlock request
///
/// Repair door ID
/// Release repair door interlock request message
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
}
};
}
///
/// Get ID 9023 cancel release repair door interlock request
///
/// Repair door ID
/// Cancel release repair door interlock request message
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
}
};
}
///
/// Get ID 9026 release repair door status response
///
/// Process result
/// Release repair door status response message
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
}
};
}
///
/// Get ID 9029 repair door interlock status change report
///
/// Repair door ID
/// Repair door stauts
/// Repair door lock status
/// Repair door interlock status change report message
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
}
};
}
///
/// Get ID 9032 fire door response
///
/// Process result
/// Rolling door ID
/// Rolling door action
/// Rolling crossing lock status
/// Fire door response message
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
}
};
}
///
/// Get ID 9036 query fire door status response
///
/// Class for door list status
/// Query fire door status response message
public static WrapperMessage Get_ID_9036_QueryFireDoorStatusResponse(List 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;
}
///
/// Get ID 9041 command request message
///
/// Controller command ID
/// Controller command type
/// Task priority
/// Source position
/// Destination position
/// Cassette ID
/// Cassette type
/// Vehicle ID
/// Command request message
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
}
};
}
///
/// Get ID 9043 command cancel request
///
/// Controller command ID
/// Command cancel request message
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
}
};
}
///
/// Get ID 9045 pause request
///
/// Event type
/// Pause type
/// Pause request message
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
}
};
}
///
/// Get ID 9052 alarm response
///
/// Process result
/// Alarm response message
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
}
};
}
///
/// Get ID 9062 command status response
///
/// Receive and check result
/// Controller's command ID
/// Controller's command status
/// Command status response message
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
}
};
}
///
/// Get ID 9065 query all command status request
///
/// Query all command status request message
public static WrapperMessage Get_ID_9065_QueryAllCommandStatusRequest()
{
return new WrapperMessage()
{
ID = 65,
LocalSystemTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
P65 = new P65_QueryAllCOmmandStatusRequest()
{
}
};
}
///
/// Get ID 9068 vehicle status response
///
/// Process result
/// Vehicle status response message
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
}
};
}
///
/// Get ID 9069 query vehicle status request
///
/// Query type
/// Vehicle ID
/// Query vehicle status request message
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
}
};
}
///
/// Get ID 9083 Change layer response
///
/// Shuttle car controller command ID
/// Source floor
/// Destination floor
/// Lifter ID
/// Process result
/// Change layer response message
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
}
};
}
///
/// Get ID 9091 lifter arrival report
///
/// Lifter ID
/// Lifter current floor
/// Lifter arrival report message
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
}
};
}
}
}