SafeNet/SN_Server/ServerMSGS/SM_SMS.cs

60 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace SN_Server.ServerMSGS
{
public class SM_SMS
{
public static InterthreadMessageQueue<SMS> recvSMSQueue = new InterthreadMessageQueue<SMS>();
public static InterthreadMessageQueue<SMS> sendSMSQueue = new InterthreadMessageQueue<SMS>();
public static InterthreadMessageQueue<SMS> confSMSQueue = new InterthreadMessageQueue<SMS>();
public static ArrayList waitConfSMSList = new ArrayList();
private ServerMSG _sm;
public SMS sms;
public SM_SMS(ServerMSG sm)
{
_sm = sm;
sms = new SMS();
DecodePayload(sm.Payload);
}
private void DecodePayload(string paylaod)
{
string[] temp = paylaod.Split('/');
sms.DBid = Convert.ToInt32(temp[0]);
sms.SUDBid = Convert.ToInt32(temp[1]);
sms.RadioID = temp[2];
sms.Msg = temp[3];
}
public static byte[] GenRequestMsg()
{
string msg = ServerMSG.GenMsg(0x0012, ServerConnector.serialNr, "");
return System.Text.Encoding.ASCII.GetBytes(msg);
}
public static byte[] GenSMSInsertMsg(SMS sms)
{
string msg = ServerMSG.GenMsg(0xB012, ServerConnector.serialNr, sms.SUDBid + "/" + sms.Msg);
return System.Text.Encoding.ASCII.GetBytes(msg);
}
public static byte[] GenSMSAckMsg(SMS sms)
{
string msg = ServerMSG.GenMsg(0xBA12, ServerConnector.serialNr, sms.DBid + "/read");
return System.Text.Encoding.ASCII.GetBytes(msg);
}
}
}