SafeDispatch/LibrarySDR/Responses/GwStatusReportResponse.cs

47 lines
1.3 KiB
C#
Raw Normal View History

2024-02-22 16:43:59 +00:00
using LibrarySDR.Enums;
using System;
namespace LibrarySDR.Responses
{
public class GwStatusReportResponse
{
public PDUType PduType => PDUType.GW_STATUS_REPORT_RESP;
private Int64 sourceISSI;
public Int64 SourceISSI { get { return sourceISSI; } }
private Int64 destinationISSI;
public Int64 DestinationISSI { get { return destinationISSI; } }
private Int16 status;
public bool isOK { get { return status == 0; } }
private Int64 transactionId;
public Int64 TransactionId { get { return transactionId; } }
public GwStatusReportResponse(String hexResponsePayload)
{
int i = 0;
Int64.TryParse(hexResponsePayload.Substring(0, i = 4 *2), out sourceISSI);
Int64.TryParse(hexResponsePayload.Substring(i, i += 4 * 2), out destinationISSI);
Int64.TryParse(hexResponsePayload.Substring(i, i += 4 * 2), out transactionId);
Int16.TryParse(hexResponsePayload.Substring(i, i += 1 * 2), out status);
}
public override String ToString()
{
return $"Source ISSI : {sourceISSI} | Destination ISSI : {destinationISSI} | Transaction ID : {transactionId} | Status : {status}";
}
}
}