home *** CD-ROM | disk | FTP | other *** search
- (*
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓·── ──·▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓│ │░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ ECO-Mail was Conceived, Designed and Written ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ by Floor A.C. Naaijkens for ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ UltiHouse Software / The ECO Group. ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ (C) MCMXCII BY EUROCON PANATIONAL CORPORATION. ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ All Rights Reserved for The ECO Group. ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓│ │░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓·── ──·░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- *)
-
-
-
- function crc16(s: ar1024): word; { by kevin cooney }
- var
- crc : longint;
- t, r : byte;
- l : word;
-
- begin
- crc := 0; l := __len1024(s);
- for t := 1 to l do begin
- crc := (crc xor (ord(s[t]) shl 8));
- for r := 1 to 8 do if (crc and $8000)>0 then
- crc := ((crc shl 1) xor $1021) else crc := (crc shl 1);
- end;
- crc16 := (crc and $ffff);
- end;
-
-
-
-
- procedure send1024(put: ar1024);
- var i : word;
- begin
- i := 1;
- if fossil then while (put[i] <> #0) and (i < 1024) do begin
- fos_write_(comport, put[i]); inc(i)
- end else while (put[i] <> #0) and (i < 1024) do begin
- async_send(put[i]); inc(i)
- end
- end;
-
-
-
- procedure comwait;
- begin
- if fossil then repeat until fos_avail_(comport) else
- repeat until async_buffer_check;
- end;
-
-
-
- function comreceive(var c: char): boolean;
- begin
- if fossil then begin
- if fos_avail_(comport) then begin
- comreceive := true; c := fos_receive_(comport);
- end else comreceive := false;
- end else comreceive := async_receive(c);
- end;
-
-
-
- procedure putemsi;
- var
- i : byte;
- ch : char;
- res : string;
- pp : word;
- pack : ar1024;
-
- begin
- writeln('° Writing EMSI-enquiry...');
- if debugmode then __logapp('Writing EMSI-enquiry...');
- __clr1024(pack); __app1024(pack, emsi_inq + #13); send1024(pack);
-
- __clr1024(pack);
- __app1024(pack, 'EMSI_DAT');
- __app1024(pack, length_emsi_dat);
- __app1024(pack, emsi_dat);
- crc := hex(crc16(pack));
-
- __clr1024(pack);
- __app1024(pack, '**EMSI_DAT');
- __app1024(pack, length_emsi_dat);
- __app1024(pack, emsi_dat);
- __app1024(pack, crc + #13);
- send1024(pack);
-
- comwait;
- repeat
- inc(tries); res := '';
- while (
- comreceive(ch) and not(pos(emsi_req, __up(res)) > 0)
- ) do begin
- res := res + ch; delay(12);
- if debugmode then write(ch);
- capturewrite(ch);
- ch := #00;
- end;
- until (pos(emsi_req, __up(res)) > 0) or (tries = maxemsitries);
-
- if res <> '' then __logapp('Response to inquiry: ' + res);
- if (pos(emsi_req, __up(res)) > 0) then begin
- res := '';
- if debugmode then begin
- writeln('° Yonder site has acknowledged receipt of EMSI_INQ');
- __logapp('Yonder site has acknowledged receipt of EMSI_INQ');
- end;
- end else begin
- writeln('! Host system failed to acknowledge the inquiry sequence.');
- __logapp('Host system failed to acknowledge the inquiry sequence.');
- if fossil then fos_hangup_(comport) else hangup232; __eos;
- { send_modem_command(modem_hang_up); absorb232response(false, tmp); }
- end;
-
- writeln('° Sending EMSI data...');
- if debugmode then __logapp('Sending EMSI data...');
- tries := 0;
-
- __clr1024(pack); __app1024(pack, emsi_inq + #13); send1024(pack);
-
- __clr1024(pack); __app1024(pack, 'EMSI_DAT'); __app1024(pack, length_emsi_dat);
- __app1024(pack, emsi_dat); crc := hex(crc16(pack));
- __clr1024(pack); __app1024(pack, '**EMSI_DAT');
- __app1024(pack, length_emsi_dat); __app1024(pack, emsi_dat);
- __app1024(pack, crc + #13); send1024(pack);
-
- comwait;
- repeat
- inc(tries); res := ''; ch := #00;
- while comreceive(ch) and (ch <> '*') do begin
- if debugmode then write(ch); capturewrite(ch);
- end;
- ch := '*'; res := '*';
- comwait;
- while (
- comreceive(ch) and not(pos(emsi_ack, __up(res)) > 0)
- ) do begin
- res := addtolast20(res, ch); delay(12);
- if debugmode then write(ch);
- capturewrite(ch);
- ch := #00;
- end;
- until (pos(emsi_ack, __up(res)) > 0) or (tries >= maxemsitries);
- if (res <> '') then __logapp('Response to EMSI data (Acq?): ' + res);
-
- if tries >= maxemsitries then begin
- writeln('Host system failed to acknowledge the EMSI_DAT packet.');
- __logapp('Host system failed to acknowledge the EMSI_DAT packet.');
- if fossil then fos_hangup_(comport) else hangup232; __eos;
- end else begin
- writeln('° Boss has acknowledged receipt of EMSI_DAT');
- __logapp('Boss has acknowledged receipt of EMSI_DAT');
- end;
-
- temp := '*'; { read in '**EMSI_DAT' }
- repeat comreceive(ch); capturewrite(ch) until (ch = '*');
- repeat
- if comreceive(ch) then temp := temp + ch;
- capturewrite(ch);
- until(pos('**EMSI_DAT', temp) > 0);
- pp := 8; { no '**' }
- pack[1] := 'E'; pack[2] := 'M'; pack[3] := 'S'; pack[4] := 'I';
- pack[5] := '_'; pack[6] := 'D'; pack[7] := 'A'; pack[8] := 'T';
- len := ''; { read in the length }
-
- for loop := 1 to 4 do begin
- delay(12); if comreceive(ch) then len := len + ch;
- inc(pp); pack[pp] := ch; capturewrite(ch);
- end;
-
- len_rec_emsi_dat := hex2dec(len);
-
- if debugmode then begin
- writeln('Length of DAT: (', len, ') ', len_rec_emsi_dat, '.');
- __logapp('Length of DAT: (' + len + ') ' + __num(len_rec_emsi_dat) + '.');
- end;
- packet := '';
- for loop := 1 to len_rec_emsi_dat do begin { read in the packet }
- delay(12); comreceive(ch); inc(pp); pack[pp] := ch; capturewrite(ch);
- end;
- crc := ''; { read in the crc }
- for loop := 1 to 4 do begin
- delay(12); comreceive(ch); crc := crc + ch; capturewrite(ch);
- end;
-
- if hex(crc16(pack)) <> crc then begin
- writeln('! The recieved EMSI_DAT is corrupt!!!!');
- __logapp('The recieved EMSI_DAT is corrupt!!!!');
- end;
-
- __clr1024(pack); __app1024(pack, emsi_ack + #13); send1024(pack);
- end; { EMSI mode }
-
-
-
-
-
-