80 lines
2.0 KiB
C#
80 lines
2.0 KiB
C#
using System;
|
|
using TBF.Rig.Network.Camera.CJMS11.POJO;
|
|
|
|
namespace TBF.Rig.Network.Camera.CJMS11
|
|
{
|
|
public class JmsMessage
|
|
{
|
|
private POJO.MessageStatus status;
|
|
private CommandM command;
|
|
private string payload;
|
|
|
|
private string orig_status;
|
|
private string orig_command;
|
|
private string orig_payload;
|
|
private DateTime timeStamp;
|
|
|
|
public POJO.MessageStatus Status
|
|
{
|
|
get => status;
|
|
set => status = value;
|
|
}
|
|
|
|
public CommandM Command
|
|
{
|
|
get => command;
|
|
set => command = value;
|
|
}
|
|
|
|
public string Payload
|
|
{
|
|
get => payload;
|
|
set => payload = value;
|
|
}
|
|
|
|
public string OrigStatus => orig_status;
|
|
|
|
public string OrigCommand => orig_command;
|
|
|
|
public string OrigPayload => orig_payload;
|
|
|
|
public DateTime TimeStamp
|
|
{
|
|
get => timeStamp;
|
|
set => timeStamp = value;
|
|
}
|
|
|
|
public JmsMessage(string status, string command, string payload)
|
|
{
|
|
this.status = MessageStatusEnum.GetCommandM(status);
|
|
this.command = CommandMEnum.GetCommandM(command);
|
|
|
|
orig_status = status;
|
|
orig_command = command;
|
|
orig_payload = payload;
|
|
this.payload = payload;
|
|
}
|
|
|
|
public bool isMessageImageType(){
|
|
return this.command == CommandM.grab_image_;
|
|
}
|
|
|
|
public ParsedImage getImage(){
|
|
if(isMessageImageType()){
|
|
return JmsPacket.ImageParser(this.payload);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format( "status:{0}, command:{1}, payload:{2}, orig_status:{3}, orig_command:{4}, orig_payload:{5}",
|
|
status,
|
|
command,
|
|
payload,
|
|
orig_status,
|
|
orig_command,
|
|
orig_payload);
|
|
}
|
|
}
|
|
} |