我在从频道返回 +CDS 时遇到了麻烦。我正在使用具有 64 个通道的调制解调器,我需要获取此值。以上任何行中缺少的信息
+CDS: 6,248,"21988
+CDS: 6,249,"6299224415
+CDS: 6,39,"11974579414",129,"13/01/31,16:40:30-12","13/02/01,16:40:30-12",70
+CDS: 6,211,"2199678119",129,"13/01/31,16:40:31-12","13/02/01,16:40:31-12",70
+CDS: 6,51,"6
+CDS: 6,105,"11974579414",129,"13/01/31,16:40:32-12","13/02/01,16:40:32-12",70
+CDS: 6,40,"11973375726",129,"13/01/31,
+CDS: 6,106,"2199378635",129,"13/01/31,16:
+CDS: 6,251,"1297228284",129,"13/01/31,16:40:38-12","13/02/01,16:40:38-12",70
+CDS: 6,53,"2499482633",129,"13/
+CDS: 6,243,"2198922817",129,"13/01/31,16:40:45-12","13/02/01
+CDS: 6,253,"2198070285",129,"13/01/31,16:40:48-12","13/02/01,16:40:48-12",70
+CDS: 6,43,"2197371789",129,"13/01/31,16:40:51-12","13/02/01,16
+CDS: 6,170,"11975327641",129,"13/02/01,11:47:58-12","13/02/01,16:41:37-12",0
+CDS: 6,158,"1982067777",129,"13/02/01,17:36:31-08","13/02/01,17:36:34-08",0
+CDS: 6,46,"1992200437",129,"13/02/01,17:36:32-08","13/02/0
+CDS: 6,154,"4891019678",129,"13/01/31,17:52:44-08","13/01/31,17:52:45-08",70
+CDS: 6,254,"6296236810",129,"13/01/31,16:41:58-12","13/02/01,16:41:59-12",
我开始:
public PortaCOM(string porta)
: base(porta, 115200, Parity.None, 8, StopBits.One)
{
this.StatusPort = StatusPorta.Ready;
this.DiscardNull = true;
this.Handshake = Handshake.RequestToSend;
//this.RtsEnable = true;
//this.DtrEnable = true;
//this.ReadTimeout = 12000;
//this.ReadTimeout = 12000;
}
我使用以下方法获得价值:
static void p_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
var p = (PortaCOM)sender;
try
{
int dataLength = p.BytesToRead;
byte[] dados = new byte[dataLength];
int nbrDataRead = p.Read(dados, 0, dataLength);
if (nbrDataRead == 0)
return;
var retorno = Encoding.ASCII.GetString(dados);
Console.WriteLine(retorno);
}
catch (Exception err) { Console.WriteLine(err.Message); }
}
请,任何帮助我!
里卡多·贝克