Separar dados da ComPort enviados por ServerSocket
Caros,
Estou trabalhando com ComPort e Socket no delphi XE5.
Gostaria de saber como separar os dados enviados da ComPort.
O meu código está assim:
*****************************************************************************************
procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer);
var
Buffer: string;
Contador: integer;
begin
Sleep(1000);
Contador:= ComPort1.InputCount;
ComPort1.ReadStr(Buffer, Contador);
ClientSocket1.Socket.SendText(buffer);
end;
**** e quando eu recebo no ClientSocket os dados ficam assim
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
Var
s :String;
begin
s:= Socket.ReceiveText;
Memo1.Lines.Add(s);
end;
1 (2): Open circuit, 26.75
2 (3): Open circuit, 27.44
3 (4): Open circuit, 27.37
4 (5): Open circuit, 27.62
5 (6): Open circuit, 27.06
6 (7): Open circuit, 27.25
7 (8): Open circuit, 27.62
8 (9): Open circuit, 27.12
9 (10): Open circuit, 27.62
10 (14): Open circuit, 27.00
11 (15): Open circuit, 27.44
12 (16): Open circuit, 26.62
13 (17): Open circuit, 27.69
e eu quero extrair desses dados apenas a numeração inicial e a final;
1 - 26.75
2 - 27.44
3 - 27.37
4 - 27.62
5 - 27.06
6 - 27.25
7 - 27.62
8 - 27.12
9 - 27.62
10 - 27.00
11 - 27.44
12 - 26.62
13 - 27.69
Desde já agradeço por qualquer dica.
Estou trabalhando com ComPort e Socket no delphi XE5.
Gostaria de saber como separar os dados enviados da ComPort.
O meu código está assim:
*****************************************************************************************
procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer);
var
Buffer: string;
Contador: integer;
begin
Sleep(1000);
Contador:= ComPort1.InputCount;
ComPort1.ReadStr(Buffer, Contador);
ClientSocket1.Socket.SendText(buffer);
end;
**** e quando eu recebo no ClientSocket os dados ficam assim
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
Var
s :String;
begin
s:= Socket.ReceiveText;
Memo1.Lines.Add(s);
end;
1 (2): Open circuit, 26.75
2 (3): Open circuit, 27.44
3 (4): Open circuit, 27.37
4 (5): Open circuit, 27.62
5 (6): Open circuit, 27.06
6 (7): Open circuit, 27.25
7 (8): Open circuit, 27.62
8 (9): Open circuit, 27.12
9 (10): Open circuit, 27.62
10 (14): Open circuit, 27.00
11 (15): Open circuit, 27.44
12 (16): Open circuit, 26.62
13 (17): Open circuit, 27.69
e eu quero extrair desses dados apenas a numeração inicial e a final;
1 - 26.75
2 - 27.44
3 - 27.37
4 - 27.62
5 - 27.06
6 - 27.25
7 - 27.62
8 - 27.12
9 - 27.62
10 - 27.00
11 - 27.44
12 - 26.62
13 - 27.69
Desde já agradeço por qualquer dica.
Célio Dias
Curtidas 0