Audiovox P965 Arkusz Danych Strona 251

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 280
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 250
API Delphi Client
248
if RouterOS.Connect('192.168.0.1', 'admin', 'password') then
begin
//we are connected successfully
end
else
begin
//an error occured; text error message is in LastError property
end;
Executing queries
All queries are done by calling Query function of TRosApiClient. It returns an instance of TRosApiResult, from
which all data are fetched.
var
Res: TRosApiResult;
Res := RouterOS.Query(['/system/resource/print'], True);
Obtaining the result with GetAll
Res := ROS.Query(['/ip/arp/print', '?interface=ether2'], True);
while not Res.Eof do
begin
SomeProcessingFunction(Res['.id'], Res['address']);
Res.Next;
end;
Res.Free;
Obtaining the result with GetOne
First, place a Timer on form and name it tmrListen, set Enabled to False. Then we make a query and enable timer:
ResListen := ROS.Query(['/log/listen'], False);
tmrListen.Enabled := True;
Then we check for new data on timer event:
procedure TForm1.tmrListenTimer(Sender: TObject);
begin
repeat
if not ResListen.GetOne(False) then Break;
if ResListen.Trap then
begin
ShowMessage('Trap: ' + ROS.LastError);
Break;
end;
if ResListen.Done then
Przeglądanie stron 250
1 2 ... 246 247 248 249 250 251 252 253 254 255 256 ... 279 280

Komentarze do niniejszej Instrukcji

Brak uwag